libMesh
Loading...
Searching...
No Matches
Protected Member Functions | Protected Attributes | List of all members
NonManifoldCouplingTestBase Class Reference
Inheritance diagram for NonManifoldCouplingTestBase:
[legend]

Protected Member Functions

void read_mesh (const std::string &mesh_filename)
 
void init_es ()
 

Protected Attributes

std::unique_ptr< MeshBase_mesh
 
std::unique_ptr< EquationSystems_es
 

Detailed Description

Definition at line 115 of file nonmanifold_coupling_test.C.

Member Function Documentation

◆ init_es()

void NonManifoldCouplingTestBase::init_es ( )
inlineprotected

Definition at line 142 of file nonmanifold_coupling_test.C.

143 {
144 _es = std::make_unique<EquationSystems>(*_mesh);
145
146 // Add System with a single linear Lagrange variable on it.
147 LinearImplicitSystem & sys = _es->add_system<LinearImplicitSystem> ("SimpleSystem");
148 sys.add_variable("u", FIRST, LAGRANGE);
149
150 // Attach ghosting functor to the System. We use the std::shared_ptr interface
151 // so that the DofMap takes ownership of the object. Note: if you comment out
152 // this line, then the test _can_ fail when run in parallel, but it depends on
153 // the number of processors used. For small numbers of procs, sometimes we can
154 // get "lucky" and wind up with all the non-manifold neighbor DOFs either local
155 // to or ghosted on all procs where they are needed. In practice, this test should
156 // be run on 3 or more procs to make it fail when the NonManifoldGhostingFunctor
157 // is not used.
158 auto ghosting_functor = std::make_shared<NonManifoldGhostingFunctor>(*_mesh);
159 sys.get_dof_map().add_coupling_functor(ghosting_functor, /*to_mesh=*/true);
160
161 // Initialize the DofMap, etc. for all Systems
162 _es->init();
163 }
std::unique_ptr< MeshBase > _mesh
std::unique_ptr< EquationSystems > _es
void add_coupling_functor(GhostingFunctor &coupling_functor, bool to_mesh=true)
Adds a functor which can specify coupling requirements for creation of sparse matrices.
Definition dof_map.C:2005
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
Definition system.C:1344
const DofMap & get_dof_map() const
Definition system.h:2417

References _es, _mesh, libMesh::DofMap::add_coupling_functor(), libMesh::System::add_variable(), libMesh::FIRST, libMesh::System::get_dof_map(), and libMesh::LAGRANGE.

Referenced by NonManifoldGhostingFunctorTest::verify_send_list_entries_helper().

◆ read_mesh()

void NonManifoldCouplingTestBase::read_mesh ( const std::string &  mesh_filename)
inlineprotected

Definition at line 123 of file nonmanifold_coupling_test.C.

124 {
125 // We are making assumptions in various places about the presence
126 // of the elements on the current processor so we're restricting to
127 // ReplicatedMesh for now.
128 _mesh = std::make_unique<ReplicatedMesh>(*TestCommWorld);
129 _mesh->read(mesh_filename);
130
131 // Use our custom partitioner that assigns non-manifold edge
132 // neighbors to different processors.
133 _mesh->partitioner() = std::make_unique<NonManifoldTestPartitioner>();
134
135 _mesh->prepare_for_use();
136
137 // Debugging: print processor ids determined by partitioner
138 // for (const auto & elem : _mesh->element_ptr_range())
139 // libMesh::out << "Elem " << elem->id() << " is on processor " << elem->processor_id() << std::endl;
140 }

References _mesh, and TestCommWorld.

Referenced by NonManifoldGhostingFunctorTest::verify_send_list_entries_helper().

Member Data Documentation

◆ _es

std::unique_ptr<EquationSystems> NonManifoldCouplingTestBase::_es
protected

◆ _mesh

std::unique_ptr<MeshBase> NonManifoldCouplingTestBase::_mesh
protected

The documentation for this class was generated from the following file: