3.1.2.4. c3po.exchangeMethods.SharedRemappingMulti1D3D module
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:
RemapperAllow to share the mesh projection for different
SharedRemappingMulti1D3Dobjects 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
Multi1D3DRemapperobject.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, usingreverseTransformations=Falseshould 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 themulti1Done and the target mesh the 3D one.offset – See
Remapper. The source mesh is themulti1Done and the target mesh the 3D one.rescaling – See
Remapper. The source mesh is themulti1Done and the target mesh the 3D one.rotation – See
Remapper. The source mesh is themulti1Done 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 callfield_0goes to position 3,field_1is discharged,field_2goes to 1 andfield_3goes 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 andfield_3(at 2) goes to 1. It returns[2]. The third call returns[3], the fourth call[0].
- class c3po.exchangeMethods.SharedRemappingMulti1D3D.SharedRemappingMulti1D3D(remapper, reverse=False, defaultValue=0.0, linearTransform=(1.0, 0.0))
Bases:
SharedRemappingSharedRemappingMulti1D3Dis 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
Multi1D3DRemapperobject.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
SharedRemappingMulti1D3Dobject, to be given to anExchanger.Warning
SharedRemappingMulti1D3Dis deprecated and will soon by deleted. Please usec3po.multi1Dpackage instead.- Parameters:
remapper (Multi1D3DRemapper) – A
Multi1D3DRemapperobject performing the projection. It can thus be shared with other instances ofSharedRemappingMulti1D3D(its initialization will always be done only once).reverse – See
SharedRemapping. Direct ismulti1D-> 3D, reverse is 3D ->multi1D.defaultValue – See
SharedRemapping.linearTransform – See
SharedRemapping.
- clean()
- getPatterns()
- c3po.exchangeMethods.SharedRemappingMulti1D3D.shift1DFields(shiftMap, shiftedFieldPositions, indexTable)
INTERNAL