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

Protected Member Functions

void build_quad_mesh (unsigned int n_refinements=0)
 
void init ()
 
void clear ()
 
void setup_coupling_matrix (std::unique_ptr< CouplingMatrix > &coupling)
 

Protected Attributes

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

Detailed Description

Definition at line 241 of file overlapping_coupling_test.C.

Member Function Documentation

◆ build_quad_mesh()

void OverlappingTestBase::build_quad_mesh ( unsigned int  n_refinements = 0)
inlineprotected

Definition at line 249 of file overlapping_coupling_test.C.

250 {
251 // We are making assumptions in various places about the presence
252 // of the elements on the current processor so we're restricting to
253 // ReplicatedMesh for now.
254 _mesh = std::make_unique<ReplicatedMesh>(*TestCommWorld);
255
256 _mesh->set_mesh_dimension(2);
257
258 _mesh->add_point( Point(0.0,0.0),0 );
259 _mesh->add_point( Point(1.0,0.0),1 );
260 _mesh->add_point( Point(1.0,1.0),2 );
261 _mesh->add_point( Point(0.0,1.0),3 );
262
263 {
264 Elem * elem = _mesh->add_elem(Elem::build_with_id(QUAD4, 0));
265 elem->subdomain_id() = 1;
266
267 for (unsigned int n=0; n<4; n++)
268 elem->set_node(n, _mesh->node_ptr(n));
269 }
270
271 _mesh->add_point( Point(1.0,2.0),4 );
272 _mesh->add_point( Point(0.0,2.0),5 );
273
274 {
275 Elem * elem = _mesh->add_elem(Elem::build_with_id(QUAD4, 1));
276 elem->subdomain_id() = 1;
277
278 elem->set_node(0, _mesh->node_ptr(3));
279 elem->set_node(1, _mesh->node_ptr(2));
280 elem->set_node(2, _mesh->node_ptr(4));
281 elem->set_node(3, _mesh->node_ptr(5));
282 }
283
284 _mesh->add_point( Point(0.0,0.0),6 );
285 _mesh->add_point( Point(1.0,0.0),7 );
286 _mesh->add_point( Point(1.0,2.0),8 );
287 _mesh->add_point( Point(0.0,2.0),9 );
288
289 {
290 Elem* elem = _mesh->add_elem(Elem::build_with_id(QUAD4, 2));
291 elem->subdomain_id() = 2;
292
293 elem->set_node(0, _mesh->node_ptr(6));
294 elem->set_node(1, _mesh->node_ptr(7));
295 elem->set_node(2, _mesh->node_ptr(8));
296 elem->set_node(3, _mesh->node_ptr(9));
297 }
298
299 _mesh->partitioner() = std::make_unique<OverlappingTestPartitioner>();
300
301 _mesh->prepare_for_use();
302
303#ifdef LIBMESH_ENABLE_AMR
304 if (n_refinements > 0)
305 {
306 MeshRefinement refine(*_mesh);
307 refine.uniformly_refine(n_refinements);
308 }
309#else
310 CPPUNIT_ASSERT_EQUAL(n_refinements, 0u);
311#endif // LIBMESH_ENABLE_AMR
312 }
std::unique_ptr< MeshBase > _mesh
This is the base class from which all geometric element types are derived.
Definition elem.h:96
virtual Node *& set_node(const unsigned int i)
Definition elem.h:2567
static std::unique_ptr< Elem > build_with_id(const ElemType type, dof_id_type id)
Calls the build() method above with a nullptr parent, and additionally sets the newly-created Elem's ...
Definition elem.C:556
subdomain_id_type subdomain_id() const
Definition elem.h:2591
Implements (adaptive) mesh refinement algorithms for a MeshBase.
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition point.h:40

References _mesh, libMesh::Elem::build_with_id(), libMesh::QUAD4, libMesh::Elem::set_node(), libMesh::Elem::subdomain_id(), TestCommWorld, and libMesh::MeshRefinement::uniformly_refine().

Referenced by OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), and OverlappingFunctorTest::setUp().

◆ clear()

void OverlappingTestBase::clear ( )
inlineprotected

Definition at line 334 of file overlapping_coupling_test.C.

335 {
336 _es.reset();
337 _mesh.reset();
338 }
std::unique_ptr< EquationSystems > _es

References _es, and _mesh.

Referenced by OverlappingFunctorTest::tearDown(), OverlappingAlgebraicGhostingTest::tearDown(), and OverlappingCouplingGhostingTest::tearDown().

◆ init()

void OverlappingTestBase::init ( )
inlineprotected

Definition at line 314 of file overlapping_coupling_test.C.

315 {
316 _es = std::make_unique<EquationSystems>(*_mesh);
317 LinearImplicitSystem & sys = _es->add_system<LinearImplicitSystem> ("SimpleSystem");
318
319 std::set<subdomain_id_type> sub_one;
320 sub_one.insert(1);
321
322 std::set<subdomain_id_type> sub_two;
323 sub_two.insert(2);
324
325 sys.add_variable("U", FIRST, LAGRANGE, &sub_two);
326 sys.add_variable("L", FIRST, LAGRANGE, &sub_two);
327
328 sys.add_variable("V", FIRST, LAGRANGE, &sub_one);
329 sys.add_variable("p", FIRST, LAGRANGE, &sub_one);
330
331 _es->init();
332 }
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

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

Referenced by OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), and OverlappingFunctorTest::setUp().

◆ setup_coupling_matrix()

void OverlappingTestBase::setup_coupling_matrix ( std::unique_ptr< CouplingMatrix > &  coupling)
inlineprotected

Definition at line 340 of file overlapping_coupling_test.C.

341 {
342 System & system = _es->get_system("SimpleSystem");
343
344 coupling = std::make_unique<CouplingMatrix>(system.n_vars());
345
346 const unsigned int u_var = system.variable_number("U");
347 const unsigned int l_var = system.variable_number("L");
348 const unsigned int v_var = system.variable_number("V");
349 const unsigned int p_var = system.variable_number("p");
350
351 // Only adding the overlapping couplings since the primary ones should
352 // be there by default.
353 (*coupling)(u_var,v_var) = true;
354 (*coupling)(l_var,v_var) = true;
355 (*coupling)(l_var,p_var) = true;
356 (*coupling)(v_var,u_var) = true;
357 (*coupling)(v_var,l_var) = true;
358 }
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition system.h:100
unsigned int variable_number(std::string_view var) const
Definition system.C:1398
unsigned int n_vars() const
Definition system.C:2674

References _es, libMesh::System::n_vars(), and libMesh::System::variable_number().

Referenced by OverlappingAlgebraicGhostingTest::run_ghosting_test(), and OverlappingCouplingGhostingTest::run_sparsity_pattern_test().

Member Data Documentation

◆ _es

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

◆ _mesh

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

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