Model
The model module of geos-mesh package contains data model.
geos.mesh.model.CellTypeCounts module
CellTypeCounts stores the number of elements of each type.
To use the filter:
from geos.mesh.model.CellTypeCounts import CellTypeCounts
counts: CellTypeCounts = CellTypeCounts()
# set data
counts.addType( cellType )
counts.setTypeCount( cellType, count )
# get data
count: int counts.getTypeCount( cellType )
- class geos.mesh.model.CellTypeCounts.CellTypeCounts[source]
Bases:
object
CellTypeCounts stores the number of cells of each type.
- addType(cellType)[source]
Increment the number of cell of input type.
- Parameters:
cellType (int) – cell type
- getTotalCount()[source]
Get the total number of cells.
- Returns:
Total number of cells
- Return type:
int
geos.mesh.model.QualityMetricSummary module
QualityMetricSummary stores the statistics of mesh quality metrics.
To use QualityMetricSummary:
from geos.mesh.model.QualityMetricSummary import QualityMetricSummary, StatTypes
qualityMetricSummary: QualityMetricSummary = QualityMetricSummary()
# Set data
qualityMetricSummary.setCellTypeCounts(counts)
qualityMetricSummary.setCellStatValueFromStatMetricAndCellType(cellMetricIndex, cellType, statType, value))
qualityMetricSummary.setOtherStatValueFromMetric(metricIndex, statType, value)
# Get stats
count: int = qualityMetricSummary.getCellTypeCountsOfCellType(cellType)
value: float = qualityMetricSummary.getCellStatValueFromStatMetricAndCellType(cellMetricIndex, cellType, statType)
subSetStats: pd.DataFrame = stats.getStatsFromMetric(cellMetricIndex)
stats: pd.DataFrame = stats.getAllCellStats()
# Output figure
fig: Figure = stats.plotSummaryFigure()
- class geos.mesh.model.QualityMetricSummary.QualityMetricSummary[source]
Bases:
object
CellTypeCounts stores the number of cells of each type.
- getAllCellStats()[source]
Get all cell stats including nan values.
- Returns:
Stats
- Return type:
pd.DataFrame
- getAllComputedMetricIndexes()[source]
Get the list of index of all computed metrics.
- Returns:
List of metrics index
- Return type:
tuple[int]
- getAllValidOtherMetricStats()[source]
Get all valid other metric stats.
- Returns:
Stats
- Return type:
pd.DataFrame
- getCellStatValueFromStatMetricAndCellType(metricIndex, cellType, statType)[source]
Get cell stat value for the given metric and cell types.
- Parameters:
metricIndex (int) – Metric index
cellType (int) – Cell type index
statType (StatTypes) – Stat number
- Returns:
Stats value
- Return type:
float
- getCellStatsFromCellType(cellType)[source]
Get cell stats for the given cell type.
- Parameters:
cellType (int) – Cell type index
- Returns:
Stats
- Return type:
pd.DataFrame
- getCellTypeCountsOfCellType(cellType)[source]
Get cell type counts.
- Returns:
Number of cell
- Return type:
int
- getComputedCellMetricIndexes()[source]
Get the list of index of computed cell quality metrics.
- Returns:
List of metrics index
- Return type:
List[int]
- getComputedOtherMetricIndexes()[source]
Get the list of index of computed other quality metrics.
- Returns:
List of metrics index
- Return type:
tuple[int]
- getStatsFromMetric(metricIndex)[source]
Get stats for the given metric index.
- Parameters:
metricIndex (int) – Metric index
- Returns:
Stats
- Return type:
pd.DataFrame
- getStatsFromMetricAndCellType(metricIndex, cellType)[source]
Get stats for the given metric and cell types.
- Parameters:
metricIndex (int) – Metric index
cellType (int) – Cell type index
- Returns:
Stats
- Return type:
pd.Series
- isCellStatsValidForMetricAndCellType(metricIndex, cellType)[source]
Returns True if input quality metric applies to input cell type.
- Parameters:
metricIndex (int) – Metric index
cellType (int) – Cell type index
- Returns:
True if input quality metric applies
- Return type:
bool
- plotSummaryFigure()[source]
Plot quality metric summary figure.
- Returns:
Output Figure
- Return type:
plt.figure
- setCellStatValueFromStatMetricAndCellType(metricIndex, cellType, statType, value)[source]
Set cell stats for the given metric and cell types.
- Parameters:
metricIndex (int) – Metric index
cellType (int) – Cell type index
statType (StatTypes) – Stat number
value (int | float) – Value
- setCellTypeCounts(counts)[source]
Set cell type counts.
- Parameters:
counts (CellTypeCounts) – CellTypeCounts instance
- class geos.mesh.model.QualityMetricSummary.StatTypes(value)[source]
Bases:
Enum
An enumeration.
- COUNT = (4, 'Count', <class 'int'>, <function StatTypes.<lambda>>)
- MAX = (3, 'Max', <class 'float'>, <function nanmax>)
- MEAN = (0, 'Mean', <class 'float'>, <function nanmean>)
- MIN = (2, 'Min', <class 'float'>, <function nanmin>)
- STD_DEV = (1, 'StdDev', <class 'float'>, <function nanstd>)
- compute(array)[source]
Compute statistics using function.
- Parameters:
array (Iterable[float]) – Input array
- Returns:
Output stat
- Return type:
int | float
- static getIndexFromName(name)[source]
Get stat index from name.
- Parameters:
name (str) – Name
- Returns:
Index
- Return type:
int