Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
bb2911e
Move SurfaceGeomechanicsFilter and refactor functions
paloma-martinez Sep 9, 2025
391aeea
Move and refactor plugin
paloma-martinez Sep 9, 2025
176b508
add geos-processing to install script
paloma-martinez Sep 10, 2025
cd83faf
Merge branch 'main' into pmartinez/refactor/moveSurfaceGeomechanics
paloma-martinez Sep 10, 2025
8b72f3f
Add more log
paloma-martinez Sep 12, 2025
5bd267c
Add documentation
paloma-martinez Sep 18, 2025
4277ebb
Filter cleaning
paloma-martinez Oct 3, 2025
2e71538
Documentation
paloma-martinez Oct 3, 2025
4bdc33c
Merge branch 'main' into pmartinez/refactor/moveSurfaceGeomechanics
paloma-martinez Oct 3, 2025
b6f9d85
Refactor the basis change computation
paloma-martinez Oct 15, 2025
37e3fd6
Merge branch 'main' into pmartinez/refactor/moveSurfaceGeomechanics
paloma-martinez Oct 15, 2025
9c10aea
Refactor of normal and tangential vectors computation
paloma-martinez Oct 21, 2025
b2d6447
Merge branch 'main' into pmartinez/refactor/moveSurfaceGeomechanics
paloma-martinez Oct 21, 2025
4643add
Replace and add tests for attribute to vector functions
paloma-martinez Oct 29, 2025
64494c8
Add tests and better error handling
paloma-martinez Oct 29, 2025
98a825b
Adding tests for SurfaceGeomechanics filter
paloma-martinez Oct 29, 2025
c87b243
Merge branch 'main' into pmartinez/refactor/moveSurfaceGeomechanics
paloma-martinez Oct 29, 2025
52bcd56
Fix
paloma-martinez Oct 29, 2025
d3e4fc6
typo
paloma-martinez Oct 29, 2025
badc7cd
Small modifications from Romain review
paloma-martinez Oct 30, 2025
335782c
Fix typing and error in getTangents function
paloma-martinez Oct 31, 2025
359ceb0
Fix tests following previous commit modifs
paloma-martinez Oct 31, 2025
27ae09d
SISO filter
paloma-martinez Oct 31, 2025
58e30e3
fix docstring
paloma-martinez Oct 31, 2025
c56b2de
fix the fix
paloma-martinez Oct 31, 2025
cdd923c
typing
paloma-martinez Oct 31, 2025
24e4c5b
typing
paloma-martinez Oct 31, 2025
a7f17e0
Merge branch 'main' into pmartinez/refactor/moveSurfaceGeomechanics
paloma-martinez Oct 31, 2025
7e7eca1
.
paloma-martinez Oct 31, 2025
9df9481
Merge branch 'pmartinez/refactor/moveSurfaceGeomechanics' of https://…
paloma-martinez Oct 31, 2025
dab09d0
Move GeosBlockMerge from geos-posp to geos-processing
RomainBaville Oct 31, 2025
7677e88
Remove PVPythonAlgorythmBase
RomainBaville Oct 31, 2025
a59d804
Update to the last version of the main
RomainBaville Oct 31, 2025
95072db
clean & refactor the code
RomainBaville Nov 3, 2025
7b94f10
Merge branch 'main' into RomainBaville/refactor/MoveGeosBlockMerge
RomainBaville Nov 3, 2025
c2ab8fb
Update import
RomainBaville Nov 3, 2025
c2df04e
Fix density name for fluid phase
RomainBaville Nov 4, 2025
eabc058
harmonized the code (logger, varriable name ...)
RomainBaville Nov 4, 2025
ab7bfcb
Clean the doc
RomainBaville Nov 4, 2025
789cd31
Update GeosBlockMerge calling
RomainBaville Nov 4, 2025
8f08be8
fix computePhaseNames
RomainBaville Nov 4, 2025
13ea5b5
fix convertBlockToSurface
RomainBaville Nov 4, 2025
7755639
fix ci
RomainBaville Nov 4, 2025
e23251b
Refactor plugin to allways extract and merge all the possible blocks
RomainBaville Nov 5, 2025
efc53be
fix timestep parsing
RomainBaville Nov 6, 2025
f2a98a0
fix computePhaseName
RomainBaville Nov 6, 2025
db03941
clean log
RomainBaville Nov 6, 2025
4a380b0
clean output
RomainBaville Nov 6, 2025
5761f7b
Update Geos Output array names
RomainBaville Nov 6, 2025
a955382
fix error
RomainBaville Nov 6, 2025
7c76c64
Apply Paloma suggestion
RomainBaville Nov 7, 2025
de12113
Update the doc and clean the interface
RomainBaville Nov 7, 2025
2dd0c9c
Move utils functions from the plugin to be generalisable
RomainBaville Nov 12, 2025
c8308dc
fix executive
RomainBaville Nov 12, 2025
3cc2be7
Clean the plugin outputs messages
RomainBaville Nov 12, 2025
62cc57d
Rename the plugin file
RomainBaville Nov 12, 2025
dddfed1
Remove old PVExtractAndMerge plugin
RomainBaville Nov 12, 2025
0569296
Update GEOS output attribute name
RomainBaville Nov 12, 2025
065f126
fix the doc
RomainBaville Nov 12, 2025
b6a7161
fix import
RomainBaville Nov 12, 2025
dbb2b44
Merge branch 'RomainBaville/refactor/MoveGeosBlockMerge' into RomainB…
RomainBaville Nov 12, 2025
0f5882a
fix yapf
RomainBaville Nov 13, 2025
8a7b9a6
Update the doc
RomainBaville Nov 13, 2025
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
12 changes: 0 additions & 12 deletions docs/geos_posp_docs/filters.rst

This file was deleted.

2 changes: 0 additions & 2 deletions docs/geos_posp_docs/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ Processing
.. toctree::
:maxdepth: 5

filters

pyvistaTools
9 changes: 9 additions & 0 deletions docs/geos_processing_docs/post_processing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,12 @@ geos.processing.post_processing.GeosBlockExtractor module
:members:
:undoc-members:
:show-inheritance:


geos.processing.post_processing.GeosBlockMerge module
-----------------------------------------------------

.. automodule:: geos.processing.post_processing.GeosBlockMerge
:members:
:undoc-members:
:show-inheritance:
24 changes: 3 additions & 21 deletions docs/geos_pv_docs/processing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,10 @@ PVClipToMainFrame
Geos output pre-processing
+++++++++++++++++++++++++++++

PVExtractMergeBlocksVolume plugin
-------------------------------------------

.. automodule:: geos.pv.plugins.PVExtractMergeBlocksVolume


PVExtractMergeBlocksVolumeSurface plugin
--------------------------------------------------

.. automodule:: geos.pv.plugins.PVExtractMergeBlocksVolumeSurface


PVExtractMergeBlocksVolumeSurfaceWell plugin
------------------------------------------------------

.. automodule:: geos.pv.plugins.PVExtractMergeBlocksVolumeSurfaceWell


PVExtractMergeBlocksVolumeWell plugin
-----------------------------------------------
PVGeosBlockExtractAndMerge plugin
----------------------------------

.. automodule:: geos.pv.plugins.PVExtractMergeBlocksVolumeWell
.. automodule:: geos.pv.plugins.PVGeosBlockExtractAndMerge



Expand Down
8 changes: 8 additions & 0 deletions docs/geos_pv_docs/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ geos.pv.utils.paraviewTreatments module
---------------------------------------------

.. automodule:: geos.pv.utils.paraviewTreatments
:members:
:undoc-members:
:show-inheritance:

geos.pv.utils.workflowFunctions module
---------------------------------------

.. automodule:: geos.pv.utils.workflowFunctions
:members:
:undoc-members:
:show-inheritance:
133 changes: 117 additions & 16 deletions geos-mesh/src/geos/mesh/utils/genericHelpers.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies.
# SPDX-FileContributor: Martin Lemay, Paloma Martinez
import numpy as np
import logging
import numpy as np
import numpy.typing as npt
from typing import Iterator, List, Sequence, Any, Union, Tuple
from typing import ( Iterator, List, Sequence, Any, Union, Tuple )

from vtkmodules.util.numpy_support import ( numpy_to_vtk, vtk_to_numpy )
from vtkmodules.vtkCommonCore import vtkIdList, vtkPoints, reference, vtkDataArray, vtkLogger, vtkFloatArray
from vtkmodules.vtkCommonDataModel import (
vtkUnstructuredGrid,
vtkMultiBlockDataSet,
vtkPolyData,
vtkDataSet,
vtkDataObject,
vtkPlane,
vtkCellTypes,
vtkIncrementalOctreePointLocator,
)
from vtkmodules.vtkCommonDataModel import ( vtkUnstructuredGrid, vtkMultiBlockDataSet, vtkPolyData, vtkDataSet,
vtkDataObject, vtkPlane, vtkCellTypes, vtkIncrementalOctreePointLocator,
VTK_TRIANGLE )
from vtkmodules.vtkFiltersCore import ( vtk3DLinearGridPlaneCutter, vtkPolyDataNormals, vtkPolyDataTangents )
from vtkmodules.vtkFiltersTexture import vtkTextureMapToPlane
from vtkmodules.vtkFiltersGeometry import vtkDataSetSurfaceFilter
from vtkmodules.vtkFiltersGeneral import vtkDataSetTriangleFilter

from geos.mesh.utils.multiblockHelpers import ( getBlockElementIndexesFlatten, getBlockFromFlatIndex )

from geos.utils.algebraFunctions import (
getAttributeMatrixFromVector,
getAttributeVectorFromMatrix,
)
from geos.utils.algebraFunctions import ( getAttributeMatrixFromVector, getAttributeVectorFromMatrix )
from geos.utils.geometryFunctions import ( getChangeOfBasisMatrix, CANONICAL_BASIS_3D )
from geos.utils.Logger import ( getLogger, Logger, VTKCaptureLog, RegexExceptionFilter )
from geos.utils.Errors import VTKError
Expand All @@ -40,6 +33,114 @@
"""


def isTriangulate( dataSet: vtkUnstructuredGrid ) -> bool:
"""Check if the mesh is triangulate only.

Args:
dataSet (vtkUnstructuredGrid): The mesh to check

Returns:
bool: True if the mesh is triangulate only, False otherwise.
"""
cellTypes: vtkCellTypes = vtkCellTypes()
dataSet.GetCellTypes( cellTypes )

return all( cellTypes.GetCellType( cell ) == VTK_TRIANGLE for cell in range( cellTypes.GetNumberOfTypes() ) )


def triangulateMesh(
dataSet: vtkUnstructuredGrid,
logger: Union[ Logger, None ] = None,
) -> vtkUnstructuredGrid:
"""Triangulate any type of dataset.

Args:
dataSet (vtkUnstructuredGrid): The mesh to triangulate
logger (Union[Logger, None], optional): A logger to manage the output messages.
Defaults to None, an internal logger is used.

Returns:
vtkUnstructuredGrid: Triangulated mesh
"""
if logger is None:
logger = getLogger( "Triangulate", True )
# Creation of a child logger to deal with VTKErrors without polluting parent logger
vtkErrorLogger: Logger = getLogger( f"{logger.name}.vtkErrorLogger", True )
vtkErrorLogger.propagate = False

vtkLogger.SetStderrVerbosity( vtkLogger.VERBOSITY_ERROR )

vtkErrorLogger.addFilter( RegexExceptionFilter() ) # will raise VTKError if captured VTK Error
vtkErrorLogger.setLevel( logging.DEBUG )

with VTKCaptureLog() as capturedLog:
triangulateMeshFilter: vtkDataSetTriangleFilter = vtkDataSetTriangleFilter()
triangulateMeshFilter.SetInputData( dataSet )
triangulateMeshFilter.Update()

capturedLog.seek( 0 )
captured = capturedLog.read().decode()

vtkErrorLogger.debug( captured.strip() )

triangulatedMesh: vtkUnstructuredGrid = triangulateMeshFilter.GetOutput()

if triangulatedMesh.GetCellData() is None:
raise VTKError( "Something went wrong with VTK triangulation of the mesh." )

return triangulatedMesh


def convertUnstructuredGridToPolyData(
dataSet: vtkUnstructuredGrid,
logger: Union[ Logger, None ] = None,
) -> vtkPolyData:
"""Convert vtkUnstructuredGrid to vtkPolyData.

..Warning:: Work only with triangulated mesh

Args:
dataSet (vtkUnstructuredGrid): Input mesh block
logger (Union[Logger, None], optional): A logger to manage the output messages.
Defaults to None, an internal logger is used.

Returns:
vtkPolyData: Extracted surface
"""
if logger is None:
logger = getLogger( "ConvertVtkUnstructuredGridToVtkPolyData.", True )
# Creation of a child logger to deal with VTKErrors without polluting parent logger
vtkErrorLogger: Logger = getLogger( f"{logger.name}.vtkErrorLogger", True )
vtkErrorLogger.propagate = False

vtkLogger.SetStderrVerbosity( vtkLogger.VERBOSITY_ERROR )

vtkErrorLogger.addFilter( RegexExceptionFilter() ) # will raise VTKError if captured VTK Error
vtkErrorLogger.setLevel( logging.DEBUG )

with VTKCaptureLog() as capturedLog:
extractSurfaceFilter: vtkDataSetSurfaceFilter = vtkDataSetSurfaceFilter()
extractSurfaceFilter.SetInputData( dataSet )
# fast mode should be used for rendering only
extractSurfaceFilter.FastModeOff()
# Delegation activated allow to accelerate the processing with unstructured mesh
# see https://vtk.org/doc/nightly/html/classvtkDataSetSurfaceFilter.html
extractSurfaceFilter.DelegationOn()
extractSurfaceFilter.Update()

capturedLog.seek( 0 )
captured = capturedLog.read().decode()

vtkErrorLogger.debug( captured.strip() )

extractedSurface: vtkPolyData = extractSurfaceFilter.GetOutput()

if extractedSurface is None:
raise VTKError( "Something went wrong with VTK convert vtu to vtp." )

return extractedSurface


def toVtkIdList( data: List[ int ] ) -> vtkIdList:
"""Utility function transforming a list of ids into a vtkIdList.

Expand Down
Loading