X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FINTERP_KERNEL%2FInterpolationOptions.cxx;h=0d70a7d0ab28307a186ab1c190d710539075748f;hb=b219559763498c4bd10c730cd3d2c62b1eed45db;hp=87f77ab0f8276699b1ce7a7484c5706beb6049e1;hpb=887d0e1efce4f46f68d2596dcd801f02f5c1f99e;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNEL/InterpolationOptions.cxx b/src/INTERP_KERNEL/InterpolationOptions.cxx index 87f77ab0f..0d70a7d0a 100644 --- a/src/INTERP_KERNEL/InterpolationOptions.cxx +++ b/src/INTERP_KERNEL/InterpolationOptions.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// Copyright (C) 2007-2019 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 // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,6 +19,8 @@ // Author : Anthony Geay (CEA/DEN) #include "InterpolationOptions.hxx" +#include "InterpKernelGeo2DPrecision.hxx" +#include "InterpKernelException.hxx" #include @@ -28,6 +30,8 @@ const double INTERP_KERNEL::InterpolationOptions::DFT_SURF3D_ADJ_EPS=1.e-4; const double INTERP_KERNEL::InterpolationOptions::DFT_MAX_DIST_3DSURF_INTERSECT=-1.; +const double INTERP_KERNEL::InterpolationOptions::DFT_MIN_DOT_BTW_3DSURF_INTERSECT=-1.; + const char INTERP_KERNEL::InterpolationOptions::PRECISION_STR[]="Precision"; const char INTERP_KERNEL::InterpolationOptions::MEDIANE_PLANE_STR[]="MedianPlane"; @@ -38,6 +42,8 @@ const char INTERP_KERNEL::InterpolationOptions::BOUNDING_BOX_ADJ_ABS_STR[]="Boun const char INTERP_KERNEL::InterpolationOptions::MAX_DISTANCE_3DSURF_INSECT_STR[]="MaxDistance3DSurfIntersect"; +const char INTERP_KERNEL::InterpolationOptions::MIN_DOT_BTW_3DSURF_INSECT_STR[]="MinDotBetween3DSurfIntersect"; + const char INTERP_KERNEL::InterpolationOptions::PRINT_LEV_STR[]="PrintLevel"; const char INTERP_KERNEL::InterpolationOptions::DO_ROTATE_STR[]="DoRotate"; @@ -58,6 +64,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"; @@ -76,10 +86,10 @@ void INTERP_KERNEL::InterpolationOptions::init() _bounding_box_adjustment=DFT_SURF3D_ADJ_EPS; _bounding_box_adjustment_abs=0.; _max_distance_for_3Dsurf_intersect=DFT_MAX_DIST_3DSURF_INTERSECT; + _min_dot_btw_3Dsurf_intersect=DFT_MIN_DOT_BTW_3DSURF_INTERSECT; _orientation=0; _measure_abs=true; _splitting_policy=PLANAR_FACE_5; - _P1P0_bary_method=false; } std::string INTERP_KERNEL::InterpolationOptions::getIntersectionTypeRepr() const @@ -92,6 +102,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"); } @@ -123,6 +137,11 @@ bool INTERP_KERNEL::InterpolationOptions::setOptionDouble(const std::string& key setMaxDistance3DSurfIntersect(value); return true; } + else if(key==MIN_DOT_BTW_3DSURF_INSECT_STR) + { + setMinDotBtwPlane3DSurfIntersect(value); + return true; + } else return false; } @@ -178,6 +197,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,12 +252,10 @@ 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, +bool INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(int print_level, std::string intersection_type, double precision, double median_plane, @@ -236,10 +263,9 @@ bool INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(long print_lev double bounding_box_adjustment, double bounding_box_adjustment_abs, double max_distance_for_3Dsurf_intersect, - long orientation, + int orientation, bool measure_abs, - std::string splitting_policy, - bool P1P0_bary_method ) + std::string splitting_policy) { _print_level=print_level; _precision=precision; @@ -250,7 +276,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)); } @@ -265,10 +290,26 @@ std::string INTERP_KERNEL::InterpolationOptions::printOptions() const oss << "Bounding box adj : " << _bounding_box_adjustment << std::endl; oss << "Bounding box adj abs : " << _bounding_box_adjustment_abs << std::endl; oss << "Max distance for 3DSurf intersect : " << _max_distance_for_3Dsurf_intersect << std::endl; + oss << "Min dot between plane for 3DSurf intersect : " << _min_dot_btw_3Dsurf_intersect << std::endl; 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(); } + +void INTERP_KERNEL::InterpolationOptions::CheckAndSplitInterpolationMethod(const std::string& method, std::string& srcMeth, std::string& trgMeth) +{ + const int NB_OF_METH_MANAGED=4; + const char *METH_MANAGED[NB_OF_METH_MANAGED]={"P0P0","P0P1","P1P0","P1P1"}; + bool found=false; + for(int i=0;i