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

getCounts()[source]

Get all counts.

Returns:

counts

Return type:

npt.NDArray[ np.int64 ]

getTotalCount()[source]

Get the total number of cells.

Returns:

Total number of cells

Return type:

int

getTypeCount(cellType)[source]

Get the number of cells of input type.

Parameters:

cellType (int) – cell type

Returns:

number of cells

Return type:

int

print()[source]

Print counts string.

Returns:

counts string.

Return type:

str

reset()[source]

Reset counts.

setTypeCount(cellType, count)[source]

Set the number of cells of input type.

Parameters:
  • cellType (int) – cell type

  • count (int) – number of cells

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]

getAllValidCellStats()[source]

Get all valid cell stats.

Returns:

Stats

Return type:

pd.DataFrame

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

getCellTypeCountsObject()[source]

Get cell type counts.

Returns:

Number of cell

Return type:

int

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

setOtherStatValueFromMetric(metricIndex, statType, value)[source]

Set other stat value for the given metric.

Parameters:
  • metricIndex (int) – Metric index

  • statType (StatTypes) – Stat number

  • value (int | float) – Value

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

getIndex()[source]

Get stat index.

Returns:

Index

Return type:

int

static getIndexFromName(name)[source]

Get stat index from name.

Parameters:

name (str) – Name

Returns:

Index

Return type:

int

static getNameFromIndex(index)[source]

Get stat name from index.

Parameters:

index (int) – Index

Returns:

Name

Return type:

str

getString()[source]

Get stat name.

Returns:

Name

Return type:

str

getType()[source]

Get stat type.

Returns:

Type

Return type:

object

static getTypeFromIndex(index)[source]

Get stat type from index.

Parameters:

index (int) – Index

Returns:

Type

Return type:

object