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 117 of file nonmanifold_coupling_test.C.

Member Function Documentation

◆ init_es()

void NonManifoldCouplingTestBase::init_es ( )
inlineprotected

Definition at line 144 of file nonmanifold_coupling_test.C.

145 {
146 _es = std::make_unique<EquationSystems>(*_mesh);
147
148 // Add System with a single linear Lagrange variable on it.
149 LinearImplicitSystem & sys = _es->add_system<LinearImplicitSystem> ("SimpleSystem");
150 sys.add_variable("u", FIRST, LAGRANGE);
151
152 // Attach ghosting functor to the System. We use the std::shared_ptr interface
153 // so that the DofMap takes ownership of the object. Note: if you comment out
154 // this line, then the test _can_ fail when run in parallel, but it depends on
155 // the number of processors used. For small numbers of procs, sometimes we can
156 // get "lucky" and wind up with all the non-manifold neighbor DOFs either local
157 // to or ghosted on all procs where they are needed. In practice, this test should
158 // be run on 3 or more procs to make it fail when the NonManifoldGhostingFunctor
159 // is not used.
160 auto ghosting_functor = std::make_shared<NonManifoldGhostingFunctor>(*_mesh);
161 sys.get_dof_map().add_coupling_functor(ghosting_functor, /*to_mesh=*/true);
162
163 // Initialize the DofMap, etc. for all Systems
164 _es->init();
165 }
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:2007
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 125 of file nonmanifold_coupling_test.C.

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

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: