1 #ifndef __dof_object_test_h__     2 #define __dof_object_test_h__     6 #define DOFOBJECTTEST                           \     7   CPPUNIT_TEST( testSetId );                    \     8   CPPUNIT_TEST( testValidId );                  \     9   CPPUNIT_TEST( testInvalidateId );             \    10   CPPUNIT_TEST( testSetProcId );                \    11   CPPUNIT_TEST( testValidProcId );              \    12   CPPUNIT_TEST( testInvalidateProcId );         \    13   CPPUNIT_TEST( testSetNSystems );              \    14   CPPUNIT_TEST( testSetNVariableGroups );       \    15   CPPUNIT_TEST( testAddExtraData );             \    16   CPPUNIT_TEST( testAddSystemExtraInts );       \    17   CPPUNIT_TEST( testSetNSystemsExtraInts );     \    18   CPPUNIT_TEST( testSetNVariableGroupsExtraInts ); \    19   CPPUNIT_TEST( testManualDofCalculation );     \    20   CPPUNIT_TEST( testJensEftangBug );    24 template <
class DerivedClass>
    34   void setUp(DerivedClass * derived_instance)
    36     instance=derived_instance;
    46     CPPUNIT_ASSERT_EQUAL( static_cast<dof_id_type>(1) , aobject.
id() );
    56     CPPUNIT_ASSERT( aobject.
valid_id() );
    59     CPPUNIT_ASSERT( !aobject.
valid_id() );
    71     CPPUNIT_ASSERT( !aobject.
valid_id() );
   117     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(10), aobject.
n_systems());
   128     std::vector<unsigned int> nvpg;
   137     for (
unsigned int s=0; s<2; s++)
   139         CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(60), aobject.
n_vars(s));
   140         CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(3),  aobject.
n_var_groups(s));
   142         for (
unsigned int vg=0; vg<3; vg++)
   143           CPPUNIT_ASSERT_EQUAL( nvpg[vg], aobject.
n_vars(s,vg) );
   157     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(9), aobject.
n_extra_integers());
   161     for (
unsigned int i=0; i != 9; ++i)
   164     for (
unsigned int i=0; i != 9; ++i)
   170         if (i == 2 && ints_per_Real <= 4)
   172         if (i < 1 || i >= (2 + ints_per_Real))
   175             CPPUNIT_ASSERT_EQUAL( static_cast<dof_id_type>(i), aobject.
get_extra_integer(i) );
   183     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(6), aobject.
n_extra_integers());
   185     for (
unsigned int i=0; i != 6; ++i)
   189         if (i == 2 && ints_per_Real <= 4)
   191         if (i < 1 || i >= (2 + ints_per_Real))
   192           CPPUNIT_ASSERT_EQUAL( static_cast<dof_id_type>(i), aobject.
get_extra_integer(i) );
   208     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(1), aobject.
n_extra_integers());
   209     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(1), aobject.
n_systems());
   210     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(0), aobject.
n_vars(0));
   218     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(4), aobject.
n_extra_integers());
   219     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(2), aobject.
n_systems());
   220     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(0), aobject.
n_vars(0));
   221     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(0), aobject.
n_vars(1));
   223     for (
unsigned int i=0; i != 4; ++i)
   232     for (
unsigned int i=0; i != 4; ++i)
   235     for (
unsigned int i=4; i != 7; ++i)
   240     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(7), aobject.
n_extra_integers());
   242     for (
unsigned int i=0; i != 4; ++i)
   245     for (
unsigned int i=4; i != 7; ++i)
   252     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(3), aobject.
n_systems());
   253     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(0), aobject.
n_vars(0));
   254     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(0), aobject.
n_vars(1));
   255     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(0), aobject.
n_vars(2));
   257     for (
unsigned int i=0; i != 7; ++i)
   273     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(5), aobject.
n_extra_integers());
   274     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(10), aobject.
n_systems());
   276     for (
unsigned int i=0; i != 5; ++i)
   285     for (
unsigned int i=0; i != 5; ++i)
   288     for (
unsigned int i=5; i != 9; ++i)
   293     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(9), aobject.
n_extra_integers());
   295     for (
unsigned int i=0; i != 5; ++i)
   298     for (
unsigned int i=5; i != 9; ++i)
   305     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(6), aobject.
n_systems());
   307     for (
unsigned int i=0; i != 9; ++i)
   321     for (
unsigned int i=0; i != 5; ++i)
   328     std::vector<unsigned int> nvpg;
   337     for (
unsigned int s=0; s<2; s++)
   339         CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(60), aobject.
n_vars(s));
   340         CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(3),  aobject.
n_var_groups(s));
   342         for (
unsigned int vg=0; vg<3; vg++)
   343           CPPUNIT_ASSERT_EQUAL( nvpg[vg], aobject.
n_vars(s,vg) );
   346     CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(5), aobject.
n_extra_integers());
   348     for (
unsigned int i=0; i != 5; ++i)
   361     std::vector<unsigned int> nvpg;
   382     CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(0), aobject.
dof_number(0, 0, 0));
   386     CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(aobject.
vg_dof_base(0, 0) + 1*1 + 0), aobject.
dof_number(0, 1, 0));
   390     CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(aobject.
vg_dof_base(0, 1) + 2*3 + 2), aobject.
dof_number(0, 4, 2));
   394     CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(aobject.
vg_dof_base(1, 1) + 0*3 + 0), aobject.
dof_number(1, 2, 0));
   404     dof_id_type buf0[] = {2, 8, 257, 0, 257, 96, 257, 192, 257, 0};
   405     aobject.
set_buffer(std::vector<dof_id_type>(buf0, buf0+10));
   412     dof_id_type buf1[] = {2, 8, 257, 1, 257, 97, 257, 193, 257, 1};
   413     aobject.
set_buffer(std::vector<dof_id_type>(buf1, buf1+10));
   422 #endif // #ifdef __dof_object_test_h__ std::string libmesh_suite_name
dof_id_type vg_dof_base(const unsigned int s, const unsigned int vg) const
VariableGroup DoF indices are indexed as id = base + var_in_vg*ncomp + comp This method allows for di...
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor. 
void testInvalidateProcId()
unsigned int n_var_groups(const unsigned int s) const
void testSetNVariableGroups()
void set_vg_dof_base(const unsigned int s, const unsigned int vg, const dof_id_type db)
VariableGroup DoF indices are indexed as id = base + var_in_vg*ncomp + comp This method allows for di...
The libMesh namespace provides an interface to certain functionality in the library. 
void add_system()
Adds an additional system to the DofObject. 
void set_buffer(const std::vector< dof_id_type > &buf)
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject. 
void testSetNVariableGroupsExtraInts()
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
unsigned int n_systems() const
bool valid_processor_id() const
void testAddSystemExtraInts()
void invalidate_id()
Sets the id to invalid_id. 
void set_extra_datum(const unsigned int index, const T value)
Sets the value on this object of the extra datum associated with index, which should have been obtain...
bool has_extra_integers() const
Returns whether extra integers are associated to the DofObject. 
void invalidate_processor_id()
Sets the processor id to invalid_processor_id. 
void set_n_comp_group(const unsigned int s, const unsigned int vg, const unsigned int ncomp)
Sets the number of components for VariableGroup vg of system s associated with this DofObject...
void set_n_systems(const unsigned int s)
Sets the number of systems for this DofObject. 
void set_n_vars_per_group(const unsigned int s, const std::vector< unsigned int > &nvpg)
Sets number of variables in each group associated with system s for this DofObject. 
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
processor_id_type global_processor_id()
void testManualDofCalculation()
The DofObject defines an abstract base class for objects that have degrees of freedom associated with...
void add_extra_integers(const unsigned int n_integers)
Assigns a set of extra integers to this DofObject. 
unsigned int n_extra_integers() const
Returns how many extra integers are associated to the DofObject. 
T get_extra_datum(const unsigned int index) const
Gets the value on this object of the extra datum associated with index, which should have been obtain...
processor_id_type processor_id() const
void setUp(DerivedClass *derived_instance)
void testSetNSystemsExtraInts()
void set_extra_integer(const unsigned int index, const dof_id_type value)
Sets the value on this object of the extra integer associated with index, which should have been obta...
dof_id_type get_extra_integer(const unsigned int index) const
Gets the value on this object of the extra integer associated with index, which should have been obta...