mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4596 Python: Add gridPath method to Case and add simpler activeCellInfo method
This commit is contained in:
parent
68d3ffdbb2
commit
edfb39c9b7
@ -46,6 +46,9 @@ class Case (PdmObject):
|
|||||||
print("ERROR: ", e)
|
print("ERROR: ", e)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def gridPath(self):
|
||||||
|
return self.getValue("CaseFileName")
|
||||||
|
|
||||||
def grid(self, index):
|
def grid(self, index):
|
||||||
"""Get Grid of a given index. Returns a rips Grid object
|
"""Get Grid of a given index. Returns a rips Grid object
|
||||||
|
|
||||||
@ -80,7 +83,7 @@ class Case (PdmObject):
|
|||||||
porosity_model=porosityModel)
|
porosity_model=porosityModel)
|
||||||
return self.stub.GetCellCount(request)
|
return self.stub.GetCellCount(request)
|
||||||
|
|
||||||
def cellInfoForActiveCells(self, porosityModel='MATRIX_MODEL'):
|
def cellInfoForActiveCellsAsync(self, porosityModel='MATRIX_MODEL'):
|
||||||
"""Get Stream of cell info objects for current case
|
"""Get Stream of cell info objects for current case
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@ -101,6 +104,28 @@ class Case (PdmObject):
|
|||||||
porosity_model=porosityModel)
|
porosity_model=porosityModel)
|
||||||
return self.stub.GetCellInfoForActiveCells(request)
|
return self.stub.GetCellInfoForActiveCells(request)
|
||||||
|
|
||||||
|
def cellInfoForActiveCells(self, porosityModel='MATRIX_MODEL'):
|
||||||
|
"""Get list of cell info objects for current case
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
porosityModel(str): String representing an enum.
|
||||||
|
must be 'MATRIX_MODEL' or 'FRACTURE_MODEL'.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
List of cell info objects with the following attributes:
|
||||||
|
grid_index(int): grid the cell belongs to
|
||||||
|
parent_grid_index(int): parent of the grid the cell belongs to
|
||||||
|
coarsening_box_index(int): the coarsening box index
|
||||||
|
local_ijk(Vec3i: i(int), j(int), k(int)): local cell index in i, j, k directions.
|
||||||
|
parent_ijk(Vec3i: i(int), j(int), k(int)): cell index in parent grid in i, j, k.
|
||||||
|
"""
|
||||||
|
activeCellInfoChunks = self.cellInfoForActiveCellsAsync()
|
||||||
|
receivedActiveCells = []
|
||||||
|
for activeCellChunk in activeCellInfoChunks:
|
||||||
|
for activeCell in activeCellChunk.data:
|
||||||
|
receivedActiveCells.append(activeCell)
|
||||||
|
return receivedActiveCells
|
||||||
|
|
||||||
def timeSteps(self):
|
def timeSteps(self):
|
||||||
"""Get a list containing time step strings for all time steps"""
|
"""Get a list containing time step strings for all time steps"""
|
||||||
return self.stub.GetTimeSteps(self.request).dates
|
return self.stub.GetTimeSteps(self.request).dates
|
||||||
|
Loading…
Reference in New Issue
Block a user