From 8d3b19d8b912251d658274ae1ba0e1d16593e5e2 Mon Sep 17 00:00:00 2001 From: ageay Date: Fri, 26 Aug 2011 16:36:30 +0000 Subject: [PATCH] Cross dimension intersectors. --- .../Test/MEDCouplingBasicsTest.hxx | 107 ++++ .../Test/MEDCouplingBasicsTest0.cxx | 444 +++++++++++++++ .../Test/MEDCouplingBasicsTestInterp.cxx | 516 ++++++++++++++++++ 3 files changed, 1067 insertions(+) diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx index 41054dcb0..11d3b7e85 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx @@ -286,6 +286,45 @@ namespace ParaMEDMEM CPPUNIT_TEST( test3DInterpP1P0Bary_1 ); CPPUNIT_TEST( test3DTo1DInterpP0P0PL_1 ); + CPPUNIT_TEST( test2D1DBasicInterpP0P0 ); + CPPUNIT_TEST( test2D1DSegQuadInterpP0P0_1 ); + CPPUNIT_TEST( test2D1DSegQuadInterpP0P0_2 ); + CPPUNIT_TEST( test2D1DSegQuadInterpP0P0_3 ); + CPPUNIT_TEST( test2D1DSegQuadInterpP0P0_4 ); + CPPUNIT_TEST( test2D1DSegQuadInterpP0P0_5 ); + CPPUNIT_TEST( test2D1DSegQuadInterpP0P0_6 ); + CPPUNIT_TEST( test2D1DSegTriInterpP0P0_1 ); + CPPUNIT_TEST( test2D1DSegTriInterpP0P0_2 ); + CPPUNIT_TEST( test2D1DSegTriInterpP0P0_3 ); + CPPUNIT_TEST( test2D1DSegTriInterpP0P0_4 ); + CPPUNIT_TEST( test2D1DSegTriInterpP0P0_5 ); + CPPUNIT_TEST( test2D1DSegTriInterpP0P0_6 ); + CPPUNIT_TEST( test3D2DBasicInterpP0P0 ); + CPPUNIT_TEST( test3D2DQuadHexaInterpP0P0_1 ); + CPPUNIT_TEST( test3D2DQuadHexaInterpP0P0_2 ); + CPPUNIT_TEST( test3D2DQuadHexaInterpP0P0_3 ); + CPPUNIT_TEST( test3D2DQuadHexaInterpP0P0_4 ); + CPPUNIT_TEST( test3D2DQuadHexaInterpP0P0_5 ); + CPPUNIT_TEST( test3D2DQuadHexaInterpP0P0_6 ); + CPPUNIT_TEST( test3D2DTriHexaInterpP0P0_1 ); + CPPUNIT_TEST( test3D2DTriHexaInterpP0P0_2 ); + CPPUNIT_TEST( test3D2DTriHexaInterpP0P0_3 ); + CPPUNIT_TEST( test3D2DTriHexaInterpP0P0_4 ); + CPPUNIT_TEST( test3D2DTriHexaInterpP0P0_5 ); + CPPUNIT_TEST( test3D2DTriHexaInterpP0P0_6 ); + CPPUNIT_TEST( test3D2DQuadTetraInterpP0P0_1 ); + CPPUNIT_TEST( test3D2DQuadTetraInterpP0P0_2 ); + CPPUNIT_TEST( test3D2DQuadTetraInterpP0P0_3 ); + CPPUNIT_TEST( test3D2DQuadTetraInterpP0P0_4 ); + CPPUNIT_TEST( test3D2DQuadTetraInterpP0P0_5 ); + CPPUNIT_TEST( test3D2DQuadTetraInterpP0P0_6 ); + CPPUNIT_TEST( test3D2DTriTetraInterpP0P0_1 ); + CPPUNIT_TEST( test3D2DTriTetraInterpP0P0_2 ); + CPPUNIT_TEST( test3D2DTriTetraInterpP0P0_3 ); + CPPUNIT_TEST( test3D2DTriTetraInterpP0P0_4 ); + CPPUNIT_TEST( test3D2DTriTetraInterpP0P0_5 ); + CPPUNIT_TEST( test3D2DTriTetraInterpP0P0_6 ); + CPPUNIT_TEST( test1DInterp_1 ); CPPUNIT_TEST( test2DCurveInterpP0P0_1 ); CPPUNIT_TEST( test2DCurveInterpP0P0_2 ); @@ -546,6 +585,45 @@ namespace ParaMEDMEM void test3DInterpP1P0Bary_1(); void test3DTo1DInterpP0P0PL_1(); + void test2D1DBasicInterpP0P0(); + void test2D1DSegQuadInterpP0P0_1(); + void test2D1DSegQuadInterpP0P0_2(); + void test2D1DSegQuadInterpP0P0_3(); + void test2D1DSegQuadInterpP0P0_4(); + void test2D1DSegQuadInterpP0P0_5(); + void test2D1DSegQuadInterpP0P0_6(); + void test2D1DSegTriInterpP0P0_1(); + void test2D1DSegTriInterpP0P0_2(); + void test2D1DSegTriInterpP0P0_3(); + void test2D1DSegTriInterpP0P0_4(); + void test2D1DSegTriInterpP0P0_5(); + void test2D1DSegTriInterpP0P0_6(); + void test3D2DBasicInterpP0P0(); + void test3D2DQuadHexaInterpP0P0_1(); + void test3D2DQuadHexaInterpP0P0_2(); + void test3D2DQuadHexaInterpP0P0_3(); + void test3D2DQuadHexaInterpP0P0_4(); + void test3D2DQuadHexaInterpP0P0_5(); + void test3D2DQuadHexaInterpP0P0_6(); + void test3D2DTriHexaInterpP0P0_1(); + void test3D2DTriHexaInterpP0P0_2(); + void test3D2DTriHexaInterpP0P0_3(); + void test3D2DTriHexaInterpP0P0_4(); + void test3D2DTriHexaInterpP0P0_5(); + void test3D2DTriHexaInterpP0P0_6(); + void test3D2DQuadTetraInterpP0P0_1(); + void test3D2DQuadTetraInterpP0P0_2(); + void test3D2DQuadTetraInterpP0P0_3(); + void test3D2DQuadTetraInterpP0P0_4(); + void test3D2DQuadTetraInterpP0P0_5(); + void test3D2DQuadTetraInterpP0P0_6(); + void test3D2DTriTetraInterpP0P0_1(); + void test3D2DTriTetraInterpP0P0_2(); + void test3D2DTriTetraInterpP0P0_3(); + void test3D2DTriTetraInterpP0P0_4(); + void test3D2DTriTetraInterpP0P0_5(); + void test3D2DTriTetraInterpP0P0_6(); + void test1DInterp_1(); void test2DCurveInterpP0P0_1(); void test2DCurveInterpP0P0_2(); @@ -592,10 +670,39 @@ namespace ParaMEDMEM static MEDCouplingUMesh *build3DMultiTypes_1(); static MEDCouplingUMesh *buildHexa8Mesh_1(); static MEDCouplingUMesh *buildPointe_1(MEDCouplingUMesh *&m1); + + static MEDCouplingUMesh *build2D1DSourceMesh(); + static MEDCouplingUMesh *build2D1DTargetMesh(); + static MEDCouplingUMesh *build2D1DSegSourceMesh(const double shiftX = 0., + const double inclinationX = 0.); + static MEDCouplingUMesh *build2D1DQuadTargetMesh(const double inclinaisonX = 0.); + static MEDCouplingUMesh *build2D1DTriTargetMesh(const double inclinaisonX = 0.); + static MEDCouplingUMesh *build3D2DSourceMesh(); + static MEDCouplingUMesh *build3D2DTargetMesh(); + static MEDCouplingUMesh* build3D2DQuadSourceMesh(const double shiftX = 0., + const double inclinationX = 0.); + static MEDCouplingUMesh* build3D2DTriSourceMesh(const double shiftX = 0., + const double inclinationX = 0.); + static MEDCouplingUMesh* build3D2DTetraTargetMesh(const double inclinaisonX = 0.); + static MEDCouplingUMesh* build3D2DHexaTargetMesh(const double inclinaisonX = 0.); + static DataArrayDouble *buildCoordsForMultiTypes_1(); static MEDCouplingMultiFields *buildMultiFields_1(); static std::vector buildMultiFields_2(); static double sumAll(const std::vector< std::map >& matrix); + private: + static int countNonZero(const std::vector< std::map >& matrix); + + static void test2D1DMeshesIntersection(MEDCouplingUMesh *sourceMesh, + MEDCouplingUMesh *targetMesh, + const double correctSurf, + const int correctDuplicateFacesNbr, + const int correctTotalIntersectFacesNbr = -1); + static void test3D2DMeshesIntersection(MEDCouplingUMesh *sourceMesh, + MEDCouplingUMesh *targetMesh, + const double correctSurf, + const int correctDuplicateFacesNbr, + const int correctTotalIntersectFacesNbr = -1); }; } diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx index 936adb68f..1810a94ae 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx @@ -1173,3 +1173,447 @@ double MEDCouplingBasicsTest::sumAll(const std::vector< std::map >& ret+=(*iter2).second; return ret; } + +MEDCouplingUMesh *MEDCouplingBasicsTest::build2D1DSourceMesh() +{ + double sourceCoords[18]={-17., 3., -17., 8., -5., 8., + -5., 3., -9., 0., -13., 3., + -9., 8., -7., 0., -7., 8. + }; + int sourceConn[16]={0,1, 1,2, 2,3, 3,0, 3,4, 4,5, 4,6, 7,8}; + MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New(); + sourceMesh->setMeshDimension(1); + sourceMesh->allocateCells(8); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn+2); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn+4); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn+6); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn+8); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn+10); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn+12); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn+14); + sourceMesh->finishInsertingCells(); + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(9,2); + std::copy(sourceCoords,sourceCoords+18,myCoords->getPointer()); + sourceMesh->setCoords(myCoords); + myCoords->decrRef(); + return sourceMesh; +} + +MEDCouplingUMesh *MEDCouplingBasicsTest::build2D1DTargetMesh() +{ + double targetCoords[10]={-17., 0., -17.,6., -9.,6., -9.,0., -5., 3.}; + int targetConn[7]={0,1,2,3, 2,3,4}; + MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); + targetMesh->setMeshDimension(2); + targetMesh->allocateCells(2); + targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn); + targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3 ,3,targetConn + 4); + targetMesh->finishInsertingCells(); + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(5,2); + std::copy(targetCoords,targetCoords+10,myCoords->getPointer()); + targetMesh->setCoords(myCoords); + myCoords->decrRef(); + return targetMesh; +} + +MEDCouplingUMesh* MEDCouplingBasicsTest::build2D1DSegSourceMesh(const double shiftX, + const double inclinationX) +{ + MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New(); + sourceMesh->setMeshDimension(1); + + const int nbY = 4; + const int nbYP1 = nbY + 1; + sourceMesh->allocateCells(nbY); + + int sourceConn[2]; + for (int iY = 0; iY < nbY; ++iY) + { + sourceConn[0] = iY ; + sourceConn[1] = iY + 1; + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn); + } + sourceMesh->finishInsertingCells(); + + std::vector sourceCoords; + for (int iY = 0; iY < nbYP1; ++iY) + { + sourceCoords.push_back(iY * inclinationX + shiftX); + sourceCoords.push_back(iY * 4.); + } + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(nbYP1,2); + std::copy(sourceCoords.begin(),sourceCoords.end(),myCoords->getPointer()); + sourceMesh->setCoords(myCoords); + myCoords->decrRef(); + + return sourceMesh; +} + +MEDCouplingUMesh* MEDCouplingBasicsTest::build2D1DQuadTargetMesh(const double inclinationX) +{ + MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); + targetMesh->setMeshDimension(2); + + const int nbX = 5; + const int nbY = 4; + const int nbXP1 = nbX + 1; + const int nbYP1 = nbY + 1; + targetMesh->allocateCells(nbX * nbY); + + int targetConn[4]; + for (int iX = 0; iX < nbX; ++iX) + { + for (int iY = 0; iY < nbY; ++iY) + { + targetConn[0] = iY + iX * nbYP1; + targetConn[1] = iY + 1 + iX * nbYP1; + targetConn[2] = iY + 1 + (iX + 1) * nbYP1; + targetConn[3] = iY + (iX + 1) * nbYP1; + targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn); + } + } + targetMesh->finishInsertingCells(); + + std::vector targetCoords; + for (int iX = 0; iX < nbXP1; ++iX) + { + for (int iY = 0; iY < nbYP1; ++iY) + { + targetCoords.push_back(iX * 3. + iY * inclinationX); + targetCoords.push_back(iY * 4.); + } + } + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(nbXP1 * nbYP1, 2); + std::copy(targetCoords.begin(),targetCoords.end(),myCoords->getPointer()); + targetMesh->setCoords(myCoords); + myCoords->decrRef(); + + return targetMesh; +} + +MEDCouplingUMesh* MEDCouplingBasicsTest::build2D1DTriTargetMesh(const double inclinationX) +{ + MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); + targetMesh->setMeshDimension(2); + + const int nbX = 5; + const int nbY = 4; + const int nbXP1 = nbX + 1; + const int nbYP1 = nbY + 1; + targetMesh->allocateCells(nbX * nbY * 2); + + int targetConn[3]; + for (int iX = 0; iX < nbX; ++iX) + { + for (int iY = 0; iY < nbY; ++iY) + { + targetConn[0] = iY + iX * nbYP1; + targetConn[1] = iY + 1 + iX * nbYP1; + targetConn[2] = iY + 1 + (iX + 1) * nbYP1; + targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn); + targetConn[0] = iY + iX * nbYP1; + targetConn[1] = iY + 1 + (iX + 1) * nbYP1; + targetConn[2] = iY + (iX + 1) * nbYP1; + targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn); + } + } + targetMesh->finishInsertingCells(); + + std::vector targetCoords; + for (int iX = 0; iX < nbXP1; ++iX) + { + for (int iY = 0; iY < nbYP1; ++iY) + { + targetCoords.push_back(iX * 3. + iY * inclinationX); + targetCoords.push_back(iY * 4.); + } + } + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(nbXP1 * nbYP1, 2); + std::copy(targetCoords.begin(),targetCoords.end(),myCoords->getPointer()); + targetMesh->setCoords(myCoords); + myCoords->decrRef(); + + return targetMesh; +} + +MEDCouplingUMesh *MEDCouplingBasicsTest::build3D2DSourceMesh() +{ + double sourceCoords[63]={-12., 6., 10., -12.,10., 6., -16.,10. , 10., + -20., 0., 0., -12., 0., 0., -12., 0. , -4., -20.,0.,-4., + -20., 0., 10., -12., 0., 10., -20.,10. , 10., + -25., 5., -5., 5., 5., -5., 5., 5. , 25., -25.,5.,25., + -20., 0., 16., -18., 0., 16., -20., 2.5, 16., + -25., 0., -5., 5., 0., -5., 5., 0. , 25., -25.,0.,25. + }; + int sourceConn[25]={0,1,2, 3,4,5,6, 7,8,9, 10,11,12,13, 14,15,16, 3,4,8,7, 17,18,19,20}; + MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New(); + sourceMesh->setMeshDimension(2); + sourceMesh->allocateCells(7); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3 ,3,sourceConn); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,sourceConn+3); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3 ,3,sourceConn+7); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,sourceConn+10); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3 ,3,sourceConn+14); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,sourceConn+17); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,sourceConn+21); + sourceMesh->finishInsertingCells(); + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(21,3); + std::copy(sourceCoords,sourceCoords+63,myCoords->getPointer()); + sourceMesh->setCoords(myCoords); + myCoords->decrRef(); + return sourceMesh; +} + +MEDCouplingUMesh *MEDCouplingBasicsTest::build3D2DTargetMesh() +{ + double targetCoords[45]={-20., 0., 0., -20.,10., 0., -12.,10., 0., + -12., 0., 0., -20., 0.,10., -20.,10.,10., + -12.,10.,10., -12., 0.,10., -20., 0.,18., + -20.,-5.,10., -20.,-5.,-4., -12.,-5.,-4., + -12.,-5.,10., -20., 0.,-4., -12., 0.,-4. + }; + int targetConn[20]={4,5,7,8, 0,3,2,1,4,7,6,5, 4,13,14,7,9,10,11,12}; + MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); + targetMesh->setMeshDimension(3); + targetMesh->allocateCells(3); + targetMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,targetConn); + targetMesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,targetConn + 4); + targetMesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,targetConn + 12); + targetMesh->finishInsertingCells(); + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(15,3); + std::copy(targetCoords,targetCoords+45,myCoords->getPointer()); + targetMesh->setCoords(myCoords); + myCoords->decrRef(); + return targetMesh; +} + +MEDCouplingUMesh* MEDCouplingBasicsTest::build3D2DQuadSourceMesh(const double shiftX, + const double inclinationX) +{ + MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New(); + sourceMesh->setMeshDimension(2); + + const int nbY = 4; + const int nbZ = 5; + const int nbYP1 = nbY + 1; + const int nbZP1 = nbZ + 1; + sourceMesh->allocateCells(nbY * nbZ); + + int sourceConn[4]; + for (int iY = 0; iY < nbY; ++iY) + { + for (int iZ = 0; iZ < nbZ; ++iZ) + { + sourceConn[0] = iZ + iY * nbZP1; + sourceConn[1] = iZ + 1 + iY * nbZP1; + sourceConn[2] = iZ + 1 + (iY + 1) * nbZP1; + sourceConn[3] = iZ + (iY + 1) * nbZP1; + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,sourceConn); + } + } + sourceMesh->finishInsertingCells(); + + std::vector sourceCoords; + for (int iY = 0; iY < nbYP1; ++iY) + { + for (int iZ = 0; iZ < nbZP1; ++iZ) + { + sourceCoords.push_back(iY * inclinationX + shiftX); + sourceCoords.push_back(iY * 4.); + sourceCoords.push_back(iZ * 3.); + } + + } + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(nbYP1 * nbZP1,3); + std::copy(sourceCoords.begin(),sourceCoords.end(),myCoords->getPointer()); + sourceMesh->setCoords(myCoords); + myCoords->decrRef(); + + return sourceMesh; +} + +MEDCouplingUMesh* MEDCouplingBasicsTest::build3D2DTriSourceMesh(const double shiftX, + const double inclinationX) +{ + MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New(); + sourceMesh->setMeshDimension(2); + + const int nbY = 4; + const int nbZ = 5; + const int nbYP1 = nbY + 1; + const int nbZP1 = nbZ + 1; + sourceMesh->allocateCells(nbY * nbZ * 2); + + int sourceConn[3]; + for (int iY = 0; iY < nbY; ++iY) + { + for (int iZ = 0; iZ < nbZ; ++iZ) + { + sourceConn[0] = iZ + iY * nbZP1; + sourceConn[1] = iZ + 1 + iY * nbZP1; + sourceConn[2] = iZ + 1 + (iY + 1) * nbZP1; + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,sourceConn); + sourceConn[0] = iZ + iY * nbZP1; + sourceConn[1] = iZ + (iY + 1) * nbZP1; + sourceConn[2] = iZ + 1 + (iY + 1) * nbZP1; + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,sourceConn); + } + } + sourceMesh->finishInsertingCells(); + + std::vector sourceCoords; + for (int iY = 0; iY < nbYP1; ++iY) + { + for (int iZ = 0; iZ < nbZP1; ++iZ) + { + sourceCoords.push_back(iY * inclinationX + shiftX); + sourceCoords.push_back(iY * 4.); + sourceCoords.push_back(iZ * 3.); + } + + } + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(nbYP1 * nbZP1,3); + std::copy(sourceCoords.begin(),sourceCoords.end(),myCoords->getPointer()); + sourceMesh->setCoords(myCoords); + myCoords->decrRef(); + + return sourceMesh; +} + +MEDCouplingUMesh* MEDCouplingBasicsTest::build3D2DHexaTargetMesh(const double inclinationX) +{ + MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); + targetMesh->setMeshDimension(3); + + const int nbX = 5; + const int nbY = 4; + const int nbZ = 5; + const int nbXP1 = nbX + 1; + const int nbYP1 = nbY + 1; + const int nbZP1 = nbZ + 1; + targetMesh->allocateCells(nbX * nbY * nbZ); + + int targetConn[8]; + for (int iX = 0; iX < nbX; ++iX) + { + for (int iY = 0; iY < nbY; ++iY) + { + for (int iZ = 0; iZ < nbZ; ++iZ) + { + targetConn[0] = iZ + ( iY + iX * nbYP1) * nbZP1; + targetConn[1] = iZ + 1 + ( iY + iX * nbYP1) * nbZP1; + targetConn[2] = iZ + 1 + ((iY + 1) + iX * nbYP1) * nbZP1; + targetConn[3] = iZ + ((iY + 1) + iX * nbYP1) * nbZP1; + targetConn[4] = iZ + ( iY + (iX + 1) * nbYP1) * nbZP1; + targetConn[5] = iZ + 1 + ( iY + (iX + 1) * nbYP1) * nbZP1; + targetConn[6] = iZ + 1 + ((iY + 1) + (iX + 1) * nbYP1) * nbZP1; + targetConn[7] = iZ + ((iY + 1) + (iX + 1) * nbYP1) * nbZP1; + targetMesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,targetConn); + } + } + } + targetMesh->finishInsertingCells(); + + std::vector targetCoords; + for (int iX = 0; iX < nbXP1; ++iX) + { + for (int iY = 0; iY < nbYP1; ++iY) + { + for (int iZ = 0; iZ < nbZP1; ++iZ) + { + targetCoords.push_back(iX * 3. + iY * inclinationX); + targetCoords.push_back(iY * 4.); + targetCoords.push_back(iZ * 3.); + } + } + } + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(nbXP1 * nbYP1 * nbZP1, 3); + std::copy(targetCoords.begin(),targetCoords.end(),myCoords->getPointer()); + targetMesh->setCoords(myCoords); + myCoords->decrRef(); + + return targetMesh; +} + +MEDCouplingUMesh* MEDCouplingBasicsTest::build3D2DTetraTargetMesh(const double inclinationX) +{ + MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); + targetMesh->setMeshDimension(3); + + const int nbX = 5; + const int nbY = 4; + const int nbZ = 5; + const int nbXP1 = nbX + 1; + const int nbYP1 = nbY + 1; + const int nbZP1 = nbZ + 1; + targetMesh->allocateCells(nbX * nbY * nbZ * 5); + + int targetConn[4]; + for (int iX = 0; iX < nbX; ++iX) + { + for (int iY = 0; iY < nbY; ++iY) + { + for (int iZ = 0; iZ < nbZ; ++iZ) + { + targetConn[0] = iZ + ( iY + iX * nbYP1) * nbZP1; + targetConn[1] = iZ + 1 + ( iY + iX * nbYP1) * nbZP1; + targetConn[2] = iZ + 1 + ( iY + (iX + 1) * nbYP1) * nbZP1; + targetConn[3] = iZ + 1 + ((iY + 1) + iX * nbYP1) * nbZP1; + targetMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,targetConn); + targetConn[0] = iZ + ( iY + iX * nbYP1) * nbZP1; + targetConn[1] = iZ + ( iY + (iX + 1) * nbYP1) * nbZP1; + targetConn[2] = iZ + 1 + ( iY + (iX + 1) * nbYP1) * nbZP1; + targetConn[3] = iZ + ((iY + 1) + (iX + 1) * nbYP1) * nbZP1; + targetMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,targetConn); + targetConn[0] = iZ + ( iY + iX * nbYP1) * nbZP1; + targetConn[1] = iZ + ((iY + 1) + iX * nbYP1) * nbZP1; + targetConn[2] = iZ + ((iY + 1) + (iX + 1) * nbYP1) * nbZP1; + targetConn[3] = iZ + 1 + ((iY + 1) + iX * nbYP1) * nbZP1; + targetMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,targetConn); + targetConn[0] = iZ + 1 + ( iY + (iX + 1) * nbYP1) * nbZP1; + targetConn[1] = iZ + 1 + ((iY + 1) + (iX + 1) * nbYP1) * nbZP1; + targetConn[2] = iZ + ((iY + 1) + (iX + 1) * nbYP1) * nbZP1; + targetConn[3] = iZ + 1 + ((iY + 1) + iX * nbYP1) * nbZP1; + targetMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,targetConn); + targetConn[0] = iZ + ( iY + iX * nbYP1) * nbZP1; + targetConn[1] = iZ + 1 + ((iY + 1) + iX * nbYP1) * nbZP1; + targetConn[2] = iZ + 1 + ( iY + (iX + 1) * nbYP1) * nbZP1; + targetConn[3] = iZ + ((iY + 1) + (iX + 1) * nbYP1) * nbZP1; + targetMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,targetConn); + } + } + } + targetMesh->finishInsertingCells(); + + std::vector targetCoords; + for (int iX = 0; iX < nbXP1; ++iX) + { + for (int iY = 0; iY < nbYP1; ++iY) + { + for (int iZ = 0; iZ < nbZP1; ++iZ) + { + targetCoords.push_back(iX * 3. + iY * inclinationX); + targetCoords.push_back(iY * 4.); + targetCoords.push_back(iZ * 3.); + } + } + } + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(nbXP1 * nbYP1 * nbZP1, 3); + std::copy(targetCoords.begin(),targetCoords.end(),myCoords->getPointer()); + targetMesh->setCoords(myCoords); + myCoords->decrRef(); + + return targetMesh; +} diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx index 03984bc64..d56c498a3 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx @@ -25,6 +25,8 @@ #include "Interpolation2D.txx" #include "Interpolation3DSurf.hxx" #include "Interpolation3D.txx" +#include "Interpolation2D1D.txx" +#include "Interpolation3D2D.txx" #include "InterpolationCC.txx" #include "InterpolationCU.txx" #include "Interpolation2DCurve.hxx" @@ -38,6 +40,8 @@ using namespace ParaMEDMEM; +typedef std::vector > IntersectionMatrix; + void MEDCouplingBasicsTest::test2DInterpP0P0_1() { MEDCouplingUMesh *sourceMesh=build2DSourceMesh_1(); @@ -2265,3 +2269,515 @@ void MEDCouplingBasicsTest::test2DCurveInterpP1P1_1() sourceMesh->decrRef(); targetMesh->decrRef(); } + +void MEDCouplingBasicsTest::test2D1DBasicInterpP0P0() +{ + MEDCouplingUMesh *sourceMesh=build2D1DSourceMesh(); + MEDCouplingUMesh *targetMesh=build2D1DTargetMesh(); + + MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); + MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); + INTERP_KERNEL::Interpolation2D1D myInterpolator; + myInterpolator.setPrecision(1e-12); + myInterpolator.setIntersectionType(INTERP_KERNEL::Geometric2D); + std::vector > matrix; + myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,matrix,"P0P0"); + + CPPUNIT_ASSERT_EQUAL(2,(int)matrix.size()); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(3., matrix[0][0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[0][1],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[0][2],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(8., matrix[0][3],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[0][4],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(5., matrix[0][5],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(6., matrix[0][6],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[0][7],1e-12); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[1][0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[1][1],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[1][2],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(4., matrix[1][3],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(5., matrix[1][4],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[1][5],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(6., matrix[1][6],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(3., matrix[1][7],1e-12); + + INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces(); + CPPUNIT_ASSERT_EQUAL(1,(int)duplicateFaces.size()); + + INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType correctDuplicateFaces; + std::set face6; + face6.insert(0); + face6.insert(1); + correctDuplicateFaces[6] = face6; + + CPPUNIT_ASSERT(correctDuplicateFaces == duplicateFaces); + + //clean up + sourceMesh->decrRef(); + targetMesh->decrRef(); +} + +int MEDCouplingBasicsTest::countNonZero(const std::vector< std::map >& matrix) +{ + int ret=0.; + for(std::vector< std::map >::const_iterator iter=matrix.begin();iter!=matrix.end();iter++) + for(std::map::const_iterator iter2=(*iter).begin();iter2!=(*iter).end();iter2++) + if (!INTERP_KERNEL::epsilonEqual((*iter2).second, 0.)) ret +=1; + return ret; +} + +void MEDCouplingBasicsTest::test2D1DMeshesIntersection(MEDCouplingUMesh *sourceMesh, + MEDCouplingUMesh *targetMesh, + const double correctLength, + const int correctDuplicateFacesNbr, + const int correctTotalIntersectFacesNbr) +{ + MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); + MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); + INTERP_KERNEL::Interpolation2D1D myInterpolator; + myInterpolator.setPrecision(1e-12); + const double prec = 1.0e-5; + IntersectionMatrix matrix; + myInterpolator.setIntersectionType(INTERP_KERNEL::Geometric2D); + myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,matrix,"P0P0"); + + std::cout.precision(16); + + const double length = sumAll(matrix); + LOG(1, "length = " << surf <<" correctLength = " << correctLength ); + CPPUNIT_ASSERT_DOUBLES_EQUAL(correctLength, length, prec * std::max(correctLength, length)); + + INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces(); + int duplicateFacesNbr = duplicateFaces.size(); + LOG(1, "duplicateFacesNbr = " << duplicateFacesNbr <<" correctDuplicateFacesNbr = " << correctDuplicateFacesNbr); + CPPUNIT_ASSERT_EQUAL(correctDuplicateFacesNbr, duplicateFacesNbr); + + if (correctTotalIntersectFacesNbr >= 0) + { + int totalIntersectFacesNbr = countNonZero(matrix); + LOG(1, "totalIntersectFacesNbr = " << totalIntersectFacesNbr <<" correctTotalIntersectFacesNbr = " << correctTotalIntersectFacesNbr ); + CPPUNIT_ASSERT_EQUAL(correctTotalIntersectFacesNbr, totalIntersectFacesNbr); + } + //clean up + sourceMesh->decrRef(); + targetMesh->decrRef(); +} + +void MEDCouplingBasicsTest::test2D1DSegQuadInterpP0P0_1() +{ + MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(); + MEDCouplingUMesh *targetMesh=build2D1DQuadTargetMesh(); + test2D1DMeshesIntersection(sourceMesh, targetMesh, 16., 0, 4); +} + +void MEDCouplingBasicsTest::test2D1DSegQuadInterpP0P0_2() +{ + const double shiftX = 3.; + MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX); + MEDCouplingUMesh *targetMesh=build2D1DQuadTargetMesh(); + test2D1DMeshesIntersection(sourceMesh, targetMesh, 2. * 16., 4, 2 * 4); +} + +void MEDCouplingBasicsTest::test2D1DSegQuadInterpP0P0_3() +{ + const double shiftX = 1.5; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build2D1DQuadTargetMesh(inclinationX); + test2D1DMeshesIntersection(sourceMesh, targetMesh, 20., 0, 4); +} + +void MEDCouplingBasicsTest::test2D1DSegQuadInterpP0P0_4() +{ + const double shiftX = 3.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build2D1DQuadTargetMesh(inclinationX); + test2D1DMeshesIntersection(sourceMesh, targetMesh, 2. * 20., 4, 2 * 4); +} + +void MEDCouplingBasicsTest::test2D1DSegQuadInterpP0P0_5() +{ + const double shiftX = 9.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX); + MEDCouplingUMesh *targetMesh=build2D1DQuadTargetMesh(inclinationX); + test2D1DMeshesIntersection(sourceMesh, targetMesh, 12., 0, 3); +} + +void MEDCouplingBasicsTest::test2D1DSegQuadInterpP0P0_6() +{ + const double shiftX = 9.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build2D1DQuadTargetMesh(); + test2D1DMeshesIntersection(sourceMesh, targetMesh, 10., 0, 2); +} + +void MEDCouplingBasicsTest::test2D1DSegTriInterpP0P0_1() +{ + MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(); + MEDCouplingUMesh *targetMesh=build2D1DTriTargetMesh(); + test2D1DMeshesIntersection(sourceMesh, targetMesh, 16., 0, 4); +} + +void MEDCouplingBasicsTest::test2D1DSegTriInterpP0P0_2() +{ + const double shiftX = 3.; + MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX); + MEDCouplingUMesh *targetMesh=build2D1DTriTargetMesh(); + test2D1DMeshesIntersection(sourceMesh, targetMesh, 2. * 16., 4, 2 * 4); +} + +void MEDCouplingBasicsTest::test2D1DSegTriInterpP0P0_3() +{ + const double shiftX = 1.5; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build2D1DTriTargetMesh(inclinationX); + test2D1DMeshesIntersection(sourceMesh, targetMesh, 20., 0, 8); +} + +void MEDCouplingBasicsTest::test2D1DSegTriInterpP0P0_4() +{ + const double shiftX = 3.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build2D1DTriTargetMesh(inclinationX); + test2D1DMeshesIntersection(sourceMesh, targetMesh, 2. * 20., 4, 8); +} + +void MEDCouplingBasicsTest::test2D1DSegTriInterpP0P0_5() +{ + const double shiftX = 9.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX); + MEDCouplingUMesh *targetMesh=build2D1DTriTargetMesh(inclinationX); + test2D1DMeshesIntersection(sourceMesh, targetMesh, 12., 0, 6); +} + +void MEDCouplingBasicsTest::test2D1DSegTriInterpP0P0_6() +{ + const double shiftX = 9.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build2D1DTriTargetMesh(); + test2D1DMeshesIntersection(sourceMesh, targetMesh, 20., 2, 4); +} + +void MEDCouplingBasicsTest::test3D2DBasicInterpP0P0() +{ + MEDCouplingUMesh *sourceMesh=build3D2DSourceMesh(); + MEDCouplingUMesh *targetMesh=build3D2DTargetMesh(); + + MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); + MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); + INTERP_KERNEL::Interpolation3D2D myInterpolator; + myInterpolator.setPrecision(1e-12); + std::vector > matrix; + INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 }; + for ( size_t i = 0; i < sizeof(sp)/sizeof(sp[0]); ++i ) + { + myInterpolator.setSplittingPolicy( sp[i] ); + matrix.clear(); + myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,matrix,"P0P0"); + + CPPUNIT_ASSERT_EQUAL(3,(int)matrix.size()); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(0. ,matrix[0][0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0. ,matrix[0][1],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(40. ,matrix[0][2],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(8. ,matrix[0][3],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(2.5 ,matrix[0][4],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0. ,matrix[0][5],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(32. ,matrix[0][6],1e-12); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(8.*sqrt(3.),matrix[1][0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0. ,matrix[1][1],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(40. ,matrix[1][2],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(80. ,matrix[1][3],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0. ,matrix[1][4],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(80. ,matrix[1][5],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(80. ,matrix[1][6],1e-12); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(0. ,matrix[2][0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(32. ,matrix[2][1],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0. ,matrix[2][2],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0. ,matrix[2][3],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0. ,matrix[2][4],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(80. ,matrix[2][5],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(112. ,matrix[2][6],1e-12); + + INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces(); + CPPUNIT_ASSERT_EQUAL(3,(int)duplicateFaces.size()); + + INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType correctDuplicateFaces; + std::set face2; + face2.insert(0); + face2.insert(1); + correctDuplicateFaces[2] = face2; + std::set face5; + face5.insert(1); + face5.insert(2); + correctDuplicateFaces[5] = face5; + std::set face6; + face6.insert(0); + face6.insert(1); + face6.insert(2); + correctDuplicateFaces[6] = face6; + + CPPUNIT_ASSERT(correctDuplicateFaces == duplicateFaces); + } + //clean up + sourceMesh->decrRef(); + targetMesh->decrRef(); +} + +void MEDCouplingBasicsTest::test3D2DMeshesIntersection(MEDCouplingUMesh *sourceMesh, + MEDCouplingUMesh *targetMesh, + const double correctSurf, + const int correctDuplicateFacesNbr, + const int correctTotalIntersectFacesNbr) +{ + MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); + MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); + INTERP_KERNEL::Interpolation3D2D myInterpolator; + myInterpolator.setPrecision(1e-12); + const double prec = 1.0e-5; + IntersectionMatrix matrix; + INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 }; + for ( size_t i = 0; i < sizeof(sp)/sizeof(sp[0]); ++i ) + { + myInterpolator.setSplittingPolicy( sp[i] ); + matrix.clear(); + myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,matrix,"P0P0"); + + std::cout.precision(16); + + const double surf = sumAll(matrix); + LOG(1, "surf = " << surf <<" correctSurf = " << correctSurf ); + CPPUNIT_ASSERT_DOUBLES_EQUAL(correctSurf, surf, prec * std::max(correctSurf, surf)); + + INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces(); + int duplicateFacesNbr = duplicateFaces.size(); + LOG(1, "duplicateFacesNbr = " << duplicateFacesNbr <<" correctDuplicateFacesNbr = " << correctDuplicateFacesNbr); + CPPUNIT_ASSERT_EQUAL(correctDuplicateFacesNbr, duplicateFacesNbr); + + if (correctTotalIntersectFacesNbr >= 0) + { + int totalIntersectFacesNbr = countNonZero(matrix); + LOG(1, "totalIntersectFacesNbr = " << totalIntersectFacesNbr <<" correctTotalIntersectFacesNbr = " << correctTotalIntersectFacesNbr ); + CPPUNIT_ASSERT_EQUAL(correctTotalIntersectFacesNbr, totalIntersectFacesNbr); + } + } + //clean up + sourceMesh->decrRef(); + targetMesh->decrRef(); +} + +void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_1() +{ + MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(); + MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh(); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 240., 0, 20); +} + +void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_2() +{ + const double shiftX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(shiftX); + MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh(); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 240., 20, 2 * 20); +} + +void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_3() +{ + const double shiftX = 1.5; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh(inclinationX); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 300., 0, 20); +} + +void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_4() +{ + const double shiftX = 3.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh(inclinationX); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 300., 20, 2 * 20); +} + +void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_5() +{ + const double shiftX = 9.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(shiftX); + MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh(inclinationX); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 180., 0, 15); +} + +void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_6() +{ + const double shiftX = 9.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh(); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 150., 0, 10); +} + +void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_1() +{ + MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(); + MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh(); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 240., 0, 40); +} + +void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_2() +{ + const double shiftX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(shiftX); + MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh(); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 240., 40, 2 * 40); +} + +void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_3() +{ + const double shiftX = 1.5; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh(inclinationX); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 300., 0, 40); +} + +void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_4() +{ + const double shiftX = 3.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh(inclinationX); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 300., 40, 2 * 40); +} + +void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_5() +{ + const double shiftX = 9.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(shiftX); + MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh(inclinationX); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 180., 0, 30); +} + +void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_6() +{ + const double shiftX = 9.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh(); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 150., 0, 20); +} + +void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_1() +{ + MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(); + MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh(); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 240., 20, 40); +} + +void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_2() +{ + const double shiftX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(shiftX); + MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh(); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 240., 20, 2 * 40); +} + +void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_3() +{ + const double shiftX = 1.5; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh(inclinationX); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 300., 0, 100); +} + +void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_4() +{ + const double shiftX = 3.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh(inclinationX); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 300., 20, 2 * 40); +} + +void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_5() +{ + const double shiftX = 9.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(shiftX); + MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh(inclinationX); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 180., 0, 45); +} + +void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_6() +{ + const double shiftX = 9.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh(); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 150., 0, 30); +} + +void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_1() +{ + MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(); + MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh(); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 240., 0, 40); +} + +void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_2() +{ + const double shiftX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(shiftX); + MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh(); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 240., 40, 40 + 80); +} + +void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_3() +{ + const double shiftX = 1.5; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh(inclinationX); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 300., 0); +} + +void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_4() +{ + const double shiftX = 3.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh(inclinationX); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 300., 40, 40 + 80); +} + +void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_5() +{ + const double shiftX = 9.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(shiftX); + MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh(inclinationX); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 180., 0); +} + +void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_6() +{ + const double shiftX = 9.; + const double inclinationX = 3.; + MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(shiftX, inclinationX); + MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh(); + test3D2DMeshesIntersection(sourceMesh, targetMesh, 150., 0); +} + -- 2.39.2