Skip to content

Commit f384d54

Browse files
committed
fix ci
1 parent b2d1b11 commit f384d54

File tree

8 files changed

+37
-37
lines changed

8 files changed

+37
-37
lines changed

geos-mesh/src/geos/mesh/utils/arrayHelpers.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def UpdateElementMappingToDataSet(
193193
elif piece == Piece.CELLS:
194194
nbElementsTo = dataSetTo.GetNumberOfCells()
195195
else:
196-
raise ValueError( f"Only { Piece.POINTS.value } or { Piece.CELLS.value } can be mapped.")
196+
raise ValueError( f"Only { Piece.POINTS.value } or { Piece.CELLS.value } can be mapped." )
197197

198198
elementMap[ flatIdDataSetTo ] = np.full( ( nbElementsTo, 2 ), -1, np.int64 )
199199
if isinstance( meshFrom, vtkDataSet ):
@@ -286,7 +286,7 @@ def UpdateDictElementMappingFromDataSetToDataSet(
286286
elif piece == Piece.CELLS:
287287
nbElementsFrom = dataSetFrom.GetNumberOfCells()
288288
else:
289-
raise ValueError( f"Only { Piece.POINTS.value } or { Piece.CELLS.value } can be mapped.")
289+
raise ValueError( f"Only { Piece.POINTS.value } or { Piece.CELLS.value } can be mapped." )
290290

291291
for idElementTo in range( nbElementsTo ):
292292
# Test if the element of the final mesh is already mapped.
@@ -838,7 +838,8 @@ def getVtkArrayInObject( dataSet: vtkDataSet, attributeName: str, piece: Piece )
838838
elif piece == Piece.FIELD:
839839
dataArray = dataSet.GetFieldData().GetArray( attributeName )
840840
else:
841-
raise ValueError( f"The attribute piece must be { Piece.FIELD.value }, { Piece.POINTS.value } or { Piece.CELLS.value }.")
841+
raise ValueError(
842+
f"The attribute piece must be { Piece.FIELD.value }, { Piece.POINTS.value } or { Piece.CELLS.value }." )
842843

843844
return dataArray
844845

@@ -991,7 +992,7 @@ def getAttributeValuesAsDF( surface: vtkPolyData,
991992
elif piece == Piece.CELLS:
992993
nbRows = surface.GetNumberOfCells()
993994
else:
994-
raise ValueError( f"The attribute piece must be { Piece.POINTS.value } or { Piece.CELLS.value }.")
995+
raise ValueError( f"The attribute piece must be { Piece.POINTS.value } or { Piece.CELLS.value }." )
995996

996997
data: pd.DataFrame = pd.DataFrame( np.full( ( nbRows, len( attributeNames ) ), np.nan ), columns=attributeNames )
997998
for attributeName in attributeNames:

geos-mesh/src/geos/mesh/utils/arrayModifiers.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ def createConstantAttribute(
266266

267267
# Deals with multiBlocksDataSets.
268268
if isinstance( mesh, ( vtkMultiBlockDataSet, vtkCompositeDataSet ) ):
269-
return createConstantAttributeMultiBlock( mesh, listValues, attributeName, componentNames, piece,
270-
vtkDataType, logger )
269+
return createConstantAttributeMultiBlock( mesh, listValues, attributeName, componentNames, piece, vtkDataType,
270+
logger )
271271

272272
# Deals with dataSets.
273273
elif isinstance( mesh, vtkDataSet ):
@@ -336,8 +336,8 @@ def createConstantAttributeMultiBlock(
336336
elementaryBlockIndexes: list[ int ] = getBlockElementIndexesFlatten( multiBlockDataSet )
337337
for blockIndex in elementaryBlockIndexes:
338338
dataSet: vtkDataSet = vtkDataSet.SafeDownCast( multiBlockDataSet.GetDataSet( blockIndex ) )
339-
if not createConstantAttributeDataSet( dataSet, listValues, attributeName, componentNames, piece,
340-
vtkDataType, logger ):
339+
if not createConstantAttributeDataSet( dataSet, listValues, attributeName, componentNames, piece, vtkDataType,
340+
logger ):
341341
return False
342342

343343
return True
@@ -846,13 +846,9 @@ def transferAttributeWithElementMap(
846846
listFlatIdDataSetTo: list[ int ] = getBlockElementIndexesFlatten( meshTo )
847847
for flatIdDataSetTo in listFlatIdDataSetTo:
848848
dataSetTo: vtkDataSet = vtkDataSet.SafeDownCast( meshTo.GetDataSet( flatIdDataSetTo ) )
849-
if not transferAttributeToDataSetWithElementMap( meshFrom,
850-
dataSetTo,
851-
elementMap,
852-
attributeName,
853-
piece,
854-
flatIdDataSetTo=flatIdDataSetTo,
855-
logger=logger ):
849+
if not transferAttributeToDataSetWithElementMap(
850+
meshFrom, dataSetTo, elementMap, attributeName, piece, flatIdDataSetTo=flatIdDataSetTo,
851+
logger=logger ):
856852
logger.error(
857853
f"The attribute transfer has failed for the dataset with the flat index { flatIdDataSetTo } of the final mesh."
858854
)
@@ -885,7 +881,7 @@ def renameAttribute(
885881
elif piece == Piece.CELLS:
886882
dim = 1
887883
else:
888-
raise ValueError( "The attribute to rename must be on points or on Cells.")
884+
raise ValueError( "The attribute to rename must be on points or on Cells." )
889885
filter = vtkArrayRename()
890886
filter.SetInputData( object )
891887
filter.SetArrayName( dim, attributeName, newAttributeName )

geos-mesh/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def _get_elementMap( meshFromName: str, meshToName: str, piece: Piece ) -> Dict[
207207
Args:
208208
meshFromName (str): The name of the meshFrom.
209209
meshToName (str): The name of the meshTo.
210-
points (bool): True if elements to map is points, False if it is cells.
210+
piece (Piece): The element to map.
211211
212212
Returns:
213213
elementMap (Dict[int, npt.NDArray[np.int64]]): The element mapping dictionary.

geos-mesh/tests/test_arrayHelpers.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def test_computeElementMapping(
5757
"""Test getting the map between two meshes element."""
5858
meshFrom: Union[ vtkDataSet, vtkMultiBlockDataSet ] = dataSetTest( meshFromName )
5959
meshTo: Union[ vtkDataSet, vtkMultiBlockDataSet ] = dataSetTest( meshToName )
60-
elementMapComputed: dict[ int, npt.NDArray[ np.int64 ] ] = arrayHelpers.computeElementMapping(
61-
meshFrom, meshTo, piece )
60+
elementMapComputed: dict[ int,
61+
npt.NDArray[ np.int64 ] ] = arrayHelpers.computeElementMapping( meshFrom, meshTo, piece )
6262
elementMapTest: dict[ int, npt.NDArray[ np.int64 ] ] = getElementMap( meshFromName, meshToName, piece )
6363

6464
keysComputed: list[ int ] = list( elementMapComputed.keys() )
@@ -155,7 +155,8 @@ def test_getAttributesFromDataSet( dataSetTest: vtkDataSet, piece: Piece, expect
155155
( "TIME", Piece.FIELD ),
156156
( "ghostRank", Piece.BOTH ),
157157
] )
158-
def test_isAttributeInObjectMultiBlockDataSet( dataSetTest: vtkMultiBlockDataSet, attributeName: str, piece: Piece ) -> None:
158+
def test_isAttributeInObjectMultiBlockDataSet( dataSetTest: vtkMultiBlockDataSet, attributeName: str,
159+
piece: Piece ) -> None:
159160
"""Test presence of attribute in a multiblock."""
160161
multiBlockDataset: vtkMultiBlockDataSet = dataSetTest( "multiblockGeosOutput" )
161162
obtained: bool = arrayHelpers.isAttributeInObjectMultiBlockDataSet( multiBlockDataset, attributeName, piece )

geos-mesh/tests/test_arrayModifiers.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,24 @@
5151
"idBlock, attributeName, nbComponentsTest, componentNamesTest, piece, listValues, listValuesTest, vtkDataTypeTest",
5252
[
5353
# Test fill an attribute on point and on cell.
54-
( 3, "PointAttribute", 3, ( "AX1", "AX2", "AX3" ), Piece.POINTS, None, [ np.float64( np.nan ), np.float64( np.nan ), np.float64( np.nan ) ], VTK_DOUBLE ),
55-
( 3, "CellAttribute", 3, ( "AX1", "AX2", "AX3" ), Piece.CELLS, None, [ np.float64( np.nan ), np.float64( np.nan ), np.float64( np.nan ) ], VTK_DOUBLE ),
54+
( 3, "PointAttribute", 3, ( "AX1", "AX2", "AX3" ), Piece.POINTS, None,
55+
[ np.float64( np.nan ), np.float64( np.nan ),
56+
np.float64( np.nan ) ], VTK_DOUBLE ),
57+
( 3, "CellAttribute", 3, ( "AX1", "AX2", "AX3" ), Piece.CELLS, None,
58+
[ np.float64( np.nan ), np.float64( np.nan ),
59+
np.float64( np.nan ) ], VTK_DOUBLE ),
5660
# Test fill attributes with different number of component with or without component names.
5761
( 3, "PORO", 1, (), Piece.CELLS, None, [ np.float32( np.nan ) ], VTK_FLOAT ),
58-
( 1, "collocated_nodes", 2, ( None, None ), Piece.POINTS, None, [ np.int64( -1 ), np.int64( -1 ) ], VTK_ID_TYPE ),
62+
( 1, "collocated_nodes", 2,
63+
( None, None ), Piece.POINTS, None, [ np.int64( -1 ), np.int64( -1 ) ], VTK_ID_TYPE ),
5964
# Test fill an attribute with different type of value.
6065
( 3, "FAULT", 1, (), Piece.CELLS, None, [ np.int32( -1 ) ], VTK_INT ),
6166
( 3, "FAULT", 1, (), Piece.CELLS, [ 4 ], [ np.int32( 4 ) ], VTK_INT ),
6267
( 3, "PORO", 1, (), Piece.CELLS, [ 4 ], [ np.float32( 4 ) ], VTK_FLOAT ),
63-
( 1, "collocated_nodes", 2, ( None, None ), Piece.POINTS, [ 4, 4 ], [ np.int64( 4 ), np.int64( 4 ) ], VTK_ID_TYPE ),
64-
( 3, "CellAttribute", 3, ( "AX1", "AX2", "AX3" ), Piece.CELLS, [ 4, 4, 4 ], [ np.float64( 4 ), np.float64( 4 ), np.float64( 4 ) ], VTK_DOUBLE ),
68+
( 1, "collocated_nodes", 2,
69+
( None, None ), Piece.POINTS, [ 4, 4 ], [ np.int64( 4 ), np.int64( 4 ) ], VTK_ID_TYPE ),
70+
( 3, "CellAttribute", 3, ( "AX1", "AX2", "AX3" ), Piece.CELLS, [ 4, 4, 4 ],
71+
[ np.float64( 4 ), np.float64( 4 ), np.float64( 4 ) ], VTK_DOUBLE ),
6572
] )
6673
def test_fillPartialAttributes(
6774
dataSetTest: vtkMultiBlockDataSet,
@@ -181,10 +188,7 @@ def test_createConstantAttributeMultiBlock(
181188
"""Test creation of constant attribute in multiblock dataset."""
182189
multiBlockDataSetTest: vtkMultiBlockDataSet = dataSetTest( "multiblock" )
183190
values: list[ float ] = [ np.nan ]
184-
assert arrayModifiers.createConstantAttributeMultiBlock( multiBlockDataSetTest,
185-
values,
186-
attributeName,
187-
piece=piece )
191+
assert arrayModifiers.createConstantAttributeMultiBlock( multiBlockDataSetTest, values, attributeName, piece=piece )
188192

189193
elementaryBlockIndexes: list[ int ] = getBlockElementIndexesFlatten( multiBlockDataSetTest )
190194
for blockIndex in elementaryBlockIndexes:
@@ -552,7 +556,8 @@ def test_renameAttributeMultiblock(
552556
assert data.HasArray( newAttributeName ) == 1
553557

554558

555-
@pytest.mark.parametrize( "attributeName, piece", [ ( "CellAttribute", Piece.CELLS ), ( "PointAttribute", Piece.POINTS ) ] )
559+
@pytest.mark.parametrize( "attributeName, piece", [ ( "CellAttribute", Piece.CELLS ),
560+
( "PointAttribute", Piece.POINTS ) ] )
556561
def test_renameAttributeDataSet(
557562
dataSetTest: vtkDataSet,
558563
attributeName: str,

geos-processing/src/geos/processing/generic_processing_tools/AttributeMapping.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from geos.utils.Logger import ( Logger, getLogger )
1313
from geos.utils.pieceEnum import Piece
1414

15-
1615
__doc__ = """
1716
AttributeMapping is a vtk filter that transfers global attributes from a source mesh to a final mesh with same
1817
point/cell coordinates. The final mesh is updated directly, without creation of a copy.

geos-processing/src/geos/processing/post_processing/GeomechanicsCalculator.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,8 +1030,7 @@ def _doComputeTotalStress(
10301030
totalStress = fcts.totalStress( effectiveStress, biotCoefficient, pressure )
10311031
self._attributesToCreate.append( geomechanicProperty )
10321032
else:
1033-
totalStress = getArrayInObject( self.output, geomechanicProperty.attributeName,
1034-
geomechanicProperty.piece )
1033+
totalStress = getArrayInObject( self.output, geomechanicProperty.attributeName, geomechanicProperty.piece )
10351034
self.logger.warning(
10361035
f"{ geomechanicProperty.attributeName } is already on the mesh, it has not been computed by the filter."
10371036
)
@@ -1290,8 +1289,7 @@ def _computeCriticalTotalStressRatio( self: Self ) -> None:
12901289

12911290
def _computeCriticalPorePressure( self: Self ) -> None:
12921291
"""Compute the critical pore pressure and the pressure index."""
1293-
if not isAttributeInObject( self.output, CRITICAL_PORE_PRESSURE.attributeName,
1294-
CRITICAL_PORE_PRESSURE.piece ):
1292+
if not isAttributeInObject( self.output, CRITICAL_PORE_PRESSURE.attributeName, CRITICAL_PORE_PRESSURE.piece ):
12951293
if self._basicProperties.totalStress is not None:
12961294
self._advancedProperties.criticalPorePressure = fcts.criticalPorePressure(
12971295
-1.0 * self._basicProperties.totalStress, self.physicalConstants.rockCohesion,
@@ -1317,8 +1315,7 @@ def _computeCriticalPorePressure( self: Self ) -> None:
13171315
self._attributesToCreate.append( CRITICAL_PORE_PRESSURE_THRESHOLD )
13181316
else:
13191317
self._advancedProperties.criticalPorePressureIndex = getArrayInObject(
1320-
self.output, CRITICAL_PORE_PRESSURE_THRESHOLD.attributeName,
1321-
CRITICAL_PORE_PRESSURE_THRESHOLD.piece )
1318+
self.output, CRITICAL_PORE_PRESSURE_THRESHOLD.attributeName, CRITICAL_PORE_PRESSURE_THRESHOLD.piece )
13221319
self.logger.warning(
13231320
f"{ CRITICAL_PORE_PRESSURE_THRESHOLD.attributeName } is already on the mesh, it has not been computed by the filter."
13241321
)

geos-utils/src/geos/utils/pieceEnum.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# SPDX-FileContributor: Romain Baville
44
from enum import Enum
55

6+
67
class Piece( str, Enum ):
78
"""String Enum of a vtkDataObject pieces."""
89
POINTS = "points"

0 commit comments

Comments
 (0)