Skip to content
Snippets Groups Projects
Commit 53308fbd authored by wenqing's avatar wenqing
Browse files

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

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