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( test3D2QuadHexaInterpP0P0_1 );
- CPPUNIT_TEST( test3D2QuadHexaInterpP0P0_2 );
- CPPUNIT_TEST( test3D2QuadHexaInterpP0P0_3 );
- CPPUNIT_TEST( test3D2QuadHexaInterpP0P0_4 );
- CPPUNIT_TEST( test3D2QuadHexaInterpP0P0_5 );
- CPPUNIT_TEST( test3D2QuadHexaInterpP0P0_6 );
- CPPUNIT_TEST( test3D2TriHexaInterpP0P0_1 );
- CPPUNIT_TEST( test3D2TriHexaInterpP0P0_2 );
- CPPUNIT_TEST( test3D2TriHexaInterpP0P0_3 );
- CPPUNIT_TEST( test3D2TriHexaInterpP0P0_4 );
- CPPUNIT_TEST( test3D2TriHexaInterpP0P0_5 );
- CPPUNIT_TEST( test3D2TriHexaInterpP0P0_6 );
- CPPUNIT_TEST( test3D2QuadTetraInterpP0P0_1 );
- CPPUNIT_TEST( test3D2QuadTetraInterpP0P0_2 );
- CPPUNIT_TEST( test3D2QuadTetraInterpP0P0_3 );
- CPPUNIT_TEST( test3D2QuadTetraInterpP0P0_4 );
- CPPUNIT_TEST( test3D2QuadTetraInterpP0P0_5 );
- CPPUNIT_TEST( test3D2QuadTetraInterpP0P0_6 );
- CPPUNIT_TEST( test3D2TriTetraInterpP0P0_1 );
- CPPUNIT_TEST( test3D2TriTetraInterpP0P0_2 );
- CPPUNIT_TEST( test3D2TriTetraInterpP0P0_3 );
- CPPUNIT_TEST( test3D2TriTetraInterpP0P0_4 );
- CPPUNIT_TEST( test3D2TriTetraInterpP0P0_5 );
- CPPUNIT_TEST( test3D2TriTetraInterpP0P0_6 );
+ 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( test2DCurveInterpP0P1_1 );
CPPUNIT_TEST( test2DCurveInterpP1P0_1 );
CPPUNIT_TEST( test2DCurveInterpP1P1_1 );
+
CPPUNIT_TEST_SUITE_END();
+
public:
//MEDCouplingBasicsTest1.cxx
void testArray();
void test2DCurveInterpP1P0_1();
void test2DCurveInterpP1P1_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 test3D2QuadHexaInterpP0P0_1();
- void test3D2QuadHexaInterpP0P0_2();
- void test3D2QuadHexaInterpP0P0_3();
- void test3D2QuadHexaInterpP0P0_4();
- void test3D2QuadHexaInterpP0P0_5();
- void test3D2QuadHexaInterpP0P0_6();
- void test3D2TriHexaInterpP0P0_1();
- void test3D2TriHexaInterpP0P0_2();
- void test3D2TriHexaInterpP0P0_3();
- void test3D2TriHexaInterpP0P0_4();
- void test3D2TriHexaInterpP0P0_5();
- void test3D2TriHexaInterpP0P0_6();
- void test3D2QuadTetraInterpP0P0_1();
- void test3D2QuadTetraInterpP0P0_2();
- void test3D2QuadTetraInterpP0P0_3();
- void test3D2QuadTetraInterpP0P0_4();
- void test3D2QuadTetraInterpP0P0_5();
- void test3D2QuadTetraInterpP0P0_6();
- void test3D2TriTetraInterpP0P0_1();
- void test3D2TriTetraInterpP0P0_2();
- void test3D2TriTetraInterpP0P0_3();
- void test3D2TriTetraInterpP0P0_4();
- void test3D2TriTetraInterpP0P0_5();
- void test3D2TriTetraInterpP0P0_6();
+ 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();
public:
static MEDCouplingUMesh *build3DSourceMesh_2();
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.,
private:
static int countNonZero(const std::vector< std::map<int,double> >& 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,
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<double> 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<double> 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<double> 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.,
std::copy(sourceCoords,sourceCoords+63,myCoords->getPointer());
sourceMesh->setCoords(myCoords);
myCoords->decrRef();
-
- //dp sourceMesh->checkCoherency();
- //dp MEDLoader::WriteUMesh("test3D2DBasicInterpP0P0.med",sourceMesh,true);
- //dp sourceMesh->decrRef();
-
return sourceMesh;
}
#include "Interpolation2D.txx"
#include "Interpolation3DSurf.hxx"
#include "Interpolation3D.txx"
+#include "Interpolation2D1D.txx"
#include "Interpolation3D2D.txx"
#include "InterpolationCC.txx"
#include "InterpolationCU.txx"
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<std::map<int,double> > 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<int> 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<int,double> >& matrix)
+{
+ int ret=0.;
+ for(std::vector< std::map<int,double> >::const_iterator iter=matrix.begin();iter!=matrix.end();iter++)
+ for(std::map<int,double>::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();
targetMesh->decrRef();
}
-int MEDCouplingBasicsTest::countNonZero(const std::vector< std::map<int,double> >& matrix)
-{
- int ret=0.;
- for(std::vector< std::map<int,double> >::const_iterator iter=matrix.begin();iter!=matrix.end();iter++)
- for(std::map<int,double>::const_iterator iter2=(*iter).begin();iter2!=(*iter).end();iter2++)
- if (!INTERP_KERNEL::epsilonEqual((*iter2).second, 0.)) ret +=1;
- return ret;
-}
-
void MEDCouplingBasicsTest::test3D2DMeshesIntersection(MEDCouplingUMesh *sourceMesh,
MEDCouplingUMesh *targetMesh,
const double correctSurf,
targetMesh->decrRef();
}
-//dp TODO DP : adapter les commentaires
-
-void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_1()
+void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_1()
{
MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh();
MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh();
test3D2DMeshesIntersection(sourceMesh, targetMesh, 240., 0, 20);
}
-void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_2()
+void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_2()
{
const double shiftX = 3.;
MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(shiftX);
test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 240., 20, 2 * 20);
}
-void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_3()
+void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_3()
{
const double shiftX = 1.5;
const double inclinationX = 3.;
test3D2DMeshesIntersection(sourceMesh, targetMesh, 300., 0, 20);
}
-void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_4()
+void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_4()
{
const double shiftX = 3.;
const double inclinationX = 3.;
test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 300., 20, 2 * 20);
}
-void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_5()
+void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_5()
{
const double shiftX = 9.;
const double inclinationX = 3.;
test3D2DMeshesIntersection(sourceMesh, targetMesh, 180., 0, 15);
}
-void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_6()
+void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_6()
{
const double shiftX = 9.;
const double inclinationX = 3.;
test3D2DMeshesIntersection(sourceMesh, targetMesh, 150., 0, 10);
}
-void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_1()
+void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_1()
{
MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh();
MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh();
test3D2DMeshesIntersection(sourceMesh, targetMesh, 240., 0, 40);
}
-void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_2()
+void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_2()
{
const double shiftX = 3.;
MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(shiftX);
test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 240., 40, 2 * 40);
}
-void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_3()
+void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_3()
{
const double shiftX = 1.5;
const double inclinationX = 3.;
test3D2DMeshesIntersection(sourceMesh, targetMesh, 300., 0, 40);
}
-void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_4()
+void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_4()
{
const double shiftX = 3.;
const double inclinationX = 3.;
test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 300., 40, 2 * 40);
}
-void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_5()
+void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_5()
{
const double shiftX = 9.;
const double inclinationX = 3.;
test3D2DMeshesIntersection(sourceMesh, targetMesh, 180., 0, 30);
}
-void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_6()
+void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_6()
{
const double shiftX = 9.;
const double inclinationX = 3.;
test3D2DMeshesIntersection(sourceMesh, targetMesh, 150., 0, 20);
}
-void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_1()
+void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_1()
{
MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh();
MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh();
test3D2DMeshesIntersection(sourceMesh, targetMesh, 240., 20, 40);
}
-void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_2()
+void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_2()
{
const double shiftX = 3.;
MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(shiftX);
test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 240., 20, 2 * 40);
}
-void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_3()
+void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_3()
{
const double shiftX = 1.5;
const double inclinationX = 3.;
test3D2DMeshesIntersection(sourceMesh, targetMesh, 300., 0, 100);
}
-void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_4()
+void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_4()
{
const double shiftX = 3.;
const double inclinationX = 3.;
test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 300., 20, 2 * 40);
}
-void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_5()
+void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_5()
{
const double shiftX = 9.;
const double inclinationX = 3.;
test3D2DMeshesIntersection(sourceMesh, targetMesh, 180., 0, 45);
}
-void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_6()
+void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_6()
{
const double shiftX = 9.;
const double inclinationX = 3.;
test3D2DMeshesIntersection(sourceMesh, targetMesh, 150., 0, 30);
}
-void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_1()
+void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_1()
{
MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh();
MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh();
test3D2DMeshesIntersection(sourceMesh, targetMesh, 240., 0, 40);
}
-void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_2()
+void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_2()
{
const double shiftX = 3.;
MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(shiftX);
test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 240., 40, 40 + 80);
}
-void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_3()
+void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_3()
{
const double shiftX = 1.5;
const double inclinationX = 3.;
test3D2DMeshesIntersection(sourceMesh, targetMesh, 300., 0);
}
-void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_4()
+void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_4()
{
const double shiftX = 3.;
const double inclinationX = 3.;
test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 300., 40, 40 + 80);
}
-void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_5()
+void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_5()
{
const double shiftX = 9.;
const double inclinationX = 3.;
test3D2DMeshesIntersection(sourceMesh, targetMesh, 180., 0);
}
-void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_6()
+void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_6()
{
const double shiftX = 9.;
const double inclinationX = 3.;
MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh();
test3D2DMeshesIntersection(sourceMesh, targetMesh, 150., 0);
}
+