const double v2 = m2[j - 1][i + 1];
if(!epsilonEqual(v1, v2))
{
- std::cout << "V1( " << i << ", " << j << ") = " << v1 << " which is different from V2( " << j - 1 << ", " << i + 1 << ") = " << v2 << std::endl;
+ std::cout << "V1( " << i << ", " << j << ") = " << v1 << " which is different from V2( " << j - 1 << ", " << i + 1 << ") = " << v2 << " | diff = " << v1 - v2 << std::endl;
isReflexive = false;
}
}
delete interpolator;
}
-void Interpolation3DTest::reflexiveTetra()
-{
- std::cout << std::endl << std::endl << "=============================" << std::endl;
- std::cout << " Reflexive tetra " << endl;
- MESH unitMesh(MED_DRIVER, "meshes/UnitTetra.med", "UnitTetra");
-
- std::cout << std::endl << "*** unit tetra" << std::endl;
- IntersectionMatrix matrix1 = interpolator->interpol_maillages(unitMesh, unitMesh);
-
-#if 0
- std::cout << std::endl << "*** non-unit large tetra" << std::endl;
- MESH largeMesh(MED_DRIVER, "meshes/tetra2.med", "Mesh_1");
- IntersectionMatrix matrix2 = interpolator->interpol_maillages(largeMesh, largeMesh);
-
- std::cout << std::endl << "*** non-unit small tetra" << std::endl;
- MESH smallMesh(MED_DRIVER, "meshes/tetra2_scaled.med", "Mesh_2");
- IntersectionMatrix matrix3 = interpolator->interpol_maillages(smallMesh, smallMesh);
-#endif
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0 / 6.0, sumVolume(matrix1), ERR_TOL);
-#if 0
- CPPUNIT_ASSERT_DOUBLES_EQUAL(48.0, sumVolume(matrix2), ERR_TOL);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.75, sumVolume(matrix3), ERR_TOL);
-#endif
-}
-
void Interpolation3DTest::calcIntersectionMatrix(const char* mesh1path, const char* mesh1, const char* mesh2path, const char* mesh2, IntersectionMatrix& m)
{
+ const string dataDir = getenv("DATA_DIR");
+
std::cout << std::endl << "=== -> intersecting src = " << mesh1 << ", target = " << mesh2 << std::endl;
std::cout << "Loading " << mesh1 << " from " << mesh1path << endl;
- MESH sMesh(MED_DRIVER, mesh1path, mesh1);
+ MESH sMesh(MED_DRIVER, dataDir+mesh1path, mesh1);
std::cout << "Loading " << mesh2 << " from " << mesh2path << endl;
- MESH tMesh(MED_DRIVER, mesh2path, mesh2);
+ MESH tMesh(MED_DRIVER, dataDir+mesh2path, mesh2);
m = interpolator->interpol_maillages(sMesh, tMesh);
-void Interpolation3DTest::tetraTetraScale()
-{
- std::cout << std::endl << std::endl << "=============================" << std::endl;
- std::cout << " Scaled included tetra " << endl;
-
- MESH srcMesh(MED_DRIVER, "meshes/tetra2.med", "Mesh_1");
- MESH targetMesh(MED_DRIVER, "meshes/tetra2_scaled.med", "Mesh_2");
-
- std::cout << "*** src - target" << std::endl;
- IntersectionMatrix matrix1 = interpolator->interpol_maillages(srcMesh, targetMesh);
- std::cout << std::endl << "*** target - src" << std::endl;
- IntersectionMatrix matrix2 = interpolator->interpol_maillages(targetMesh, srcMesh);
-
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.75, sumVolume(matrix1), 1.0e-6 );
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.75, sumVolume(matrix2), 1.0e-6 );
-}
-
-
-void Interpolation3DTest::cyl1()
-{
- std::cout << std::endl << std::endl << "=============================" << std::endl;
- std::cout << " Cylinders " << endl;
-
-
- MESH srcMesh(MED_DRIVER, "meshes/cyl1_fine.med", "Mesh_1");
- MESH targetMesh(MED_DRIVER, "meshes/cyl1_rot_moderate.med", "Mesh_2");
-
- IntersectionMatrix matrix1 = interpolator->interpol_maillages(srcMesh, targetMesh);
- IntersectionMatrix matrix2 = interpolator->interpol_maillages(targetMesh, srcMesh);
-
- CPPUNIT_ASSERT_EQUAL(true, isIntersectionConsistent(matrix1));
- CPPUNIT_ASSERT_EQUAL(true, isIntersectionConsistent(matrix2));
-
- const double vol1 = sumVolume(matrix1);
- const double vol2 = sumVolume(matrix2);
-
- CPPUNIT_ASSERT_DOUBLES_EQUAL(vol1, vol2, 0.1);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(3.09079e6, vol1, 1.0e2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(3.09079e6, vol2, 1.0e2);
-}
-
-
-void Interpolation3DTest::box1()
-{
- std::cout << std::endl << std::endl << "=============================" << std::endl;
- std::cout << " Boxes " << endl;
-
-
- MESH srcMesh(MED_DRIVER, "meshes/box1_moderate.med", "Mesh_1");
- MESH targetMesh(MED_DRIVER, "meshes/box1_rot_moderate.med", "Mesh_2");
-
- IntersectionMatrix matrix1 = interpolator->interpol_maillages(srcMesh, targetMesh);
- IntersectionMatrix matrix2 = interpolator->interpol_maillages(targetMesh, srcMesh);
-
- // CPPUNIT_ASSERT_EQUAL(true, isIntersectionConsistent(matrix1));
- // CPPUNIT_ASSERT_EQUAL(true, isIntersectionConsistent(matrix2));
-
- const double vol1 = sumVolume(matrix1);
- const double vol2 = sumVolume(matrix2);
-
- // CPPUNIT_ASSERT_DOUBLES_EQUAL(vol1, vol2, 1.0);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(750684, vol1, 1.0);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(750684, vol2, 1.0);
-
-}
-
-void Interpolation3DTest::tetra1()
-{
- std::cout << std::endl << std::endl << "=============================" << std::endl;
- std::cout << " General tetrahedra - 1-element meshes " << endl;
-
- MESH srcMesh(MED_DRIVER, "meshes/tetra1_gen.med", "Mesh_4");
- MESH targetMesh(MED_DRIVER, "meshes/tetra1_gen_rot.med", "Mesh_5");
-std::cout << "*** src - target" << std::endl;
- IntersectionMatrix matrix1 = interpolator->interpol_maillages(srcMesh, targetMesh);
- std::cout << "*** target - src" << std::endl;
- IntersectionMatrix matrix2 = interpolator->interpol_maillages(targetMesh, srcMesh);
-
- std::cout << std::endl << std::endl << "--------------------" << std::endl;
- std::cout << "src - target" << std::endl;
- dumpIntersectionMatrix(matrix1);
- std::cout << std::endl << std::endl << "--------------------" << std::endl;
- std::cout << "target - src" << std::endl;
- dumpIntersectionMatrix(matrix2);
-
- // CPPUNIT_ASSERT_EQUAL(true, isIntersectionConsistent(matrix1));
- // CPPUNIT_ASSERT_EQUAL(true, isIntersectionConsistent(matrix2));
-
- const double vol1 = sumVolume(matrix1);
- const double vol2 = sumVolume(matrix2);
-
- CPPUNIT_ASSERT_DOUBLES_EQUAL(vol1, vol2, 1.0);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0494584, vol1, 1.0e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0494584, vol2, 1.0e-7);
-}
-
-void Interpolation3DTest::tetra3()
-{
- std::cout << std::endl << std::endl << "=============================" << std::endl;
- std::cout << " General tetrahedra 10-element meshes " << endl;
-
- MESH srcMesh(MED_DRIVER, "meshes/tetra3_moderate.med", "Mesh_1");
- MESH targetMesh(MED_DRIVER, "meshes/tetra3_rot_moderate.med", "Mesh_3");
-
- IntersectionMatrix matrix1 = interpolator->interpol_maillages(srcMesh, targetMesh);
-
- IntersectionMatrix matrix2 = interpolator->interpol_maillages(targetMesh, srcMesh);
-
- std::cout << std::endl << std::endl << "--------------------" << std::endl;
- std::cout << "src - target" << std::endl;
- dumpIntersectionMatrix(matrix1);
- std::cout << std::endl << std::endl << "--------------------" << std::endl;
- std::cout << "target - src" << std::endl;
- dumpIntersectionMatrix(matrix2);
-
- // CPPUNIT_ASSERT_EQUAL(true, isIntersectionConsistent(matrix1));
- // CPPUNIT_ASSERT_EQUAL(true, isIntersectionConsistent(matrix2));
-
- const double vol1 = sumVolume(matrix1);
- const double vol2 = sumVolume(matrix2);
-
- CPPUNIT_ASSERT_DOUBLES_EQUAL(vol1, vol2, 1.0);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(538.76, vol1, 1.0);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(538.76, vol2, 1.0);
-}
{
CPPUNIT_TEST_SUITE( Interpolation3DTest );
-#if 0
+
+ // single - element
CPPUNIT_TEST( tetraReflexiveUnit );
CPPUNIT_TEST( tetraReflexiveGeneral );
CPPUNIT_TEST( tetraNudgedSimpler );
CPPUNIT_TEST( tetraNudged );
CPPUNIT_TEST( tetraCorner );
-#endif
CPPUNIT_TEST( tetraSimpleIncluded );
- CPPUNIT_TEST( tetraComplexIncluded );
-#if 0
+ CPPUNIT_TEST( tetraDegenEdge );
+ CPPUNIT_TEST( tetraDegenFace );
CPPUNIT_TEST( tetraHalfstripOnly );
CPPUNIT_TEST( tetraHalfstripOnly2 );
CPPUNIT_TEST( tetraSimpleHalfstripOnly );
CPPUNIT_TEST( generalTetra );
+
+ // multi - element
+ CPPUNIT_TEST( tetraComplexIncluded );
CPPUNIT_TEST( dividedUnitTetraSimplerReflexive );
CPPUNIT_TEST( dividedUnitTetraReflexive );
CPPUNIT_TEST( nudgedDividedUnitTetra );
CPPUNIT_TEST( nudgedDividedUnitTetraSimpler );
CPPUNIT_TEST( dividedGenTetra );
-#endif
-#if 0
- CPPUNIT_TEST( boxReflexive );
-
+ //CPPUNIT_TEST( boxReflexive );
CPPUNIT_TEST( tetraBoxes );
-#endif
CPPUNIT_TEST_SUITE_END();
intersectMeshes("meshes/GenTetra1.med", "GenTetra1", "meshes/GenTetra2.med", "GenTetra2", 4.91393, 1.0e-5);
}
+ void tetraDegenEdge()
+ {
+ intersectMeshes("meshes/UnitTetraDegenT.med", "UnitTetraDegenT", "meshes/DegenEdgeXY.med", "DegenEdgeXY", 0.0);
+ }
+
+ void tetraDegenFace()
+ {
+ intersectMeshes("meshes/UnitTetraDegenT.med", "UnitTetraDegenT", "meshes/DegenFaceXYZ.med", "DegenFaceXYZ", 0.0);
+ }
+
void dividedUnitTetraReflexive()
{
intersectMeshes("meshes/DividedUnitTetra.med", "DividedUnitTetra", "meshes/DividedUnitTetra.med", "DividedUnitTetra", 0.1666667);
void dividedGenTetra()
{
- intersectMeshes("meshes/DividedGenTetra1.med", "DividedGenTetra1", "meshes/DividedGenTetra2.med", "DividedGenTetra2", 4.91393, 1.0e-5);
+ intersectMeshes("meshes/DividedGenTetra1.med", "DividedGenTetra1", "meshes/DividedGenTetra2.med", "DividedGenTetra2", 0.546329);
}
void boxReflexive()