libMesh
Public Member Functions | Protected Types | Private Attributes | List of all members
NodeTest Class Reference
Inheritance diagram for NodeTest:
[legend]

Public Member Functions

 CPPUNIT_TEST_SUITE (NodeTest)
 
POINTTEST DOFOBJECTTEST CPPUNIT_TEST_SUITE_END ()
 
virtual void setUp ()
 
virtual void tearDown ()
 
void testValue ()
 
void testZero ()
 
void testNorm ()
 
void testNormSq ()
 
void testEquality ()
 
void testInEquality ()
 
void testAssignment ()
 
void testScalarInit ()
 
void testScalarMult ()
 
void testScalarDiv ()
 
void testScalarMultAssign ()
 
void testScalarDivAssign ()
 
void testVectorAdd ()
 
void testVectorAddScaled ()
 
void testVectorSub ()
 
void testVectorMult ()
 
void testVectorAddAssign ()
 
void testVectorSubAssign ()
 
void testValueBase ()
 
void testZeroBase ()
 
void testIsZero ()
 
void testNormBase ()
 
void testNormSqBase ()
 
void testEqualityBase ()
 
void testInEqualityBase ()
 
void testAssignmentBase ()
 
void testScalarMultBase ()
 
void testScalarDivBase ()
 
void testScalarMultAssignBase ()
 
void testScalarDivAssignBase ()
 
void testVectorAddBase ()
 
void testVectorAddScaledBase ()
 
void testVectorSubBase ()
 
void testVectorMultBase ()
 
void testVectorAddAssignBase ()
 
void testVectorSubAssignBase ()
 
void setUp (Node *derived_instance)
 
void testSetId ()
 
void testValidId ()
 
void testInvalidateId ()
 
void testSetProcId ()
 
void testValidProcId ()
 
void testInvalidateProcId ()
 
void testSetNSystems ()
 
void testSetNVariableGroups ()
 
void testAddExtraData ()
 
void testAddSystemExtraInts ()
 
void testSetNSystemsExtraInts ()
 
void testSetNVariableGroupsExtraInts ()
 
void testManualDofCalculation ()
 
void testJensEftangBug ()
 

Protected Types

typedef Node ::value_type T
 

Private Attributes

Nodedof_object_instance
 
Nodem_1_1_1
 
Nodem_n1_1_n1
 
TypeVector< T > * basem_1_1_1
 
TypeVector< T > * basem_n1_1_n1
 
Nodeinstance
 

Detailed Description

Definition at line 10 of file node_test.C.

Member Typedef Documentation

◆ T

typedef Node ::value_type TypeVectorTestBase< Node >::T
protectedinherited

Definition at line 61 of file type_vector_test.h.

Member Function Documentation

◆ CPPUNIT_TEST_SUITE()

NodeTest::CPPUNIT_TEST_SUITE ( NodeTest  )

◆ CPPUNIT_TEST_SUITE_END()

POINTTEST DOFOBJECTTEST NodeTest::CPPUNIT_TEST_SUITE_END ( )

◆ setUp() [1/2]

virtual void NodeTest::setUp ( )
inlinevirtual

◆ setUp() [2/2]

void DofObjectTest< Node >::setUp ( Node derived_instance)
inlineinherited

Definition at line 31 of file dof_object_test.h.

32  {
33  instance=derived_instance;
34  }

◆ tearDown()

virtual void NodeTest::tearDown ( )
inlinevirtual

Reimplemented from PointTestBase< Node >.

Definition at line 37 of file node_test.C.

38  {
40 
41  delete dof_object_instance;
42  }

References PointTestBase< DerivedClass >::tearDown().

◆ testAddExtraData()

void DofObjectTest< Node >::testAddExtraData ( )
inlineinherited

Definition at line 128 of file dof_object_test.h.

129  {
130  DofObject aobject(*instance);
131 
132  aobject.add_extra_integers (9);
133 
134  CPPUNIT_ASSERT(aobject.has_extra_integers());
135 
136  CPPUNIT_ASSERT_EQUAL( (unsigned int) 9, aobject.n_extra_integers() );
137 
138  unsigned int ints_per_Real = (sizeof(Real)-1)/sizeof(dof_id_type) + 1;
139 
140  for (unsigned int i=0; i != 9; ++i)
141  CPPUNIT_ASSERT_EQUAL( DofObject::invalid_id, aobject.get_extra_integer(i) );
142 
143  for (unsigned int i=0; i != 9; ++i)
144  {
145  // Try out a char at i=1
146  if (i == 1)
147  aobject.set_extra_datum<char>(i, '1');
148  // Try out an extra Real at i=2 if we'll have room
149  if (i == 2 && ints_per_Real <= 4)
150  aobject.set_extra_datum<Real>(i, pi);
151  if (i < 1 || i >= (2 + ints_per_Real))
152  {
153  aobject.set_extra_integer(i, i);
154  CPPUNIT_ASSERT_EQUAL( dof_id_type(i), aobject.get_extra_integer(i) );
155  }
156  }
157 
158  aobject.add_extra_integers (6);
159 
160  CPPUNIT_ASSERT(aobject.has_extra_integers());
161 
162  CPPUNIT_ASSERT_EQUAL( (unsigned int) 6, aobject.n_extra_integers() );
163 
164  for (unsigned int i=0; i != 6; ++i)
165  {
166  if (i == 1)
167  CPPUNIT_ASSERT_EQUAL(aobject.get_extra_datum<char>(i), '1');
168  if (i == 2 && ints_per_Real <= 4)
169  CPPUNIT_ASSERT_EQUAL(aobject.get_extra_datum<Real>(i), pi);
170  if (i < 1 || i >= (2 + ints_per_Real))
171  CPPUNIT_ASSERT_EQUAL( dof_id_type(i), aobject.get_extra_integer(i) );
172  }
173  }

◆ testAddSystemExtraInts()

void DofObjectTest< Node >::testAddSystemExtraInts ( )
inlineinherited

Definition at line 175 of file dof_object_test.h.

176  {
177  DofObject aobject(*instance);
178 
179  aobject.add_extra_integers (1);
180 
181  aobject.add_system();
182 
183  CPPUNIT_ASSERT(aobject.has_extra_integers());
184 
185  CPPUNIT_ASSERT_EQUAL( (unsigned int) 1, aobject.n_extra_integers() );
186 
187  CPPUNIT_ASSERT_EQUAL( (unsigned int) 1, aobject.n_systems() );
188 
189  CPPUNIT_ASSERT_EQUAL( (unsigned int) 0, aobject.n_vars(0) );
190 
191  aobject.add_extra_integers (4);
192 
193  aobject.add_system();
194 
195  CPPUNIT_ASSERT(aobject.has_extra_integers());
196 
197  CPPUNIT_ASSERT_EQUAL( (unsigned int) 4, aobject.n_extra_integers() );
198 
199  CPPUNIT_ASSERT_EQUAL( (unsigned int) 2, aobject.n_systems() );
200 
201  CPPUNIT_ASSERT_EQUAL( (unsigned int) 0, aobject.n_vars(0) );
202  CPPUNIT_ASSERT_EQUAL( (unsigned int) 0, aobject.n_vars(1) );
203 
204  for (unsigned int i=0; i != 4; ++i)
205  {
206  CPPUNIT_ASSERT_EQUAL( DofObject::invalid_id, aobject.get_extra_integer(i) );
207  aobject.set_extra_integer(i, i);
208  CPPUNIT_ASSERT_EQUAL( dof_id_type(i), aobject.get_extra_integer(i) );
209  }
210 
211  aobject.add_extra_integers (7);
212 
213  for (unsigned int i=0; i != 4; ++i)
214  CPPUNIT_ASSERT_EQUAL( dof_id_type(i), aobject.get_extra_integer(i) );
215 
216  for (unsigned int i=4; i != 7; ++i)
217  CPPUNIT_ASSERT_EQUAL( DofObject::invalid_id, aobject.get_extra_integer(i) );
218 
219  aobject.add_system();
220 
221  CPPUNIT_ASSERT_EQUAL( (unsigned int) 7, aobject.n_extra_integers() );
222 
223  for (unsigned int i=0; i != 4; ++i)
224  CPPUNIT_ASSERT_EQUAL( dof_id_type(i), aobject.get_extra_integer(i) );
225 
226  for (unsigned int i=4; i != 7; ++i)
227  {
228  CPPUNIT_ASSERT_EQUAL( DofObject::invalid_id, aobject.get_extra_integer(i) );
229  aobject.set_extra_integer(i, i);
230  CPPUNIT_ASSERT_EQUAL( dof_id_type(i), aobject.get_extra_integer(i) );
231  }
232 
233  CPPUNIT_ASSERT_EQUAL( (unsigned int) 3, aobject.n_systems() );
234 
235  CPPUNIT_ASSERT_EQUAL( (unsigned int) 0, aobject.n_vars(0) );
236  CPPUNIT_ASSERT_EQUAL( (unsigned int) 0, aobject.n_vars(1) );
237  CPPUNIT_ASSERT_EQUAL( (unsigned int) 0, aobject.n_vars(2) );
238 
239  for (unsigned int i=0; i != 7; ++i)
240  CPPUNIT_ASSERT_EQUAL( dof_id_type(i), aobject.get_extra_integer(i) );
241  }

◆ testAssignment()

void TypeVectorTestBase< Node >::testAssignment ( )
inlineinherited

Definition at line 150 of file type_vector_test.h.

151  {
152  DerivedClass avector = (*m_1_1_1);
153 
154  for (int i = 0; i != LIBMESH_DIM; ++i)
155  CPPUNIT_ASSERT_EQUAL( T(1), (avector)(i) );
156  }

◆ testAssignmentBase()

void TypeVectorTestBase< Node >::testAssignmentBase ( )
inlineinherited

Definition at line 323 of file type_vector_test.h.

324  {
325  TypeVector<T> avector = (*m_1_1_1);
326 
327  for (int i = 0; i != LIBMESH_DIM; ++i)
328  CPPUNIT_ASSERT_EQUAL( T(1), (avector)(i) );
329  }

◆ testEquality()

void TypeVectorTestBase< Node >::testEquality ( )
inlineinherited

Definition at line 134 of file type_vector_test.h.

135  {
136  CPPUNIT_ASSERT( (*m_1_1_1) == (*m_1_1_1) );
137 #if LIBMESH_DIM > 1
138  CPPUNIT_ASSERT( !((*m_1_1_1) == (*m_n1_1_n1)) );
139 #endif
140  }

◆ testEqualityBase()

void TypeVectorTestBase< Node >::testEqualityBase ( )
inlineinherited

Definition at line 311 of file type_vector_test.h.

312  {
313  CPPUNIT_ASSERT( (*basem_1_1_1) == (*basem_1_1_1) );
314  CPPUNIT_ASSERT( !((*basem_1_1_1) == (*basem_n1_1_n1)) );
315  }

◆ testInEquality()

void TypeVectorTestBase< Node >::testInEquality ( )
inlineinherited

Definition at line 142 of file type_vector_test.h.

143  {
144  CPPUNIT_ASSERT( !((*m_1_1_1) != (*m_1_1_1)) );
145 #if LIBMESH_DIM > 1
146  CPPUNIT_ASSERT( (*m_1_1_1) != (*m_n1_1_n1) );
147 #endif
148  }

◆ testInEqualityBase()

void TypeVectorTestBase< Node >::testInEqualityBase ( )
inlineinherited

Definition at line 317 of file type_vector_test.h.

318  {
319  CPPUNIT_ASSERT( !((*basem_1_1_1) != (*basem_1_1_1)) );
320  CPPUNIT_ASSERT( (*basem_1_1_1) != (*basem_n1_1_n1) );
321  }

◆ testInvalidateId()

void DofObjectTest< Node >::testInvalidateId ( )
inlineinherited

Definition at line 55 of file dof_object_test.h.

56  {
57  DofObject aobject(*instance);
58 
59  aobject.set_id(1);
60  aobject.invalidate_id();
61 
62  CPPUNIT_ASSERT( !aobject.valid_id() );
63  }

◆ testInvalidateProcId()

void DofObjectTest< Node >::testInvalidateProcId ( )
inlineinherited

Definition at line 84 of file dof_object_test.h.

85  {
86  DofObject aobject(*instance);
87 
88  aobject.processor_id(libMesh::global_processor_id());
89  aobject.invalidate_processor_id();
90 
91  CPPUNIT_ASSERT( !aobject.valid_processor_id() );
92  }

◆ testIsZero()

void TypeVectorTestBase< Node >::testIsZero ( )
inlineinherited

Definition at line 277 of file type_vector_test.h.

278  {
279  {
280 #if LIBMESH_DIM > 2
281  DerivedClass avector(0,0,0);
282 #elif LIBMESH_DIM > 1
283  DerivedClass avector(0,0);
284 #else
285  DerivedClass avector(0);
286 #endif
287  CPPUNIT_ASSERT(avector.is_zero());
288  }
289  {
290 #if LIBMESH_DIM > 2
291  DerivedClass avector(1,1,1);
292 #elif LIBMESH_DIM > 1
293  DerivedClass avector(1,1);
294 #else
295  DerivedClass avector(1);
296 #endif
297  CPPUNIT_ASSERT(!avector.is_zero());
298  }
299  }

◆ testJensEftangBug()

void DofObjectTest< Node >::testJensEftangBug ( )
inlineinherited

Definition at line 374 of file dof_object_test.h.

375  {
376  // For more information on this bug, see the following email thread:
377  // https://sourceforge.net/p/libmesh/mailman/libmesh-users/thread/[email protected]/
378  DofObject aobject(*instance);
379  dof_id_type buf0[] = {2, 8, 257, 0, 257, 96, 257, 192, 257, 0};
380  aobject.set_buffer(std::vector<dof_id_type>(buf0, buf0+10));
381 
382  CPPUNIT_ASSERT_EQUAL (aobject.dof_number(0,0,0), static_cast<dof_id_type>( 0));
383  CPPUNIT_ASSERT_EQUAL (aobject.dof_number(0,1,0), static_cast<dof_id_type>( 96));
384  CPPUNIT_ASSERT_EQUAL (aobject.dof_number(0,2,0), static_cast<dof_id_type>(192));
385  CPPUNIT_ASSERT_EQUAL (aobject.dof_number(1,0,0), static_cast<dof_id_type>( 0));
386 
387  dof_id_type buf1[] = {2, 8, 257, 1, 257, 97, 257, 193, 257, 1};
388  aobject.set_buffer(std::vector<dof_id_type>(buf1, buf1+10));
389 
390  CPPUNIT_ASSERT_EQUAL (aobject.dof_number(0,0,0), static_cast<dof_id_type>( 1));
391  CPPUNIT_ASSERT_EQUAL (aobject.dof_number(0,1,0), static_cast<dof_id_type>( 97));
392  CPPUNIT_ASSERT_EQUAL (aobject.dof_number(0,2,0), static_cast<dof_id_type>(193));
393  CPPUNIT_ASSERT_EQUAL (aobject.dof_number(1,0,0), static_cast<dof_id_type>( 1));
394  }

◆ testManualDofCalculation()

void DofObjectTest< Node >::testManualDofCalculation ( )
inlineinherited

Definition at line 332 of file dof_object_test.h.

333  {
334  DofObject aobject(*instance);
335 
336  aobject.set_n_systems (2);
337 
338  std::vector<unsigned int> nvpg;
339 
340  nvpg.push_back(2);
341  nvpg.push_back(3);
342 
343  aobject.set_n_vars_per_group (0, nvpg);
344  aobject.set_n_vars_per_group (1, nvpg);
345 
346  aobject.set_n_comp_group (0, 0, 1);
347  aobject.set_n_comp_group (0, 1, 3);
348 
349  aobject.set_n_comp_group (1, 0, 2);
350  aobject.set_n_comp_group (1, 1, 1);
351 
352  aobject.set_vg_dof_base(0, 0, 0);
353  aobject.set_vg_dof_base(0, 1, 120);
354 
355  aobject.set_vg_dof_base(1, 0, 20);
356  aobject.set_vg_dof_base(1, 1, 220);
357 
358  // Make sure the first dof is sane
359  CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(0), aobject.dof_number(0, 0, 0));
360 
361  // Check that we can manually index dofs of variables based on the first dof in a variable group
362  // Using: id = base + var_in_vg*ncomp + comp
363  CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(aobject.vg_dof_base(0, 0) + 1*1 + 0), aobject.dof_number(0, 1, 0));
364 
365  // Another Check that we can manually index dofs of variables based on the first dof in a variable group
366  // Using: id = base + var_in_vg*ncomp + comp
367  CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(aobject.vg_dof_base(0, 1) + 2*3 + 2), aobject.dof_number(0, 4, 2));
368 
369  // One More Check that we can manually index dofs of variables based on the first dof in a variable group
370  // Using: id = base + var_in_vg*ncomp + comp
371  CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(aobject.vg_dof_base(1, 1) + 0*3 + 0), aobject.dof_number(1, 2, 0));
372  }

◆ testNorm()

void TypeVectorTestBase< Node >::testNorm ( )
inlineinherited

Definition at line 124 of file type_vector_test.h.

125  {
126  LIBMESH_ASSERT_FP_EQUAL( std::sqrt(Real(LIBMESH_DIM)) , m_1_1_1->norm() , TOLERANCE*TOLERANCE );
127  }

◆ testNormBase()

void TypeVectorTestBase< Node >::testNormBase ( )
inlineinherited

Definition at line 301 of file type_vector_test.h.

302  {
303  LIBMESH_ASSERT_FP_EQUAL( std::sqrt(Real(LIBMESH_DIM)) , basem_1_1_1->norm() , TOLERANCE*TOLERANCE );
304  }

◆ testNormSq()

void TypeVectorTestBase< Node >::testNormSq ( )
inlineinherited

Definition at line 129 of file type_vector_test.h.

130  {
131  LIBMESH_ASSERT_FP_EQUAL( Real(LIBMESH_DIM) , m_1_1_1->norm_sq() , TOLERANCE*TOLERANCE );
132  }

◆ testNormSqBase()

void TypeVectorTestBase< Node >::testNormSqBase ( )
inlineinherited

Definition at line 306 of file type_vector_test.h.

307  {
308  LIBMESH_ASSERT_FP_EQUAL( Real(LIBMESH_DIM) , basem_1_1_1->norm_sq() , TOLERANCE*TOLERANCE );
309  }

◆ testScalarDiv()

void TypeVectorTestBase< Node >::testScalarDiv ( )
inlineinherited

Definition at line 176 of file type_vector_test.h.

177  {
178  for (int i = 0; i != LIBMESH_DIM; ++i)
179  LIBMESH_ASSERT_FP_EQUAL( 1/Real(5) , libmesh_real(((*m_1_1_1)/5.0)(i)) , TOLERANCE*TOLERANCE );
180  }

◆ testScalarDivAssign()

void TypeVectorTestBase< Node >::testScalarDivAssign ( )
inlineinherited

Definition at line 191 of file type_vector_test.h.

192  {
193  DerivedClass avector = (*m_1_1_1);
194  avector/=5.0;
195 
196  for (int i = 0; i != LIBMESH_DIM; ++i)
197  LIBMESH_ASSERT_FP_EQUAL( 1/Real(5) , libmesh_real(avector(i)) , TOLERANCE*TOLERANCE );
198  }

◆ testScalarDivAssignBase()

void TypeVectorTestBase< Node >::testScalarDivAssignBase ( )
inlineinherited

Definition at line 352 of file type_vector_test.h.

353  {
354  TypeVector<T> avector(*m_1_1_1);
355  avector/=5.0;
356 
357  for (int i = 0; i != LIBMESH_DIM; ++i)
358  LIBMESH_ASSERT_FP_EQUAL( 1/Real(5) , libmesh_real(avector(i)) , TOLERANCE*TOLERANCE );
359  }

◆ testScalarDivBase()

void TypeVectorTestBase< Node >::testScalarDivBase ( )
inlineinherited

Definition at line 337 of file type_vector_test.h.

338  {
339  for (int i = 0; i != LIBMESH_DIM; ++i)
340  LIBMESH_ASSERT_FP_EQUAL( 1/Real(5) , libmesh_real(((*basem_1_1_1)/5.0)(i)) , TOLERANCE*TOLERANCE );
341  }

◆ testScalarInit()

void TypeVectorTestBase< Node >::testScalarInit ( )
inlineinherited

Definition at line 158 of file type_vector_test.h.

159  {
160  DerivedClass avector = 0;
161  for (int i = 0; i != LIBMESH_DIM; ++i)
162  LIBMESH_ASSERT_FP_EQUAL( 0.0 , libmesh_real(avector(i)) , TOLERANCE*TOLERANCE );
163 
164  DerivedClass bvector = 2.0;
165  LIBMESH_ASSERT_FP_EQUAL( 2.0 , libmesh_real(bvector(0)) , TOLERANCE*TOLERANCE );
166  for (int i = 1; i != LIBMESH_DIM; ++i)
167  LIBMESH_ASSERT_FP_EQUAL( 0.0 , libmesh_real(bvector(i)) , TOLERANCE*TOLERANCE );
168  }

◆ testScalarMult()

void TypeVectorTestBase< Node >::testScalarMult ( )
inlineinherited

Definition at line 170 of file type_vector_test.h.

171  {
172  for (int i = 0; i != LIBMESH_DIM; ++i)
173  LIBMESH_ASSERT_FP_EQUAL( 5.0 , libmesh_real(((*m_1_1_1)*5.0)(i)) , TOLERANCE*TOLERANCE );
174  }

◆ testScalarMultAssign()

void TypeVectorTestBase< Node >::testScalarMultAssign ( )
inlineinherited

Definition at line 182 of file type_vector_test.h.

183  {
184  DerivedClass avector = (*m_1_1_1);
185  avector*=5.0;
186 
187  for (int i = 0; i != LIBMESH_DIM; ++i)
188  LIBMESH_ASSERT_FP_EQUAL( 5.0 , libmesh_real(avector(i)) , TOLERANCE*TOLERANCE );
189  }

◆ testScalarMultAssignBase()

void TypeVectorTestBase< Node >::testScalarMultAssignBase ( )
inlineinherited

Definition at line 343 of file type_vector_test.h.

344  {
345  TypeVector<T> avector(*m_1_1_1);
346  avector*=5.0;
347 
348  for (int i = 0; i != LIBMESH_DIM; ++i)
349  LIBMESH_ASSERT_FP_EQUAL( 5.0 , libmesh_real(avector(i)) , TOLERANCE*TOLERANCE );
350  }

◆ testScalarMultBase()

void TypeVectorTestBase< Node >::testScalarMultBase ( )
inlineinherited

Definition at line 331 of file type_vector_test.h.

332  {
333  for (int i = 0; i != LIBMESH_DIM; ++i)
334  LIBMESH_ASSERT_FP_EQUAL( 5.0 , libmesh_real(((*basem_1_1_1)*5.0)(i)) , TOLERANCE*TOLERANCE );
335  }

◆ testSetId()

void DofObjectTest< Node >::testSetId ( )
inlineinherited

Definition at line 36 of file dof_object_test.h.

37  {
38  DofObject aobject(*instance);
39 
40  aobject.set_id(1);
41  CPPUNIT_ASSERT_EQUAL( static_cast<dof_id_type>(1) , aobject.id() );
42  }

◆ testSetNSystems()

void DofObjectTest< Node >::testSetNSystems ( )
inlineinherited

Definition at line 94 of file dof_object_test.h.

95  {
96  DofObject aobject(*instance);
97 
98  aobject.set_n_systems (10);
99 
100  CPPUNIT_ASSERT_EQUAL( (unsigned int) 10, aobject.n_systems() );
101  }

◆ testSetNSystemsExtraInts()

void DofObjectTest< Node >::testSetNSystemsExtraInts ( )
inlineinherited

Definition at line 243 of file dof_object_test.h.

244  {
245  DofObject aobject(*instance);
246 
247  aobject.add_extra_integers (5);
248 
249  aobject.set_n_systems (10);
250 
251  CPPUNIT_ASSERT(aobject.has_extra_integers());
252 
253  CPPUNIT_ASSERT_EQUAL( (unsigned int) 5, aobject.n_extra_integers() );
254 
255  CPPUNIT_ASSERT_EQUAL( (unsigned int) 10, aobject.n_systems() );
256 
257  for (unsigned int i=0; i != 5; ++i)
258  {
259  CPPUNIT_ASSERT_EQUAL( DofObject::invalid_id, aobject.get_extra_integer(i) );
260  aobject.set_extra_integer(i, i);
261  CPPUNIT_ASSERT_EQUAL( dof_id_type(i), aobject.get_extra_integer(i) );
262  }
263 
264  aobject.add_extra_integers (9);
265 
266  for (unsigned int i=0; i != 5; ++i)
267  CPPUNIT_ASSERT_EQUAL( dof_id_type(i), aobject.get_extra_integer(i) );
268 
269  for (unsigned int i=5; i != 9; ++i)
270  CPPUNIT_ASSERT_EQUAL( DofObject::invalid_id, aobject.get_extra_integer(i) );
271 
272  aobject.set_n_systems (6);
273 
274  CPPUNIT_ASSERT_EQUAL( (unsigned int) 9, aobject.n_extra_integers() );
275 
276  for (unsigned int i=0; i != 5; ++i)
277  CPPUNIT_ASSERT_EQUAL( dof_id_type(i), aobject.get_extra_integer(i) );
278 
279  for (unsigned int i=5; i != 9; ++i)
280  {
281  CPPUNIT_ASSERT_EQUAL( DofObject::invalid_id, aobject.get_extra_integer(i) );
282  aobject.set_extra_integer(i, i);
283  CPPUNIT_ASSERT_EQUAL( dof_id_type(i), aobject.get_extra_integer(i) );
284  }
285 
286  CPPUNIT_ASSERT_EQUAL( (unsigned int) 6, aobject.n_systems() );
287 
288  for (unsigned int i=0; i != 9; ++i)
289  CPPUNIT_ASSERT_EQUAL( dof_id_type(i), aobject.get_extra_integer(i) );
290  }

◆ testSetNVariableGroups()

void DofObjectTest< Node >::testSetNVariableGroups ( )
inlineinherited

Definition at line 103 of file dof_object_test.h.

104  {
105  DofObject aobject(*instance);
106 
107  aobject.set_n_systems (2);
108 
109  std::vector<unsigned int> nvpg;
110 
111  nvpg.push_back(10);
112  nvpg.push_back(20);
113  nvpg.push_back(30);
114 
115  aobject.set_n_vars_per_group (0, nvpg);
116  aobject.set_n_vars_per_group (1, nvpg);
117 
118  for (unsigned int s=0; s<2; s++)
119  {
120  CPPUNIT_ASSERT_EQUAL( (unsigned int) 60, aobject.n_vars(s) );
121  CPPUNIT_ASSERT_EQUAL( (unsigned int) 3, aobject.n_var_groups(s) );
122 
123  for (unsigned int vg=0; vg<3; vg++)
124  CPPUNIT_ASSERT_EQUAL( nvpg[vg], aobject.n_vars(s,vg) );
125  }
126  }

◆ testSetNVariableGroupsExtraInts()

void DofObjectTest< Node >::testSetNVariableGroupsExtraInts ( )
inlineinherited

Definition at line 292 of file dof_object_test.h.

293  {
294  DofObject aobject(*instance);
295 
296  aobject.set_n_systems (2);
297 
298  aobject.add_extra_integers (5);
299 
300  for (unsigned int i=0; i != 5; ++i)
301  {
302  CPPUNIT_ASSERT_EQUAL( DofObject::invalid_id, aobject.get_extra_integer(i) );
303  aobject.set_extra_integer(i, i);
304  CPPUNIT_ASSERT_EQUAL( dof_id_type(i), aobject.get_extra_integer(i) );
305  }
306 
307  std::vector<unsigned int> nvpg;
308 
309  nvpg.push_back(10);
310  nvpg.push_back(20);
311  nvpg.push_back(30);
312 
313  aobject.set_n_vars_per_group (0, nvpg);
314  aobject.set_n_vars_per_group (1, nvpg);
315 
316  for (unsigned int s=0; s<2; s++)
317  {
318  CPPUNIT_ASSERT_EQUAL( (unsigned int) 60, aobject.n_vars(s) );
319  CPPUNIT_ASSERT_EQUAL( (unsigned int) 3, aobject.n_var_groups(s) );
320 
321  for (unsigned int vg=0; vg<3; vg++)
322  CPPUNIT_ASSERT_EQUAL( nvpg[vg], aobject.n_vars(s,vg) );
323  }
324 
325  CPPUNIT_ASSERT_EQUAL( (unsigned int) 5, aobject.n_extra_integers() );
326 
327  for (unsigned int i=0; i != 5; ++i)
328  CPPUNIT_ASSERT_EQUAL( dof_id_type(i), aobject.get_extra_integer(i) );
329  }

◆ testSetProcId()

void DofObjectTest< Node >::testSetProcId ( )
inlineinherited

Definition at line 65 of file dof_object_test.h.

66  {
67  DofObject aobject(*instance);
68 
69  aobject.processor_id(libMesh::global_processor_id());
70  CPPUNIT_ASSERT_EQUAL( (processor_id_type)libMesh::global_processor_id() , aobject.processor_id() );
71  }

◆ testValidId()

void DofObjectTest< Node >::testValidId ( )
inlineinherited

Definition at line 44 of file dof_object_test.h.

45  {
46  DofObject aobject(*instance);
47 
48  aobject.set_id(1);
49  CPPUNIT_ASSERT( aobject.valid_id() );
50 
51  aobject.set_id(DofObject::invalid_id);
52  CPPUNIT_ASSERT( !aobject.valid_id() );
53  }

◆ testValidProcId()

void DofObjectTest< Node >::testValidProcId ( )
inlineinherited

Definition at line 73 of file dof_object_test.h.

74  {
75  DofObject aobject(*instance);
76 
77  aobject.processor_id(libMesh::global_processor_id());
78  CPPUNIT_ASSERT(aobject.valid_processor_id());
79 
80  aobject.processor_id(DofObject::invalid_processor_id);
81  CPPUNIT_ASSERT(!aobject.valid_processor_id());
82  }

◆ testValue()

void TypeVectorTestBase< Node >::testValue ( )
inlineinherited

Definition at line 93 of file type_vector_test.h.

94  {
95  CPPUNIT_ASSERT_EQUAL( T(1), (*m_1_1_1)(0));
96  CPPUNIT_ASSERT_EQUAL( T(-1), (*m_n1_1_n1)(0));
97 
98 #if LIBMESH_DIM > 1
99  CPPUNIT_ASSERT_EQUAL( T(1), (*m_1_1_1)(1));
100  CPPUNIT_ASSERT_EQUAL( T(1) , (*m_n1_1_n1)(1));
101 #endif
102 
103 #if LIBMESH_DIM > 2
104  CPPUNIT_ASSERT_EQUAL( T(1), (*m_1_1_1)(2));
105  CPPUNIT_ASSERT_EQUAL( T(-1), (*m_n1_1_n1)(2));
106 #endif
107  }

◆ testValueBase()

void TypeVectorTestBase< Node >::testValueBase ( )
inlineinherited

Definition at line 256 of file type_vector_test.h.

257  {
258  for (int i = 0; i != LIBMESH_DIM; ++i)
259  CPPUNIT_ASSERT_EQUAL( T(1), (*basem_1_1_1)(i));
260 
261  CPPUNIT_ASSERT_EQUAL( T(-1), (*basem_n1_1_n1)(0));
262  if (LIBMESH_DIM > 1)
263  CPPUNIT_ASSERT_EQUAL( T(1 ), (*basem_n1_1_n1)(1));
264  if (LIBMESH_DIM > 2)
265  CPPUNIT_ASSERT_EQUAL( T(-1), (*basem_n1_1_n1)(2));
266  }

◆ testVectorAdd()

void TypeVectorTestBase< Node >::testVectorAdd ( )
inlineinherited

Definition at line 200 of file type_vector_test.h.

201  {
202  LIBMESH_ASSERT_FP_EQUAL( 0.0 , libmesh_real(((*m_1_1_1)+(*m_n1_1_n1))(0)) , TOLERANCE*TOLERANCE );
203  if (LIBMESH_DIM > 1)
204  LIBMESH_ASSERT_FP_EQUAL( 2.0 , libmesh_real(((*m_1_1_1)+(*m_n1_1_n1))(1)) , TOLERANCE*TOLERANCE );
205  if (LIBMESH_DIM > 2)
206  LIBMESH_ASSERT_FP_EQUAL( 0.0 , libmesh_real(((*m_1_1_1)+(*m_n1_1_n1))(2)) , TOLERANCE*TOLERANCE );
207  }

◆ testVectorAddAssign()

void TypeVectorTestBase< Node >::testVectorAddAssign ( )
inlineinherited

Definition at line 235 of file type_vector_test.h.

236  {
237  DerivedClass avector = (*m_1_1_1);
238  avector+=(*m_1_1_1);
239 
240  for (int i = 0; i != LIBMESH_DIM; ++i)
241  LIBMESH_ASSERT_FP_EQUAL( 2.0 , libmesh_real(avector(i)) , TOLERANCE*TOLERANCE );
242  }

◆ testVectorAddAssignBase()

void TypeVectorTestBase< Node >::testVectorAddAssignBase ( )
inlineinherited

Definition at line 396 of file type_vector_test.h.

397  {
398  TypeVector<T> avector(*m_1_1_1);
399  avector+=(*basem_1_1_1);
400 
401  for (int i = 0; i != LIBMESH_DIM; ++i)
402  LIBMESH_ASSERT_FP_EQUAL( 2.0 , libmesh_real(avector(i)) , TOLERANCE*TOLERANCE );
403  }

◆ testVectorAddBase()

void TypeVectorTestBase< Node >::testVectorAddBase ( )
inlineinherited

Definition at line 361 of file type_vector_test.h.

362  {
363  LIBMESH_ASSERT_FP_EQUAL( 0.0 , libmesh_real(((*basem_1_1_1)+(*basem_n1_1_n1))(0)) , TOLERANCE*TOLERANCE );
364  if (LIBMESH_DIM > 1)
365  LIBMESH_ASSERT_FP_EQUAL( 2.0 , libmesh_real(((*basem_1_1_1)+(*basem_n1_1_n1))(1)) , TOLERANCE*TOLERANCE );
366  if (LIBMESH_DIM > 2)
367  LIBMESH_ASSERT_FP_EQUAL( 0.0 , libmesh_real(((*basem_1_1_1)+(*basem_n1_1_n1))(2)) , TOLERANCE*TOLERANCE );
368  }

◆ testVectorAddScaled()

void TypeVectorTestBase< Node >::testVectorAddScaled ( )
inlineinherited

Definition at line 209 of file type_vector_test.h.

210  {
211  DerivedClass avector = (*m_1_1_1);
212  avector.add_scaled((*m_1_1_1),0.5);
213 
214  for (int i = 0; i != LIBMESH_DIM; ++i)
215  LIBMESH_ASSERT_FP_EQUAL( 1.5 , libmesh_real(avector(i)) , TOLERANCE*TOLERANCE );
216  }

◆ testVectorAddScaledBase()

void TypeVectorTestBase< Node >::testVectorAddScaledBase ( )
inlineinherited

Definition at line 370 of file type_vector_test.h.

371  {
372  TypeVector<T> avector(*m_1_1_1);
373  avector.add_scaled((*basem_1_1_1),0.5);
374 
375  for (int i = 0; i != LIBMESH_DIM; ++i)
376  LIBMESH_ASSERT_FP_EQUAL( 1.5 , libmesh_real(avector(i)) , TOLERANCE*TOLERANCE );
377  }

◆ testVectorMult()

void TypeVectorTestBase< Node >::testVectorMult ( )
inlineinherited

Definition at line 227 of file type_vector_test.h.

228  {
229  if (LIBMESH_DIM == 2)
230  LIBMESH_ASSERT_FP_EQUAL( 0.0 , libmesh_real((*m_1_1_1)*(*m_n1_1_n1)) , TOLERANCE*TOLERANCE );
231  else
232  LIBMESH_ASSERT_FP_EQUAL( -1.0 , libmesh_real((*m_1_1_1)*(*m_n1_1_n1)) , TOLERANCE*TOLERANCE );
233  }

◆ testVectorMultBase()

void TypeVectorTestBase< Node >::testVectorMultBase ( )
inlineinherited

Definition at line 388 of file type_vector_test.h.

389  {
390  if (LIBMESH_DIM == 2)
391  LIBMESH_ASSERT_FP_EQUAL( 0.0 , libmesh_real((*basem_1_1_1)*(*basem_n1_1_n1)) , TOLERANCE*TOLERANCE );
392  else
393  LIBMESH_ASSERT_FP_EQUAL( -1.0 , libmesh_real((*basem_1_1_1)*(*basem_n1_1_n1)) , TOLERANCE*TOLERANCE );
394  }

◆ testVectorSub()

void TypeVectorTestBase< Node >::testVectorSub ( )
inlineinherited

Definition at line 218 of file type_vector_test.h.

219  {
220  LIBMESH_ASSERT_FP_EQUAL( 2.0 , libmesh_real(((*m_1_1_1)-(*m_n1_1_n1))(0)) , TOLERANCE*TOLERANCE );
221  if (LIBMESH_DIM > 1)
222  LIBMESH_ASSERT_FP_EQUAL( 0.0 , libmesh_real(((*m_1_1_1)-(*m_n1_1_n1))(1)) , TOLERANCE*TOLERANCE );
223  if (LIBMESH_DIM > 2)
224  LIBMESH_ASSERT_FP_EQUAL( 2.0 , libmesh_real(((*m_1_1_1)-(*m_n1_1_n1))(2)) , TOLERANCE*TOLERANCE );
225  }

◆ testVectorSubAssign()

void TypeVectorTestBase< Node >::testVectorSubAssign ( )
inlineinherited

Definition at line 244 of file type_vector_test.h.

245  {
246  DerivedClass avector = (*m_1_1_1);
247  avector-=(*m_n1_1_n1);
248 
249  LIBMESH_ASSERT_FP_EQUAL( 2.0 , libmesh_real(avector(0)) , TOLERANCE*TOLERANCE );
250  if (LIBMESH_DIM > 1)
251  LIBMESH_ASSERT_FP_EQUAL( 0.0 , libmesh_real(avector(1)) , TOLERANCE*TOLERANCE );
252  if (LIBMESH_DIM > 2)
253  LIBMESH_ASSERT_FP_EQUAL( 2.0 , libmesh_real(avector(2)) , TOLERANCE*TOLERANCE );
254  }

◆ testVectorSubAssignBase()

void TypeVectorTestBase< Node >::testVectorSubAssignBase ( )
inlineinherited

Definition at line 405 of file type_vector_test.h.

406  {
407  TypeVector<T> avector(*m_1_1_1);
408  avector-=(*basem_n1_1_n1);
409 
410  LIBMESH_ASSERT_FP_EQUAL( 2.0 , libmesh_real(avector(0)) , TOLERANCE*TOLERANCE );
411  if (LIBMESH_DIM > 1)
412  LIBMESH_ASSERT_FP_EQUAL( 0.0 , libmesh_real(avector(1)) , TOLERANCE*TOLERANCE );
413  if (LIBMESH_DIM > 2)
414  LIBMESH_ASSERT_FP_EQUAL( 2.0 , libmesh_real(avector(2)) , TOLERANCE*TOLERANCE );
415  }

◆ testVectorSubBase()

void TypeVectorTestBase< Node >::testVectorSubBase ( )
inlineinherited

Definition at line 379 of file type_vector_test.h.

380  {
381  LIBMESH_ASSERT_FP_EQUAL( 2.0 , libmesh_real(((*basem_1_1_1)-(*basem_n1_1_n1))(0)) , TOLERANCE*TOLERANCE );
382  if (LIBMESH_DIM > 1)
383  LIBMESH_ASSERT_FP_EQUAL( 0.0 , libmesh_real(((*basem_1_1_1)-(*basem_n1_1_n1))(1)) , TOLERANCE*TOLERANCE );
384  if (LIBMESH_DIM > 2)
385  LIBMESH_ASSERT_FP_EQUAL( 2.0 , libmesh_real(((*basem_1_1_1)-(*basem_n1_1_n1))(2)) , TOLERANCE*TOLERANCE );
386  }

◆ testZero()

void TypeVectorTestBase< Node >::testZero ( )
inlineinherited

Definition at line 109 of file type_vector_test.h.

110  {
111 #if LIBMESH_DIM > 2
112  DerivedClass avector(1,1,1);
113 #elif LIBMESH_DIM > 1
114  DerivedClass avector(1,1);
115 #else
116  DerivedClass avector(1);
117 #endif
118  avector.zero();
119 
120  for (int i = 0; i != LIBMESH_DIM; ++i)
121  CPPUNIT_ASSERT_EQUAL( T(0), avector(i));
122  }

◆ testZeroBase()

void TypeVectorTestBase< Node >::testZeroBase ( )
inlineinherited

Definition at line 268 of file type_vector_test.h.

269  {
270  TypeVector<T> avector((*basem_1_1_1));
271  avector.zero();
272 
273  for (int i = 0; i != LIBMESH_DIM; ++i)
274  CPPUNIT_ASSERT_EQUAL( T(0), avector(i));
275  }

Member Data Documentation

◆ basem_1_1_1

TypeVector<T>* TypeVectorTestBase< Node >::basem_1_1_1
privateinherited

Definition at line 65 of file type_vector_test.h.

◆ basem_n1_1_n1

TypeVector<T> * TypeVectorTestBase< Node >::basem_n1_1_n1
privateinherited

Definition at line 65 of file type_vector_test.h.

◆ dof_object_instance

Node* NodeTest::dof_object_instance
private

Definition at line 25 of file node_test.C.

◆ instance

Node * DofObjectTest< Node >::instance
privateinherited

Definition at line 28 of file dof_object_test.h.

◆ m_1_1_1

Node * TypeVectorTestBase< Node >::m_1_1_1
privateinherited

Definition at line 64 of file type_vector_test.h.

◆ m_n1_1_n1

Node * TypeVectorTestBase< Node >::m_n1_1_n1
privateinherited

Definition at line 64 of file type_vector_test.h.


The documentation for this class was generated from the following file:
TypeVectorTestBase< Node >::basem_1_1_1
TypeVector< T > * basem_1_1_1
Definition: type_vector_test.h:65
libMesh::dof_id_type
uint8_t dof_id_type
Definition: id_types.h:67
libMesh::pi
const Real pi
.
Definition: libmesh.h:237
PointTestBase::setUp
virtual void setUp()
Definition: point_test.h:13
libMesh::libmesh_real
T libmesh_real(T a)
Definition: libmesh_common.h:166
TypeVectorTestBase< Node >::m_n1_1_n1
Node * m_n1_1_n1
Definition: type_vector_test.h:64
std::sqrt
MetaPhysicL::DualNumber< T, D > sqrt(const MetaPhysicL::DualNumber< T, D > &in)
libMesh::TOLERANCE
static const Real TOLERANCE
Definition: libmesh_common.h:128
libMesh::DofObject
The DofObject defines an abstract base class for objects that have degrees of freedom associated with...
Definition: dof_object.h:53
TypeVectorTestBase< Node >::basem_n1_1_n1
TypeVector< T > * basem_n1_1_n1
Definition: type_vector_test.h:65
libMesh::TypeVector::norm_sq
auto norm_sq() const -> decltype(std::norm(T()))
Definition: type_vector.h:986
DofObjectTest::setUp
void setUp(DerivedClass *derived_instance)
Definition: dof_object_test.h:31
libMesh::processor_id_type
uint8_t processor_id_type
Definition: id_types.h:104
TypeVectorTestBase< Node >::m_1_1_1
Node * m_1_1_1
Definition: type_vector_test.h:64
libMesh::Node
A Node is like a Point, but with more information.
Definition: node.h:52
TypeVectorTestBase< Node >::T
Node ::value_type T
Definition: type_vector_test.h:61
DofObjectTest< Node >::instance
Node * instance
Definition: dof_object_test.h:28
PointTestBase::tearDown
virtual void tearDown()
Definition: point_test.h:18
NodeTest::dof_object_instance
Node * dof_object_instance
Definition: node_test.C:25
libMesh::TypeVector
This class defines a vector in LIBMESH_DIM dimensional space of type T.
Definition: tensor_tools.h:45
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::TypeVector::norm
auto norm() const -> decltype(std::norm(T()))
Definition: type_vector.h:955
libMesh::global_processor_id
processor_id_type global_processor_id()
Definition: libmesh_base.h:85