Skip to content
Snippets Groups Projects
Commit 605e4d95 authored by wenqing's avatar wenqing Committed by Dmitri Naumov
Browse files

Revert "[NumLib] Modified NumLibFemIsoTest according to the change in computeMappingMatrices"

This reverts commit d0a28ac5.
parent 42c270b5
No related branches found
No related tags found
No related merge requests found
......@@ -330,12 +330,7 @@ TEST(NumLib, FemNaturalCoordinatesMappingLineY)
ASSERT_ARRAY_NEAR(exp_J, shape.J.data(), shape.J.size(), eps);
ASSERT_ARRAY_NEAR(exp_J, shape.invJ.data(), shape.invJ.size(), eps);
ASSERT_NEAR(1.0, shape.detJ, eps);
double exp_dNdx[2 * e_nnodes] = {
-0.5,
0.5,
0,
0,
};
double exp_dNdx[2 * e_nnodes] = {0, 0, -0.5, 0.5};
ASSERT_ARRAY_NEAR(exp_dNdx, shape.dNdx.data(), shape.dNdx.size(), eps);
for (auto n = 0u; n < line->getNumberOfNodes(); ++n)
......
......@@ -41,12 +41,11 @@ template <class TestFeType_, template <typename, int> class ShapeMatrixPolicy_>
struct TestCase
{
using TestFeType = TestFeType_;
static const int GlobalDim = TestFeType::global_dim;
using ShapeMatrixTypes =
ShapeMatrixPolicy_<typename TestFeType::ShapeFunction,
TestFeType::ShapeFunction::DIM>;
ShapeMatrixPolicy_<typename TestFeType::ShapeFunction, GlobalDim>;
template <typename X>
using ShapeMatrixPolicy =
ShapeMatrixPolicy_<X, TestFeType::ShapeFunction::DIM>;
using ShapeMatrixPolicy = ShapeMatrixPolicy_<X, GlobalDim>;
using ShapeFunction = typename TestFeType::ShapeFunction;
};
......@@ -106,7 +105,8 @@ public:
public:
NumLibFemIsoTest()
: expectedM(e_nnodes, e_nnodes),
: D(dim, dim),
expectedM(e_nnodes, e_nnodes),
expectedK(e_nnodes, e_nnodes),
integration_method(2)
{
......@@ -114,20 +114,14 @@ public:
mesh_element = this->createMeshElement();
// set a conductivity tensor
globalD.resize(TestFeType::global_dim, TestFeType::global_dim);
setIdentityMatrix(TestFeType::global_dim, globalD);
globalD *= conductivity;
setIdentityMatrix(dim, D);
D *= conductivity;
MeshLib::ElementCoordinatesMappingLocal ele_local_coord(
*mesh_element,
MeshLib::CoordinateSystem(*mesh_element).getDimension());
Eigen::Matrix<double, ShapeFunction::DIM, TestFeType::global_dim> const
R = ele_local_coord.getRotationMatrixToGlobal()
.transpose()
.topLeftCorner(mesh_element->getDimension(),
TestFeType::global_dim);
localD = R * globalD * R.transpose();
auto R = ele_local_coord.getRotationMatrixToGlobal().topLeftCorner(
TestFeType::dim, TestFeType::global_dim);
globalD.noalias() = R.transpose() * (D * R);
// set expected matrices
this->setExpectedMassMatrix(expectedM);
......@@ -158,12 +152,11 @@ public:
static const double conductivity;
static const double eps;
Eigen::Matrix<double, TestFeType::global_dim, TestFeType::global_dim>
globalD;
DimMatrix D;
NodalMatrix expectedM;
NodalMatrix expectedK;
IntegrationMethod integration_method;
Eigen::Matrix<double, ShapeFunction::DIM, ShapeFunction::DIM> localD;
GlobalDimMatrixType globalD;
std::vector<const MeshLib::Node*> vec_nodes;
std::vector<const MeshElementType*> vec_eles;
......@@ -241,7 +234,7 @@ TYPED_TEST(NumLibFemIsoTest, CheckLaplaceMatrix)
{
auto const& shape = shape_matrices[i];
auto wp = this->integration_method.getWeightedPoint(i);
K.noalias() += shape.dNdx.transpose() * this->localD * shape.dNdx *
K.noalias() += shape.dNdx.transpose() * this->globalD * shape.dNdx *
shape.detJ * wp.getWeight();
}
// std::cout << "K=\n" << K << std::endl;
......@@ -270,7 +263,7 @@ TYPED_TEST(NumLibFemIsoTest, CheckMassLaplaceMatrices)
auto wp = this->integration_method.getWeightedPoint(i);
M.noalias() +=
shape.N.transpose() * shape.N * shape.detJ * wp.getWeight();
K.noalias() += shape.dNdx.transpose() * (this->localD * shape.dNdx) *
K.noalias() += shape.dNdx.transpose() * (this->globalD * shape.dNdx) *
shape.detJ * wp.getWeight();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment