Skip to content

Commit 32dc50b

Browse files
Fix collocated_nodes array name to match GEOS name (#170)
1 parent 0cbcbeb commit 32dc50b

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

geos-mesh/src/geos/mesh/doctor/actions/checkFractures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def formatCollocatedNodes( fractureMesh: vtkUnstructuredGrid ) -> Sequence[ Iter
5252
Returns:
5353
Sequence[ Iterable[ int ] ]: An iterable over all the buckets of collocated nodes.
5454
"""
55-
collocatedNodes: numpy.ndarray = vtk_to_numpy( fractureMesh.GetPointData().GetArray( "collocatedNodes" ) )
55+
collocatedNodes: numpy.ndarray = vtk_to_numpy( fractureMesh.GetPointData().GetArray( "collocated_nodes" ) )
5656
if len( collocatedNodes.shape ) == 1:
5757
collocatedNodes: numpy.ndarray = collocatedNodes.reshape( ( collocatedNodes.shape[ 0 ], 1 ) )
5858
generator = ( tuple( sorted( bucket[ bucket > -1 ] ) ) for bucket in collocatedNodes )

geos-mesh/src/geos/mesh/doctor/actions/generateFractures.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,8 @@ def __generateFractureMesh( oldMesh: vtkUnstructuredGrid, fractureInfo: Fracture
521521
for j, val in enumerate( bucket ):
522522
collocatedNodes[ i, j ] = val
523523
array = numpy_to_vtk( collocatedNodes, array_type=VTK_ID_TYPE )
524-
array.SetName( "collocatedNodes" )
524+
array.SetName( "collocated_nodes" ) # Following the hardcoded naming convention used in GEOS for now:
525+
# src/coreComponents/mesh/generators/CollocatedNodes.cpp: string const COLLOCATED_NODES = "collocated_nodes";
525526

526527
fractureMesh = vtkUnstructuredGrid() # We could be using vtkPolyData, but it's not supported by GEOS for now.
527528
fractureMesh.SetPoints( points )

geos-mesh/tests/data/fracture_res5_id.vtp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PolyData>
44
<Piece NumberOfPoints="212" NumberOfVerts="0" NumberOfLines="0" NumberOfStrips="0" NumberOfPolys="156" >
55
<PointData GlobalIds="GLOBAL_IDS_POINTS">
6-
<DataArray type="Int64" IdType="1" Name="collocatedNodes" NumberOfComponents="2" format="appended" RangeMin="3905.8931117" RangeMax="5326.4624283" offset="0" >
6+
<DataArray type="Int64" IdType="1" Name="collocated_nodes" NumberOfComponents="2" format="appended" RangeMin="3905.8931117" RangeMax="5326.4624283" offset="0" >
77
<InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
88
<Value index="0">
99
3905.8931117

geos-mesh/tests/data/fracture_res5_id.vtu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<UnstructuredGrid>
44
<Piece NumberOfPoints="212" NumberOfCells="156">
55
<PointData GlobalIds="GLOBAL_IDS_POINTS">
6-
<DataArray type="Int64" IdType="1" Name="collocatedNodes" NumberOfComponents="2" format="binary" RangeMin="3905.8931116967346" RangeMax="5326.462428291407">
6+
<DataArray type="Int64" IdType="1" Name="collocated_nodes" NumberOfComponents="2" format="binary" RangeMin="3905.8931116967346" RangeMax="5326.462428291407">
77
AQAAAACAAABADQAABgMAAA==eJwtyMVSFgAAhVFduHDh+Ah2d2GD2I0NdnchJnZiYmCLgYmtKHZid3djgo0dG2f8z918c27B7Jn+LyVzoIX4BBfmk1yET3FRPs3F+AwX57N8Tkv4S+p5fym+wKX5IpfhS1yWL3M5vsJBfJWvaXl/Bb3ur8g3uBLf5Mp8i6vwba7KdziY7/I9DfFX0/v+UH7A1fkh1+BHXJMfcy1+wrX5KT/TOv66muqvx8+5Pr/gBvySG/IrbsSvuTG/4TQN8zfRdH9TfsvN+B035/fcgj9wS/7IrfgTf9Zwf4Rm+FvzF27DX7ktf+N2/J1nZgm0vX8Wd+BY7siddLa/M8/hudrFP4+7chx34/ncnRdwD17IPbmXLvL35sW8RPv4l3JfXsb9OJ7783IewCt4IEfqSv8gXsUJGuVfzYN5DQ/htTyU1/EwXs/DeYRu8EdzIm/Ukf5NPIo382jewmN4K4/lbTyOx+t2/wTewTt1oj+JJ/Eunsy7eQoncwzv4ak8Tff6p/M+3q8z/Ad4Jh/kWXyIY/kwz+YjPIfn6lH/PD7Gcdwya6DzuRUv4HCO0IX+1ryI2/BiXqJt/Uu5HS/j9hzPHXg5d+ROusLfmVdyF17FCdrVv5q78Rruzmu5B6/jntxL1/t78wbuw4m8Ufv6N3E/3sz9eQsP4K08kCN1m38Qb+co3sE7dbA/iYfwLh7Ku3kYJ/NwHqF7/NG8l0fyPt6vo/wHeDQf5DF8iMfyYR7H4/WIfwIf5Yl8jI/rJH8KT+YTPIVPcgyf4qk8TU/7p/MZPqs5sgWaU8/5c/F5vqC5/Xn0ov+S5vVf5nx8hfPzVS7ABfWavxBf5xta2F9Eb/pvaVH/bS7Gd7g43+USXFLv+UvxfX6gpf1l9KH/kZb1P+Zy/ISD+CmX5wr6zF+RU7kSP+fK/IJfahX/K67KrzmY33AIV9M0fyinc3V+yzX4Hb/Xmv4PXIs/cm3+xHW4rn721+MMrs9fuAF/5W/a0P+dG/EPbsw/OYyb6C9/U/7NzfgPN+e//A+qS/z/
88
<InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
99
<Value index="0">

geos-mesh/tests/test_arrayHelpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def test_computeElementMapping(
7070

7171
@pytest.mark.parametrize( "onpoints, expected", [ ( True, {
7272
'GLOBAL_IDS_POINTS': 1,
73-
'collocatedNodes': 2,
73+
'collocated_nodes': 2,
7474
'PointAttribute': 3
7575
} ), ( False, {
7676
'CELL_MARKERS': 1,
@@ -215,7 +215,7 @@ def test_getArrayInObject( request: pytest.FixtureRequest, arrayExpected: npt.ND
215215
@pytest.mark.parametrize( "attributeName, vtkDataType, onPoints", [
216216
( "CellAttribute", 11, False ),
217217
( "PointAttribute", 11, True ),
218-
( "collocatedNodes", 12, True ),
218+
( "collocated_nodes", 12, True ),
219219
] )
220220
def test_getVtkArrayTypeInMultiBlock( dataSetTest: vtkMultiBlockDataSet, attributeName: str, vtkDataType: int,
221221
onPoints: bool ) -> None:
@@ -324,7 +324,7 @@ def test_getComponentNamesMultiBlock(
324324

325325

326326
@pytest.mark.parametrize( "attributeNames, onPoints, expected_columns", [
327-
( ( "collocatedNodes", ), True, ( "collocatedNodes_0", "collocatedNodes_1" ) ),
327+
( ( "collocated_nodes", ), True, ( "collocated_nodes_0", "collocated_nodes_1" ) ),
328328
] )
329329
def test_getAttributeValuesAsDF( dataSetTest: vtkPolyData, attributeNames: Tuple[ str, ...], onPoints: bool,
330330
expected_columns: Tuple[ str, ...] ) -> None:

geos-mesh/tests/test_arrayModifiers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@
5858
np.nan ), np.float64( np.nan ), np.float64( np.nan ) ], VTK_DOUBLE ),
5959
# Test fill attributes with different number of component with or without component names.
6060
( 3, "PORO", 1, (), False, None, [ np.float32( np.nan ) ], VTK_FLOAT ),
61-
( 1, "collocatedNodes", 2, ( None, None ), True, None, [ np.int64( -1 ), np.int64( -1 ) ], VTK_ID_TYPE ),
61+
( 1, "collocated_nodes", 2, ( None, None ), True, None, [ np.int64( -1 ), np.int64( -1 ) ], VTK_ID_TYPE ),
6262
# Test fill an attribute with different type of value.
6363
( 3, "FAULT", 1, (), False, None, [ np.int32( -1 ) ], VTK_INT ),
6464
( 3, "FAULT", 1, (), False, [ 4 ], [ np.int32( 4 ) ], VTK_INT ),
6565
( 3, "PORO", 1, (), False, [ 4 ], [ np.float32( 4 ) ], VTK_FLOAT ),
66-
( 1, "collocatedNodes", 2, ( None, None ), True, [ 4, 4 ], [ np.int64( 4 ), np.int64( 4 ) ], VTK_ID_TYPE ),
66+
( 1, "collocated_nodes", 2, ( None, None ), True, [ 4, 4 ], [ np.int64( 4 ), np.int64( 4 ) ], VTK_ID_TYPE ),
6767
( 3, "CellAttribute", 3, ( "AX1", "AX2", "AX3" ), False, [ 4, 4, 4 ],
6868
[ np.float64( 4 ), np.float64( 4 ), np.float64( 4 ) ], VTK_DOUBLE ),
6969
] )
@@ -140,7 +140,7 @@ def test_FillAllPartialAttributes(
140140
for blockIndex in elementaryBlockIndexes:
141141
dataSet: vtkDataSet = vtkDataSet.SafeDownCast( multiBlockDataSetTest.GetDataSet( blockIndex ) )
142142
attributeExist: int
143-
for attributeNameOnPoint in [ "PointAttribute", "collocatedNodes" ]:
143+
for attributeNameOnPoint in [ "PointAttribute", "collocated_nodes" ]:
144144
attributeExist = dataSet.GetPointData().HasArray( attributeNameOnPoint )
145145
assert attributeExist == 1
146146
for attributeNameOnCell in [ "CELL_MARKERS", "CellAttribute", "FAULT", "PERM", "PORO" ]:
@@ -482,7 +482,7 @@ def test_copyAttributeDataSet(
482482

483483

484484
@pytest.mark.parametrize( "meshFromName, meshToName, attributeName, onPoints, defaultValueTest", [
485-
( "fracture", "emptyFracture", "collocatedNodes", True, [ -1, -1 ] ),
485+
( "fracture", "emptyFracture", "collocated_nodes", True, [ -1, -1 ] ),
486486
( "multiblock", "emptyFracture", "FAULT", False, -1 ),
487487
( "multiblock", "emptymultiblock", "FAULT", False, -1 ),
488488
( "dataset", "emptymultiblock", "FAULT", False, -1 ),

0 commit comments

Comments
 (0)