libMesh
Public Member Functions | List of all members
EquationSystemsTest Class Reference
Inheritance diagram for EquationSystemsTest:
[legend]

Public Member Functions

 CPPUNIT_TEST_SUITE (EquationSystemsTest)
 
 CPPUNIT_TEST (testConstruction)
 
 CPPUNIT_TEST (testAddSystem)
 
 CPPUNIT_TEST (testInit)
 
 CPPUNIT_TEST (testPostInitAddSystem)
 
 CPPUNIT_TEST (testPostInitAddElem)
 
 CPPUNIT_TEST (testRefineThenReinitPreserveFlags)
 
 CPPUNIT_TEST_SUITE_END ()
 
void setUp ()
 
void tearDown ()
 
void testConstruction ()
 
void testAddSystem ()
 
void testInit ()
 
void testPostInitAddSystem ()
 
void testPostInitAddRealSystem ()
 
void testPostInitAddElem ()
 
void testRefineThenReinitPreserveFlags ()
 

Detailed Description

Definition at line 29 of file equation_systems_test.C.

Member Function Documentation

EquationSystemsTest::CPPUNIT_TEST ( testConstruction  )
EquationSystemsTest::CPPUNIT_TEST ( testAddSystem  )
EquationSystemsTest::CPPUNIT_TEST ( testInit  )
EquationSystemsTest::CPPUNIT_TEST ( testPostInitAddSystem  )
EquationSystemsTest::CPPUNIT_TEST ( testPostInitAddElem  )
EquationSystemsTest::CPPUNIT_TEST ( testRefineThenReinitPreserveFlags  )
EquationSystemsTest::CPPUNIT_TEST_SUITE ( EquationSystemsTest  )
EquationSystemsTest::CPPUNIT_TEST_SUITE_END ( )
void EquationSystemsTest::setUp ( )

Definition at line 45 of file equation_systems_test.C.

46  {}
void EquationSystemsTest::tearDown ( )

Definition at line 48 of file equation_systems_test.C.

49  {}
void EquationSystemsTest::testAddSystem ( )

Definition at line 59 of file equation_systems_test.C.

References libMesh::EquationSystems::add_system(), mesh, and TestCommWorld.

60  {
63  /*System &sys = */es.add_system<System> ("SimpleSystem");
64  }
This is the EquationSystems class.
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:28
MeshBase & mesh
This is the base class for classes which contain information related to any physical process that mig...
Definition: system.h:76
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
void EquationSystemsTest::testConstruction ( )

Definition at line 53 of file equation_systems_test.C.

References mesh, and TestCommWorld.

54  {
57  }
This is the EquationSystems class.
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:28
MeshBase & mesh
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
void EquationSystemsTest::testInit ( )

Definition at line 66 of file equation_systems_test.C.

References libMesh::EquationSystems::add_system(), libMesh::MeshTools::Generation::build_point(), libMesh::EquationSystems::init(), mesh, and TestCommWorld.

67  {
70  /*System &sys = */es.add_system<System> ("SimpleSystem");
72  es.init();
73  }
This is the EquationSystems class.
void build_point(UnstructuredMesh &mesh, const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 0D meshes.
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:28
MeshBase & mesh
This is the base class for classes which contain information related to any physical process that mig...
Definition: system.h:76
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
void EquationSystemsTest::testPostInitAddElem ( )

Definition at line 99 of file equation_systems_test.C.

References libMesh::ReplicatedMesh::add_elem(), libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::Elem::build(), libMesh::MeshTools::Generation::build_line(), libMesh::EDGE2, libMesh::FIRST, libMesh::EquationSystems::init(), libMesh::ReplicatedMesh::max_elem_id(), mesh, libMesh::ReplicatedMesh::node_ptr(), libMesh::MeshBase::prepare_for_use(), libMesh::DofObject::processor_id(), libMesh::EquationSystems::reinit(), libMesh::DofObject::set_id(), libMesh::Elem::set_node(), libMesh::sys, and TestCommWorld.

100  {
102 
103  EquationSystems es(mesh);
104  System &sys = es.add_system<System> ("SimpleSystem");
105  sys.add_variable("u", FIRST);
106 
108  es.init();
109 
110  Elem* e = Elem::build(EDGE2).release();
111  e->set_id(mesh.max_elem_id());
112  e->processor_id() = 0;
113  e->set_node(0) = mesh.node_ptr(2);
114  e->set_node(1) = mesh.node_ptr(8);
115  mesh.add_elem(e);
117 
118  es.reinit();
119  }
This is the EquationSystems class.
The ReplicatedMesh class is derived from the MeshBase class, and is used to store identical copies of...
virtual Node *& set_node(const unsigned int i)
Definition: elem.h:1941
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:28
ImplicitSystem & sys
unsigned int add_variable(const std::string &var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=libmesh_nullptr)
Adds the variable var to the list of variables for this system.
Definition: system.C:1101
This is the base class from which all geometric element types are derived.
Definition: elem.h:89
MeshBase & mesh
virtual const Node * node_ptr(const dof_id_type i) const =0
dof_id_type & set_id()
Definition: dof_object.h:641
virtual dof_id_type max_elem_id() const =0
This is the base class for classes which contain information related to any physical process that mig...
Definition: system.h:76
virtual Elem * add_elem(Elem *e)=0
Add elem e to the end of the element array.
void prepare_for_use(const bool skip_renumber_nodes_and_elements=false, const bool skip_find_neighbors=false)
Prepare a newly created (or read) mesh for use.
Definition: mesh_base.C:174
void build_line(UnstructuredMesh &mesh, const unsigned int nx, const Real xmin=0., const Real xmax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 1D meshes.
processor_id_type processor_id() const
Definition: dof_object.h:694
void EquationSystemsTest::testPostInitAddRealSystem ( )

Definition at line 86 of file equation_systems_test.C.

References libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::MeshTools::Generation::build_point(), libMesh::FIRST, libMesh::EquationSystems::init(), mesh, libMesh::EquationSystems::reinit(), and TestCommWorld.

87  {
91  System &sys1 = es.add_system<System> ("SimpleSystem");
92  sys1.add_variable("u1", FIRST);
93  es.init();
94  System &sys2 = es.add_system<System> ("SecondSystem");
95  sys2.add_variable("u2", FIRST);
96  es.reinit();
97  }
This is the EquationSystems class.
void build_point(UnstructuredMesh &mesh, const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 0D meshes.
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:28
unsigned int add_variable(const std::string &var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=libmesh_nullptr)
Adds the variable var to the list of variables for this system.
Definition: system.C:1101
MeshBase & mesh
This is the base class for classes which contain information related to any physical process that mig...
Definition: system.h:76
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
void EquationSystemsTest::testPostInitAddSystem ( )

Definition at line 75 of file equation_systems_test.C.

References libMesh::EquationSystems::add_system(), libMesh::MeshTools::Generation::build_point(), libMesh::EquationSystems::init(), mesh, libMesh::EquationSystems::reinit(), and TestCommWorld.

76  {
80  /*System &sys1 = */es.add_system<System> ("SimpleSystem");
81  es.init();
82  /*System &sys2 = */es.add_system<System> ("SecondSystem");
83  es.reinit();
84  }
This is the EquationSystems class.
void build_point(UnstructuredMesh &mesh, const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 0D meshes.
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:28
virtual void reinit()
Reinitializes degrees of freedom and other required data on the current mesh.
Definition: system.C:385
MeshBase & mesh
void init()
Initializes degrees of freedom on the current mesh.
Definition: system.C:235
This is the base class for classes which contain information related to any physical process that mig...
Definition: system.h:76
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
void EquationSystemsTest::testRefineThenReinitPreserveFlags ( )

Definition at line 121 of file equation_systems_test.C.

References libMesh::Elem::active(), libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::MeshBase::allow_renumbering(), libMesh::MeshTools::Generation::build_square(), libMesh::Elem::child_ptr(), CPPUNIT_TEST_SUITE_REGISTRATION(), libMesh::EquationSystems::disable_refine_in_reinit(), libMesh::DistributedMesh::elem_ptr(), libMesh::FIRST, libMesh::Elem::INACTIVE, libMesh::EquationSystems::init(), libMesh::Elem::JUST_REFINED, mesh, libMesh::Elem::n_children(), libMesh::DistributedMesh::query_elem_ptr(), libMesh::Elem::REFINE, libMesh::MeshRefinement::refine_elements(), libMesh::Elem::refinement_flag(), libMesh::EquationSystems::reinit(), libMesh::remote_elem, libMesh::Elem::set_refinement_flag(), libMesh::sys, and TestCommWorld.

122  {
123  // This test requires AMR support since it sets refinement flags.
124 #ifdef LIBMESH_ENABLE_AMR
126  mesh.allow_renumbering(false);
127  EquationSystems es(mesh);
128  System & sys = es.add_system<System> ("SimpleSystem");
129  sys.add_variable("u", FIRST);
131  es.init();
132 
133  Elem * to_refine = mesh.query_elem_ptr(0);
134  if (to_refine)
135  to_refine->set_refinement_flag(Elem::REFINE);
136 
137  MeshRefinement mr(mesh);
138  mr.refine_elements();
139  es.disable_refine_in_reinit();
140  es.reinit();
141 
142  if (mesh.query_elem_ptr(1))
143  CPPUNIT_ASSERT( mesh.elem_ptr(1)->active() );
144 
145  const Elem * elem = mesh.query_elem_ptr(0);
146  if (elem)
147  {
148  CPPUNIT_ASSERT_EQUAL( Elem::INACTIVE,elem->refinement_flag() );
149 
150  for (unsigned int c=0; c<elem->n_children(); c++)
151  if (elem->child_ptr(c) != remote_elem)
152  CPPUNIT_ASSERT_EQUAL(Elem::JUST_REFINED,
153  elem->child_ptr(c)->refinement_flag());
154  }
155 #endif
156  }
This is the EquationSystems class.
bool active() const
Definition: elem.h:2257
void allow_renumbering(bool allow)
If false is passed in then this mesh will no longer be renumbered when being prepared for use...
Definition: mesh_base.h:749
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:28
ImplicitSystem & sys
unsigned int add_variable(const std::string &var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=libmesh_nullptr)
Adds the variable var to the list of variables for this system.
Definition: system.C:1101
This is the base class from which all geometric element types are derived.
Definition: elem.h:89
MeshBase & mesh
void set_refinement_flag(const RefinementState rflag)
Sets the value of the refinement flag for the element.
Definition: elem.h:2513
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 2D meshes.
This is the MeshRefinement class.
This is the base class for classes which contain information related to any physical process that mig...
Definition: system.h:76
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:2445
virtual unsigned int n_children() const =0
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0
RefinementState refinement_flag() const
Definition: elem.h:2505
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
virtual const Elem * elem_ptr(const dof_id_type i) const =0
const RemoteElem * remote_elem
Definition: remote_elem.C:57

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