From: ageay Date: Mon, 19 Aug 2013 08:49:20 +0000 (+0000) Subject: API modif : suppression of P1P0Bary policy. Now it is included in the intersection... X-Git-Tag: DBugPolyhIntersector~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=989a26b0eeb491d2d84b9a4dbdca0bc8f525581e;p=modules%2Fmed.git API modif : suppression of P1P0Bary policy. Now it is included in the intersection type. --- diff --git a/idl/ParaMEDMEMComponent.idl b/idl/ParaMEDMEMComponent.idl index acd720d1a..024e1cb2b 100644 --- a/idl/ParaMEDMEMComponent.idl +++ b/idl/ParaMEDMEMComponent.idl @@ -53,8 +53,7 @@ module SALOME_MED in double max_distance_for_3Dsurf_intersect, in long orientation, in boolean measure_abs, - in string splitting_policy, - in boolean P1P0_bary_method) raises (SALOME::SALOME_Exception); + in string splitting_policy) raises (SALOME::SALOME_Exception); void initializeCoupling(in string coupling, in string ior) raises (SALOME::SALOME_Exception); void terminateCoupling(in string coupling) raises (SALOME::SALOME_Exception); }; diff --git a/src/INTERP_KERNEL/Interpolation3D.txx b/src/INTERP_KERNEL/Interpolation3D.txx index 87ab6b14c..9edf10b45 100644 --- a/src/INTERP_KERNEL/Interpolation3D.txx +++ b/src/INTERP_KERNEL/Interpolation3D.txx @@ -132,17 +132,13 @@ namespace INTERP_KERNEL case PointLocator: intersector=new PointLocator3DIntersectorP1P0(targetMesh, srcMesh, getPrecision()); break; + case Barycentric: + intersector=new PolyhedronIntersectorP1P0Bary(targetMesh, srcMesh, getSplittingPolicy()); + break; default: - throw INTERP_KERNEL::Exception("Invalid 3D intersection type for P1P0 interp specified : must be Triangle or PointLocator."); + throw INTERP_KERNEL::Exception("Invalid 3D intersection type for P1P0 interp specified : must be Triangle, PointLocator or Barycentric."); } } - else if(methC=="P1P0Bary") - { - if(InterpolationOptions::getIntersectionType()==Triangulation) - intersector=new PolyhedronIntersectorP1P0Bary(targetMesh, srcMesh, getSplittingPolicy()); - else - throw INTERP_KERNEL::Exception("Invalid 3D intersection type specified : must be Triangle."); - } else if(methC=="P1P1") { switch(InterpolationOptions::getIntersectionType()) diff --git a/src/INTERP_KERNEL/InterpolationOptions.cxx b/src/INTERP_KERNEL/InterpolationOptions.cxx index cdfef798c..c3551054a 100644 --- a/src/INTERP_KERNEL/InterpolationOptions.cxx +++ b/src/INTERP_KERNEL/InterpolationOptions.cxx @@ -58,6 +58,10 @@ const char INTERP_KERNEL::InterpolationOptions::GEOMETRIC_INTERSECT2D_STR[]="Geo const char INTERP_KERNEL::InterpolationOptions::POINTLOCATOR_INTERSECT_STR[]="PointLocator"; +const char INTERP_KERNEL::InterpolationOptions::BARYCENTRIC_INTERSECT_STR[]="Barycentric"; + +const char INTERP_KERNEL::InterpolationOptions::BARYCENTRICGEO2D_INTERSECT_STR[]="BarycentricGeo2D"; + const char INTERP_KERNEL::InterpolationOptions::PLANAR_SPLIT_FACE_5_STR[]="PLANAR_FACE_5"; const char INTERP_KERNEL::InterpolationOptions::PLANAR_SPLIT_FACE_6_STR[]="PLANAR_FACE_6"; @@ -79,7 +83,6 @@ void INTERP_KERNEL::InterpolationOptions::init() _orientation=0; _measure_abs=true; _splitting_policy=PLANAR_FACE_5; - _P1P0_bary_method=false; } std::string INTERP_KERNEL::InterpolationOptions::getIntersectionTypeRepr() const @@ -92,6 +95,10 @@ std::string INTERP_KERNEL::InterpolationOptions::getIntersectionTypeRepr() const return std::string(GEOMETRIC_INTERSECT2D_STR); else if(_intersection_type==INTERP_KERNEL::PointLocator) return std::string(POINTLOCATOR_INTERSECT_STR); + else if(_intersection_type==INTERP_KERNEL::Barycentric) + return std::string(BARYCENTRIC_INTERSECT_STR); + else if(_intersection_type==INTERP_KERNEL::BarycentricGeo2D) + return std::string(BARYCENTRICGEO2D_INTERSECT_STR); else return std::string("UNKNOWN_INTERSECT_TYPE"); } @@ -178,6 +185,16 @@ bool INTERP_KERNEL::InterpolationOptions::setOptionString(const std::string& key setIntersectionType(INTERP_KERNEL::PointLocator); return true; } + else if(value==BARYCENTRIC_INTERSECT_STR) + { + setIntersectionType(INTERP_KERNEL::Barycentric); + return true; + } + else if(value==BARYCENTRICGEO2D_INTERSECT_STR) + { + setIntersectionType(INTERP_KERNEL::BarycentricGeo2D); + return true; + } } else if(key==SPLITTING_POLICY_STR) { @@ -223,9 +240,7 @@ std::string INTERP_KERNEL::InterpolationOptions::getSplittingPolicyRepr() const std::string INTERP_KERNEL::InterpolationOptions::filterInterpolationMethod(const std::string& meth) const { - if ( _P1P0_bary_method && meth == "P1P0" ) - return "P1P0Bary"; - return meth; + return std::string(meth); } bool INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(long print_level, @@ -238,8 +253,7 @@ bool INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(long print_lev double max_distance_for_3Dsurf_intersect, long orientation, bool measure_abs, - std::string splitting_policy, - bool P1P0_bary_method ) + std::string splitting_policy) { _print_level=print_level; _precision=precision; @@ -250,7 +264,6 @@ bool INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(long print_lev _max_distance_for_3Dsurf_intersect=max_distance_for_3Dsurf_intersect; _orientation=orientation; _measure_abs=measure_abs; - _P1P0_bary_method=P1P0_bary_method; return(setOptionString(INTERSEC_TYPE_STR,intersection_type) && setOptionString(SPLITTING_POLICY_STR,splitting_policy)); } @@ -268,7 +281,6 @@ std::string INTERP_KERNEL::InterpolationOptions::printOptions() const oss << "Orientation : " << _orientation << std::endl; oss << "Measure abs : " << _measure_abs << std::endl; oss << "Splitting policy : " << getSplittingPolicyRepr() << std::endl; - oss << "P1P0 Barycentric method : " << _P1P0_bary_method << std::endl; oss << "****************************" << std::endl; return oss.str(); } diff --git a/src/INTERP_KERNEL/InterpolationOptions.hxx b/src/INTERP_KERNEL/InterpolationOptions.hxx index b97d3db17..53655259d 100644 --- a/src/INTERP_KERNEL/InterpolationOptions.hxx +++ b/src/INTERP_KERNEL/InterpolationOptions.hxx @@ -28,7 +28,7 @@ namespace INTERP_KERNEL { - typedef enum { Triangulation, Convex, Geometric2D, PointLocator } IntersectionType; + typedef enum { Triangulation, Convex, Geometric2D, PointLocator, Barycentric, BarycentricGeo2D } IntersectionType; /*! * \class InterpolationOptions @@ -53,8 +53,6 @@ namespace INTERP_KERNEL int _orientation ; bool _measure_abs; SplittingPolicy _splitting_policy ; - bool _P1P0_bary_method; // issue 0020440 - public: InterpolationOptions() { init(); } int getPrintLevel() const { return _print_level; } @@ -92,9 +90,6 @@ namespace INTERP_KERNEL void setSplittingPolicy(SplittingPolicy sp) { _splitting_policy=sp; } std::string getSplittingPolicyRepr() const; - void setP1P0BaryMethod(bool isP1P0) { _P1P0_bary_method=isP1P0; } - bool getP1P0BaryMethod() const { return _P1P0_bary_method; } - std::string filterInterpolationMethod(const std::string& meth) const; void init(); @@ -109,8 +104,7 @@ namespace INTERP_KERNEL double max_distance_for_3Dsurf_intersect, long orientation, bool measure_abs, - std::string splitting_policy, - bool P1P0_bary_method ); + std::string splitting_policy); void copyOptions(const InterpolationOptions & other) { *this = other; } bool setOptionDouble(const std::string& key, double value); bool setOptionInt(const std::string& key, int value); @@ -136,6 +130,8 @@ namespace INTERP_KERNEL static const char CONVEX_INTERSECT2D_STR[]; static const char GEOMETRIC_INTERSECT2D_STR[]; static const char POINTLOCATOR_INTERSECT_STR[]; + static const char BARYCENTRIC_INTERSECT_STR[]; + static const char BARYCENTRICGEO2D_INTERSECT_STR[]; static const char PLANAR_SPLIT_FACE_5_STR[]; static const char PLANAR_SPLIT_FACE_6_STR[]; static const char GENERAL_SPLIT_24_STR[]; diff --git a/src/INTERP_KERNEL/InterpolationPlanar.txx b/src/INTERP_KERNEL/InterpolationPlanar.txx index 110ff9d56..92aa07407 100644 --- a/src/INTERP_KERNEL/InterpolationPlanar.txx +++ b/src/INTERP_KERNEL/InterpolationPlanar.txx @@ -264,41 +264,23 @@ namespace INTERP_KERNEL InterpolationOptions::getPrecision(), InterpolationOptions::getOrientation()); break; + case Barycentric: + intersector=new TriangulationIntersector(myMeshT,myMeshS,_dim_caracteristic, + InterpolationOptions::getPrecision(), + InterpolationOptions::getMaxDistance3DSurfIntersect(), + InterpolationOptions::getMedianPlane(), + InterpolationOptions::getOrientation(), + InterpolationOptions::getPrintLevel()); + break; + case BarycentricGeo2D: + intersector=new Geometric2DIntersector(myMeshT, myMeshS, _dim_caracteristic, + InterpolationOptions::getMaxDistance3DSurfIntersect(), + InterpolationOptions::getMedianPlane(), + InterpolationOptions::getPrecision(), + InterpolationOptions::getOrientation()); + break; } } - else if(meth=="P1P0Bary") - { - switch (InterpolationOptions::getIntersectionType()) - { - case Triangulation: - intersector=new TriangulationIntersector(myMeshT,myMeshS,_dim_caracteristic, - InterpolationOptions::getPrecision(), - InterpolationOptions::getMaxDistance3DSurfIntersect(), - InterpolationOptions::getMedianPlane(), - InterpolationOptions::getOrientation(), - InterpolationOptions::getPrintLevel()); - break; - case Convex: - intersector=new ConvexIntersector(myMeshT,myMeshS,_dim_caracteristic, - InterpolationOptions::getPrecision(), - InterpolationOptions::getMaxDistance3DSurfIntersect(), - InterpolationOptions::getMedianPlane(), - InterpolationOptions::getDoRotate(), - InterpolationOptions::getOrientation(), - InterpolationOptions::getPrintLevel()); - break; - case Geometric2D: - intersector=new Geometric2DIntersector(myMeshT, myMeshS, _dim_caracteristic, - InterpolationOptions::getMaxDistance3DSurfIntersect(), - InterpolationOptions::getMedianPlane(), - InterpolationOptions::getPrecision(), - InterpolationOptions::getOrientation()); - break; - case PointLocator: - throw INTERP_KERNEL::Exception("Invalid intersector (PointLocator) for P1P0Bary !"); - break; - } - } else if(meth=="P1P1") { switch (InterpolationOptions::getIntersectionType()) diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx index 278221585..cb0e0e8eb 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx @@ -1932,9 +1932,8 @@ void MEDCouplingBasicsTestInterp::test2DInterpP1P0Bary_1() MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - myInterpolator.setP1P0BaryMethod(true); std::vector > res; - INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; + INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Barycentric,INTERP_KERNEL::BarycentricGeo2D}; for(int i=0;i<2;i++) { myInterpolator.setPrecision(1e-12); @@ -1974,9 +1973,8 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP1P0Bary_1() MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3DSurf myInterpolator; - myInterpolator.setP1P0BaryMethod(true); std::vector > res; - INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; + INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Barycentric,INTERP_KERNEL::BarycentricGeo2D}; for(int i=0;i<2;i++) { myInterpolator.setPrecision(1e-12); @@ -2017,9 +2015,9 @@ void MEDCouplingBasicsTestInterp::test3DInterpP1P0Bary_1() MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3D myInterpolator; - myInterpolator.setP1P0BaryMethod(true); std::vector > res; myInterpolator.setPrecision(1e-12); + myInterpolator.setIntersectionType(INTERP_KERNEL::Barycentric); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); CPPUNIT_ASSERT_EQUAL(5,(int)res.size()); diff --git a/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py b/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py index 56b562278..795e66e61 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py @@ -342,7 +342,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): f.setTime(5.6,7,8) f.setName("toto") ; f.setDescription("aDescription") p=MEDCouplingRemapper() - p.setP1P0BaryMethod(True) + p.setIntersectionType(Barycentric) p.prepare(um,um,"P1P0") fNode=p.reverseTransferField(f,1e300) self.assertEqual("toto",fNode.getName()) diff --git a/src/ParaMEDMEMComponent/ParaMEDMEMComponent_i.cxx b/src/ParaMEDMEMComponent/ParaMEDMEMComponent_i.cxx index a13a2dc23..869c837ce 100644 --- a/src/ParaMEDMEMComponent/ParaMEDMEMComponent_i.cxx +++ b/src/ParaMEDMEMComponent/ParaMEDMEMComponent_i.cxx @@ -234,8 +234,7 @@ void ParaMEDMEMComponent_i::setInterpolationOptions(const char * coupling, CORBA::Double max_distance_for_3Dsurf_intersect, CORBA::Long orientation, CORBA::Boolean measure_abs, - const char * splitting_policy, - CORBA::Boolean P1P0_bary_method ) throw(SALOME::SALOME_Exception) + const char * splitting_policy) throw(SALOME::SALOME_Exception) { except_st *est; void *ret_th; @@ -262,7 +261,6 @@ void ParaMEDMEMComponent_i::setInterpolationOptions(const char * coupling, st->orientation = orientation; st->measure_abs = measure_abs; st->splitting_policy = splitting_policy; - st->P1P0_bary_method = P1P0_bary_method; pthread_create(&(th[ip]),NULL,th_setinterpolationoptions,(void*)st); } } @@ -280,8 +278,7 @@ void ParaMEDMEMComponent_i::setInterpolationOptions(const char * coupling, max_distance_for_3Dsurf_intersect, orientation, measure_abs, - splitting_policy, - P1P0_bary_method ); + splitting_policy ); if(!ret) { @@ -511,8 +508,7 @@ void *th_setinterpolationoptions(void *s) st->max_distance_for_3Dsurf_intersect, st->orientation, st->measure_abs, - st->splitting_policy, - st->P1P0_bary_method); + st->splitting_policy); } catch(const SALOME::SALOME_Exception &ex) { diff --git a/src/ParaMEDMEMComponent/ParaMEDMEMComponent_i.hxx b/src/ParaMEDMEMComponent/ParaMEDMEMComponent_i.hxx index 768806d49..bd00bf4d0 100644 --- a/src/ParaMEDMEMComponent/ParaMEDMEMComponent_i.hxx +++ b/src/ParaMEDMEMComponent/ParaMEDMEMComponent_i.hxx @@ -55,7 +55,6 @@ typedef struct long orientation; bool measure_abs; const char * splitting_policy; - bool P1P0_bary_method; std::string coupling; std::string ior; Engines::IORTab* tior; @@ -91,8 +90,7 @@ namespace ParaMEDMEM CORBA::Double max_distance_for_3Dsurf_intersect, CORBA::Long orientation, CORBA::Boolean measure_abs, - const char * splitting_policy, - CORBA::Boolean P1P0_bary_method ) throw(SALOME::SALOME_Exception); + const char * splitting_policy ) throw(SALOME::SALOME_Exception); virtual void initializeCoupling(const char * coupling, const char * ior) throw(SALOME::SALOME_Exception); virtual void terminateCoupling(const char * coupling) throw(SALOME::SALOME_Exception); virtual void _getOutputField(const char * coupling, MEDCouplingFieldDouble* field);