Skip to content

Data operations

meshio++ carries three kinds of data alongside a mesh's geometry: point_data (one row per point), cell_data (one array per cell block, one row per cell) and field_data (mesh-global). The data operations act on those arrays rather than on the geometry, which none of them ever modifies — points, connectivity, block order and block types come through bit-identical.

OperationWhat it doesPage
data_manage / data_drop / data_keep / data_renameRewrite which arrays a mesh carries and under what namesArray management
point_data_to_cell_data / cell_data_to_point_dataMove data between locations by averagingLocation averaging
data_calcDerive a new array from an elementwise expressionExpressions
data_conditionClamp, normalize or standardize valuesValue conditioning
data_infoRead-only per-array summaryData summary

They are mesh operations (like quality metrics or geometric statistics), not file formats, and use only standard C++/numpy, so they run under every mesh backend and are reachable from every binding surface. All nine CLI verbs live under the meshioplusplus data group — see the CLI reference.

Non-finite values

Every data operation follows one rule for NaN and ±inf:

  • They are always excluded from every reduction — min, max, mean, standard deviation, and the accumulators used by point/cell averaging. An array that is entirely non-finite therefore reduces to NaN.
  • What reaches the output is chosen by nan_policy:
    • "ignore" (the default) passes the value through unchanged;
    • "replace" substitutes nan_replacement;
    • "fail" raises, naming the array and the first offending index.
  • data_info never raises — it counts non-finite values instead, which is the point of the report.
  • Division by zero inside data_calc produces an IEEE infinity or NaN and is deliberately not an error.

Locations

Everywhere a location is named, these spellings are accepted:

CanonicalAliases
point_datapoint, node
cell_datacell, element
field_datafield

Multiple cell blocks

cell_data is stored as one array per cell block. Every operation that writes cell_data produces exactly len(mesh.cells) arrays, and every operation that reads a named cell_data array validates that its block count matches the mesh, raising a clear error otherwise. data_condition computes its statistics jointly across all blocks before applying a single transform to each, and data_calc is evaluated once per block.

Data types

Operationdtype rule
data_manageByte-identical passthrough; nothing is reinterpreted.
point_data_to_cell_data / cell_data_to_point_dataAlways float64 — the mean of an integer field is not an integer.
data_calcArithmetic is always performed in double; the result is stored as float64.
data_conditionclamp preserves the input dtype (unless preserve_dtype=False); normalize and standardize always produce float64.
data_infoRead-only; reports the dtype as stored.

TIP

The NATIVE and KRATOS mesh backends canonicalize integer widths on ingest (int32int64), so tests should assert the dtype kind rather than an exact width. Only the Python path, which is pinned to the MESHIO backend, sees the original width.

Point and cell sets

point_sets and cell_sets index geometry, which these operations never touch, so they pass through unchanged. Like every other operation, they are handled in the Python shim and never reach the C++ core — so they are not carried by the C API, Fortran or WebAssembly surfaces.

Released under the MIT License.