Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MEDCoupling::MEDCouplingRemapper Class Reference
Inheritance diagram for MEDCoupling::MEDCouplingRemapper:
Collaboration diagram for MEDCoupling::MEDCouplingRemapper:

Public Member Functions

const std::vector< std::map
< int, double > > & 
getCrudeMatrix () const
 
int getInterpolationMatrixPolicy () const
 
double getMaxValueInCrudeMatrix () const
 
int getNumberOfColsOfMatrix () const
 
 MEDCouplingRemapper ()
 
int nullifiedTinyCoeffInCrudeMatrix (double scaleFactor)
 
int nullifiedTinyCoeffInCrudeMatrixAbs (double maxValAbs)
 
void partialTransfer (const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField)
 
int prepare (const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string &method)
 
int prepareEx (const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target)
 
void reverseTransfer (MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue)
 
MEDCouplingFieldDoublereverseTransferField (const MEDCouplingFieldDouble *targetField, double dftValue)
 
void setInterpolationMatrixPolicy (int newInterpMatPol)
 
bool setOptionDouble (const std::string &key, double value)
 
bool setOptionInt (const std::string &key, int value)
 
bool setOptionString (const std::string &key, const std::string &value)
 
void transfer (const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue)
 
MEDCouplingFieldDoubletransferField (const MEDCouplingFieldDouble *srcField, double dftValue)
 
 ~MEDCouplingRemapper ()
 
- Public Member Functions inherited from MEDCoupling::TimeLabel
void declareAsNew () const
 
std::size_t getTimeOfThis () const
 
TimeLabeloperator= (const TimeLabel &other)
 
- Public Member Functions inherited from INTERP_KERNEL::InterpolationOptions
void copyOptions (const InterpolationOptions &other)
 
std::string filterInterpolationMethod (const std::string &meth) const
 
double getArcDetectionPrecision () const
 
double getBoundingBoxAdjustment () const
 
double getBoundingBoxAdjustmentAbs () const
 
bool getDoRotate () const
 
IntersectionType getIntersectionType () const
 
std::string getIntersectionTypeRepr () const
 
double getMaxDistance3DSurfIntersect () const
 
bool getMeasureAbsStatus () const
 
double getMedianPlane () const
 
double getMinDotBtwPlane3DSurfIntersect () const
 
int getOrientation () const
 
double getPrecision () const
 
int getPrintLevel () const
 
SplittingPolicy getSplittingPolicy () const
 
std::string getSplittingPolicyRepr () const
 
void init ()
 
 InterpolationOptions ()
 
std::string printOptions () const
 
void setArcDetectionPrecision (double p)
 
void setBoundingBoxAdjustment (double bba)
 
void setBoundingBoxAdjustmentAbs (double bba)
 
void setDoRotate (bool dr)
 
bool setInterpolationOptions (long print_level, std::string intersection_type, double precision, double median_plane, bool do_rotate, double bounding_box_adjustment, double bounding_box_adjustment_abs, double max_distance_for_3Dsurf_intersect, long orientation, bool measure_abs, std::string splitting_policy)
 
void setIntersectionType (IntersectionType it)
 
void setMaxDistance3DSurfIntersect (double bba)
 
void setMeasureAbsStatus (bool newStatus)
 
void setMedianPlane (double mp)
 
void setMinDotBtwPlane3DSurfIntersect (double v)
 
bool setOptionDouble (const std::string &key, double value)
 
bool setOptionInt (const std::string &key, int value)
 
bool setOptionString (const std::string &key, const std::string &value)
 
void setOrientation (int o)
 
void setPrecision (double p)
 
void setPrintLevel (int pl)
 
void setSplittingPolicy (SplittingPolicy sp)
 

Static Public Member Functions

static std::string BuildMethodFrom (const std::string &meth1, const std::string &meth2)
 
static void PrintMatrix (const std::vector< std::map< int, double > > &m)
 
- Static Public Member Functions inherited from INTERP_KERNEL::InterpolationOptions
static void CheckAndSplitInterpolationMethod (const std::string &method, std::string &srcMeth, std::string &trgMeth)
 

Additional Inherited Members

- Static Public Attributes inherited from INTERP_KERNEL::InterpolationOptions
static const char ARC_DETECTION_PRECISION_STR [] ="ArcDetectionPrecision"
 
static const char BARYCENTRIC_INTERSECT_STR [] ="Barycentric"
 
static const char BARYCENTRICGEO2D_INTERSECT_STR [] ="BarycentricGeo2D"
 
static const char BOUNDING_BOX_ADJ_ABS_STR [] ="BoundingBoxAdjustmentAbs"
 
static const char BOUNDING_BOX_ADJ_STR [] ="BoundingBoxAdjustment"
 
static const char CONVEX_INTERSECT2D_STR [] ="Convex"
 
static const char DO_ROTATE_STR [] ="DoRotate"
 
static const char GENERAL_SPLIT_24_STR [] ="GENERAL_24"
 
static const char GENERAL_SPLIT_48_STR [] ="GENERAL_48"
 
static const char GEOMETRIC_INTERSECT2D_STR [] ="Geometric2D"
 
static const char INTERSEC_TYPE_STR [] ="IntersectionType"
 
static const char MAX_DISTANCE_3DSURF_INSECT_STR [] ="MaxDistance3DSurfIntersect"
 
static const char MEASURE_ABS_STR [] ="MeasureAbs"
 
static const char MEDIANE_PLANE_STR [] ="MedianPlane"
 
static const char MIN_DOT_BTW_3DSURF_INSECT_STR [] ="MinDotBetween3DSurfIntersect"
 
static const char ORIENTATION_STR [] ="Orientation"
 
static const char PLANAR_SPLIT_FACE_5_STR [] ="PLANAR_FACE_5"
 
static const char PLANAR_SPLIT_FACE_6_STR [] ="PLANAR_FACE_6"
 
static const char POINTLOCATOR_INTERSECT_STR [] ="PointLocator"
 
static const char PRECISION_STR [] ="Precision"
 
static const char PRINT_LEV_STR [] ="PrintLevel"
 
static const char SPLITTING_POLICY_STR [] ="SplittingPolicy"
 
static const char TRIANGULATION_INTERSECT2D_STR [] ="Triangulation"
 
- Protected Member Functions inherited from MEDCoupling::TimeLabel
void forceTimeOfThis (const TimeLabel &other) const
 
 TimeLabel ()
 
void updateTimeWith (const TimeLabel &other) const
 
virtual ~TimeLabel ()
 

Constructor & Destructor Documentation

MEDCouplingRemapper::MEDCouplingRemapper ( )
MEDCouplingRemapper::~MEDCouplingRemapper ( )

Member Function Documentation

int MEDCouplingRemapper::prepare ( const MEDCouplingMesh srcMesh,
const MEDCouplingMesh targetMesh,
const std::string &  method 
)

This method is the second step of the remapping process. The remapping process works in three phases :

  • Set remapping options appropriately
  • The computation of remapping matrix
  • Apply the matrix vector multiply to obtain the result of the remapping

This method performs the second step (computation of remapping matrix) which may be CPU-time consuming. This phase is also the most critical (where the most tricky algorithm) in the remapping process. Strictly speaking to perform the computation of the remapping matrix the field templates source-side and target-side is required (which is the case of MEDCouplingRemapper::prepareEx). So this method is less precise but a more user friendly way to compute a remapping matrix.

Parameters
[in]srcMeshthe source mesh
[in]targetMeshthe target mesh
[in]methodA string obtained by aggregation of the spatial discretisation string representation of source field and target field. The string representation is those returned by MEDCouplingFieldDiscretization::getStringRepr. Example : "P0" is for cell discretization. "P1" is for node discretization. So "P0P1" for method parameter means from a source cell field (lying on srcMesh) to a target node field (lying on targetMesh).
See Also
MEDCouplingRemapper::prepareEx

References INTERP_KERNEL::InterpolationOptions::CheckAndSplitInterpolationMethod(), MEDCoupling::MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(), MEDCoupling::MEDCouplingFieldTemplate::New(), prepareEx(), and MEDCoupling::MEDCouplingField::setMesh().

int MEDCouplingRemapper::prepareEx ( const MEDCouplingFieldTemplate src,
const MEDCouplingFieldTemplate target 
)

This method is the generalization of MEDCouplingRemapper::prepare. Indeed, MEDCouplingFieldTemplate instances gives all required information to compute the remapping matrix. This method must be used instead of MEDCouplingRemapper::prepare if Gauss point to Gauss point must be applied.

Parameters
[in]srcis the field template source side.
[in]targetis the field template target side.
See Also
MEDCouplingRemapper::prepare

References MEDCoupling::MEDCouplingField::getMesh().

Referenced by prepare().

void MEDCouplingRemapper::transfer ( const MEDCouplingFieldDouble srcField,
MEDCouplingFieldDouble targetField,
double  dftValue 
)

This method performs the operation source to target using matrix computed in MEDCoupling::MEDCouplingRemapper::prepare method. If meshes of srcField and targetField do not match exactly those given into prepare method an exception will be thrown.

Parameters
[in]srcFieldis the source field from which the interpolation will be done. The mesh into srcField should be the same than those specified on MEDCoupling::MEDCouplingRemapper::prepare.
[in/out]targetField the destination field with the allocated array in which all tuples will be overwritten.
[in]dftValueis the value that will be assigned in the targetField to each entity of target mesh (entity depending on the method selected on prepare invocation) that is not intercepted by any entity of source mesh. For example in "P0P0" case (cell-cell) if a cell in target mesh is not overlapped by any source cell the dftValue value will be attached on that cell in the returned targetField. In some cases a target cell not intercepted by any source cell is a bug so in this case it is advised to set a huge value (1e300 for example) to dftValue to quickly point to the problem. But for users doing parallelism a target cell can be intercepted by a source cell on a different process. In this case 0. assigned to dftValue is more appropriate.
See Also
transferField

Referenced by transferField().

void MEDCouplingRemapper::partialTransfer ( const MEDCouplingFieldDouble srcField,
MEDCouplingFieldDouble targetField 
)

This method is equivalent to MEDCoupling::MEDCouplingRemapper::transfer except that here targetField is a in/out parameter. If an entity (cell for example) in targetField is not fetched by any entity (cell for example) of srcField, the value in targetField is let unchanged. This method requires that targetField was fully defined and allocated. If the array is not allocated an exception will be thrown.

Parameters
[in]srcFieldis the source field from which the interpolation will be done. The mesh into srcField should be the same than those specified on MEDCoupling::MEDCouplingRemapper::prepare.
[in,out]targetFieldthe destination field with the allocated array in which only tuples whose entities are fetched by interpolation will be overwritten only.
MEDCouplingFieldDouble * MEDCouplingRemapper::transferField ( const MEDCouplingFieldDouble srcField,
double  dftValue 
)

This method performs the operation source to target using matrix computed in MEDCoupling::MEDCouplingRemapper::prepare method. If mesh of srcField does not match exactly those given into prepare method an exception will be thrown.

Parameters
[in]srcFieldis the source field from which the interpolation will be done. The mesh into srcField should be the same than those specified on MEDCoupling::MEDCouplingRemapper::prepare.
[in]dftValueis the value that will be assigned in the targetField to each entity of target mesh (entity depending on the method selected on prepare invocation) that is not intercepted by any entity of source mesh. For example in "P0P0" case (cell-cell) if a cell in target mesh is not overlapped by any source cell the dftValue value will be attached on that cell in the returned targetField. In some cases a target cell not intercepted by any source cell is a bug so in this case it is advised to set a huge value (1e300 for example) to dftValue to quickly point to the problem. But for users doing parallelism a target cell can be intercepted by a source cell on a different process. In this case 0. assigned to dftValue is more appropriate.
Returns
destination field to be deallocated by the caller.
See Also
transfer

References MEDCoupling::MEDCouplingFieldT< T >::checkConsistencyLight(), MEDCoupling::MEDCouplingFieldT< T >::copyAllTinyAttrFrom(), MEDCoupling::MEDCouplingField::getDiscretization(), MEDCoupling::MEDCouplingField::getNature(), MEDCoupling::MEDCouplingFieldDiscretization::getStringRepr(), MEDCoupling::MEDCouplingFieldT< T >::getTimeDiscretization(), MEDCoupling::MEDCouplingFieldDouble::New(), MEDCoupling::MEDCouplingField::setNature(), and transfer().

bool MEDCouplingRemapper::setOptionInt ( const std::string &  key,
int  value 
)

This method does nothing more than inherited INTERP_KERNEL::InterpolationOptions::setOptionInt method. This method is here only for automatic CORBA generators.

References INTERP_KERNEL::InterpolationOptions::setOptionInt().

bool MEDCouplingRemapper::setOptionDouble ( const std::string &  key,
double  value 
)

This method does nothing more than inherited INTERP_KERNEL::InterpolationOptions::setOptionInt method. This method is here only for automatic CORBA generators.

References INTERP_KERNEL::InterpolationOptions::setOptionDouble().

bool MEDCouplingRemapper::setOptionString ( const std::string &  key,
const std::string &  value 
)

This method does nothing more than inherited INTERP_KERNEL::InterpolationOptions::setOptionInt method. This method is here only for automatic CORBA generators.

References INTERP_KERNEL::InterpolationOptions::setOptionString().

int MEDCouplingRemapper::getInterpolationMatrixPolicy ( ) const

This method returns the interpolation matrix policy. This policy specifies which interpolation matrix method to keep or prefered. If interpolation matrix policy is :

  • set to IK_ONLY_PREFERED (0) (the default) : the INTERP_KERNEL only method is prefered. That is to say, if it is possible to treat the case regarding spatial discretization of source and target with INTERP_KERNEL only method, INTERP_KERNEL only method will be performed. If not, the not only INTERP_KERNEL method will be attempt.
  • set to NOT_IK_ONLY_PREFERED (1) : the NOT only INTERP_KERNEL method is prefered. That is to say, if it is possible to treat the case regarding spatial discretization of source and target with NOT only INTERP_KERNEL method, NOT only INTERP_KERNEL method, will be performed. If not, the INTERP_KERNEL only method will be attempt.
  • IK_ONLY_FORCED (2) : Only INTERP_KERNEL only method will be launched.
  • NOT_IK_ONLY_FORCED (3) : Only NOT INTERP_KERNEL only method will be launched.
See Also
MEDCouplingRemapper::setInterpolationMatrixPolicy
void MEDCouplingRemapper::setInterpolationMatrixPolicy ( int  newInterpMatPol)

This method sets a new interpolation matrix policy. The default one is IK_PREFERED (0). The input is of type int to be dealt by standard Salome CORBA component generators. This method throws an INTERP_KERNEL::Exception if a the input integer is not in the available possibilities, that is to say not in [0 (IK_PREFERED) , 1 (NOT_IK_PREFERED), 2 (IK_ONLY_FORCED), 3 (NOT_IK_ONLY_FORCED)].

If interpolation matrix policy is :

  • set to IK_ONLY_PREFERED (0) (the default) : the INTERP_KERNEL only method is prefered. That is to say, if it is possible to treat the case regarding spatial discretization of source and target with INTERP_KERNEL only method, INTERP_KERNEL only method will be performed. If not, the not only INTERP_KERNEL method will be attempt.
  • set to NOT_IK_ONLY_PREFERED (1) : the NOT only INTERP_KERNEL method is prefered. That is to say, if it is possible to treat the case regarding spatial discretization of source and target with NOT only INTERP_KERNEL method, NOT only INTERP_KERNEL method, will be performed. If not, the INTERP_KERNEL only method will be attempt.
  • IK_ONLY_FORCED (2) : Only INTERP_KERNEL only method will be launched.
  • NOT_IK_ONLY_FORCED (3) : Only NOT INTERP_KERNEL only method will be launched.

newInterpMatPol the new interpolation matrix method policy. This parameter is of type int and not of type MEDCoupling::InterpolationMatrixPolicy for automatic generation of CORBA component.

See Also
MEDCouplingRemapper::getInterpolationMatrixPolicy

References MEDCoupling::IK_ONLY_FORCED, MEDCoupling::IK_ONLY_PREFERED, MEDCoupling::NOT_IK_ONLY_FORCED, and MEDCoupling::NOT_IK_ONLY_PREFERED.

int MEDCouplingRemapper::nullifiedTinyCoeffInCrudeMatrixAbs ( double  maxValAbs)

This method is supposed to be called , if needed, right after MEDCouplingRemapper::prepare or MEDCouplingRemapper::prepareEx. If not the behaviour is unpredictable. This method works on precomputed this->_matrix. All coefficients in the matrix is lower than maxValAbs this coefficient is set to 0. That is to say that its entry disappear from the map storing the corresponding row in the data storage of sparse crude matrix. This method is useful to correct at a high level some problems linked to precision. Indeed, with some natures of field some threshold effect can occur.

Parameters
[in]maxValAbsis a limit behind which a coefficient is set to 0. maxValAbs is expected to be positive, if not this method do nothing.
Returns
a positive value that tells the number of coefficients put to 0. The 0 returned value means that the matrix has remained unchanged.
See Also
MEDCouplingRemapper::nullifiedTinyCoeffInCrudeMatrix

Referenced by nullifiedTinyCoeffInCrudeMatrix().

int MEDCouplingRemapper::nullifiedTinyCoeffInCrudeMatrix ( double  scaleFactor)

This method is supposed to be called , if needed, right after MEDCouplingRemapper::prepare or MEDCouplingRemapper::prepareEx. If not the behaviour is unpredictable. This method works on precomputed this->_matrix. All coefficients in the matrix is lower than delta multiplied by scaleFactor this coefficient is set to 0. That is to say that its entry disappear from the map storing the corresponding row in the data storage of sparse crude matrix. delta is the value returned by MEDCouplingRemapper::getMaxValueInCrudeMatrix method. This method is useful to correct at a high level some problems linked to precision. Indeed, with some natures of field some threshold effect can occur.

Parameters
[in]scaleFactoris the scale factor from which coefficients lower than scaleFactor times range width of coefficients are set to zero.
Returns
a positive value that tells the number of coefficients put to 0. The 0 returned value means that the matrix has remained unchanged. If -1 is returned it means that all coefficients are null.
See Also
MEDCouplingRemapper::nullifiedTinyCoeffInCrudeMatrixAbs

References getMaxValueInCrudeMatrix(), and nullifiedTinyCoeffInCrudeMatrixAbs().

double MEDCouplingRemapper::getMaxValueInCrudeMatrix ( ) const

This method is supposed to be called , if needed, right after MEDCouplingRemapper::prepare or MEDCouplingRemapper::prepareEx. If not the behaviour is unpredictable. This method returns the maximum of the absolute values of coefficients into the sparse crude matrix. The returned value is positive.

Referenced by nullifiedTinyCoeffInCrudeMatrix().

const std::vector< std::map< int, double > > & MEDCouplingRemapper::getCrudeMatrix ( ) const
int MEDCouplingRemapper::getNumberOfColsOfMatrix ( ) const

Returns the number of columns of matrix returned by MEDCouplingRemapper::getCrudeMatrix method.

void MEDCouplingRemapper::PrintMatrix ( const std::vector< std::map< int, double > > &  m)
static
std::string MEDCouplingRemapper::BuildMethodFrom ( const std::string &  meth1,
const std::string &  meth2 
)
static