vtk Filters
This package defines vtk filters that allows to process Geos outputs.
geos_posp.filters.AttributeMappingFromCellCoords module
AttributeMappingFromCellCoords module is a vtk filter that map two identical mesh (or a mesh is an extract from the other one) and create an attribute containing shared cell ids.
Filter input and output types are vtkUnstructuredGrid.
To use the filter:
from filters.AttributeMappingFromCellCoords import AttributeMappingFromCellCoords
# filter inputs
logger :Logger
input :vtkUnstructuredGrid
TransferAttributeName : str
# instanciate the filter
filter :AttributeMappingFromCellCoords = AttributeMappingFromCellCoords()
# set the logger
filter.SetLogger(logger)
# set input data object
filter.SetInputDataObject(input)
# set Attribute to transfer
filter.SetTransferAttributeNames(AttributeName)
# set Attribute to compare
filter.SetIDAttributeName(AttributeName)
# do calculations
filter.Update()
# get output object
output :vtkPolyData = filter.GetOutputDataObject(0)
# get created attribute names
newAttributeNames :set[str] = filter.GetNewAttributeNames()
- class geos_posp.filters.AttributeMappingFromCellCoords.AttributeMappingFromCellCoords[source]
Bases:
VTKPythonAlgorithmBase
Map the properties of a source mesh to a receiver mesh.
- RequestData(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestData.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- RequestDataObject(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestDataObject.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- SetTransferAttributeNames(transferredAttributeNames)[source]
Setter for transferredAttributeName.
- Parameters:
transferredAttributeNames (set[str]) – set of names of the attributes to transfer.
geos_posp.filters.AttributeMappingFromCellId module
AttributeMappingFromCellId module is a vtk filter that transfer a attribute from a server mesh to a client mesh.
Filter input and output types are vtkPolyData.
To use the filter:
from filters.AttributeMappingFromCellId import AttributeMappingFromCellId
# filter inputs
logger :Logger
input :vtkPolyData
TransferAttributeName : str
# instanciate the filter
filter :AttributeMappingFromCellId = AttributeMappingFromCellId()
# set the logger
filter.SetLogger(logger)
# set input data object
filter.SetInputDataObject(input)
# set Attribute to transfer
filter.SetTransferAttributeName(AttributeName)
# set Attribute to compare
filter.SetIDAttributeName(AttributeName)
# do calculations
filter.Update()
# get output object
output :vtkPolyData = filter.GetOutputDataObject(0)
# get created attribute names
newAttributeNames :set[str] = filter.GetNewAttributeNames()
- class geos_posp.filters.AttributeMappingFromCellId.AttributeMappingFromCellId[source]
Bases:
VTKPythonAlgorithmBase
Map the properties of a source mesh to a receiver mesh.
- RequestData(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestData.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- RequestDataObject(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestDataObject.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- getCellMap(serverMesh, clientMesh)[source]
Compute the mapping between both mesh from cell ids.
- Parameters:
serverMesh (vtkUnstructuredGrid) – server mesh
clientMesh (vtkUnstructuredGrid) – client mesh
- Returns:
- the map where for each cell index of the
client mesh, the cell index of the server mesh.
- Return type:
npt.NDArray[np.int64]
geos_posp.filters.GeomechanicsCalculator module
GeomechanicsCalculator module is a vtk filter that allows to compute additional Geomechanical properties from existing ones.
GeomechanicsCalculator filter inputs are either vtkPointSet or vtkUnstructuredGrid and returned object is of same type as input.
To use the filter:
import numpy as np
from filters.GeomechanicsCalculator import GeomechanicsCalculator
# filter inputs
logger :Logger
# input object
input :Union[vtkPointSet, vtkUnstructuredGrid]
# grain bulk modulus in Pa (e.g., use a very high value to get a Biot coefficient equal to 1)
grainBulkModulus :float = 1e26
# Reference density to compute specific gravity (e.g. fresh water density) in kg.m^-3
specificDensity :float = 1000.
# rock cohesion in Pa
rockCohesion :float = 1e8
# friction angle in °
frictionAngle :float = 10 * np.pi / 180.
# instanciate the filter
geomechanicsCalculatorFilter :GeomechanicsCalculator = GeomechanicsCalculator()
# set filter attributes
# set logger
geomechanicsCalculatorFilter.SetLogger(logger)
# set input object
geomechanicsCalculatorFilter.SetInputDataObject(input)
# set computeAdvancedOutputsOn or computeAdvancedOutputsOff to compute or
# not advanced outputs...
geomechanicsCalculatorFilter.computeAdvancedOutputsOn()
# set oter parameters
geomechanicsCalculatorFilter.SetGrainBulkModulus(grainBulkModulus)
geomechanicsCalculatorFilter.SetSpecificDensity(specificDensity)
# rock cohesion and friction angle are used for advanced outputs only
geomechanicsCalculatorFilter.SetRockCohesion(rockCohesion)
geomechanicsCalculatorFilter.SetFrictionAngle(frictionAngle)
# do calculations
geomechanicsCalculatorFilter.Update()
# get filter output (same type as input)
output :Union[vtkPointSet, vtkUnstructuredGrid] = geomechanicsCalculatorFilter.GetOutputDataObject(0)
- class geos_posp.filters.GeomechanicsCalculator.GeomechanicsCalculator[source]
Bases:
VTKPythonAlgorithmBase
VTK Filter to perform Geomechanical output computation.
Input object is either a vtkPointSet or a vtkUntructuredGrid.
- FillInputPortInformation(port, info)[source]
Inherited from VTKPythonAlgorithmBase::RequestInformation.
- Parameters:
port (int) – input port
info (vtkInformationVector) – info
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- RequestData(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestData.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- RequestDataObject(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestDataObject.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- RequestInformation(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestInformation.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- SetFrictionAngle(frictionAngle)[source]
Set the friction angle.
- Parameters:
frictionAngle (float) – friction angle (rad)
- SetGrainBulkModulus(grainBulkModulus)[source]
Set the grain bulk modulus.
- Parameters:
grainBulkModulus (float) – grain bulk modulus
- SetRockCohesion(rockCohesion)[source]
Set the rock cohesion.
- Parameters:
rockCohesion (float) – rock cohesion
- SetSpecificDensity(specificDensity)[source]
Set the specific density.
- Parameters:
specificDensity (float) – pecific density
- checkMandatoryAttributes(onPoints)[source]
Check that mandatory attributes are present in the mesh.
The mesh must contains either the young Modulus and Poisson’s ratio (m_computeYoungPoisson=False) or the bulk and shear moduli (m_computeYoungPoisson=True)
- Parameters:
onPoints (bool) – attributes are on points (True) or on cells (False)
- Returns:
True if all needed attributes are present, False otherwise
- Return type:
bool
- computeAdvancedOutputs()[source]
Compute advanced geomechanical outputs.
- Returns:
return True if calculation successfully ended, False otherwise.
- Return type:
bool
- computeBasicOutputs()[source]
Compute basic geomechanical outputs.
- Returns:
return True if calculation successfully ended, False otherwise.
- Return type:
bool
- computeBiotCoefficient()[source]
Compute Biot coefficient from default and grain bulk modulus.
- Returns:
True if calculation successfully ended, False otherwise.
- Return type:
bool
- computeCompressibilityCoefficient()[source]
Compute compressibility coefficient from simulation outputs.
Compressibility coefficient is computed from Poisson’s ratio, bulk modulus, Biot coefficient and Porosity.
- Returns:
True if the attribute is correctly created, False otherwise.
- Return type:
bool
- computeCriticalPorePressure()[source]
Compute the critical pore pressure and the pressure index.
- Returns:
return True if calculation successfully ended, False otherwise.
- Return type:
bool
- computeCriticalTotalStressRatio()[source]
Compute fracture index and fracture threshold.
- Returns:
return True if calculation successfully ended, False otherwise.
- Return type:
bool
- computeDepthAlongLine()[source]
Compute depth along a line.
- Returns:
1D array with depth property
- Return type:
npt.NDArray[np.float64]
- computeDepthInMesh()[source]
Compute depth of each cell in a mesh.
- Returns:
array with depth property
- Return type:
npt.NDArray[np.float64]
- computeEffectiveStressRatioOed()[source]
Compute the effective stress ratio in oedometric conditions.
- Returns:
return True if calculation successfully ended, False otherwise.
- Return type:
bool
- computeElasticModulus()[source]
Compute elastic moduli.
Young modulus and the poisson ratio computed from shear and bulk moduli if needed.
- Returns:
True if elastic moduli are already present or if calculation successfully ended, False otherwise.
- Return type:
bool
- computeElasticModulusFromBulkShear()[source]
Compute Young modulus Poisson’s ratio from bulk and shear moduli.
- Returns:
True if calculation successfully ended, False otherwise
- Return type:
bool
- computeElasticModulusFromYoungPoisson()[source]
Compute bulk modulus from Young Modulus and Poisson’s ratio.
- Returns:
True if bulk modulus was wuccessfully computed, False otherwise
- Return type:
bool
- computeElasticStrain()[source]
Compute elastic strain from effective stress and elastic modulus.
- Returns:
return True if calculation successfully ended, False otherwise.
- Return type:
bool
- computeLitostaticStress()[source]
Compute lithostatic stress.
- Returns:
True if calculation successfully ended, False otherwise.
- Return type:
bool
- computeRealEffectiveStressRatio()[source]
Compute effective stress ratio.
- Returns:
True if calculation successfully ended, False otherwise.
- Return type:
bool
- computeReservoirStressPathOed()[source]
Compute Reservoir Stress Path in oedometric conditions.
- Returns:
return True if calculation successfully ended, False otherwise.
- Return type:
bool
- computeReservoirStressPathReal()[source]
Compute reservoir stress paths.
- Returns:
return True if calculation successfully ended, False otherwise.
- Return type:
bool
- computeSpecificGravity()[source]
Create Specific gravity attribute.
Specific gravity is computed from rock density attribute and specific density input.
- Returns:
True if the attribute is correctly created, False otherwise.
- Return type:
bool
- computeStressRatioReal(inputAttribute, outputAttribute)[source]
Compute the ratio between horizontal and vertical effective stress.
- Returns:
return True if calculation successfully ended, False otherwise.
- Return type:
bool
- computeTotalStressInitial()[source]
Compute total stress at initial time step.
- Returns:
True if calculation successfully ended, False otherwise.
- Return type:
bool
- computeTotalStresses()[source]
Compute total stress total stress ratio.
Total stress is computed at the initial and current time steps. total stress ratio is computed at current time step only.
- Returns:
True if calculation successfully ended, False otherwise.
- Return type:
bool
- doComputeTotalStress(effectiveStress, pressure, biotCoefficient, totalStressAttributeName)[source]
Compute total stress from effective stress and pressure.
- Parameters:
effectiveStress (npt.NDArray[np.float64]) – effective stress
pressure (npt.NDArray[np.float64] | None) – pressure
biotCoefficient (npt.NDArray[np.float64]) – biot coefficient
totalStressAttributeName (str) – total stress attribute name
- Returns:
return True if calculation successfully ended, False otherwise.
- Return type:
bool
- getPointCoordinates()[source]
Get the coordinates of Points or Cell center.
- Returns:
points/cell center coordinates
- Return type:
npt.NDArray[np.float64]
- getZcoordinates()[source]
Get z coordinates from self.m_output.
- Returns:
1D array with depth property
- Return type:
npt.NDArray[np.float64]
geos_posp.filters.GeosBlockExtractor module
GeosBlockExtractor module is a vtk filter that allows to extract Volume mesh, Wells and Faults from a vtkMultiBlockDataSet.
Filter input and output types are vtkMultiBlockDataSet.
To use the filter:
from filters.GeosBlockExtractor import GeosBlockExtractor
# filter inputs
logger :Logger
input :vtkMultiBlockDataSet
# instanciate the filter
blockExtractor :GeosBlockExtractor = GeosBlockExtractor()
# set the logger
blockExtractor.SetLogger(logger)
# set input data object
blockExtractor.SetInputDataObject(input)
# ExtractFaultsOn or ExtractFaultsOff to (de)activate the extraction of Fault blocks
blockExtractor.ExtractFaultsOn()
# ExtractWellsOn or ExtractWellsOff to (de)activate the extraction of well blocks
blockExtractor.ExtractWellsOn()
# do calculations
blockExtractor.Update()
# get output object
output :vtkMultiBlockDataSet = blockExtractor.GetOutputDataObject(0)
- class geos_posp.filters.GeosBlockExtractor.GeosBlockExtractor[source]
Bases:
VTKPythonAlgorithmBase
VTK Filter that perform GEOS block extraction.
The filter returns the volume mesh as the first output, Surface mesh as the second output, and well mesh as the third output.
- FillInputPortInformation(port, info)[source]
Inherited from VTKPythonAlgorithmBase::RequestInformation.
- Parameters:
port (int) – input port
info (vtkInformationVector) – info
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- RequestData(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestData.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- RequestInformation(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestInformation.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- doExtraction()[source]
Apply block extraction.
- Returns:
True if block extraction successfully ended, False otherwise.
- Return type:
bool
- extractRegion(type)[source]
Extract volume mesh from input vtkMultiBlockDataSet.
- Returns:
True if volume mesh extraction successfully ended, False otherwise.
- Return type:
bool
- getOutputFaults()[source]
Get output fault mesh.
- Returns:
fault mesh
- Return type:
vtkMultiBlockDataSet
geos_posp.filters.GeosBlockMerge module
GeosBlockMerge module is a vtk filter that allows to merge Geos ranks, rename stress and porosity attributes, and identify fluids and rock phases.
Filter input and output types are vtkMultiBlockDataSet.
To use the filter:
from filters.GeosBlockMerge import GeosBlockMerge
# filter inputs
logger :Logger
input :vtkMultiBlockDataSet
# instanciate the filter
mergeBlockFilter :GeosBlockMerge = GeosBlockMerge()
# set the logger
mergeBlockFilter.SetLogger(logger)
# set input data object
mergeBlockFilter.SetInputDataObject(input)
# ConvertSurfaceMeshOff or ConvertSurfaceMeshOn to (de)activate the conversion
# of vtkUnstructuredGrid to surface withNormals and Tangents calculation.
mergeBlockFilter.ConvertSurfaceMeshOff()
# do calculations
mergeBlockFilter.Update()
# get output object
output :vtkMultiBlockDataSet = mergeBlockFilter.GetOutputDataObject(0)
- class geos_posp.filters.GeosBlockMerge.GeosBlockMerge[source]
Bases:
VTKPythonAlgorithmBase
VTK Filter that perform GEOS rank merge.
The filter returns a multiblock mesh composed of elementary blocks.
- ConvertSurfaceMeshOff()[source]
Deactivate surface conversion from vtkUnstructredGrid to vtkPolyData.
- FillInputPortInformation(port, info)[source]
Inherited from VTKPythonAlgorithmBase::RequestInformation.
- Parameters:
port (int) – input port
info (vtkInformationVector) – info
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- RequestData(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestData.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- RequestInformation(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestInformation.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- computeNormals(surface)[source]
Compute normals of the given surface.
- Parameters:
surface (vtkPolyData) – surface to compute the normals
- Returns:
surface with normal attribute
- Return type:
vtkPolyData
- computeTangents(surface)[source]
Compute tangents of the given surface.
- Parameters:
surface (vtkPolyData) – surface to compute the tangents
- Returns:
surface with tangent attribute
- Return type:
vtkPolyData
- convertBlockToSurface(block)[source]
Convert vtkUnstructuredGrid to a surface vtkPolyData.
..WARNING: work only with triangulated surfaces
TODO: need to convert quadrangular to triangulated surfaces first
- Parameters:
block (vtkUnstructuredGrid) – block from which to extract the surface
- Returns:
extracted surface
- Return type:
vtkPolyData
- convertFaultsToSurfaces()[source]
Convert blocks corresponding to faults to surface.
- Returns:
True if calculation succesfully ended, False otherwise
- Return type:
bool
- doMerge()[source]
Apply block merge.
- Returns:
True if block merge successfully ended, False otherwise.
- Return type:
bool
- getPhaseNames(attributeSet)[source]
Get the names of the phases in the mesh from Point/Cell attributes.
- Parameters:
attributeSet (set[str]) – list of attributes where to find phases
- Returns:
the list of phase names that appear at least twice.
- Return type:
set[str]
- getPhases(onCells=True)[source]
Get the dictionnary of phases classified according to PhaseTypeEnum.
- Parameters:
onCells (bool, optional) –
Attributes are on Cells (Default) or on Points.
Defaults to True.
- Returns:
a dictionnary with phase names as keys and phase type as value.
- Return type:
dict[str, PhaseTypeEnum]
- mergeChildBlocks(compositeBlock)[source]
Merge all children of the input composite block.
- Parameters:
compositeBlock (vtkMultiBlockDataSet) – composite block
- Returns:
merged block
- Return type:
vtkUnstructuredGrid
- mergeRankBlocks()[source]
Merge all elementary node that belong to a same parent node.
- Returns:
True if calculation successfully ended, False otherwise
- Return type:
bool
- renameAttributes(mesh, phaseClassification)[source]
Rename attributes to harmonize throughout the mesh.
- Parameters:
mesh (vtkMultiBlockDataSet) – input mesh
phaseClassification (dict[str, PhaseTypeEnum]) – phase classification detected from attributes
- Returns:
output mesh with renamed attributes
- Return type:
vtkMultiBlockDataSet
geos_posp.filters.SurfaceGeomechanics module
SurfaceGeomechanics module is a vtk filter that allows to compute Geomechanical properties on surfaces.
Filter input and output types are vtkPolyData.
To use the filter:
from filters.SurfaceGeomechanics import SurfaceGeomechanics
# filter inputs
logger :Logger
input :vtkPolyData
rockCohesion :float
frictionAngle :float # angle in radian
# instanciate the filter
surfaceGeomechanicsFilter :SurfaceGeomechanics = SurfaceGeomechanics()
# set the logger
surfaceGeomechanicsFilter.SetLogger(logger)
# set input data object
surfaceGeomechanicsFilter.SetInputDataObject(input)
# set rock cohesion anf friction angle
surfaceGeomechanicsFilter.SetRockCohesion(rockCohesion)
surfaceGeomechanicsFilter.SetFrictionAngle(frictionAngle)
# do calculations
surfaceGeomechanicsFilter.Update()
# get output object
output :vtkPolyData = surfaceGeomechanicsFilter.GetOutputDataObject(0)
# get created attribute names
newAttributeNames :set[str] = surfaceGeomechanicsFilter.GetNewAttributeNames()
- class geos_posp.filters.SurfaceGeomechanics.SurfaceGeomechanics[source]
Bases:
VTKPythonAlgorithmBase
Vtk filter to compute geomechanical surfacic attributes.
Input and Output objects are a vtkMultiBlockDataSet containing surface objects with Normals and Tangential attributes.
- FillInputPortInformation(port, info)[source]
Inherited from VTKPythonAlgorithmBase::RequestInformation.
- Parameters:
port (int) – input port
info (vtkInformationVector) – info
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- GetNewAttributeNames()[source]
Get the set of new attribute names that were created.
- Returns:
set of new attribute names
- Return type:
set[str]
- RequestData(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestData.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- RequestInformation(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestInformation.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- SetFrictionAngle(frictionAngle)[source]
Set friction angle value.
- Parameters:
frictionAngle (float) – friction angle (rad)
- SetRockCohesion(rockCohesion)[source]
Set rock cohesion value.
- Parameters:
rockCohesion (float) – rock cohesion (Pa)
- computeChangeOfBasisMatrix(localBasis, fromLocalToYXZ)[source]
Compute the change of basis matrix according to local coordinates.
- Parameters:
localBasis (npt.NDArray[np.float64]) – local coordinate vectors.
fromLocalToYXZ (bool) – if True, change of basis matrix is from local to XYZ bases, otherwise it is from XYZ to local bases.
- Returns:
change of basis matrix.
- Return type:
npt.NDArray[np.float64]
- computeNewCoordinates(attrArray, normalTangentVectors, fromLocalToYXZ)[source]
Compute the coordinates of a vectorial attribute.
- Parameters:
attrArray (npt.NDArray[np.float64]) – vector of attribute values
normalTangentVectors (npt.NDArray[np.float64]) – 3xNx3 local vector coordinates
fromLocalToYXZ (bool) – if True, conversion is done from local to XYZ basis, otherwise conversion is done from XZY to Local basis.
- Returns:
Vector of new coordinates of the attribute.
- Return type:
npt.NDArray[np.float64]
- computeNewCoordinatesVector3(vector, changeOfBasisMatrix)[source]
Compute attribute new coordinates of vector of size 3.
- Parameters:
vector (npt.NDArray[np.float64]) – input coordinates.
changeOfBasisMatrix (npt.NDArray[np.float64]) – change of basis matrix
- Returns:
new coordinates
- Return type:
npt.NDArray[np.float64]
- computeNewCoordinatesVector6(vector, changeOfBasisMatrix)[source]
Compute attribute new coordinates of vector of size > 3.
- Parameters:
vector (npt.NDArray[np.float64]) – input coordinates.
changeOfBasisMatrix (npt.NDArray[np.float64]) – change of basis matrix
- Returns:
new coordinates
- Return type:
npt.NDArray[np.float64]
- computeShearCapacityUtilization()[source]
Compute the shear capacity utilization on surface.
- Returns:
True if calculation successfully ended, False otherwise.
- Return type:
bool
- convertLocalToXYZBasisAttributes()[source]
Convert vectorial property coordinates from Local to canonic basis.
- Returns:
True if calculation successfully ended, False otherwise
- Return type:
bool
- convertXYZToLocalBasisAttributes()[source]
Convert vectorial property coordinates from canonic to local basis.
- Returns:
True if calculation successfully ended, False otherwise
- Return type:
bool
- filterAttributesToConvert(attributesToFilter0)[source]
Filter the set of attribute names if they are vectorial and present.
- Parameters:
attributesToFilter0 (set[str]) – set of attribute names to filter.
- Returns:
Set of the attribute names.
- Return type:
set[str]
geos_posp.filters.TransferAttributesVolumeSurface module
TransferAttributesVolumeSurface is a vtk filter that allows to transfer volume mesh attributes to surface mesh.
This filter transfer a cell attribute as a face attribute from each volume cell adjacent to a surface face. Since a face can be adjacent to 2 cells (one at each side), 2 attributes are created with the suffix ‘_plus’ and ‘_minus’ depending on the normal vector direction of the face.
Input and output surface types are vtkPolyData and input volume mesh is vtkUnstructuredGrid.
Warning
This filter must be use very cautiously since its result may have no sense.
To use it:
from filters.TransferAttributesVolumeSurface import TransferAttributesVolumeSurface
filter :TransferAttributesVolumeSurface = TransferAttributesVolumeSurface()
# set input data objects
filter.AddInputDataObject(0, volumeMesh)
filter.AddInputDataObject(1, surfaceMesh)
# set attribute names to transfer
attributeNames :set[str]
filter.SetAttributeNamesToTransfer(attributeNames)
# do calculations
filter.Update()
# get filter output surface with new attributes
output :vtkPolyData = filter.GetOutputDataObject(0)
- class geos_posp.filters.TransferAttributesVolumeSurface.TransferAttributesVolumeSurface[source]
Bases:
VTKPythonAlgorithmBase
Vtk filter to transfer attributes from volume to surface mesh.
Input volume is vtkUnstructuredGrid and input, output surface mesh is vtkPolyData, and the list of names of the attributes to transfer.
- FillInputPortInformation(port, info)[source]
Inherited from VTKPythonAlgorithmBase::RequestInformation.
- Parameters:
port (int) – input port
info (vtkInformationVector) – info
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- GetAttributeNamesToTransfer()[source]
Get the set of attribute names to transfer from volume to surface.
- Returns:
set of attributes names.
- Return type:
set[str]
- GetNewAttributeNames()[source]
Get the set of attribute names created in the output surface.
- Returns:
Set of new attribute names in the surface.
- Return type:
set[str]
- RequestData(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestData.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- RequestDataObject(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestDataObject.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- RequestInformation(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestInformation.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- SetAttributeNamesToTransfer(names)[source]
Set the set of attribute names to transfer from volume to surface.
- Parameters:
names (set[str]) – set of attributes names.
- doTransferAttributes(meshMap)[source]
Transfer all attributes from the set of attribute names.
Except on boundaries, surfaces are bounded by cells along each side. Two attributes are then created on the surface, one corresponding to positive side cell values, one corresponding to negative side cell values.
- Parameters:
meshMap (dict[int, dict[int, bool]]) – map of surface face ids to volume mesh cell ids and side.
- Returns:
True if transfer successfully ended, False otherwise.
- Return type:
bool
- getMeshMapping()[source]
Compute cell mapping between volume and surface mesh.
- Returns:
dictionnary of face ids as keys and volume cell ids and side as values.
- Return type:
dict[int, dict[int, bool]]
- m_attributeNames
set of attribute names to transfer
- m_newAttributeNames
create attribute names
- m_outputSurfaceMesh
output surface mesh
- m_surfaceMesh
input surface mesh where to transfer attributes
- m_volumeMesh
input volume mesh attributes are from
- transferAttribute(attributeName, surfaceSide, meshMap)[source]
Transfer the attribute attributeName from volume to surface mesh.
Created surface attribute will have the same name as input attribute name with suffix “_Plus” for positive (True) side and “_Minus” for negative (False) side.
- Parameters:
attributeName (str) – Name of the attribute to transfer.
surfaceSide (bool) – Side of the surface the attribute is from.
meshMap (dict[int, dict[int, bool]]) – map of surface face ids to volume mesh cell ids and side.
- Returns:
True if transfer successfully ended, False otherwise.
- Return type:
bool
geos_posp.filters.VolumeSurfaceMeshMapper module
VolumeSurfaceMeshMapper is a vtk filter that collects the cell of a volume mesh adjacents to the faces of a surface mesh.
VolumeSurfaceMeshMapper inputs are a volume mesh of type vtkUnstructuredGrid and a surface mesh of type vtkPolyData.
To use the filter:
from filters.VolumeSurfaceMeshMapper import VolumeSurfaceMeshMapper
# filter inputs
logger :Logger
# input objects
volumeMesh :vtkUnstructuredGrid
surfaceMesh :vtkPolyData
# instanciate the filter
volumeSurfaceMeshMapper :VolumeSurfaceMeshMapper = VolumeSurfaceMeshMapper()
# set parameters and logger
volumeSurfaceMeshMapper.SetCreateAttribute(True)
volumeSurfaceMeshMapper.SetAttributeName("Surface1_AdjacentCell")
volumeSurfaceMeshMapper.SetLogger(logger)
# set input objects
volumeSurfaceMeshMapper.AddInputDataObject(0, volumeMesh)
volumeSurfaceMeshMapper.AddInputDataObject(1, surfaceMesh)
# do calculations
volumeSurfaceMeshMapper.Update()
# get filter output mesh (same as input volume mesh with new attribute if
# volumeSurfaceMeshMapper.SetCreateAttribute(True))
output :vtkUnstructuredGrid = volumeSurfaceMeshMapper.GetOutputDataObject(0)
# get filter output mapping
# surface faces to volume cell mapping
surfaceToVolumeMap :dict[int, dict[int, bool]] = volumeSurfaceMeshMapper.GetSurfaceToVolumeMap()
# volume cell to surface faces mapping
volumeToSurfaceMap :dict[int, tuple[set[int], bool]] = volumeSurfaceMeshMapper.GetVolumeToSurfaceMap()
- class geos_posp.filters.VolumeSurfaceMeshMapper.VolumeSurfaceMeshMapper[source]
Bases:
VTKPythonAlgorithmBase
Vtk filter to compute cell adjacency between volume and surface meshes.
Inputs are vtkUnstructuredGrid for volume mesh, vtkPolyData for surface mesh, and attribute name.
Ouputs are the volume mesh (vtkUnstructuredGrid) with a new attribute if SetCreateAttribute was set to True, and a map of surface face indexess as keys and adjacent volume cell indexes as values.
- FillInputPortInformation(port, info)[source]
Inherited from VTKPythonAlgorithmBase::RequestInformation.
- Parameters:
port (int) – input port
info (vtkInformationVector) – info
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- GetAttributeName()[source]
Get the name of the attribute to create.
- Returns:
name of the attribute.
- Return type:
str
- GetCreateAttribute()[source]
Get the value of the boolean to create the attribute.
- Returns:
create attribute boolean value.
- Return type:
bool
- GetSurfaceToVolumeConnectionSets()[source]
Get the collection of surface to volume cell ids.
- Returns:
collection of ConnectionSet.
- Return type:
- GetVolumeToSurfaceConnectionSets()[source]
Get the ConnectionSetCollection of volume to surface cell ids.
- Returns:
reversed collection of connection set.
- Return type:
- RequestData(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestData.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- RequestDataObject(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestDataObject.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- RequestInformation(request, inInfoVec, outInfoVec)[source]
Inherited from VTKPythonAlgorithmBase::RequestInformation.
- Parameters:
request (vtkInformation) – request
inInfoVec (list[vtkInformationVector]) – input objects
outInfoVec (vtkInformationVector) – output objects
- Returns:
1 if calculation successfully ended, 0 otherwise.
- Return type:
int
- SetAttributeName(name)[source]
Set the name of the attribute to create.
- Parameters:
name (str) – name of the attribute.
- SetCreateAttribute(value)[source]
Set the value of the boolean to create the attribute.
- Returns:
True to create the attribute, False otherwise.
- Return type:
bool
- createAttribute(mesh)[source]
Create the cell adjacency attribute.
Attribute yields -1 is a cell is not adjacent to input surface, 0 if the cell is along negative side, 1 if the cell is along positive side.
- Parameters:
mesh (vtkUnstructuredGrid) – mesh where to add the attribute
- Returns:
True if the new attribute was successfully added, False otherwise
- Return type:
bool
- getAdjacentCells(faceId, ptsCoordsSurf, ptsCoordsVol)[source]
Get the cells from volume mesh adjacent to the face cellIdSurf.
- Parameters:
faceId (int) – id of the face of the surface mesh.
ptsCoordsSurf (npt.NDArray[np.float64]) – coordinates of the points of the surface mesh
ptsCoordsVol (npt.NDArray[np.float64]) – coordinates of the points of the volume mesh
- Returns:
map of cell ids adjacent to the face as keys, and side as values
- Return type:
dict[int, bool]
- getCellIds(ptsCoordsFace, ptsCoordsVol)[source]
Get the ids of all the cells that are adjacent to input face.
A cell is adjacent to a face if it contains all the vertices of the face.
Warning
Face adjacency determination relies on a geometrical test of vertex location, it is error prone because of computational precision.
- Parameters:
ptsCoordsFace (npt.NDArray[np.float64]) – List of vertex coordinates of the face. The shape of the array should be (N,1).
ptsCoordsVol (npt.NDArray[np.float64]) – Coodinates of the vertices of the volume mesh. The shape of the array should be (N,M), where M is the number of vertices in the volume mesh.
- Returns:
set of cell ids adjacent to the face.
- Return type:
set[int]
- getCellSide(cellId, faceId, ptsCoordsFace, ptsCoordsVol)[source]
Get the side of the cell from volume mesh against the surface.
- Parameters:
cellId (int) – cell id in the volume mesh.
faceId (int) – cell id in the surface mesh.
ptsCoordsFace (list[npt.NDArray[np.float64]]) – coordinates of the vertices of the face.
ptsCoordsVol (npt.NDArray[np.float64]) – coordinates of the vertices of the cell.
- Returns:
True if the cell is the same side as surface normal, False otherwise.
- Return type:
bool
- m_attributeName
name of the attribute to create in the volume mesh
- m_createAttribute
if set to True, will create an attribute in the volume mesh
- m_logger
logger
- m_surfaceMesh
input surface mesh
- m_volumeMesh
input volume mesh