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

Public Member Functions

 CPPUNIT_TEST_SUITE (DefaultCouplingTest)
 
 CPPUNIT_TEST (testCouplingOnEdge3)
 
 CPPUNIT_TEST (testCouplingOnQuad9)
 
 CPPUNIT_TEST (testCouplingOnTri6)
 
 CPPUNIT_TEST (testCouplingOnHex27)
 
 CPPUNIT_TEST_SUITE_END ()
 
void setUp ()
 
void tearDown ()
 
void testCoupling (const ElemType elem_type)
 
void testCouplingOnEdge3 ()
 
void testCouplingOnQuad9 ()
 
void testCouplingOnTri6 ()
 
void testCouplingOnHex27 ()
 

Detailed Description

Definition at line 45 of file default_coupling_test.C.

Member Function Documentation

DefaultCouplingTest::CPPUNIT_TEST ( testCouplingOnEdge3  )
DefaultCouplingTest::CPPUNIT_TEST ( testCouplingOnQuad9  )
DefaultCouplingTest::CPPUNIT_TEST ( testCouplingOnTri6  )
DefaultCouplingTest::CPPUNIT_TEST ( testCouplingOnHex27  )
DefaultCouplingTest::CPPUNIT_TEST_SUITE ( DefaultCouplingTest  )
DefaultCouplingTest::CPPUNIT_TEST_SUITE_END ( )
void DefaultCouplingTest::setUp ( )

Definition at line 59 of file default_coupling_test.C.

60  {}
void DefaultCouplingTest::tearDown ( )

Definition at line 62 of file default_coupling_test.C.

63  {}
void DefaultCouplingTest::testCoupling ( const ElemType  elem_type)

Definition at line 65 of file default_coupling_test.C.

References libMesh::DistributedMesh::active_local_element_ptr_range(), libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::Elem::build(), libMesh::MeshTools::Generation::build_cube(), libMesh::Elem::centroid(), cubic_default_coupling_test(), libMesh::DofMap::default_algebraic_ghosting(), libMesh::System::get_dof_map(), libMesh::HIERARCHIC, libMesh::EquationSystems::init(), libMesh::libmesh_real(), mesh, libMesh::Elem::neighbor_ptr(), libMesh::EquationSystems::parameters, libMesh::System::point_value(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::System::project_solution(), libMesh::Real, libMesh::DefaultCoupling::set_n_levels(), libMesh::sys, TestCommWorld, libMesh::THIRD, and libMesh::TOLERANCE.

66  {
68 
70  System &sys = es.add_system<System> ("SimpleSystem");
71  sys.add_variable("u", THIRD, HIERARCHIC);
73 
74  const unsigned n_elem_per_side = 5;
75  const UniquePtr<Elem> test_elem = Elem::build(elem_type);
76  const Real ymax = test_elem->dim() > 1;
77  const Real zmax = test_elem->dim() > 2;
78  const unsigned int ny = ymax * n_elem_per_side;
79  const unsigned int nz = zmax * n_elem_per_side;
80 
82  n_elem_per_side,
83  ny,
84  nz,
85  0., 1.,
86  0., ymax,
87  0., zmax,
88  elem_type);
89 
90  es.init();
91  sys.project_solution(cubic_default_coupling_test, NULL, es.parameters);
92 
93  for (const auto & elem : mesh.active_local_element_ptr_range())
94  for (unsigned int s1=0; s1 != elem->n_neighbors(); ++s1)
95  {
96  const Elem * n1 = elem->neighbor_ptr(s1);
97  if (!n1)
98  continue;
99 
100  // Let's speed up this test by only checking the ghosted
101  // elements which are most likely to break.
102  if (n1->processor_id() == mesh.processor_id())
103  continue;
104 
105  for (unsigned int s2=0; s2 != elem->n_neighbors(); ++s2)
106  {
107  const Elem * n2 = elem->neighbor_ptr(s2);
108  if (!n2 ||
109  n2->processor_id() == mesh.processor_id())
110  continue;
111 
112  for (unsigned int s3=0; s3 != elem->n_neighbors(); ++s3)
113  {
114  const Elem * n3 = elem->neighbor_ptr(s3);
115  if (!n3 ||
116  n3->processor_id() == mesh.processor_id())
117  continue;
118 
119  Point p = n3->centroid();
120 
121  CPPUNIT_ASSERT_DOUBLES_EQUAL(libmesh_real(sys.point_value(0,p,n3)),
122  libmesh_real(cubic_default_coupling_test(p,es.parameters,"","")),
124  }
125  }
126  }
127  }
T libmesh_real(T a)
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true) const
Definition: system.C:2011
This is the EquationSystems class.
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
DefaultCoupling & default_algebraic_ghosting()
Default algebraic ghosting functor.
Definition: dof_map.h:323
static const Real TOLERANCE
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=libmesh_nullptr) const
Projects arbitrary functions onto the current solution.
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
const Elem * neighbor_ptr(unsigned int i) const
Definition: elem.h:1967
virtual SimpleRange< element_iterator > active_local_element_ptr_range()=0
const DofMap & get_dof_map() const
Definition: system.h:2030
Number cubic_default_coupling_test(const Point &p, const Parameters &, const std::string &, const std::string &)
This is the base class for classes which contain information related to any physical process that mig...
Definition: system.h:76
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void set_n_levels(unsigned int n_levels)
virtual Point centroid() const
Definition: elem.C:446
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
void build_cube(UnstructuredMesh &mesh, const unsigned int nx=0, const unsigned int ny=0, const unsigned int nz=0, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const Real zmin=0., const Real zmax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
Builds a (elements) cube.
processor_id_type processor_id() const
processor_id_type processor_id() const
Definition: dof_object.h:694
void DefaultCouplingTest::testCouplingOnEdge3 ( )

Definition at line 131 of file default_coupling_test.C.

References libMesh::EDGE3.

131 { testCoupling(EDGE3); }
void testCoupling(const ElemType elem_type)
void DefaultCouplingTest::testCouplingOnHex27 ( )

Definition at line 134 of file default_coupling_test.C.

References CPPUNIT_TEST_SUITE_REGISTRATION(), and libMesh::HEX27.

134 { testCoupling(HEX27); }
void testCoupling(const ElemType elem_type)
void DefaultCouplingTest::testCouplingOnQuad9 ( )

Definition at line 132 of file default_coupling_test.C.

References libMesh::QUAD9.

132 { testCoupling(QUAD9); }
void testCoupling(const ElemType elem_type)
void DefaultCouplingTest::testCouplingOnTri6 ( )

Definition at line 133 of file default_coupling_test.C.

References libMesh::TRI6.

133 { testCoupling(TRI6); }
void testCoupling(const ElemType elem_type)

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