X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FTest%2FMEDCouplingRemapperTest.cxx;h=662ad77a6a7be1a83e097530d1008a353d352d20;hb=ffe6d640bbaae9d66ac15d1015761d047a495ede;hp=b5c4a24169e104a96e0df0baff10ac80b9638c00;hpb=293a6104470482e450701aa8061d9b244f2057d5;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx b/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx index b5c4a2416..662ad77a6 100644 --- a/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx +++ b/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -1272,3 +1272,47 @@ void MEDCouplingRemapperTest::testPartialTransfer1() sourceMesh->decrRef(); targetMesh->decrRef(); } + +void MEDCouplingRemapperTest::testBugNonRegression1() +{ + // source + DataArrayDouble *coordsSrc(DataArrayDouble::New()); + const double coordsSrcData[18]={-6.25,3.6084391824351605,264.85199999999998,-6.25,3.6084391824351605,289.05200000000002,-6.2499999999999991,-3.6084391824351618,264.85199999999998,-6.2499999999999991,-3.6084391824351618,289.05200000000002,-1.7763568394002505e-15,4.4408920985006262e-15,264.85199999999998,-1.7763568394002505e-15,4.4408920985006262e-15,289.05200000000002}; + coordsSrc->useArray(coordsSrcData,false,CPP_DEALLOC,6,3); + DataArrayInt *connSrc(DataArrayInt::New()),*connISrc(DataArrayInt::New()); + const int connSrcData[7]={16,2,0,4,3,1,5}; + connSrc->useArray(connSrcData,false,CPP_DEALLOC,7,1); + const int connISrcData[2]={0,7}; + connISrc->useArray(connISrcData,false,CPP_DEALLOC,2,1); + MEDCouplingUMesh *srcMesh(MEDCouplingUMesh::New("source",3)); + srcMesh->setCoords(coordsSrc); + srcMesh->setConnectivity(connSrc,connISrc,true); + coordsSrc->decrRef(); connSrc->decrRef(); connISrc->decrRef(); + // target + DataArrayDouble *coordsTrg(DataArrayDouble::New()); +const double coordsTrgData[36]={-2,1.1547005383792521,264.85199999999998,-2,0.57735026918962618,264.85199999999998,-2.5,0.2886751345948132,264.85199999999998,-2.5,1.443375672974065,264.85199999999998,-3.0000000000000004,1.1547005383792526,264.85199999999998,-3.0000000000000004,0.57735026918962662,264.85199999999998,-2,1.1547005383792521,289.05200000000002,-2,0.57735026918962618,289.05200000000002,-2.5,0.2886751345948132,289.05200000000002,-2.5,1.443375672974065,289.05200000000002,-3.0000000000000004,1.1547005383792526,289.05200000000002,-3.0000000000000004,0.57735026918962662,289.05200000000002}; + coordsTrg->useArray(coordsTrgData,false,CPP_DEALLOC,12,3); + DataArrayInt *connTrg=DataArrayInt::New(); + const int connTrgData[44]={31,0,1,2,5,4,3,-1,7,6,9,10,11,8,-1,3,9,6,0,-1,4,10,9,3,-1,5,11,10,4,-1,2,8,11,5,-1,1,7,8,2,-1,0,6,7,1}; + connTrg->useArray(connTrgData,false,CPP_DEALLOC,44,1); + DataArrayInt *connITrg=DataArrayInt::New(); + const int connITrgData[2]={0,44}; + connITrg->useArray(connITrgData,false,CPP_DEALLOC,2,1); + MEDCouplingUMesh *trgMesh=MEDCouplingUMesh::New("target",3); + trgMesh->setCoords(coordsTrg); + trgMesh->setConnectivity(connTrg,connITrg,true); + coordsTrg->decrRef(); connTrg->decrRef(); connITrg->decrRef(); + // Go ! + const double valExpected(20.957814771583468); + MEDCouplingRemapper remapper; + remapper.setPrecision(1e-12); + remapper.setIntersectionType(INTERP_KERNEL::Triangulation); + CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(srcMesh,trgMesh,"P0P0")); + std::vector > matrx(remapper.getCrudeMatrix()); + CPPUNIT_ASSERT_EQUAL(1,(int)matrx.size()); + CPPUNIT_ASSERT_EQUAL(1,(int)matrx[0].size()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(valExpected,matrx[0][0],1e-13); + // + srcMesh->decrRef(); trgMesh->decrRef(); +} +