1 #include <libmesh/libmesh.h> 2 #include <libmesh/elem.h> 3 #include <libmesh/mesh_generation.h> 4 #include <libmesh/mesh_tools.h> 5 #include <libmesh/mesh.h> 6 #include <libmesh/node.h> 7 #include <libmesh/sparse_matrix.h> 8 #include <libmesh/system.h> 33 #ifdef LIBMESH_HAVE_SOLVER 34 CPPUNIT_TEST( testEdge2 );
35 CPPUNIT_TEST( testEdge3 );
36 CPPUNIT_TEST( testEdge4 );
39 CPPUNIT_TEST_SUITE_END();
61 CPPUNIT_ASSERT_EQUAL(n_components_orig,
dof_id_type(1));
67 for (
const auto & elem :
mesh.element_ptr_range())
69 const Point c = elem->vertex_average();
71 if (std::abs(c(0) - 0.5) < 0.2)
80 CPPUNIT_ASSERT_EQUAL(n_components_broken,
dof_id_type(2));
86 for (
const auto & elem :
mesh.element_ptr_range())
87 for (
const auto & node : elem->node_ref_range())
89 if (node(0) ==
Real(0))
90 left_node = node.id();
91 if (node(0) ==
Real(1))
92 right_node = node.id();
115 matrix->set(i,i-1,1);
117 if (left_node > right_node)
118 matrix->set(right_node, left_node-1, 1);
120 matrix->set(right_node, left_node, 1);
130 CPPUNIT_ASSERT_EQUAL(n_components_constrained,
dof_id_type(1));
ElemType
Defines an enum for geometric element types.
libMesh::Parallel::Communicator * TestCommWorld
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
processor_id_type rank() const
void copy_constraint_rows(const MeshBase &other_mesh)
Copy the constraints from the other mesh to this mesh.
const Parallel::Communicator & comm() const
The libMesh namespace provides an interface to certain functionality in the library.
static std::unique_ptr< SparseMatrix< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package(), const MatrixBuildType matrix_build_type=MatrixBuildType::AUTOMATIC)
Builds a SparseMatrix<T> using the linear solver package specified by solver_package.
CPPUNIT_TEST_SUITE_REGISTRATION(ConnectedComponentsTest)
uint8_t processor_id_type
void allow_remote_element_removal(bool allow)
If false is passed in then this mesh will no longer have remote elements deleted when being prepared ...
const dof_id_type n_nodes
virtual void delete_elem(Elem *e)=0
Removes element e from the mesh.
void testEdge(unsigned n_elem, ElemType elem_type)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void max(const T &r, T &o, Request &req) const
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...
virtual dof_id_type max_node_id() const =0
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
A Point defines a location in LIBMESH_DIM dimensional Real space.
virtual dof_id_type n_nodes() const =0