20 #ifndef __test__mast_mesh__ 21 #define __test__mast_mesh__ 27 #include "libmesh/libmesh.h" 28 #include "libmesh/replicated_mesh.h" 29 #include "libmesh/distributed_mesh.h" 30 #include "libmesh/face_quad4.h" 31 #include "libmesh/edge_edge2.h" 52 libMesh::ReplicatedMesh
mesh;
71 n_nodes = coordinates.cols();
73 mesh.reserve_elem(n_elems);
74 mesh.reserve_nodes(n_nodes);
75 mesh.set_spatial_dimension(3);
77 for (
auto i = 0; i <
n_nodes; i++) {
78 mesh.add_point(libMesh::Point(coordinates(0,i),coordinates(1,i), coordinates(2,i)), i, 0);
84 reference_elem =
new libMesh::Edge2;
88 reference_elem =
new libMesh::Quad4;
91 libmesh_error_msg(
"Invalid element type; " << __PRETTY_FUNCTION__
92 <<
" in " << __FILE__ <<
" at line number " << __LINE__);
95 mesh.set_mesh_dimension(n_dim);
96 reference_elem->set_id(0);
97 reference_elem->subdomain_id() = 0;
98 reference_elem = mesh.add_elem(reference_elem);
100 for (
int i=0; i<
n_nodes; i++) {
101 reference_elem->set_node(i) = mesh.node_ptr(i);
104 mesh.prepare_for_use();
116 *mesh.node_ptr(i) = libMesh::Point(new_coordinates(0,i), new_coordinates(1,i), new_coordinates(2,i));
122 #endif // __test__mast_mesh__ libMesh::Elem * reference_elem
Pointer to the actual libMesh element object.
Storage class for a mesh consisting of a single element used in testing.
int n_nodes
Number of nodes per element in the test mesh.
Matrix< Real, Dynamic, Dynamic > RealMatrixX
libMesh::LibMeshInit * p_global_init
int n_dim
Dimension of the test element (1, 2, 3)
TestMeshSingleElement(libMesh::ElemType e_type, RealMatrixX &coordinates)
Construct a single element mesh using the specified type and nodal coordinates.
int n_elems
Number of elements in the test mesh.
void update_coordinates(RealMatrixX &new_coordinates)
Update the nodal coordinates in the mesh.
libMesh::ReplicatedMesh mesh
The actual libMesh mesh object.