Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b6ed2c6
start filter diff
jafranc Nov 27, 2025
cd1f6f5
in process transcription to filter
jafranc Dec 15, 2025
0ea6dcf
Refactor the script to compute L1Diff
RomainBaville Dec 17, 2025
1b3dc36
test diffFields
RomainBaville Dec 22, 2025
75198eb
Clean variables names and add the doc
RomainBaville Dec 23, 2025
47bcd9f
fix setMeshes
RomainBaville Dec 23, 2025
b132c9f
Rename the AttributeDiff file
RomainBaville Dec 23, 2025
2f8e82e
Update the doc
RomainBaville Dec 23, 2025
debf4ce
Update the test of AttributesDiff
RomainBaville Dec 23, 2025
7ce3962
Rename the test file of AttributesDiff filter
RomainBaville Dec 23, 2025
411353d
Merge branch 'main' into jafranc/feat/DiffFilter
RomainBaville Dec 24, 2025
6317757
Change bool with enum for the attribute localization
RomainBaville Dec 24, 2025
d4e5ee6
fix dicSharedAttributes computation
RomainBaville Jan 5, 2026
915ac4a
implementation of inf norm
RomainBaville Jan 5, 2026
f759fe0
fix inf norm computation
RomainBaville Jan 5, 2026
afecb7c
Factorize the two diff computation functions in one
RomainBaville Jan 5, 2026
389898b
fix the ci
RomainBaville Jan 6, 2026
0475bba
Apply suggestions from Paloma's code review
RomainBaville Jan 22, 2026
c6a6031
Use dict instead of dic in the variables name
RomainBaville Jan 22, 2026
1513f06
Remove Capital in the variables names
RomainBaville Jan 22, 2026
043a27a
Merge remote-tracking branch 'origin/jafranc/feat/DiffFilter' into ja…
RomainBaville Jan 22, 2026
eae9570
Add meshes for testing AttributesDiff filter
RomainBaville Jan 26, 2026
51c0153
Update with the last version of the main
RomainBaville Feb 4, 2026
782f752
Update the test meshes
RomainBaville Feb 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/geos_processing_docs/generic_processing_tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ AttributeMapping
:undoc-members:
:show-inheritance:

geos.processing.generic_processing_tools.AttributesDiff filter
----------------------------------------------------------------

.. automodule:: geos.processing.generic_processing_tools.AttributesDiff
:members:
:undoc-members:
:show-inheritance:

CreateConstantAttributePerRegion
--------------------------------------
Expand Down

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions geos-processing/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def _get_dataset( datasetType: str ) -> Union[ vtkMultiBlockDataSet, vtkPolyData
vtkFilename = "data/domain_res5_id.vtu"
elif datasetType == "emptydataset":
vtkFilename = "data/domain_res5_id_empty.vtu"
elif datasetType == "2Ranks":
vtkFilename = "data/singlePhasePoromechanics_FaultModel_well_seq/CellElementRegion2Ranks.vtm"
elif datasetType == "4Ranks":
vtkFilename = "data/singlePhasePoromechanics_FaultModel_well_seq/CellElementRegion4Ranks.vtm"
elif datasetType == "singlePhasePoromechanicsVTKOutput":
vtkFilename = "data/singlePhasePoromechanics_FaultModel_well_seq/singlePhasePoromechanicsVTKOutput.vtm"
elif datasetType == "extractAndMergeVolume":
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<VTKFile type="vtkMultiBlockDataSet" version="1.0" byte_order="LittleEndian" header_type="UInt64" compressor="vtkZLibDataCompressor">
<vtkMultiBlockDataSet>
<Block index="0" name="mesh1">
<Block index="0" name="Level0">
<Block index="0" name="CellElementRegion">
<Block index="0" name="Region">
<DataSet index="0" name="rank_0" file="CellElementRegion2Ranks/CellElementRegion2Ranks_0_0.vtu"/>
<DataSet index="1" name="rank_1" file="CellElementRegion2Ranks/CellElementRegion2Ranks_1_0.vtu"/>
</Block>
</Block>
</Block>
</Block>
</vtkMultiBlockDataSet>
</VTKFile>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<VTKFile type="vtkMultiBlockDataSet" version="1.0" byte_order="LittleEndian" header_type="UInt64" compressor="vtkZLibDataCompressor">
<vtkMultiBlockDataSet>
<Block index="0" name="mesh1">
<Block index="0" name="Level0">
<Block index="0" name="CellElementRegion">
<Block index="0" name="Region">
<DataSet index="0" name="rank_0" file="CellElementRegion4Ranks/CellElementRegion4Ranks_0_0.vtu"/>
<DataSet index="1" name="rank_1" file="CellElementRegion4Ranks/CellElementRegion4Ranks_1_0.vtu"/>
<DataSet index="2" name="rank_2" file="CellElementRegion4Ranks/CellElementRegion4Ranks_2_0.vtu"/>
<DataSet index="3" name="rank_3" file="CellElementRegion4Ranks/CellElementRegion4Ranks_3_0.vtu"/>
</Block>
</Block>
</Block>
</Block>
</vtkMultiBlockDataSet>
</VTKFile>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ The XML-files used to launch the simulation came from the integrated tests of GE

The ParaView plugin "PVGeosBlockExtractAndMerge" has been used to get the vtm with the block "CellElementRegion" from the simulation pvd result. The integrated ParaView plugin "merge block" has been used to get a vtu with the data of the second time step.

The mesh singlePhasePoromechanicsVTKOutput.vtm has been save as vtm from the the simulation pvd result with ParaView 6.
The mesh singlePhasePoromechanicsVTKOutput.vtm has been saved as vtm from the the simulation pvd result with ParaView 6.

The meshes CellElementRegion2Ranks.vtm and CellElementRegion4Ranks.vtm have been extracted with the integrated ParaView plugin 'extract block' from two identical GEOS simulations except for the partitioning, respectively on 2 and 4 ranks. The extraction and save of the meshes have been made for the last time step.
47 changes: 47 additions & 0 deletions geos-processing/tests/test_AttributesDiff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies.
# SPDX-FileContributor: Romain Baville
# SPDX-License-Identifier: Apache 2.0
# ruff: noqa: E402 # disable Module level import not at top of file
# mypy: disable-error-code="operator"
import numpy as np

from vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet, vtkDataSet

from geos.processing.generic_processing_tools.AttributesDiff import AttributesDiff
from geos.mesh.utils.arrayHelpers import getArrayInObject
from geos.mesh.utils.multiblockHelpers import getBlockElementIndexesFlatten
from geos.utils.pieceEnum import Piece


def test_AttributesDiff( dataSetTest: vtkMultiBlockDataSet, ) -> None:
"""Test the filter AttributesDiff."""
mesh1: vtkMultiBlockDataSet = dataSetTest( "2Ranks" )
mesh2: vtkMultiBlockDataSet = dataSetTest( "4Ranks" )

attributesDiffFilter: AttributesDiff = AttributesDiff()
attributesDiffFilter.setMeshes( [ mesh1, mesh2 ] )
attributesDiffFilter.logSharedAttributeInfo()
dictAttributesToCompare: dict[ Piece, set[ str ] ] = {
Piece.POINTS: { 'totalDisplacement', 'localToGlobalMap', 'mass', 'externalForce' },
Piece.CELLS: {
'elementVolume', 'pressure', 'rock_bulkModulus', 'rockPorosity_referencePorosity', 'water_dInternalEnergy',
'water_dViscosity', 'water_viscosity', 'averageStrain', 'water_dEnthalpy', 'deltaPressure',
'rockPerm_permeability', 'rockPorosity_initialPorosity', 'localToGlobalMap', 'averagePlasticStrain',
'temperature', 'rock_density', 'averageStress', 'rockPorosity_porosity', 'rock_shearModulus',
'water_density', 'mass', 'water_internalEnergy', 'water_dDensity', 'rockPorosity_grainBulkModulus',
'elementCenter', 'water_enthalpy', 'rockPorosity_biotCoefficient'
},
}
attributesDiffFilter.setDictAttributesToCompare( dictAttributesToCompare )
attributesDiffFilter.applyFilter()
mesh: vtkDataSet | vtkMultiBlockDataSet = mesh1.NewInstance()
mesh.ShallowCopy( attributesDiffFilter.getOutput() )
dictAttributesDiffNames: dict[ Piece, set[ str ] ] = attributesDiffFilter.getDictAttributesDiffNames()
listFlattenIndexes = getBlockElementIndexesFlatten( mesh )
for it in listFlattenIndexes:
dataset: vtkDataSet = vtkDataSet.SafeDownCast( mesh.GetDataSet( it ) ) # type: ignore[union-attr]
for piece, listDiffAttributesName in dictAttributesDiffNames.items():
for diffAttributeName in listDiffAttributesName:
test = getArrayInObject( dataset, diffAttributeName, piece )
assert ( test < np.array( [ 0.0001 for _ in range( test.size ) ] ) ).all()