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

Public Member Functions

void setUp ()
 
void tearDown ()
 
 CPPUNIT_TEST_SUITE (TypeTensorTest)
 
 CPPUNIT_TEST (testInverse)
 
 CPPUNIT_TEST_SUITE_END ()
 

Private Member Functions

void testInverse ()
 

Detailed Description

Definition at line 22 of file type_tensor_test.C.

Member Function Documentation

TypeTensorTest::CPPUNIT_TEST ( testInverse  )
TypeTensorTest::CPPUNIT_TEST_SUITE ( TypeTensorTest  )
TypeTensorTest::CPPUNIT_TEST_SUITE_END ( )
void TypeTensorTest::setUp ( )

Definition at line 25 of file type_tensor_test.C.

25 {}
void TypeTensorTest::tearDown ( )

Definition at line 27 of file type_tensor_test.C.

27 {}
void TypeTensorTest::testInverse ( )
private

Definition at line 37 of file type_tensor_test.C.

References CPPUNIT_TEST_SUITE_REGISTRATION(), and libMesh::TypeTensor< T >::inverse().

38  {
39  // This random input tensor and its inverse came from Octave/Matlab:
40  // > format long e
41  // > A = rand(3)
42  // > inv(A)
43 
44  // The base class, TypeTensor, has a protected constructor. We
45  // are using the derived class, TensorValue, for our tests...
46  TensorValue<double> tensor(9.08973348886179e-01, 3.36455579239923e-01, 5.16389236893863e-01,
47  9.44156071777472e-01, 1.35610910092516e-01, 1.49881119060538e-02,
48  1.15988384086146e-01, 6.79845197685518e-03, 3.77028969454745e-01);
49 
50  TensorValue<double> inverse = tensor.inverse();
51 
52  TensorValue<double> true_inverse(-6.57484735104482e-01, 1.58926633961497e+00, 8.37330721137561e-01,
53  4.56430940967411e+00, -3.64404559823061e+00, -6.10654107858520e+00,
54  1.19965194510943e-01, -4.23210359257434e-01, 2.50483242797707e+00);
55 
56  for (unsigned i=0; i<3; ++i)
57  for (unsigned j=0; j<3; ++j)
58  CPPUNIT_ASSERT_DOUBLES_EQUAL(inverse(i,j), true_inverse(i,j), 1.e-12);
59  }
TypeTensor< T > inverse() const
Definition: type_tensor.h:1022
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.

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