libMesh
Loading...
Searching...
No Matches
checkpoint.C
Go to the documentation of this file.
1#include "libmesh/boundary_info.h"
2#include "libmesh/cell_c0polyhedron.h"
3#include "libmesh/checkpoint_io.h"
4#include "libmesh/distributed_mesh.h"
5#include "libmesh/face_c0polygon.h"
6#include "libmesh/int_range.h"
7#include "libmesh/mesh.h"
8#include "libmesh/mesh_generation.h"
9#include "libmesh/node.h"
10#include "libmesh/parallel.h"
11#include "libmesh/partitioner.h"
12#include "libmesh/periodic_boundaries.h"
13#include "libmesh/periodic_boundary_base.h"
14#include "libmesh/replicated_mesh.h"
15#include "libmesh/utility.h"
16
17#include "test_comm.h"
18#include "libmesh_cppunit.h"
19
20#include <regex>
21
22
23using namespace libMesh;
24
25class CheckpointIOTest : public CppUnit::TestCase {
29public:
31
32#if LIBMESH_DIM > 1
43#if LIBMESH_DIM > 2
46#endif
48#ifdef LIBMESH_ENABLE_PERIODIC
51#endif
52#endif
53
55
56protected:
57
58public:
59 void setUp()
60 {
61 }
62
63 void tearDown()
64 {
65 }
66
67 // Test that we can write multiple checkpoint files from a single processor.
68 template <typename MeshA, typename MeshB>
69 void testSplitter(bool binary, bool using_distmesh, bool skip_partition = false)
70 {
71 // The CheckpointIO-based splitter requires XDR.
72#ifdef LIBMESH_HAVE_XDR
73
74 // In this test, we partition the mesh into n_procs parts. Don't
75 // try to partition a DistributedMesh into more parts than we have
76 // processors, though.
77 const unsigned int n_procs = using_distmesh ?
78 std::min(static_cast<processor_id_type>(2), TestCommWorld->size()) :
79 2;
80
81 // The number of elements in the original mesh. For verification
82 // later.
83 dof_id_type original_n_elem = 0;
84
85 const std::string filename =
86 std::string("checkpoint_splitter.cp") + (binary ? "r" : "a");
87
88 {
89 MeshA mesh(*TestCommWorld);
90
92 4, 4,
93 0., 1.,
94 0., 1.,
95 QUAD4);
96
97 // Store the number of elements that were in the original mesh.
98 original_n_elem = mesh.n_elem();
99
100 // Partition the mesh into n_procs pieces
101 mesh.partition(n_procs);
102
103 // Write out checkpoint files for each piece. Since on a
104 // ReplicatedMesh we might have more pieces than we do
105 // processors, some processors may have to write out more than
106 // one piece.
107 CheckpointIO cpr(mesh);
108 cpr.current_processor_ids().clear();
109 for (processor_id_type pid = mesh.processor_id(); pid < n_procs; pid += mesh.n_processors())
110 cpr.current_processor_ids().push_back(pid);
111 cpr.current_n_processors() = n_procs;
112 cpr.binary() = binary;
113 cpr.parallel() = true;
114 cpr.write(filename);
115 }
116
117 TestCommWorld->barrier();
118
119 // Test that we can read in the files we wrote and sum up to the
120 // same total number of elements.
121 {
122 MeshB mesh(*TestCommWorld);
123 if (skip_partition)
125
126 CheckpointIO cpr(mesh);
127 cpr.current_n_processors() = n_procs;
128 cpr.binary() = binary;
129 cpr.read(filename);
130
131 // If we decided to skip partitioning, then we shouldn't be
132 // waiting for a partition() call to get our n_partitions()
133 // cache in order
134 if (skip_partition)
135 CPPUNIT_ASSERT_EQUAL(mesh.n_partitions(), n_procs);
136
137 std::size_t read_in_elements = 0;
138
139 for (unsigned pid=mesh.processor_id(); pid<n_procs; pid += mesh.n_processors())
140 {
141 read_in_elements += std::distance(mesh.pid_elements_begin(pid),
142 mesh.pid_elements_end(pid));
143 }
144 mesh.comm().sum(read_in_elements);
145
146 // Verify that we read in exactly as many elements as we started with.
147 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(read_in_elements), original_n_elem);
148 }
149#endif // LIBMESH_HAVE_XDR
150 }
151
152 void testC0PolygonCheckpoint(bool binary)
153 {
154#ifdef LIBMESH_HAVE_XDR
155 // Parallel element packing does not yet support runtime topology,
156 // so exercise serial CheckpointIO independently on rank 0.
157 if (TestCommWorld->rank() != 0)
158 return;
159
160 Parallel::Communicator comm_self;
161 const std::string filename =
162 std::string("checkpoint_c0polygon.cp") + (binary ? "r" : "a");
163 const std::vector<Point> points =
164 {{0., 0.}, {1., 0.}, {1.5, 0.5}, {1., 1.}, {0., 1.}};
165
166 {
167 Mesh mesh(comm_self, 2);
168 mesh.allow_renumbering(false);
169
170 auto polygon =
171 std::make_unique<C0Polygon>(cast_int<unsigned int>(points.size()));
172 polygon->set_id() = 0;
173 for (auto n : index_range(points))
174 polygon->set_node(n, mesh.add_point(points[n], n));
175
176 mesh.add_elem(std::move(polygon));
178
179 CheckpointIO checkpoint(mesh, binary);
180 checkpoint.write(filename);
181 }
182
183 {
184 Mesh mesh(comm_self);
185 CheckpointIO checkpoint(mesh, binary);
186 checkpoint.read(filename);
187
188 CPPUNIT_ASSERT_EQUAL(dof_id_type(1), mesh.n_elem());
189 CPPUNIT_ASSERT_EQUAL(dof_id_type(5), mesh.n_nodes());
190 CPPUNIT_ASSERT_EQUAL(2u, static_cast<unsigned int>(mesh.mesh_dimension()));
191
192 const Elem * elem = mesh.query_elem_ptr(0);
193 bool found_elem = elem;
194 mesh.comm().max(found_elem);
195 CPPUNIT_ASSERT(found_elem);
196
197 if (elem)
198 {
199 CPPUNIT_ASSERT_EQUAL(C0POLYGON, elem->type());
200 CPPUNIT_ASSERT_EQUAL(5u, elem->n_nodes());
201 CPPUNIT_ASSERT_EQUAL(5u, elem->n_vertices());
202 CPPUNIT_ASSERT_EQUAL(5u, elem->n_sides());
203 CPPUNIT_ASSERT_EQUAL(5u, elem->n_edges());
204
205 for (auto n : index_range(points))
206 {
207 CPPUNIT_ASSERT_EQUAL(cast_int<dof_id_type>(n), elem->node_id(n));
208 CPPUNIT_ASSERT_EQUAL(points[n], elem->point(n));
209
210 const auto side_nodes = elem->nodes_on_side(n);
211 CPPUNIT_ASSERT_EQUAL(std::size_t(2), side_nodes.size());
212 CPPUNIT_ASSERT_EQUAL(cast_int<unsigned int>(n), side_nodes[0]);
213 CPPUNIT_ASSERT_EQUAL
214 (cast_int<unsigned int>((n + 1) % points.size()), side_nodes[1]);
215 }
216 }
217 }
218
219 CheckpointIO::cleanup(filename, 1);
220#endif // LIBMESH_HAVE_XDR
221 }
222
223#if LIBMESH_DIM > 2
225 {
226#ifdef LIBMESH_HAVE_XDR
227 // Parallel element packing does not yet support runtime topology,
228 // so exercise serial CheckpointIO independently on rank 0.
229 if (TestCommWorld->rank() != 0)
230 return;
231
232 Parallel::Communicator comm_self;
233 const std::string filename =
234 std::string("checkpoint_c0polyhedron.cp") + (binary ? "r" : "a");
235 const std::vector<Point> points =
236 {{0., -2., 0.}, {-1., -1., 0.}, {-1., 1., 0.},
237 {0., 2., 0.}, {1., 1., 0.}, {1., -1., 0.},
238 {0., -2., 1.}, {-1., -1., 1.}, {-1., 1., 1.},
239 {0., 2., 1.}, {1., 1., 1.}, {1., -1., 1.}};
240 const std::vector<std::vector<unsigned int>> nodes_on_sides =
241 {{0, 1, 2, 3, 4, 5},
242 {0, 1, 7, 6},
243 {1, 2, 8, 7},
244 {2, 3, 9, 8},
245 {3, 4, 10, 9},
246 {4, 5, 11, 10},
247 {5, 0, 6, 11},
248 {6, 7, 8, 9, 10, 11}};
249
250 {
251 Mesh mesh(comm_self, 3);
252 mesh.allow_renumbering(false);
253 for (auto n : index_range(points))
254 mesh.add_point(points[n], n);
255
256 std::vector<std::shared_ptr<Polygon>> sides(nodes_on_sides.size());
257 for (auto s : index_range(nodes_on_sides))
258 {
259 const auto & side_nodes = nodes_on_sides[s];
260 auto side =
261 std::make_shared<C0Polygon>
262 (cast_int<unsigned int>(side_nodes.size()));
263 for (auto n : index_range(side_nodes))
264 side->set_node(n, mesh.node_ptr(side_nodes[n]));
265 sides[s] = std::move(side);
266 }
267
268 std::unique_ptr<Node> mid_elem_node;
269 auto polyhedron =
270 std::make_unique<C0Polyhedron>(sides, mid_elem_node);
271 CPPUNIT_ASSERT(mid_elem_node);
272
273 // Explicit id so DistributedMesh matches ReplicatedMesh
274 mid_elem_node->set_id(points.size());
275
276 mesh.add_node(std::move(mid_elem_node));
277 polyhedron->set_id() = 0;
278 mesh.add_elem(std::move(polyhedron));
280
281 CheckpointIO checkpoint(mesh, binary);
282 checkpoint.write(filename);
283 }
284
285 {
286 Mesh mesh(comm_self);
287 CheckpointIO checkpoint(mesh, binary);
288 checkpoint.read(filename);
289
290 CPPUNIT_ASSERT_EQUAL(dof_id_type(1), mesh.n_elem());
291 CPPUNIT_ASSERT_EQUAL(dof_id_type(13), mesh.n_nodes());
292 CPPUNIT_ASSERT_EQUAL(3u, static_cast<unsigned int>(mesh.mesh_dimension()));
293
294 const Elem * elem = mesh.query_elem_ptr(0);
295 bool found_elem = elem;
296 mesh.comm().max(found_elem);
297 CPPUNIT_ASSERT(found_elem);
298
299 if (elem)
300 {
301 CPPUNIT_ASSERT_EQUAL(C0POLYHEDRON, elem->type());
302 CPPUNIT_ASSERT_EQUAL(12u, elem->n_vertices());
303 CPPUNIT_ASSERT_EQUAL(13u, elem->n_nodes());
304 CPPUNIT_ASSERT_EQUAL(8u, elem->n_sides());
305 CPPUNIT_ASSERT_EQUAL(18u, elem->n_edges());
306 CPPUNIT_ASSERT_EQUAL(dof_id_type(12),
307 elem->node_id(elem->n_vertices()));
308
309 for (auto s : index_range(nodes_on_sides))
310 {
311 const auto side_nodes = elem->nodes_on_side(s);
312 CPPUNIT_ASSERT_EQUAL(nodes_on_sides[s].size(), side_nodes.size());
313 for (auto n : index_range(side_nodes))
314 CPPUNIT_ASSERT_EQUAL
315 (cast_int<dof_id_type>(nodes_on_sides[s][n]),
316 elem->node_id(side_nodes[n]));
317 }
318 }
319 }
320
321 CheckpointIO::cleanup(filename, 1);
322#endif // LIBMESH_HAVE_XDR
323 }
324#endif
325
326 // Test that a read() for a split count with no matching split (and no
327 // serial fallback) reports the split counts that do exist, per #4560.
329 {
330 LOG_UNIT_TEST;
331
332#ifdef LIBMESH_HAVE_XDR
333#ifdef LIBMESH_ENABLE_EXCEPTIONS
334 // The error message we're checking only depends on the checkpoint
335 // directory's contents, so there's no need to exercise this on more
336 // than one rank.
337 if (TestCommWorld->rank() != 0)
338 return;
339
340 Parallel::Communicator comm_self;
341 const std::string filename = "checkpoint_missing_split.cpa";
342 const processor_id_type n_procs = 2;
343
344 {
345 ReplicatedMesh mesh(comm_self);
346 MeshTools::Generation::build_square(mesh, 2, 2, 0., 1., 0., 1., QUAD4);
347 mesh.partition(n_procs);
348
349 CheckpointIO cpr(mesh);
350 cpr.current_processor_ids().clear();
351 for (processor_id_type pid = 0; pid < n_procs; pid++)
352 cpr.current_processor_ids().push_back(pid);
353 cpr.current_n_processors() = n_procs;
354 cpr.parallel() = true;
355 cpr.write(filename);
356 }
357
358 {
359 // Ask for a split count for which neither that split nor the
360 // serial fallback exists; only the split for n_procs does.
361 ReplicatedMesh mesh(comm_self);
362 CheckpointIO cpr(mesh);
363 cpr.current_n_processors() = n_procs + 1;
364
365 bool threw_desired_exception = false;
366 try {
367 cpr.read(filename);
368 }
369 catch (libMesh::LogicError & e) {
370 std::regex msg_regex("Splits that do exist in '" + filename + "': " +
371 std::to_string(n_procs) + "\\.");
372 CPPUNIT_ASSERT(std::regex_search(e.what(), msg_regex));
373 threw_desired_exception = true;
374 }
375 CPPUNIT_ASSERT(threw_desired_exception);
376 }
377
378 CheckpointIO::cleanup(filename, n_procs);
379#endif
380#endif
381 }
382
384 {
385 LOG_UNIT_TEST;
386
387 testSplitter<DistributedMesh, ReplicatedMesh>(false, true);
388 }
389
391 {
392 LOG_UNIT_TEST;
393
394 testSplitter<DistributedMesh, ReplicatedMesh>(true, true);
395 }
396
398 {
399 LOG_UNIT_TEST;
400
401 testSplitter<ReplicatedMesh, DistributedMesh>(false, true);
402 }
403
405 {
406 LOG_UNIT_TEST;
407
408 testSplitter<ReplicatedMesh, DistributedMesh>(true, true);
409 }
410
412 {
413 LOG_UNIT_TEST;
414
415 testSplitter<ReplicatedMesh, ReplicatedMesh>(false, false);
416 }
417
419 {
420 LOG_UNIT_TEST;
421
422 testSplitter<ReplicatedMesh, ReplicatedMesh>(true, false);
423 }
424
426 {
427 LOG_UNIT_TEST;
428
429 testSplitter<DistributedMesh, DistributedMesh>(false, true);
430 }
431
433 {
434 LOG_UNIT_TEST;
435
436 testSplitter<DistributedMesh, DistributedMesh>(true, true);
437 }
438
439#ifdef LIBMESH_ENABLE_PERIODIC
440 // Test that disjoint neighbor boundary pairs survive a checkpoint
441 // round trip, so neighbors across a split interface are restored.
443 {
444#ifdef LIBMESH_HAVE_XDR
445 const std::string filename =
446 std::string("checkpoint_disjoint_pairs.cp") + (binary ? "r" : "a");
447 const boundary_id_type left_id = 5, right_id = 6;
448 const RealVectorValue translation(0.25, 0.);
449 processor_id_type n_splits = 1;
450
451 {
452 // Two unit quads whose facing sides share coordinates but not
453 // nodes; only the disjoint pair makes them neighbors.
455 mesh.allow_renumbering(false);
456
457 for (auto i : make_range(2))
458 {
459 const Real x0 = 1.25 * i;
460 const dof_id_type n0 = 4 * i;
461 mesh.add_point(Point(x0, 0.), n0);
462 mesh.add_point(Point(x0 + 1, 0.), n0 + 1);
463 mesh.add_point(Point(x0 + 1, 1.), n0 + 2);
464 mesh.add_point(Point(x0, 1.), n0 + 3);
465
467 for (auto n : make_range(4))
468 elem->set_node(n, mesh.node_ptr(n0 + n));
469 }
470
471 BoundaryInfo & boundary_info = mesh.get_boundary_info();
472 boundary_info.add_side(mesh.elem_ptr(0), 1, left_id);
473 boundary_info.add_side(mesh.elem_ptr(1), 3, right_id);
476
477 n_splits = mesh.is_serial() ? 1 : mesh.n_processors();
478 CheckpointIO checkpoint(mesh, binary);
479 checkpoint.write(filename);
480 }
481
482 {
484 mesh.allow_renumbering(false);
485
486 // A stale pair on the mesh being read into must not survive
487 const boundary_id_type stale_id = 7;
489
490 CheckpointIO checkpoint(mesh, binary);
491 checkpoint.read(filename);
493
495 CPPUNIT_ASSERT(db);
496 CPPUNIT_ASSERT_EQUAL(std::size_t(2), db->size());
497 CPPUNIT_ASSERT_EQUAL(right_id, libmesh_map_find(*db, left_id)->pairedboundary);
498 CPPUNIT_ASSERT_EQUAL(left_id, libmesh_map_find(*db, right_id)->pairedboundary);
499 LIBMESH_ASSERT_FP_EQUAL
500 (0., (libmesh_map_find(*db, left_id)->get_corresponding_pos(Point(0)) -
501 translation).norm(), TOLERANCE*TOLERANCE);
502
503 if (const Elem * elem = mesh.query_elem_ptr(0))
504 {
505 CPPUNIT_ASSERT(elem->neighbor_ptr(1));
506 CPPUNIT_ASSERT_EQUAL(dof_id_type(1), elem->neighbor_ptr(1)->id());
507 }
508 if (const Elem * elem = mesh.query_elem_ptr(1))
509 {
510 CPPUNIT_ASSERT(elem->neighbor_ptr(3));
511 CPPUNIT_ASSERT_EQUAL(dof_id_type(0), elem->neighbor_ptr(3)->id());
512 }
513 }
514
515 TestCommWorld->barrier();
516 if (TestCommWorld->rank() == 0)
517 CheckpointIO::cleanup(filename, n_splits);
518#endif // LIBMESH_HAVE_XDR
519 }
520
522 {
523 LOG_UNIT_TEST;
524
526 }
527
529 {
530 LOG_UNIT_TEST;
531
533 }
534#endif // LIBMESH_ENABLE_PERIODIC
535
537 {
538 LOG_UNIT_TEST;
539
541 }
542
544 {
545 LOG_UNIT_TEST;
546
548 }
549
550#if LIBMESH_DIM > 2
552 {
553 LOG_UNIT_TEST;
554
556 }
557
559 {
560 LOG_UNIT_TEST;
561
563 }
564#endif
565
567 {
568 LOG_UNIT_TEST;
569
570 testSplitter<DistributedMesh, DistributedMesh>(false, true, true);
571 }
572
573
574};
575
CPPUNIT_TEST_SUITE_REGISTRATION(CheckpointIOTest)
void testBinaryDistDistSplitter()
Definition checkpoint.C:432
CPPUNIT_TEST(testBinaryC0Polygon)
CPPUNIT_TEST(testAsciiRepRepSplitter)
void testSplitter(bool binary, bool using_distmesh, bool skip_partition=false)
Definition checkpoint.C:69
void testBinaryDisjointNeighborPairs()
Definition checkpoint.C:528
CPPUNIT_TEST(testAsciiDisjointNeighborPairs)
void testBinaryRepDistSplitter()
Definition checkpoint.C:404
void testAsciiDisjointNeighborPairs()
Definition checkpoint.C:521
void testC0PolyhedronCheckpoint(bool binary)
Definition checkpoint.C:224
void testAsciiRepDistSplitter()
Definition checkpoint.C:397
void testBinaryC0Polygon()
Definition checkpoint.C:543
CPPUNIT_TEST(testAsciiDistRepSplitter)
CPPUNIT_TEST(testBinaryDistRepSplitter)
LIBMESH_CPPUNIT_TEST_SUITE(CheckpointIOTest)
This test verifies that we can write files with the CheckpointIO object.
CPPUNIT_TEST(testMissingSplitError)
void testAsciiDistDistSplitter()
Definition checkpoint.C:425
void testBinaryRepRepSplitter()
Definition checkpoint.C:418
void testC0PolygonCheckpoint(bool binary)
Definition checkpoint.C:152
CPPUNIT_TEST(testBinaryDisjointNeighborPairs)
void testAsciiC0Polygon()
Definition checkpoint.C:536
void testAsciiRepRepSplitter()
Definition checkpoint.C:411
void testAsciiC0Polyhedron()
Definition checkpoint.C:551
CPPUNIT_TEST(testBinaryRepDistSplitter)
void testAsciiDistRepSplitter()
Definition checkpoint.C:383
CPPUNIT_TEST(testAsciiC0Polygon)
CPPUNIT_TEST(testBinaryC0Polyhedron)
CPPUNIT_TEST(testBinaryRepRepSplitter)
void testMissingSplitError()
Definition checkpoint.C:328
void testDisjointNeighborPairsCheckpoint(bool binary)
Definition checkpoint.C:442
void testBinaryC0Polyhedron()
Definition checkpoint.C:558
void testBinaryDistRepSplitter()
Definition checkpoint.C:390
CPPUNIT_TEST(testAsciiDistDistSplitter)
CPPUNIT_TEST(testBinaryDistDistSplitter)
CPPUNIT_TEST(testAsciiC0Polyhedron)
CPPUNIT_TEST(testAsciiRepDistSplitter)
void testAsciiDistDistSplitterCache()
Definition checkpoint.C:566
void max(const T &r, T &o, Request &req) const
The BoundaryInfo class contains information relevant to boundary conditions including storing faces,...
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
Add side side of element number elem with boundary id id to the boundary information data structure.
The CheckpointIO class can be used to write simplified restart files that can be used to restart simu...
const std::vector< processor_id_type > & current_processor_ids() const
Get/Set the processor id or processor ids to use.
virtual void read(const std::string &input_name) override
This method implements reading a mesh from a specified file.
bool binary() const
Get/Set the flag indicating if we should read/write binary.
const processor_id_type & current_n_processors() const
Get/Set the n_processors to use.
static void cleanup(const std::string &input_name, processor_id_type n_procs)
Used to remove a checkpoint directory and its corresponding files.
virtual void write(const std::string &name) override
This method implements writing a mesh to a specified file.
bool parallel() const
Get/Set the flag indicating if we should read/write binary.
dof_id_type & set_id()
Definition dof_object.h:841
This is the base class from which all geometric element types are derived.
Definition elem.h:96
virtual Node *& set_node(const unsigned int i)
Definition elem.h:2688
virtual unsigned int n_vertices() const =0
const Point & point(const unsigned int i) const
Definition elem.h:2583
static std::unique_ptr< Elem > build_with_id(const ElemType type, dof_id_type id)
Calls the build() method above with a nullptr parent, and additionally sets the newly-created Elem's ...
Definition elem.C:496
virtual unsigned int n_nodes() const =0
virtual std::vector< unsigned int > nodes_on_side(const unsigned int) const =0
virtual ElemType type() const =0
virtual unsigned int n_edges() const =0
virtual unsigned int n_sides() const =0
dof_id_type node_id(const unsigned int i) const
Definition elem.h:2605
A class to represent the internal "this should never happen" errors, to be thrown by "libmesh_error()...
virtual bool is_serial() const
Definition mesh_base.h:357
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition mesh_base.h:170
virtual const Node * node_ptr(const dof_id_type i) const =0
unsigned int mesh_dimension() const
Definition mesh_base.C:435
virtual dof_id_type n_elem() const =0
PeriodicBoundaries * get_disjoint_neighbor_boundary_pairs()
Definition mesh_base.C:2311
void allow_renumbering(bool allow)
If false is passed in then this mesh will no longer be renumbered when being prepared for use.
Definition mesh_base.h:1359
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly created (or read) mesh for use.
Definition mesh_base.C:824
virtual dof_id_type n_nodes() const =0
virtual Node * add_point(const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)=0
Add a new Node at Point p to the end of the vertex array, with processor_id procid.
virtual const Elem * elem_ptr(const dof_id_type i) const =0
unsigned int n_partitions() const
Definition mesh_base.h:1530
virtual Node * add_node(Node *n)=0
Add Node n to the end of the vertex array.
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0
virtual Elem * add_elem(Elem *e)=0
Add elem e to the end of the element array.
void add_disjoint_neighbor_boundary_pairs(const boundary_id_type b1, const boundary_id_type b2, const RealVectorValue &translation)
Register a pair of boundaries as disjoint neighbor boundary pairs.
Definition mesh_base.C:2287
virtual void partition(const unsigned int n_parts)
Call the default partitioner (currently metis_partition()).
Definition mesh_base.C:1784
void skip_partitioning(bool skip)
If true is passed in then nothing on this mesh will be (re)partitioned.
Definition mesh_base.h:1433
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition mesh.h:51
processor_id_type processor_id() const
const Parallel::Communicator & comm() const
processor_id_type n_processors() const
We're using a class instead of a typedef to allow forward declarations and future flexibility.
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition point.h:41
The ReplicatedMesh class is derived from the MeshBase class, and is used to store identical copies of...
static const boundary_id_type left_id
static const boundary_id_type right_id
Communicator * TestCommWorld
MeshBase & mesh
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 2D meshes.
The libMesh namespace provides an interface to certain functionality in the library.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition int_range.h:153
int8_t boundary_id_type
Definition id_types.h:51
VectorValue< Real > RealVectorValue
Useful typedefs to allow transparent switching between Real and Complex data types.
static constexpr Real TOLERANCE
uint8_t dof_id_type
Definition id_types.h:67
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
uint8_t processor_id_type
Definition id_types.h:104
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition int_range.h:176