3.1.2.4. c3po.exchangeMethods.SharedRemappingMulti1D3D module

Inheritance diagram of c3po.exchangeMethods.SharedRemappingMulti1D3D

Contain the class SharedRemappingMulti1D3D.

class c3po.exchangeMethods.SharedRemappingMulti1D3D.Multi1D3DRemapper(xCoordinates, yCoordinates, indexTable, weights, meshAlignment=False, offset=None, rescaling=1.0, rotation=0.0, outsideCellsScreening=False, reverseTransformations=True)

Bases: Remapper

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

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

Build a Multi1D3DRemapper object.

An intermediate inner 3D mesh is built from a 2D grid defined by the parameters.

The axial coordinates will be read from the 1D fields passed to the remapper.

Each cell of this 2D grid is associated to a 1D field.

Warning

There seems to be a bug in MEDCoupling that may cause wrong results when rescaling is used with a source mesh (multi1D) of nature ExtensiveMaximum or IntensiveConservation. In this case, using reverseTransformations=False should be enough to solve the problem.

Parameters:
  • xCoordinates – x coordinates of the inner mesh to build.

  • yCoordinates – y coordinates of the inner mesh to build.

  • indexTable – For each position of the 2D grid (x coordinate changes first), the index of the 1D field to associate. Put -1 to associate to nothing.

  • weights – Weigh of each 1D field to take into account for extensive variables.

  • meshAlignment – See Remapper. The source mesh is the multi1D one and the target mesh the 3D one.

  • offset – See Remapper. The source mesh is the multi1D one and the target mesh the 3D one.

  • rescaling – See Remapper. The source mesh is the multi1D one and the target mesh the 3D one.

  • rotation – See Remapper. The source mesh is the multi1D one and the target mesh the 3D one.

  • outsideCellsScreening – See Remapper.

  • reverseTransformations – See Remapper.

build1DFields(field3D)

INTERNAL

build3DField(fields1D, defaultValue=0.0)

INTERNAL

buildInnerField(meshes1D)

INTERNAL

getInnerField()

INTERNAL

getNumberOf1DFields()

INTERNAL

setShiftedIndex(shiftedFieldPositions, indexTable)

INTERNAL

shift1DFields(shiftMap)

This method allows to shift the index of the 1D fields provided through the indexTable parameter of constructor.

For example, shiftMap=[3, -1, 1, 2] indicates that at first call field_0 goes to position 3, field_1 is discharged, field_2 goes to 1 and field_3 goes to 2. It returns [1]. At the second call with the same input, field_0 (now at position 3) goes to 2, field_1 (at 0) goes to 3, field_2 (at 1) is discharged and field_3 (at 2) goes to 1. It returns [2]. The third call returns [3], the fourth call [0].

Parameters:

shiftMap (list) – A list providing for each 1D fields the index (in indexTable) of its new position (-1 can be used to indicate that the field is no more used).

Returns:

The list of the indexes no more used.

Return type:

list

class c3po.exchangeMethods.SharedRemappingMulti1D3D.SharedRemappingMulti1D3D(remapper, reverse=False, defaultValue=0.0, linearTransform=(1.0, 0.0))

Bases: SharedRemapping

SharedRemappingMulti1D3D is an ExchangeMethod which projects the input fields one by one before returning them as outputs, in the same order.

See c3po.Exchanger.Exchanger.__init__().

1D fields are processed in packets using the intermediate mesh defined by the Multi1D3DRemapper object.

The method assumes that all input fields (or packets) have the same mesh, and produces output fields on identical meshes.

This output mesh is the one of the first field (or packet) passed to the method (obtained by getInputMEDFieldTemplate).

The input scalars are returned in the same order, without modification.

The initialization of the projection method (long operation) is done only once, and can be shared with other instances of SharedRemappingMulti1D3D.

__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 a SharedRemappingMulti1D3D object, to be given to an Exchanger.

Warning

SharedRemappingMulti1D3D is deprecated and will soon by deleted. Please use c3po.multi1D package instead.

Parameters:
clean()

See ExchangeMethod.clean().

getPatterns()

See ExchangeMethod.getPatterns().

c3po.exchangeMethods.SharedRemappingMulti1D3D.shift1DFields(shiftMap, shiftedFieldPositions, indexTable)

INTERNAL