1#ifndef PARTITIONER_TEST_H
2#define PARTITIONER_TEST_H
4#include <libmesh/distributed_mesh.h>
5#include <libmesh/elem.h>
6#include <libmesh/partitioner.h>
7#include <libmesh/replicated_mesh.h>
8#include <libmesh/mesh_generation.h>
15#define PARTITIONERTEST \
16 CPPUNIT_TEST( testBuild ); \
17 CPPUNIT_TEST( testPartitionEmpty ); \
18 CPPUNIT_TEST( testPartition1 ); \
19 CPPUNIT_TEST( testPartition2 ); \
20 CPPUNIT_TEST( testPartitionNProc );
22#define PARTITIONERTEST
27template <
typename PartitionerSub
class,
typename MeshClass>
42 PartitionerSubclass myclass;
48 CPPUNIT_ASSERT_EQUAL(new_build->type(), type);
57 0., 1., 0., 1., 0., 1.,
62 PartitionerSubclass newpart;
63 newpart.partition(
mesh, 1);
65 for (
auto elem :
mesh.element_ptr_range())
68 for (
auto node :
mesh.node_ptr_range())
73 newpart.partition(
mesh, n_parts);
86 const std::size_t n_elem_on_p =
87 std::distance(
mesh.pid_elements_begin(p),
88 mesh.pid_elements_end(p));
102 CPPUNIT_ASSERT(nonempty_procs >= n_nonempty ||
103 nonempty_procs >= 13 ||
104 (nonempty_procs >= 7 &&
106 (nonempty_procs >= 9 &&
115 PartitionerSubclass newpart;
144#define INSTANTIATE_PARTITIONER_TEST(partitionersubclass, meshclass) \
145 class PartitionerTest_##partitionersubclass##_##meshclass : \
146 public PartitionerTest<partitionersubclass, meshclass> { \
148 PartitionerTest_##partitionersubclass##_##meshclass() : \
149 PartitionerTest<partitionersubclass,meshclass>() { \
150 if (unitlog->summarized_logs_enabled()) \
151 this->libmesh_suite_name = "PartitionerTest"; \
153 this->libmesh_suite_name = "PartitionerTest_" #partitionersubclass "_" #meshclass; \
155 CPPUNIT_TEST_SUITE( PartitionerTest_##partitionersubclass##_##meshclass); \
157 CPPUNIT_TEST_SUITE_END(); \
160 CPPUNIT_TEST_SUITE_REGISTRATION( PartitionerTest_##partitionersubclass##_##meshclass );
void testPartitionEmpty()
void testPartitionNProc()
void testPartition(processor_id_type n_parts)
std::string libmesh_suite_name
virtual void allgather()
Gathers all elements and nodes of the mesh onto every processor.
static std::unique_ptr< Partitioner > build(const PartitionerType solver_package)
Builds a Partitioner of the type specified by partitioner_type.
Communicator * TestCommWorld
The libMesh namespace provides an interface to certain functionality in the library.
PartitionerType
Defines an enum for mesh partitioner types.
uint8_t processor_id_type