case PointLocator:
intersector=new PointLocator3DIntersectorP1P0<MyMeshType,MatrixType>(targetMesh, srcMesh, getPrecision());
break;
+ case Barycentric:
+ intersector=new PolyhedronIntersectorP1P0Bary<MyMeshType,MatrixType>(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<MyMeshType,MatrixType>(targetMesh, srcMesh, getSplittingPolicy());
- else
- throw INTERP_KERNEL::Exception("Invalid 3D intersection type specified : must be Triangle.");
- }
else if(methC=="P1P1")
{
switch(InterpolationOptions::getIntersectionType())
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";
_orientation=0;
_measure_abs=true;
_splitting_policy=PLANAR_FACE_5;
- _P1P0_bary_method=false;
}
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");
}
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)
{
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,
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;
_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));
}
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();
}
namespace INTERP_KERNEL
{
- typedef enum { Triangulation, Convex, Geometric2D, PointLocator } IntersectionType;
+ typedef enum { Triangulation, Convex, Geometric2D, PointLocator, Barycentric, BarycentricGeo2D } IntersectionType;
/*!
* \class InterpolationOptions
int _orientation ;
bool _measure_abs;
SplittingPolicy _splitting_policy ;
- bool _P1P0_bary_method; // issue 0020440
-
public:
InterpolationOptions() { init(); }
int getPrintLevel() const { return _print_level; }
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();
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);
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[];
InterpolationOptions::getPrecision(),
InterpolationOptions::getOrientation());
break;
+ case Barycentric:
+ intersector=new TriangulationIntersector<MyMeshType,MatrixType,PlanarIntersectorP1P0Bary>(myMeshT,myMeshS,_dim_caracteristic,
+ InterpolationOptions::getPrecision(),
+ InterpolationOptions::getMaxDistance3DSurfIntersect(),
+ InterpolationOptions::getMedianPlane(),
+ InterpolationOptions::getOrientation(),
+ InterpolationOptions::getPrintLevel());
+ break;
+ case BarycentricGeo2D:
+ intersector=new Geometric2DIntersector<MyMeshType,MatrixType,PlanarIntersectorP1P0Bary>(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<MyMeshType,MatrixType,PlanarIntersectorP1P0Bary>(myMeshT,myMeshS,_dim_caracteristic,
- InterpolationOptions::getPrecision(),
- InterpolationOptions::getMaxDistance3DSurfIntersect(),
- InterpolationOptions::getMedianPlane(),
- InterpolationOptions::getOrientation(),
- InterpolationOptions::getPrintLevel());
- break;
- case Convex:
- intersector=new ConvexIntersector<MyMeshType,MatrixType,PlanarIntersectorP1P0Bary>(myMeshT,myMeshS,_dim_caracteristic,
- InterpolationOptions::getPrecision(),
- InterpolationOptions::getMaxDistance3DSurfIntersect(),
- InterpolationOptions::getMedianPlane(),
- InterpolationOptions::getDoRotate(),
- InterpolationOptions::getOrientation(),
- InterpolationOptions::getPrintLevel());
- break;
- case Geometric2D:
- intersector=new Geometric2DIntersector<MyMeshType,MatrixType,PlanarIntersectorP1P0Bary>(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())
MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation2D myInterpolator;
- myInterpolator.setP1P0BaryMethod(true);
std::vector<std::map<int,double> > 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);
MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3DSurf myInterpolator;
- myInterpolator.setP1P0BaryMethod(true);
std::vector<std::map<int,double> > 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);
MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
INTERP_KERNEL::Interpolation3D myInterpolator;
- myInterpolator.setP1P0BaryMethod(true);
std::vector<std::map<int,double> > res;
myInterpolator.setPrecision(1e-12);
+ myInterpolator.setIntersectionType(INTERP_KERNEL::Barycentric);
myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
CPPUNIT_ASSERT_EQUAL(5,(int)res.size());
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())