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

Public Member Functions

 InterpKernelDEC ()
 
 InterpKernelDEC (ProcessorGroup &source_group, ProcessorGroup &target_group)
 
 InterpKernelDEC (const std::set< int > &src_ids, const std::set< int > &trg_ids, const MPI_Comm &world_comm=MPI_COMM_WORLD)
 
void prepareSourceDE ()
 
void prepareTargetDE ()
 
void recvData ()
 
void recvData (double time)
 
void sendData ()
 
void sendData (double time, double deltatime)
 
void synchronize ()
 
virtual ~InterpKernelDEC ()
 
- Public Member Functions inherited from MEDCoupling::DisjointDEC
void attachLocalField (MEDCouplingFieldDouble *field)
 
void attachLocalField (const ParaFIELD *field, bool ownPt=false)
 
void attachLocalField (const ICoCo::MEDField *field)
 
virtual void computeProcGroup ()
 
 DisjointDEC ()
 
 DisjointDEC (ProcessorGroup &source_group, ProcessorGroup &target_group)
 
 DisjointDEC (const DisjointDEC &)
 
 DisjointDEC (const std::set< int > &src_ids, const std::set< int > &trg_ids, const MPI_Comm &world_comm=MPI_COMM_WORLD)
 
ProcessorGroupgetSourceGrp () const
 
ProcessorGroupgetTargetGrp () const
 
bool isInSourceSide () const
 
bool isInTargetSide () const
 
bool isInUnion () const
 
DisjointDECoperator= (const DisjointDEC &s)
 
void renormalizeTargetField (bool isWAbs)
 
void sendRecvData (bool way=true)
 
void setNature (NatureOfField nature)
 
virtual ~DisjointDEC ()
 
- Public Member Functions inherited from MEDCoupling::DEC
void copyFrom (const DEC &other)
 
 DEC ()
 
virtual ~DEC ()
 
- Public Member Functions inherited from MEDCoupling::DECOptions
 DECOptions ()
 
 DECOptions (const DECOptions &deco)
 
AllToAllMethod getAllToAllMethod () const
 
bool getAsynchronous () const
 
bool getForcedRenormalization () const
 
const std::string & getMethod () const
 
TimeInterpolationMethod getTimeInterpolationMethod () const
 
void setAllToAllMethod (AllToAllMethod sp)
 
void setAsynchronous (bool dr)
 
void setForcedRenormalization (bool dr)
 
void setMethod (const char *m)
 
void setTimeInterpolationMethod (TimeInterpolationMethod it)
 
- 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)
 

Additional Inherited Members

- Static Public Member Functions inherited from INTERP_KERNEL::InterpolationOptions
static void CheckAndSplitInterpolationMethod (const std::string &method, std::string &srcMeth, std::string &trgMeth)
 
- 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::DisjointDEC
void checkPartitionGroup () const
 
void cleanInstance ()
 
void compareFieldAndMethod () const throw (INTERP_KERNEL::Exception)
 
void copyInstance (const DisjointDEC &other)
 
- Protected Attributes inherited from MEDCoupling::DisjointDEC
const CommInterface_comm_interface
 
const ParaFIELD_local_field
 
bool _owns_field
 
bool _owns_groups
 
ProcessorGroup_source_group
 
ProcessorGroup_target_group
 
MPI_Comm _union_comm
 
ProcessorGroup_union_group
 

Detailed Description

Overview

The InterpKernelDEC enables the remapping (or interpolation) of fields between two parallel codes.

The projection methodology is based on the algorithms of INTERP_KERNEL, that is to say, they work in a similar fashion than what the sequential remapper does. The following projection methods are supported: P0->P0 (the most common case), P1->P0, P0->P1.

The computation is possible for 3D meshes, 2D meshes, and 3D-surface meshes. Dimensions must be identical for code A and code B (for instance, though it could be desirable, it is not yet possible to couple 3D surfaces with 2D surfaces).

The name "InterpKernelDEC" comes from the fact that this class uses exactly the same algorithms as the sequential remapper. Both this class and the sequential MEDCouplingRemapper are built on top of the INTERP_KERNEL algorithms (notably the computation of the intersection volumes).

Among the important properties inherited from the parent abstract class DisjointDEC, the two processor groups (source and target) must have a void intersection.

NonCoincident_small.png
Transfer of a field supported by a quadrangular mesh to a triangular mesh

.

In the figure above we see the transfer of a field based on a quadrangular mesh to a new field supported by a triangular mesh. In a P0-P0 interpolation, to obtain the value on a triangle, the values on the quadrangles are weighted by their intersection area and summed.

A typical use of InterpKernelDEC encompasses two distinct phases :

  • A setup phase during which the intersection volumes are computed and the communication structures are setup. This corresponds to calling the InterpKernelDEC::synchronize() method.
  • A running phase during which the projections are actually performed. This corresponds to the calls to sendData() and recvData() which actually trigger the data exchange. The data exchange are synchronous in the current version of the library so that recvData() and sendData() calls must be synchronized on code A and code B processor groups.

The following code excerpt illustrates a typical use of the InterpKernelDEC class.

...
InterpKernelDEC dec(groupA, groupB);
dec.attachLocalField(field);
dec.synchronize();
if (groupA.containsMyRank())
dec.recvData();
else if (groupB.containsMyRank())
dec.sendData();
...

A remapping of the field from the source mesh to the target mesh is performed by the function synchronise(), which computes the interpolation matrix.

Computing the field on the receiving side can be expressed in terms of a matrix-vector product : $ \phi_t=W.\phi_s$, with $ \phi_t $ the field on the target side and $ \phi_s $ the field on the source side. When remapping a 3D surface to another 3D surface, a projection phase is necessary to match elements from both sides. Care must be taken when defining this projection to obtain a conservative remapping.

In the P0-P0 case, this matrix is a plain rectangular matrix with coefficients equal to the intersection areas between triangle and quadrangles. For instance, in the above figure, the matrix is :

\[ \begin{tabular}{|cccc|} 0.72 & 0 & 0.2 & 0 \\ 0.46 & 0 & 0.51 & 0.03\\ 0.42 & 0.53 & 0 & 0.05\\ 0 & 0 & 0.92 & 0.05 \\ \end{tabular} \]

Options

On top of the usual DEC options, the options supported by InterpKernelDEC objects are related to the underlying intersector class. All the options available in the intersector objects are available for the InterpKernelDEC object. The various options available for intersectors can be reviewed in Intersectors and point locators.

For instance :

InterpKernelDEC dec(source_group, target_group);
dec.attachLocalField(field);
dec.setDoRotate(false);
dec.setPrecision(1e-12);
dec.synchronize();
Warning
{ Options must be set before calling the synchronize method. }

Constructor & Destructor Documentation

MEDCoupling::InterpKernelDEC::InterpKernelDEC ( )
MEDCoupling::InterpKernelDEC::InterpKernelDEC ( ProcessorGroup source_group,
ProcessorGroup target_group 
)

This constructor creates an InterpKernelDEC which has source_group as a working side and target_group as an idle side. All the processors will actually participate, but intersection computations will be performed on the working side during the synchronize() phase. The constructor must be called synchronously on all processors of both processor groups. The source group and target group MUST form a partition of all the procs within the communicator passed as 'world_comm' when building the group.

Parameters
source_groupworking side ProcessorGroup
target_grouplazy side ProcessorGroup
MEDCoupling::InterpKernelDEC::InterpKernelDEC ( const std::set< int > &  src_ids,
const std::set< int > &  trg_ids,
const MPI_Comm &  world_comm = MPI_COMM_WORLD 
)

Creates an InterpKernelDEC from a set of source procs IDs and target group IDs. The difference with the ctor using groups is that the set of procs might not cover entirely MPI_COMM_WORLD (a sub-communicator holding the union of source and target procs is recreated internally).

MEDCoupling::InterpKernelDEC::~InterpKernelDEC ( )
virtual

Member Function Documentation

void MEDCoupling::InterpKernelDEC::synchronize ( )
virtual

Synchronization process for exchanging topologies.

This method prepares all the structures necessary for sending data from a processor group to the other. It uses the mesh underlying the fields that have been set with attachLocalField method. It works in four steps :

  1. Bounding boxes are computed for each sub-domain,
  2. The lazy side mesh parts that are likely to intersect the working side local processor are sent to the working side,
  3. The working side calls the interpolation kernel to compute the intersection between local and imported mesh.
  4. The lazy side is updated so that it knows the structure of the data that will be sent by the working side during a sendData() call.

Implements MEDCoupling::DisjointDEC.

References MEDCoupling::DisjointDEC::_local_field, MEDCoupling::DECOptions::_method, MEDCoupling::DisjointDEC::_source_group, MEDCoupling::DisjointDEC::_target_group, MEDCoupling::DisjointDEC::_union_group, MEDCoupling::InterpolationMatrix::addContribution(), MEDCoupling::ProcessorGroup::containsMyRank(), MEDCoupling::RefCountObjectOnly::decrRef(), MEDCoupling::InterpolationMatrix::finishContributionL(), MEDCoupling::InterpolationMatrix::finishContributionW(), MEDCoupling::DisjointDEC::isInUnion(), MEDCoupling::InterpolationMatrix::prepare(), MEDCoupling::ProcessorGroup::size(), and MEDCoupling::ProcessorGroup::translateRank().

void MEDCoupling::InterpKernelDEC::recvData ( double  time)

Receives the data at time time in asynchronous mode. The value of the field will be time-interpolated from the field values received.

Parameters
timetime at which the value is desired

References MEDCoupling::InterpolationMatrix::getAccessDEC(), and recvData().

void MEDCoupling::InterpKernelDEC::sendData ( double  time,
double  deltatime 
)

Sends the data available at time time in asynchronous mode.

Parameters
timetime at which the value is available
deltatimetime interval between the value presently sent and the next one.

References MEDCoupling::InterpolationMatrix::getAccessDEC(), and sendData().

void MEDCoupling::InterpKernelDEC::prepareSourceDE ( )
virtual
void MEDCoupling::InterpKernelDEC::prepareTargetDE ( )
virtual