11#include <libmesh/elem.h>
12#include <libmesh/enum_fe_family.h>
13#include <libmesh/enum_order.h>
14#include <libmesh/fe_base.h>
15#include <libmesh/fe_type.h>
16#include <libmesh/int_range.h>
17#include <libmesh/mesh.h>
18#include <libmesh/mesh_generation.h>
19#include <libmesh/node.h>
20#include <libmesh/parallel_implementation.h>
21#include <libmesh/quadrature.h>
32template <ElemType elem_type, Order order>
51 MeshTools::Generation::build_cube(*
_mesh, 2, 2, 2, 0., 1., 0., 1., 0., 1., elem_type);
54 for (
auto * node :
_mesh->node_ptr_range())
57 const Real y = (LIBMESH_DIM > 1) ? p(1) : 0.;
58 const Real z = (LIBMESH_DIM > 2) ? p(2) : 0.;
60 p(0) += 0.3 * y + 0.17 * z;
83 fe->attach_quadrature_rule(qrule.get());
86 const std::vector<std::vector<Real>> & phi = fe->get_phi();
88 unsigned int n_elem = 0;
90 for (
const auto * elem :
_mesh->active_local_element_ptr_range())
95 CPPUNIT_ASSERT_EQUAL(phi.size(), std::size_t(qrule->n_points()));
99 CPPUNIT_ASSERT_EQUAL((i == q) ?
Real(1) :
Real(0), phi[i][q]);
104 _mesh->comm().sum(n_elem);
105 CPPUNIT_ASSERT(n_elem > 0);
117 fe->attach_quadrature_rule(qrule.get());
119 const std::vector<std::vector<Real>> & phi = fe->get_phi();
120 const std::vector<Real> & JxW = fe->get_JxW();
122 for (
const auto * elem :
_mesh->active_local_element_ptr_range())
126 const std::size_t n_dofs = phi.size();
133 m += JxW[q] * phi[i][q] * phi[j][q];
139 CPPUNIT_ASSERT(m > 0.);
143 CPPUNIT_ASSERT_EQUAL(
Real(0), m);
149#define INSTANTIATE_FEGLLCOLLOCATIONTEST(elemtype, order) \
150 class FEGLLCollocationTest_##order##_##elemtype : \
151 public FEGLLCollocationTest<elemtype, order> { \
153 FEGLLCollocationTest_##order##_##elemtype() : \
154 FEGLLCollocationTest<elemtype, order>() { \
155 if (unitlog->summarized_logs_enabled()) \
156 this->libmesh_suite_name = "FEGLLCollocationTest"; \
158 this->libmesh_suite_name = \
159 "FEGLLCollocationTest_" #order "_" #elemtype; \
161 CPPUNIT_TEST_SUITE( FEGLLCollocationTest_##order##_##elemtype ); \
162 CPPUNIT_TEST( testShapesAreIdentity ); \
163 CPPUNIT_TEST( testMassMatrixIsDiagonal ); \
164 CPPUNIT_TEST_SUITE_END(); \
167 CPPUNIT_TEST_SUITE_REGISTRATION( FEGLLCollocationTest_##order##_##elemtype )
std::unique_ptr< Mesh > _mesh
void testShapesAreIdentity()
void testMassMatrixIsDiagonal()
std::unique_ptr< QBase > collocated_rule(const FEType &fe_type, const unsigned int dim)
The family's default quadrature rule, which is collocated with the basis.
std::string libmesh_suite_name
static const unsigned int type_to_dim_map[INVALID_ELEM]
This array maps the integer representation of the ElemType enum to the geometric dimension of the ele...
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
std::unique_ptr< QBase > default_quadrature_rule(const unsigned int dim, const int extraorder=0) const
A Node is like a Point, but with more information.
Communicator * TestCommWorld
INSTANTIATE_FEGLLCOLLOCATIONTEST(EDGE2, FIRST)
The libMesh namespace provides an interface to certain functionality in the library.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
static constexpr Real TOLERANCE
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...