Skip to content

Commit e518d95

Browse files
paloma-martinezRomainBavilleRomain Baville
authored
refactor: Move workflow plugins (#164)
* Move SurfaceGeomechanicsFilter and refactor functions * Move and refactor plugin * add geos-processing to install script * Add more log * Add documentation * Filter cleaning * Documentation * Refactor the basis change computation * Refactor of normal and tangential vectors computation * Replace and add tests for attribute to vector functions * Add tests and better error handling * Adding tests for SurfaceGeomechanics filter * Fix * typo * Small modifications from Romain review * Fix typing and error in getTangents function * Fix tests following previous commit modifs * SISO filter * fix docstring * fix the fix * typing * typing * . * Move the plugins and adapt the import paths * Typing and doc move * doc fix * Fix doc * Fix GeomechanicsWorkflows * fix conflict --------- Co-authored-by: Romain Baville <126683264+RomainBaville@users.noreply.github.com> Co-authored-by: Romain Baville <romain.baville@external.totalenergies.com>
1 parent 0cde8ff commit e518d95

11 files changed

+166
-173
lines changed

docs/geos_posp_docs/PVplugins.rst

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,59 +5,9 @@ Paraview plugins were developed using Python 3.9.13 and are compatible with Para
55

66
The plugins include:
77

8-
* A reader that parse GEOS output log file;
9-
* 3D mesh cleanning plugins;
10-
* Processing plugins to compute additional geomechanical properties;
118
* Visualization plugins to plot Mohr's circles and cross plots using Paraview Python View.
129

1310

14-
PVExtractMergeBlocksVolume plugin
15-
-------------------------------------------
16-
17-
.. automodule:: PVplugins.PVExtractMergeBlocksVolume
18-
19-
20-
PVExtractMergeBlocksVolumeSurface plugin
21-
--------------------------------------------------
22-
23-
.. automodule:: PVplugins.PVExtractMergeBlocksVolumeSurface
24-
25-
26-
PVExtractMergeBlocksVolumeSurfaceWell plugin
27-
------------------------------------------------------
28-
29-
.. automodule:: PVplugins.PVExtractMergeBlocksVolumeSurfaceWell
30-
31-
32-
PVExtractMergeBlocksVolumeWell plugin
33-
-----------------------------------------------
34-
35-
.. automodule:: PVplugins.PVExtractMergeBlocksVolumeWell
36-
37-
PVGeomechanicsWorkflowVolume plugin
38-
---------------------------------------------
39-
40-
.. automodule:: PVplugins.PVGeomechanicsWorkflowVolume
41-
42-
43-
PVGeomechanicsWorkflowVolumeSurface plugin
44-
----------------------------------------------------
45-
46-
.. automodule:: PVplugins.PVGeomechanicsWorkflowVolumeSurface
47-
48-
49-
PVGeomechanicsWorkflowVolumeSurfaceWell plugin
50-
--------------------------------------------------------
51-
52-
.. automodule:: PVplugins.PVGeomechanicsWorkflowVolumeSurfaceWell
53-
54-
55-
PVGeomechanicsWorkflowVolumeWell plugin
56-
-------------------------------------------------
57-
58-
.. automodule:: PVplugins.PVGeomechanicsWorkflowVolumeWell
59-
60-
6111
PVMohrCirclePlot plugin
6212
---------------------------------
6313

docs/geos_pv_docs/processing.rst

Lines changed: 69 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
Post-/Pre-processing
22
=========================
3+
The plugins include:
4+
5+
* A reader that parse GEOS output log file;
6+
* 3D mesh cleanning plugins;
7+
* Processing plugins to compute additional geomechanical properties;
8+
* Visualization plugins to plot Mohr's circles (currently in `geos_posp`) and cross plots using Paraview Python View.
9+
310

411
PVAttributeMapping
512
--------------------
@@ -19,12 +26,6 @@ PVFillPartialArrays
1926
.. automodule:: geos.pv.plugins.PVFillPartialArrays
2027

2128

22-
PVGeomechanicsCalculator plugin
23-
---------------------------------------
24-
25-
.. automodule:: geos.pv.plugins.PVGeomechanicsCalculator
26-
27-
2829
PVSplitMesh
2930
----------------------------------
3031

@@ -41,3 +42,65 @@ PVClipToMainFrame
4142
----------------------------------
4243

4344
.. automodule:: geos.pv.plugins.PVClipToMainFrame
45+
46+
47+
Geos output pre-processing
48+
+++++++++++++++++++++++++++++
49+
50+
PVExtractMergeBlocksVolume plugin
51+
-------------------------------------------
52+
53+
.. automodule:: geos.pv.plugins.PVExtractMergeBlocksVolume
54+
55+
56+
PVExtractMergeBlocksVolumeSurface plugin
57+
--------------------------------------------------
58+
59+
.. automodule:: geos.pv.plugins.PVExtractMergeBlocksVolumeSurface
60+
61+
62+
PVExtractMergeBlocksVolumeSurfaceWell plugin
63+
------------------------------------------------------
64+
65+
.. automodule:: geos.pv.plugins.PVExtractMergeBlocksVolumeSurfaceWell
66+
67+
68+
PVExtractMergeBlocksVolumeWell plugin
69+
-----------------------------------------------
70+
71+
.. automodule:: geos.pv.plugins.PVExtractMergeBlocksVolumeWell
72+
73+
74+
75+
Geomechanics workflows
76+
++++++++++++++++++++++++
77+
78+
79+
PVGeomechanicsWorkflowVolume plugin
80+
---------------------------------------------
81+
82+
.. automodule:: geos.pv.plugins.PVGeomechanicsWorkflowVolume
83+
84+
85+
PVGeomechanicsWorkflowVolumeSurface plugin
86+
----------------------------------------------------
87+
88+
.. automodule:: geos.pv.plugins.PVGeomechanicsWorkflowVolumeSurface
89+
90+
91+
PVGeomechanicsWorkflowVolumeSurfaceWell plugin
92+
--------------------------------------------------------
93+
94+
.. automodule:: geos.pv.plugins.PVGeomechanicsWorkflowVolumeSurfaceWell
95+
96+
97+
PVGeomechanicsWorkflowVolumeWell plugin
98+
-------------------------------------------------
99+
100+
.. automodule:: geos.pv.plugins.PVGeomechanicsWorkflowVolumeWell
101+
102+
103+
PVGeomechanicsCalculator plugin
104+
---------------------------------------
105+
106+
.. automodule:: geos.pv.plugins.PVGeomechanicsCalculator

geos-posp/src/PVplugins/PVExtractMergeBlocksVolume.py renamed to geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolume.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
# SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies.
33
# SPDX-FileContributor: Martin Lemay
44
# ruff: noqa: E402 # disable Module level import not at top of file
5-
import os
65
import sys
6+
from pathlib import Path
77
import numpy as np
88
import numpy.typing as npt
99
from typing_extensions import Self
1010
from vtkmodules.vtkCommonCore import vtkInformation, vtkInformationVector
1111
from vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet
1212

13-
dir_path = os.path.dirname( os.path.realpath( __file__ ) )
14-
parent_dir_path = os.path.dirname( dir_path )
15-
if parent_dir_path not in sys.path:
16-
sys.path.append( parent_dir_path )
13+
# update sys.path to load all GEOS Python Package dependencies
14+
geos_pv_path: Path = Path( __file__ ).parent.parent.parent.parent.parent
15+
sys.path.insert( 0, str( geos_pv_path / "src" ) )
16+
from geos.pv.utils.config import update_paths
1717

18-
import PVplugins # noqa: F401
18+
update_paths()
1919

2020
from geos.utils.GeosOutputsConstants import (
2121
GeosMeshOutputsEnum,
@@ -28,7 +28,7 @@
2828
copyAttribute,
2929
createCellCenterAttribute,
3030
)
31-
from geos_posp.visu.PVUtils.paraviewTreatments import getTimeStepIndex
31+
from geos.pv.utils.paraviewTreatments import getTimeStepIndex
3232
from paraview.util.vtkAlgorithm import ( # type: ignore[import-not-found]
3333
VTKPythonAlgorithmBase, smdomain, smhint, smproperty, smproxy,
3434
)

geos-posp/src/PVplugins/PVExtractMergeBlocksVolumeSurface.py renamed to geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolumeSurface.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
# SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies.
33
# SPDX-FileContributor: Martin Lemay
44
# ruff: noqa: E402 # disable Module level import not at top of file
5-
import os
65
import sys
6+
from pathlib import Path
77

88
import numpy as np
99
import numpy.typing as npt
1010
from typing_extensions import Self
1111
from vtkmodules.vtkCommonCore import vtkInformation, vtkInformationVector
1212
from vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet
1313

14-
dir_path = os.path.dirname( os.path.realpath( __file__ ) )
15-
parent_dir_path = os.path.dirname( dir_path )
16-
if parent_dir_path not in sys.path:
17-
sys.path.append( parent_dir_path )
14+
# update sys.path to load all GEOS Python Package dependencies
15+
geos_pv_path: Path = Path( __file__ ).parent.parent.parent.parent.parent
16+
sys.path.insert( 0, str( geos_pv_path / "src" ) )
17+
from geos.pv.utils.config import update_paths
1818

19-
import PVplugins # noqa: F401
19+
update_paths()
2020

2121
from geos.utils.GeosOutputsConstants import (
2222
GeosMeshOutputsEnum,
@@ -29,7 +29,7 @@
2929
copyAttribute,
3030
createCellCenterAttribute,
3131
)
32-
from geos_posp.visu.PVUtils.paraviewTreatments import getTimeStepIndex
32+
from geos.pv.utils.paraviewTreatments import getTimeStepIndex
3333
from paraview.util.vtkAlgorithm import ( # type: ignore[import-not-found]
3434
VTKPythonAlgorithmBase, smdomain, smhint, smproperty, smproxy,
3535
)

geos-posp/src/PVplugins/PVExtractMergeBlocksVolumeSurfaceWell.py renamed to geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolumeSurfaceWell.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
# SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies.
33
# SPDX-FileContributor: Martin Lemay
44
# ruff: noqa: E402 # disable Module level import not at top of file
5-
import os
65
import sys
6+
from pathlib import Path
77

88
import numpy as np
99
import numpy.typing as npt
1010
from typing_extensions import Self
1111
from vtkmodules.vtkCommonCore import vtkInformation, vtkInformationVector
1212
from vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet
1313

14-
dir_path = os.path.dirname( os.path.realpath( __file__ ) )
15-
parent_dir_path = os.path.dirname( dir_path )
16-
if parent_dir_path not in sys.path:
17-
sys.path.append( parent_dir_path )
14+
# update sys.path to load all GEOS Python Package dependencies
15+
geos_pv_path: Path = Path( __file__ ).parent.parent.parent.parent.parent
16+
sys.path.insert( 0, str( geos_pv_path / "src" ) )
17+
from geos.pv.utils.config import update_paths
1818

19-
import PVplugins # noqa: F401
19+
update_paths()
2020

2121
from geos.utils.GeosOutputsConstants import (
2222
GeosMeshOutputsEnum,
@@ -29,7 +29,7 @@
2929
copyAttribute,
3030
createCellCenterAttribute,
3131
)
32-
from geos_posp.visu.PVUtils.paraviewTreatments import getTimeStepIndex
32+
from geos.pv.utils.paraviewTreatments import getTimeStepIndex
3333
from paraview.util.vtkAlgorithm import ( # type: ignore[import-not-found]
3434
VTKPythonAlgorithmBase, smdomain, smhint, smproperty, smproxy,
3535
)

geos-posp/src/PVplugins/PVExtractMergeBlocksVolumeWell.py renamed to geos-pv/src/geos/pv/plugins/PVExtractMergeBlocksVolumeWell.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies.
33
# SPDX-FileContributor: Martin Lemay
44
# ruff: noqa: E402 # disable Module level import not at top of file
5-
import os
65
import sys
6+
from pathlib import Path
77

88
import numpy as np
99
import numpy.typing as npt
@@ -14,12 +14,12 @@
1414
from vtkmodules.vtkCommonCore import vtkInformation, vtkInformationVector
1515
from vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet
1616

17-
dir_path = os.path.dirname( os.path.realpath( __file__ ) )
18-
parent_dir_path = os.path.dirname( dir_path )
19-
if parent_dir_path not in sys.path:
20-
sys.path.append( parent_dir_path )
17+
# update sys.path to load all GEOS Python Package dependencies
18+
geos_pv_path: Path = Path( __file__ ).parent.parent.parent.parent.parent
19+
sys.path.insert( 0, str( geos_pv_path / "src" ) )
20+
from geos.pv.utils.config import update_paths
2121

22-
import PVplugins # noqa: F401
22+
update_paths()
2323

2424
from geos.utils.GeosOutputsConstants import (
2525
GeosMeshOutputsEnum,
@@ -32,7 +32,7 @@
3232
copyAttribute,
3333
createCellCenterAttribute,
3434
)
35-
from geos_posp.visu.PVUtils.paraviewTreatments import getTimeStepIndex
35+
from geos.pv.utils.paraviewTreatments import getTimeStepIndex
3636

3737
__doc__ = """
3838
PVExtractMergeBlocksVolumeWell is a Paraview plugin that allows to merge

geos-posp/src/PVplugins/PVGeomechanicsWorkflowVolume.py renamed to geos-pv/src/geos/pv/plugins/PVGeomechanicsWorkflowVolume.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
# SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies.
33
# SPDX-FileContributor: Martin Lemay
44
# ruff: noqa: E402 # disable Module level import not at top of file
5-
import os
65
import sys
6+
from pathlib import Path
77

88
import numpy as np
99
from typing_extensions import Self
1010
from vtkmodules.vtkCommonCore import vtkInformation, vtkInformationVector
1111
from vtkmodules.vtkCommonDataModel import (
1212
vtkMultiBlockDataSet, )
1313

14-
dir_path = os.path.dirname( os.path.realpath( __file__ ) )
15-
parent_dir_path = os.path.dirname( dir_path )
16-
if parent_dir_path not in sys.path:
17-
sys.path.append( parent_dir_path )
14+
# update sys.path to load all GEOS Python Package dependencies
15+
geos_pv_path: Path = Path( __file__ ).parent.parent.parent.parent.parent
16+
sys.path.insert( 0, str( geos_pv_path / "src" ) )
17+
from geos.pv.utils.config import update_paths
1818

19-
import PVplugins # noqa: F401
19+
update_paths()
2020

2121
from geos.utils.Logger import Logger, getLogger
2222
from geos.utils.PhysicalConstants import (
@@ -29,12 +29,9 @@
2929
from paraview.util.vtkAlgorithm import ( # type: ignore[import-not-found]
3030
VTKPythonAlgorithmBase, smdomain, smhint, smproperty, smproxy,
3131
)
32-
from paraview.detail.loghandler import ( # type: ignore[import-not-found]
33-
VTKHandler,
34-
) # source: https://github.com/Kitware/ParaView/blob/master/Wrapping/Python/paraview/detail/loghandler.py
3532

36-
from PVplugins.PVExtractMergeBlocksVolume import PVExtractMergeBlocksVolume
37-
from geos.processing.post_processing.GeomechanicsCalculator import GeomechanicsCalculator
33+
from geos.pv.plugins.PVExtractMergeBlocksVolume import PVExtractMergeBlocksVolume
34+
from geos.pv.plugins.PVGeomechanicsCalculator import PVGeomechanicsCalculator
3835

3936
__doc__ = """
4037
PVGeomechanicsWorkflowVolume is a Paraview plugin that execute multiple filters
@@ -372,16 +369,14 @@ def computeAdditionalOutputsVolume( self: Self ) -> bool:
372369
Returns:
373370
bool: True if calculation successfully eneded, False otherwise.
374371
"""
375-
filter = GeomechanicsCalculator( self.m_volumeMesh,
376-
computeAdvancedOutputs=self.getComputeAdvancedOutputs(),
377-
speHandler=True )
378-
if not filter.logger.hasHandlers():
379-
filter.setLoggerHandler( VTKHandler() )
380-
filter.physicalConstants.grainBulkModulus = self.grainBulkModulus
381-
filter.physicalConstants.specificDensity = self.specificDensity
382-
filter.physicalConstants.rockCohesion = self.rockCohesion
383-
filter.physicalConstants.frictionAngle = self.frictionAngle
384-
filter.applyFilter()
385-
self.m_volumeMesh.ShallowCopy( filter.getOutput() )
372+
filter = PVGeomechanicsCalculator()
373+
filter.SetInputDataObject( self.m_volumeMesh ),
374+
filter.setComputeAdvancedProperties( self.getComputeAdvancedOutputs() )
375+
filter.setGrainBulkModulus( self.m_grainBulkModulus )
376+
filter.setSpecificDensity = ( self.m_specificDensity )
377+
filter.setRockCohesion = ( self.m_rockCohesion )
378+
filter.setFrictionAngle = ( self.m_frictionAngle )
379+
filter.Update()
380+
self.m_volumeMesh.ShallowCopy( filter.GetOutputDataObject( 0 ) )
386381
self.m_volumeMesh.Modified()
387382
return True

0 commit comments

Comments
 (0)