3.1.4.1.2. c3po.mpi.mpiExchangeMethods.MPISharedRemapping module

Inheritance diagram of c3po.mpi.mpiExchangeMethods.MPISharedRemapping

Contain the class SharedRemapping.

class c3po.mpi.mpiExchangeMethods.MPISharedRemapping.MPIRemapper(meshAlignment=False, offset=None, rescaling=1.0, rotation=0.0, outsideCellsScreening=False, reverseTransformations=True)

Bases: object

Allow to share the mesh projection for different MPISharedRemapping objects by building them with the same instance of this class.

__init__(meshAlignment=False, offset=None, rescaling=1.0, rotation=0.0, outsideCellsScreening=False, reverseTransformations=True)

Build a MPIRemapper object.

Warning

It is mandatory to call the terminate() method after use, otherwise MPI may be badly ended.

Warning

The option outsideCellsScreening is not ready to use yet.

There seems to be a bug in MEDCoupling that may cause wrong results when rescaling is used with a source mesh of nature IntensiveConservation. In this case, it is necessary to use reverseTransformations=False and to never perform a remapping on a field whose underling mesh has not been rescaled.

Parameters:
  • meshAlignment (bool) – If set to True, at the initialization phase of the MPIRemapper object, meshes are translated such as their “bounding box” are radially centred on (x = 0., y = 0.) and, if the meshes are 3D, have zmin = 0.

  • offset – Value of the offset between the source and the target meshes (>0 on z means that the source mesh is above the target one). The given vector is used to translate the source mesh (after the mesh alignment, if any). The dimension of offset must be >= the dimension of the meshes (we use only the first components).

  • rescaling – Value of a rescaling factor to be applied between the source and the target meshes (>1 means that the source mesh is initially larger than the target one). The scaling is centered on [0., 0.(, 0.)] and is applied to the source mesh after mesh alignment or translation, if any.

  • rotation – Value of the rotation between the source and the target meshes. The rotation is centered on [0., 0.(, 0.)] and is about the vertical axis. >0 means that the source mesh is rotated of the given angle compared to the target one. The inverse rotation is applied to the source mesh, after mesh alignment or translation, if any. pi means half turn.

  • outsideCellsScreening (bool) – If set to True, target (and source) cells whose barycentre is outside of source (or target) mesh are screen out (defaultValue is assigned to them). It can be useful to screen out cells that are in contact with the other mesh, but that should not be intersected by it. On the other hand, it will screen out cells actually intersected if their barycenter is outside of the other mesh ! Be careful with this option.

  • reverseTransformations (bool) – If set to True, all the transformations (translation, rescaling and rotation) applied in initialize() on the provided meshes are reversed at the end of initialize().

initialize(ranksToGet, ranksToSet, mpiComm, field)

INTERNAL

recvField(fieldTemplate)

INTERNAL

sendField(field)

INTERNAL

terminate()

Release all allocated resources.

Warning

This method must be called once the object is no more needed in order to properly release MPI resources.

class c3po.mpi.mpiExchangeMethods.MPISharedRemapping.MPISharedRemapping(remapper, reverse=False, defaultValue=0.0, linearTransform=(1.0, 0.0))

Bases: MPIExchangeMethod

MPISharedRemapping is the MPI version of c3po.exchangeMethods.SharedRemapping.SharedRemapping.

MPI features of MEDCoupling must be available. It allows to use MEDCoupling projections between codes using domain decomposition methods.

__call__(fieldsToGet, fieldsToSet, valuesToGet)

Project the input fields one by one before returning them as outputs, in the same order.

__init__(remapper, reverse=False, defaultValue=0.0, linearTransform=(1.0, 0.0))

Build an MPISharedRemapping object, to be given to an c3po.mpi.MPIExchanger.MPIExchanger.

Warning

At the present time, defaultValue has to be 0.

Parameters:
  • remapper (MPIRemapper) – A MPIRemapper object (defined in C3PO) performing the projection. It can thus be shared with other instances of MPISharedRemapping (its initialization will always be done only once).

  • reverse (bool) – Allows the MPIRemapper to be shared with an instance of MPISharedRemapping performing the reverse exchange (the projection will be done in the reverse direction if reverse is set to True).

  • defaultValue – This is the default value to be assigned, during the projection, in the meshes of the target mesh that are not intersected by the source mesh.

  • linearTransform (tuple) – Tuple (a,b): apply a linear function to all output fields f such as they become a * f + b. The transformation is applied after the mesh projection.

clean()

See ExchangeMethod.clean().

getPatterns()

See ExchangeMethod.getPatterns().

initialize(field)

INTERNAL

setRanks(ranksToGet, ranksToSet, mpiComm)

See MPIExchangeMethod.setRanks().