From: eap Date: Fri, 30 Oct 2009 07:53:39 +0000 (+0000) Subject: 0020441: [CEA 349] P1P1 barycentric interpolators X-Git-Tag: V5_1_3_patch03 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bf986db60b923219006f308e3c5b51095f24da32;p=tools%2Fmedcoupling.git 0020441: [CEA 349] P1P1 barycentric interpolators fix indentation: offset -> 2 --- diff --git a/src/INTERP_KERNEL/Interpolation3D.txx b/src/INTERP_KERNEL/Interpolation3D.txx index 2528b0e73..df8fcf3af 100644 --- a/src/INTERP_KERNEL/Interpolation3D.txx +++ b/src/INTERP_KERNEL/Interpolation3D.txx @@ -61,7 +61,7 @@ namespace INTERP_KERNEL Interpolation3D::Interpolation3D(const InterpolationOptions& io):Interpolation(io) { } - + /** * Calculates the matrix of volumes of intersection between the elements of srcMesh and the elements of targetMesh. * The calculation is done in two steps. First a filtering process reduces the number of pairs of elements for which the @@ -77,7 +77,7 @@ namespace INTERP_KERNEL * 0 to (nb target elements - 1), meaning that the map for target element i is stored at index i - 1. In the maps, however, * the indexing is more natural : the intersection volume of the target element i with source element j is found at matrix[i-1][j]. * - + * @param srcMesh 3-dimensional source mesh * @param targetMesh 3-dimesional target mesh, containing only tetraedra * @param result matrix in which the result is stored @@ -95,12 +95,12 @@ namespace INTERP_KERNEL std::vector*> srcElems(numSrcElems); std::vector*> targetElems(numTargetElems); - + std::map*, int> indices; - + for(unsigned long i = 0 ; i < numSrcElems ; ++i) srcElems[i] = new MeshElement(i, srcMesh); - + for(unsigned long i = 0 ; i < numTargetElems ; ++i) targetElems[i] = new MeshElement(i, targetMesh); @@ -122,7 +122,7 @@ namespace INTERP_KERNEL result.resize(intersector->getNumberOfRowsOfResMatrix()); #ifdef USE_RECURSIVE_BBOX_FILTER - + /* * Performs a depth-first search over srcMesh, using bounding boxes to recursively eliminate the elements of targetMesh * which cannot intersect smaller and smaller regions of srcMesh. At each level, each region is divided in two, forming @@ -137,7 +137,7 @@ namespace INTERP_KERNEL // intersects that of the source region RegionNode* firstNode = new RegionNode(); - + MeshRegion& srcRegion = firstNode->getSrcRegion(); for(unsigned long i = 0 ; i < numSrcElems ; ++i) @@ -188,11 +188,11 @@ namespace INTERP_KERNEL RegionNode* leftNode = new RegionNode(); RegionNode* rightNode = new RegionNode(); - + // split current source region //} decide on axis static BoundingBox::BoxCoord axis = BoundingBox::XMAX; - + currNode->getTargetRegion().split(leftNode->getTargetRegion(), rightNode->getTargetRegion(), axis, targetMesh); LOG(5, "After split, left target region has " << leftNode->getTargetRegion().getNumberOfElements() @@ -212,19 +212,19 @@ namespace INTERP_KERNEL iter != currNode->getSrcRegion().getEndElements() ; ++iter) { LOG(6, " --- New target node"); - + if(!leftNode->getTargetRegion().isDisjointWithElementBoundingBox(**iter)) { leftNode->getSrcRegion().addElement(*iter, srcMesh); ++numLeftElements; } - + if(!rightNode->getTargetRegion().isDisjointWithElementBoundingBox(**iter)) { rightNode->getSrcRegion().addElement(*iter, srcMesh); ++numRightElements; } - + } LOG(5, "Left src region has " << numLeftElements << " elements and right src region has " @@ -249,7 +249,7 @@ namespace INTERP_KERNEL delete rightNode; } } - + // all nodes are deleted here delete currNode; @@ -257,7 +257,7 @@ namespace INTERP_KERNEL } #else // Use BBTree - + // create BBTree structure // - get bounding boxes double* bboxes = new double[6 * numSrcElems]; @@ -276,9 +276,9 @@ namespace INTERP_KERNEL // source indices have to begin with zero for BBox, I think srcElemIdx[i] = srcElems[i]->getIndex(); } - + BBTree<3,ConnType> tree(bboxes, srcElemIdx, 0, numSrcElems); - + // for each target element, get source elements with which to calculate intersection // - calculate intersection by calling intersectCells for(unsigned long i = 0; i < numTargetElems; ++i) @@ -305,7 +305,7 @@ namespace INTERP_KERNEL delete [] bboxes; delete [] srcElemIdx; - + #endif // free allocated memory int ret=intersector->getNumberOfColsOfResMatrix(); diff --git a/src/INTERP_KERNEL/Intersector3DP1P1.txx b/src/INTERP_KERNEL/Intersector3DP1P1.txx index 90f75b472..ee5e2db31 100644 --- a/src/INTERP_KERNEL/Intersector3DP1P1.txx +++ b/src/INTERP_KERNEL/Intersector3DP1P1.txx @@ -34,7 +34,7 @@ namespace INTERP_KERNEL { return Intersector3D::_target_mesh.getNumberOfNodes(); } - + template int Intersector3DP1P1::getNumberOfColsOfResMatrix() const { diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx index eea552e4a..f0d456fc4 100644 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx @@ -85,48 +85,48 @@ namespace INTERP_KERNEL Intersector3D::_target_mesh,conn[node]); SplitterTetra tgtTetra(Intersector3D::_src_mesh, nodes, conn); for (int i=0; i<24; i++) - { - subTetraNodes[i].second.resize(12); - tgtTetra.splitMySelfForDual(&subTetraNodes[i].second[0],i,subTetraNodes[i].first); - } + { + subTetraNodes[i].second.resize(12); + tgtTetra.splitMySelfForDual(&subTetraNodes[i].second[0],i,subTetraNodes[i].first); + } // intersect each source tetrahedron with each of target dual cells SplitterTetra* subTetrasS[24]; for(typename std::vector::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++) - { - // split a source cell into dual cells - for(int node = 0; node < 4 ; ++node) - nodes[node]=getCoordsOfNode2(node, OTT::indFC(*iterCellS), - Intersector3D::_src_mesh,conn[node]); + { + // split a source cell into dual cells + for(int node = 0; node < 4 ; ++node) + nodes[node]=getCoordsOfNode2(node, OTT::indFC(*iterCellS), + Intersector3D::_src_mesh,conn[node]); - SplitterTetra srcTetra(Intersector3D::_target_mesh, nodes, conn); - srcTetra.splitIntoDualCells(subTetrasS); + SplitterTetra srcTetra(Intersector3D::_target_mesh, nodes, conn); + srcTetra.splitIntoDualCells(subTetrasS); - // intersect each target subTetra with each source one - for(int i=0;i<24;i++) - { - SplitterTetra *tmp=subTetrasS[i]; - ConnType sourceNode=OTT::indFC(tmp->getId(0)); - for(int j=0;j<24;j++) - { - const double* tetraNodes12 = &subTetraNodes[j].second[0]; - const double* tetraNodesT[4]={ tetraNodes12, tetraNodes12+3, tetraNodes12+6, tetraNodes12+9 }; - double volume = tmp->intersectTetra( tetraNodesT ); - if(volume!=0.) + // intersect each target subTetra with each source one + for(int i=0;i<24;i++) { - ConnType tgtNode=subTetraNodes[j].first; - typename MyMatrix::value_type& resRow = res[tgtNode]; - typename MyMatrix::value_type::const_iterator iterRes=resRow.find( sourceNode ); - if(iterRes!=resRow.end()) - { - volume += (*iterRes).second; - resRow.erase(sourceNode); - } - resRow.insert(std::make_pair(sourceNode,volume)); + SplitterTetra *tmp=subTetrasS[i]; + ConnType sourceNode=OTT::indFC(tmp->getId(0)); + for(int j=0;j<24;j++) + { + const double* tetraNodes12 = &subTetraNodes[j].second[0]; + const double* tetraNodesT[4]={ tetraNodes12, tetraNodes12+3, tetraNodes12+6, tetraNodes12+9 }; + double volume = tmp->intersectTetra( tetraNodesT ); + if(volume!=0.) + { + ConnType tgtNode=subTetraNodes[j].first; + typename MyMatrix::value_type& resRow = res[tgtNode]; + typename MyMatrix::value_type::const_iterator iterRes=resRow.find( sourceNode ); + if(iterRes!=resRow.end()) + { + volume += (*iterRes).second; + resRow.erase(sourceNode); + } + resRow.insert(std::make_pair(sourceNode,volume)); + } + } + delete tmp; } - } - delete tmp; } - } } } diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest.cxx index da248dfd3..8442aa986 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest.cxx @@ -67,18 +67,18 @@ void MEDCouplingBasicsTest::testMesh() { const int nbOfCells=6; const int nbOfNodes=12; - + double coords[3*nbOfNodes]={ 0.024155, 0.04183768725682622, -0.305, 0.04831000000000001, -1.015761910347357e-17, -0.305, 0.09662000000000001, -1.832979297858306e-18, -0.305, 0.120775, 0.04183768725682623, -0.305, 0.09662000000000001, 0.08367537451365245, -0.305, 0.04831000000000001, 0.08367537451365246, -0.305, 0.024155, 0.04183768725682622, -0.2863, 0.04831000000000001, -1.015761910347357e-17, -0.2863, 0.09662000000000001, -1.832979297858306e-18, -0.2863, 0.120775, 0.04183768725682623, -0.2863, 0.09662000000000001, 0.08367537451365245, -0.2863, 0.04831000000000001, 0.08367537451365246, -0.2863, }; - + int tab4[4*nbOfCells]={ 1, 2, 8, 7, 2, 3, 9, 8, 3, 4, 10, 9, 4, 5, 11, 10, 5, 0, 6, 11, 0, 1, 7, 6, }; - + MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(8); @@ -1476,25 +1476,25 @@ void MEDCouplingBasicsTest::test3DInterpP1P1_1() double sum = 0; //cout.precision(18); for(std::vector >::const_iterator iter1=res.begin();iter1!=res.end();iter1++,i++) - { - //cout<< "res3D[" <::const_iterator iter2=(*iter1).find(j); - if(iter2!=(*iter1).end()) - { - //cout<< iter2->second<< ", "; - sum += iter2->second; - CPPUNIT_ASSERT_DOUBLES_EQUAL(res3D[i][j],(*iter2).second,1.e-5); - } - else - { - //cout << "0.0, "; - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,res3D[i][j],1e-14); - } + //cout<< "res3D[" <::const_iterator iter2=(*iter1).find(j); + if(iter2!=(*iter1).end()) + { + //cout<< iter2->second<< ", "; + sum += iter2->second; + CPPUNIT_ASSERT_DOUBLES_EQUAL(res3D[i][j],(*iter2).second,1.e-5); + } + else + { + //cout << "0.0, "; + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,res3D[i][j],1e-14); + } + } + //cout << "}" << endl; } - //cout << "}" << endl; - } //cout << "Sum = " << sum << endl; CPPUNIT_ASSERT_DOUBLES_EQUAL(8000000,sum,1.e-5); //clean-up @@ -1538,16 +1538,16 @@ void MEDCouplingBasicsTest::testInterpolationCC() double arr2[4] = { 0/3, 1/3., 2/3., 3/3. }; MEDCouplingCMesh* mesh[2]; for ( int i = 0; i < 2; ++i ) - { - const double* arr = i ? arr1 : arr2; - const int nb_coord = i ? 3 : 4; - DataArrayDouble* coords = DataArrayDouble::New(); - coords->useArray( arr, /*ownership=*/false, CPP_DEALLOC, nb_coord, 1 ); - - mesh[i] = MEDCouplingCMesh::New(); - mesh[i]->setCoords( coords, coords, coords ); - coords->decrRef(); - } + { + const double* arr = i ? arr1 : arr2; + const int nb_coord = i ? 3 : 4; + DataArrayDouble* coords = DataArrayDouble::New(); + coords->useArray( arr, /*ownership=*/false, CPP_DEALLOC, nb_coord, 1 ); + + mesh[i] = MEDCouplingCMesh::New(); + mesh[i]->setCoords( coords, coords, coords ); + coords->decrRef(); + } MEDCouplingNormalizedCartesianMesh<3,3> targetWrapper(mesh[1]); MEDCouplingNormalizedCartesianMesh<3,3> sourceWrapper(mesh[0]); CPPUNIT_ASSERT_EQUAL( 27,int( sourceWrapper.getNumberOfElements())); @@ -1567,24 +1567,24 @@ void MEDCouplingBasicsTest::testInterpolationCC() double sum = 0; for ( int i = 0; i < res.size(); ++i ) for ( map::iterator s_v = res[i].begin(); s_v != res[i].end(); ++s_v) - { - sum += s_v->second; - double vvv; + { + sum += s_v->second; + double vvv; #ifdef WNT - double vv = s_v->second / precis; - if(vv>=0.0) - { - vvv = floor(vv+0.5); - } - else - { - vvv = ceil(vv-0.5); - } + double vv = s_v->second / precis; + if(vv>=0.0) + { + vvv = floor(vv+0.5); + } + else + { + vvv = ceil(vv-0.5); + } #else - vvv = round( s_v->second / precis ); + vvv = round( s_v->second / precis ); #endif - vals.insert( precis * vvv ); - } + vals.insert( precis * vvv ); + } //cout << "tgt: " << i << " src: " << s_v->first << " - w: " << s_v->second << endl; CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, sum, precis ); @@ -1782,31 +1782,31 @@ void MEDCouplingBasicsTest::test2DInterpP1P0Bary_1() vector > res; INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; for(int i=0;i<2;i++) - { - myInterpolator.setPrecision(1e-12); - myInterpolator.setIntersectionType(types[i]); - myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); - CPPUNIT_ASSERT_EQUAL(5,(int)res.size()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666669,res[0][0],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343,res[0][1],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343,res[0][2],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664,res[0][3],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664,res[1][0],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625,res[1][1],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343,res[1][3],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343,res[2][0],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625,res[2][1],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664,res[2][3],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625,res[3][0],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125,res[3][2],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625,res[3][3],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664,res[4][0],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343,res[4][1],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343,res[4][2],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666666,res[4][3],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,sumAll(res),1e-12); - res.clear(); - } + { + myInterpolator.setPrecision(1e-12); + myInterpolator.setIntersectionType(types[i]); + myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); + CPPUNIT_ASSERT_EQUAL(5,(int)res.size()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666669,res[0][0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343,res[0][1],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343,res[0][2],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664,res[0][3],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664,res[1][0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625,res[1][1],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343,res[1][3],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343,res[2][0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625,res[2][1],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664,res[2][3],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625,res[3][0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125,res[3][2],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625,res[3][3],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664,res[4][0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343,res[4][1],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343,res[4][2],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666666,res[4][3],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,sumAll(res),1e-12); + res.clear(); + } //clean up sourceMesh->decrRef(); targetMesh->decrRef(); @@ -1824,31 +1824,31 @@ void MEDCouplingBasicsTest::test3DSurfInterpP1P0Bary_1() vector > res; INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; for(int i=0;i<2;i++) - { - myInterpolator.setPrecision(1e-12); - myInterpolator.setIntersectionType(types[i]); - myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); - CPPUNIT_ASSERT_EQUAL(5,(int)res.size()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666669*sqrt(2.),res[0][0],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343*sqrt(2.),res[0][1],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343*sqrt(2.),res[0][2],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664*sqrt(2.),res[0][3],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664*sqrt(2.),res[1][0],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625*sqrt(2.),res[1][1],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343*sqrt(2.),res[1][3],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343*sqrt(2.),res[2][0],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625*sqrt(2.),res[2][1],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664*sqrt(2.),res[2][3],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625*sqrt(2.),res[3][0],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125*sqrt(2.),res[3][2],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625*sqrt(2.),res[3][3],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664*sqrt(2.),res[4][0],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343*sqrt(2.),res[4][1],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343*sqrt(2.),res[4][2],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666666*sqrt(2.),res[4][3],1e-12); - CPPUNIT_ASSERT_DOUBLES_EQUAL(1.*sqrt(2.),sumAll(res),1e-12); - res.clear(); - } + { + myInterpolator.setPrecision(1e-12); + myInterpolator.setIntersectionType(types[i]); + myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); + CPPUNIT_ASSERT_EQUAL(5,(int)res.size()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666669*sqrt(2.),res[0][0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343*sqrt(2.),res[0][1],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343*sqrt(2.),res[0][2],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664*sqrt(2.),res[0][3],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664*sqrt(2.),res[1][0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625*sqrt(2.),res[1][1],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343*sqrt(2.),res[1][3],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343*sqrt(2.),res[2][0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625*sqrt(2.),res[2][1],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664*sqrt(2.),res[2][3],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625*sqrt(2.),res[3][0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125*sqrt(2.),res[3][2],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0625*sqrt(2.),res[3][3],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664*sqrt(2.),res[4][0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343*sqrt(2.),res[4][1],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.020833333333333343*sqrt(2.),res[4][2],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666666*sqrt(2.),res[4][3],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.*sqrt(2.),sumAll(res),1e-12); + res.clear(); + } //clean up sourceMesh->decrRef(); targetMesh->decrRef(); @@ -1878,21 +1878,21 @@ void MEDCouplingBasicsTest::test3DInterpP1P0Bary_1() double sum = 0; int i=0; for(std::vector >::const_iterator iter1=res.begin();iter1!=res.end();iter1++,i++) - { - for(int j=0;j<28;j++) { - std::map::const_iterator iter2=(*iter1).find(j); - if(iter2!=(*iter1).end()) - { - sum += iter2->second; - CPPUNIT_ASSERT_DOUBLES_EQUAL(res3D[i][j],(*iter2).second,1.e-3); - } - else - { - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,res3D[i][j],1e-14); - } + for(int j=0;j<28;j++) + { + std::map::const_iterator iter2=(*iter1).find(j); + if(iter2!=(*iter1).end()) + { + sum += iter2->second; + CPPUNIT_ASSERT_DOUBLES_EQUAL(res3D[i][j],(*iter2).second,1.e-3); + } + else + { + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,res3D[i][j],1e-14); + } + } } - } CPPUNIT_ASSERT_DOUBLES_EQUAL(8000000,sum,1.e-5); //clean up sourceMesh->decrRef(); @@ -1906,15 +1906,15 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSourceMesh_2() 0.0, 100.0, 200.0, 100.0, 0.0, 200.0, 0.0, 0.0, 200.0, 100.0, 100.0, 200.0, 200.0, 0.0, 200.0, 200.0, 200.0, 100.0, 0.0, 200.0, 100.00000000833332, 100.00000000833332, 200.0, 0.0, 100.0, 200.0, 0.0, 0.0, 200.0, 100.0, 200.0, 200.0, 0.0, 200.0, 200.0, 200.0, 0.0, 200.0, 200.0, 100.0, 200.0, 200.0, 200.0, 149.999999970343, 149.9999999874621, 49.999999881628682}; - - + + int sourceConn[212]={25, 27, 13, 19, 18, 3, 20, 21, 5, 10, 17, 1, 1, 3, 0, 7, 18, 1, 0, 27, 12, 27, 13, 24, 25, 19, 16, 26, 1, 2, 6, 8, 15, 13, 12, 5, 24, 13, 25, 27, 10, 11, 9, 6, 19, 8, 23, 1, 22, 8, 23, 19, 16, 13, 17, 1, 6, 9, 10, 8, 13, 17, 5, 15, 5, 4, 1, 12, 18, 0, 24, 27, 19, 20, 18, 1, 7, 6, 5, 1, 4, 12, 15, 14, 25, 27, 19, 18, 1, 19, 16, 13, 20, 19, 23, 1, 27, 12, 1, 0, 6, 5, 1, 10, 4, 5, 1, 7, 12, 27, 1, 13, 5, 15, 4, 12, 19, 16, 26, 22, 13, 5, 17, 1, 1, 3, 7, 2, 13, 5, 1, 12, 18, 1, 3, 0, 8, 23, 2, 9, 3, 1, 18, 20, 1, 27, 19, 13, 24, 25, 18, 27, 25, 16, 19, 13, 7, 1, 2, 6, 3, 1, 20, 2, 8, 16, 17, 1, 7, 4, 0, 1, 18, 19, 1, 27, 27, 12, 0, 24, 9, 6, 2, 8, 1, 4, 0, 12, 19, 16, 22, 8, 8, 2, 23, 1, 1, 16, 19, 8, 20, 2, 1, 23, 10, 1, 6, 8, 10, 8, 17, 1}; - + MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New(); sourceMesh->setMeshDimension(3); sourceMesh->allocateCells(53);