Exemple #1
0
void
SymmElasticityTensor::convertFrom6x6(const ColumnMajorMatrix & input)
{
  if (input.numEntries() != 36)
  {
    mooseError("Cannot convert from ColumnMajorMatrix (wrong size)");
  }

  _val[0] = input(0, 0);
  _val[1] = input(0, 1);
  _val[2] = input(0, 2);
  _val[3] = input(0, 3);
  _val[4] = input(0, 4);
  _val[5] = input(0, 5);

  _val[6] = input(1, 1);
  _val[7] = input(1, 2);
  _val[8] = input(1, 3);
  _val[9] = input(1, 4);
  _val[10] = input(1, 5);

  _val[11] = input(2, 2);
  _val[12] = input(2, 3);
  _val[13] = input(2, 4);
  _val[14] = input(2, 5);

  _val[15] = input(3, 3);
  _val[16] = input(3, 4);
  _val[17] = input(3, 5);

  _val[18] = input(4, 4);
  _val[19] = input(4, 5);

  _val[20] = input(5, 5);
}
void
ColumnMajorMatrixTest::numEntries()
{
  //numEntries is tested in other functions, like after different
  //constructors to make sure the number of entries copied over correctly
  ColumnMajorMatrix mat = *two_mat;
  ColumnMajorMatrix mat2(3, 4);

  CPPUNIT_ASSERT( mat.numEntries() == 4 );
  CPPUNIT_ASSERT( mat2.numEntries() == 12 );
}
void
ColumnMajorMatrixTest::copyConstructor()
{
  ColumnMajorMatrix mat = *two_mat;
  ColumnMajorMatrix test = mat;
  test(1, 1) = 9;

  CPPUNIT_ASSERT( test(0,0) == 1 );
  CPPUNIT_ASSERT( test(1,0) == 2 );
  CPPUNIT_ASSERT( test(0,1) == 3 );
  CPPUNIT_ASSERT( test(1,1) == 9 );
  CPPUNIT_ASSERT( mat(1,1) == 4 );

  CPPUNIT_ASSERT( test.numEntries() == 4 );
}