Python API

class pcms.BoundCoordinateMap

A CoordinateMap bound to one set of query points

mapped_points(self: object) → pcms.CoordinateView

The query points in the map’s target coordinate system, read-only

num_points(self: pcms.BoundCoordinateMap) → int
output_basis(self: pcms.BoundCoordinateMap, stored: pcms.ValueBasis) → pcms.ValueBasis

The basis values stored in stored are re-expressed in

transform_values(self: pcms.BoundCoordinateMap, values: pcms.ValueView) → pcms.ValueView

Re-express values (one row per query point, over a writeable C-contiguous float64 array) in place, and return a ValueView of the same array tagged with the new basis

class pcms.BoundPoints

A set of query points localized on a geometry; evaluators created from it share its search

found_points(self: object) → numpy.ndarray[numpy.int32]

Indices of the query points the source evaluates, read-only

get_geometry(self: pcms.BoundPoints) → object

The geometry the points were localized on

missing_points(self: object) → numpy.ndarray[numpy.int32]

Indices of the query points the source does not evaluate, read-only

num_points(self: pcms.BoundPoints) → int
property policy
class pcms.ComponentScaling

How components are scaled relative to the coordinate-induced basis

Members:

Physical : Components on the unit basis; all have the same units

Natural : Components on the unscaled coordinate basis

Natural = <ComponentScaling.Natural: 1>
Physical = <ComponentScaling.Physical: 0>
ComponentScaling.name -> str
property value
class pcms.CoordinateMap

Maps points from a source to a target coordinate system; values are re-expressed the other way

bind(self: pcms.CoordinateMap, query_points: pcms.CoordinateView) → pcms.BoundCoordinateMap

Do every per-point computation for points in the source coordinate system

get_source_coordinate_system(self: pcms.CoordinateMap) → object
get_target_coordinate_system(self: pcms.CoordinateMap) → object
class pcms.CoordinateSystem

What coordinate numbers mean. Create one with the functions in pcms.csys.

dimension(self: pcms.CoordinateSystem) → int

Number of coordinate columns

has_orthogonal_basis(self: pcms.CoordinateSystem) → bool
has_unit_scale_factors(self: pcms.CoordinateSystem) → bool
kind(self: pcms.CoordinateSystem) → str

Family label, e.g. ‘cartesian’

class pcms.CoordinateView

Coordinates tagged with their coordinate system

get_coordinate_system(self: pcms.CoordinateView) → object
get_values(self: pcms.CoordinateView) → numpy.ndarray[numpy.float64]

The coordinates as a read-only 2D array (num_points × dim)

class pcms.DifferentialOperator

The quantity a point evaluator computes

Members:

Value

Gradient

Divergence

Curl

Hessian

Curl = <DifferentialOperator.Curl: 3>
Divergence = <DifferentialOperator.Divergence: 2>
Gradient = <DifferentialOperator.Gradient: 1>
Hessian = <DifferentialOperator.Hessian: 4>
Value = <DifferentialOperator.Value: 0>
DifferentialOperator.name -> str
property value
class pcms.Field

DOF-holder values together with the layout that orders them

get_data(self: pcms.Field) → pcms.FieldData
get_dof_holder_data(self: object) → pcms.ValueView

The DOF-holder values (num_dof_holders × num_components) as a ValueView whose array is read-only. When the field’s data is in host memory the array shares it, so it reflects later writes; otherwise it is a copy.

get_layout(self: pcms.Field) → pcms.FieldLayout
get_name(self: pcms.Field) → str
set_dof_holder_data(*args, **kwargs)

Overloaded function.

  1. set_dof_holder_data(self: pcms.Field, data: pcms.ValueView) -> None

Set the DOF-holder values from a ValueView (num_dof_holders × num_components) whose basis must match the field’s

  1. set_dof_holder_data(self: pcms.Field, data: numpy.ndarray[numpy.float64]) -> None

Set a scalar field’s DOF-holder values from a plain 2D array (num_dof_holders × num_components). A 1D array (num_dof_holders,) is accepted when the field has one component.

set_dof_holder_data_unchecked(self: pcms.Field, data: numpy.ndarray[numpy.float64]) → None

Set the DOF-holder values without checking their basis (the shape is still checked). A 1D array (num_dof_holders,) is accepted when the field has one component.

synchronize(self: pcms.Field) → None

Bring the copies of DOF holders other ranks own (e.g. Omega_h ghosts) up to date with their owners’ values

class pcms.FieldData

A field’s stored values

get_value_basis(self: pcms.FieldData) → pcms.ValueBasis

The basis the stored components are in

get_value_type(self: pcms.FieldData) → pcms.FieldValueType
class pcms.FieldLayout

How a field’s DOF holders are laid out

get_coordinate_system(self: pcms.FieldLayout) → object

What this layout’s DOF-holder coordinates mean

get_dimension(self: pcms.FieldLayout) → int
get_dof_holder_coordinates(self: object) → pcms.CoordinateView

The owned DOF-holder coordinates (num_dof_holders × dim), read-only

get_num_components(self: pcms.FieldLayout) → int
get_num_dof_holder(self: pcms.FieldLayout) → int

Number of DOF holders this rank owns

get_num_global_dof_holder(self: pcms.FieldLayout) → int
is_distributed(self: pcms.FieldLayout) → bool
class pcms.FieldValueType

Members:

Scalar

Vector

Tensor

Scalar = <FieldValueType.Scalar: 0>
Tensor = <FieldValueType.Tensor: 2>
Vector = <FieldValueType.Vector: 1>
FieldValueType.name -> str
property value
class pcms.Function

A Field that knows its FunctionSpace

get_space(self: pcms.Function) → pcms::Immutable<pcms::FunctionSpace>
class pcms.FunctionSpace
create_function(self: pcms.FunctionSpace, name: str = '', variance: pcms.VarianceSignature = <pcms.VarianceSignature []>, system: pcms.CoordinateSystem | None = None, scaling: pcms.ComponentScaling | None = None) → pcms.Function

Create a Function in this space. Vector and tensor values are in system’s basis (default: this space’s coordinate system), with scaling required when that system admits both scalings.

create_point_evaluator(self: pcms.FunctionSpace, bound: pcms.BoundPoints, op: pcms.DifferentialOperator = <DifferentialOperator.Value: 0>) → pcms::PointEvaluator<double, Kokkos::layout_right>

Create an evaluator at the points of bound (a result of bind() on this source’s geometry) that applies op: the values for DifferentialOperator.Value, the gradient for DifferentialOperator.Gradient

get_coordinate_system(self: pcms.FunctionSpace) → object

The coordinate system of the space’s geometry

get_geometry(self: pcms.FunctionSpace) → object

The geometry whose BoundPoints this source accepts; bind query points with its bind()

get_layout(self: pcms.FunctionSpace) → pcms.FieldLayout
supports(self: pcms.FunctionSpace, op: pcms.DifferentialOperator) → bool

Whether create_point_evaluator accepts op

class pcms.Geometry

The coordinates of a set of entities (a mesh, a grid, a point cloud) and the point search; function spaces are created on it

bind(*args, **kwargs)

Overloaded function.

  1. bind(self: pcms.Geometry, coordinates: pcms.CoordinateView, policy: pcms.OutOfBoundsPolicy = <pcms.OutOfBoundsPolicy object at 0x7fb8576e81f0>, map: Optional[pcms::Immutable<pcms::CoordinateMap>] = None) -> pcms::Immutable<pcms::BoundPoints>

Localize the points of a CoordinateView (in get_coordinate_system(), or in the source system of map, a CoordinateMap to get_coordinate_system(): the points are then located at their images and evaluated values re-expressed through it); the search is done once here

  1. bind(self: pcms.Geometry, space: pcms::Immutable<pcms::FunctionSpace>, policy: pcms.OutOfBoundsPolicy = <pcms.OutOfBoundsPolicy object at 0x7fb8576f82f0>, map: Optional[pcms::Immutable<pcms::CoordinateMap>] = None) -> pcms::Immutable<pcms::BoundPoints>

Bind the DOF-holder coordinates of space, through map if given; without a map, a space whose DOF holders are entities of this geometry binds them with owner hints, which are verified (with a map the hints are ignored)

get_coordinate_system(self: pcms.Geometry) → object
class pcms.LagrangeBackend

Members:

MeshFields : MeshFields-backed layout (default when MeshFields is enabled)

OmegaH : Native Omega_h Lagrange layout (required by the conservative and Monte Carlo projection transfer operators)

MeshFields = <LagrangeBackend.MeshFields: 0>
OmegaH = <LagrangeBackend.OmegaH: 1>
LagrangeBackend.name -> str
property value
class pcms.MLSOptions
property basis
property decay_factor
property degree
property lambda_reg
property tol
class pcms.MassMatrixType

Members:

Consistent : Full Galerkin mass matrix

Lumped : Row-sum lumped diagonal mass matrix (exact diagonal solve; conserves the integral but adds lumping error)

Consistent = <MassMatrixType.Consistent: 0>
Lumped = <MassMatrixType.Lumped: 1>
MassMatrixType.name -> str
property value
class pcms.NeighbourhoodOptions

Support search of a point-cloud geometry

property adapt_radius
property min_supports
property radius
class pcms.OutOfBoundsMode

Members:

ERROR : Raise error when points are out of bounds

FILL : Fill with a specified value when points are out of bounds

NEAREST_BOUNDARY : Clamp to nearest boundary cell (extrapolate)

ERROR = <OutOfBoundsMode.ERROR: 0>
FILL = <OutOfBoundsMode.FILL: 1>
NEAREST_BOUNDARY = <OutOfBoundsMode.NEAREST_BOUNDARY: 2>
OutOfBoundsMode.name -> str
property value
class pcms.OutOfBoundsPolicy
property fill_value

Fill value (used only when mode == FILL)

property mode

Out-of-bounds handling mode

class pcms.PointEvaluator

Evaluates fields at the query points it was created for

evaluate(*args, **kwargs)

Overloaded function.

  1. evaluate(self: pcms.PointEvaluator, field: pcms.Field, output: pcms.ValueView) -> None

Evaluate the field into output, a ValueView over a writeable C-contiguous float64 array (num_points × num_components) whose basis must be output_basis() of the field’s stored basis

  1. evaluate(self: pcms.PointEvaluator, field: pcms.Field, output: numpy.ndarray) -> None

Evaluate a scalar field into a writeable C-contiguous float64 array (num_points × num_components). A 1D array (num_points,) is accepted when the output has one component.

filled_points(self: object) → numpy.ndarray[numpy.int32]

Indices of the query points that get the out-of-bounds fill value, read-only

num_points(self: pcms.PointEvaluator) → int
output_basis(self: pcms.PointEvaluator, stored: pcms.ValueBasis) → pcms.ValueBasis

The basis this evaluator writes for a field stored in stored

class pcms.PointEvaluatorFactory

Creates evaluators at the points of BoundPoints of its geometry

create_point_evaluator(self: pcms.PointEvaluatorFactory, bound: pcms.BoundPoints, op: pcms.DifferentialOperator = <DifferentialOperator.Value: 0>) → pcms::PointEvaluator<double, Kokkos::layout_right>

Create an evaluator at the points of bound (a result of bind() on this source’s geometry) that applies op: the values for DifferentialOperator.Value, the gradient for DifferentialOperator.Gradient

get_geometry(self: pcms.PointEvaluatorFactory) → object

The geometry whose BoundPoints this source accepts; bind query points with its bind()

supports(self: pcms.PointEvaluatorFactory, op: pcms.DifferentialOperator) → bool

Whether create_point_evaluator accepts op

class pcms.QueryPoints

Evaluation at points that move between calls: locate() binds the points and rebinds them in place after; evaluate() creates the evaluator of a function on first use after each locate()

property bound

The BoundPoints of the located points, or None before locate(); while it is held, the next locate() binds anew instead of reusing it

evaluate(*args, **kwargs)

Overloaded function.

  1. evaluate(self: pcms.QueryPoints, function: pcms.Function, output: pcms.ValueView, op: pcms.DifferentialOperator = <DifferentialOperator.Value: 0>) -> None

Evaluate op of the function at the located points into output, a ValueView as PointEvaluator.evaluate takes it

  1. evaluate(self: pcms.QueryPoints, function: pcms.Function, output: numpy.ndarray, op: pcms.DifferentialOperator = <DifferentialOperator.Value: 0>) -> None

Evaluate the values of a scalar function at the located points into a writeable C-contiguous float64 array (num_points × num_components)

locate(self: pcms.QueryPoints, coordinates: pcms.CoordinateView) → None

Locate the points of a CoordinateView (as Geometry.bind takes them), reusing the previous points’ storage when nothing else holds it

class pcms.RadialBasisFunction

Members:

RBF_GAUSSIAN

RBF_C4

RBF_CONST

NO_OP

NO_OP = <RadialBasisFunction.NO_OP: 3>
RBF_C4 = <RadialBasisFunction.RBF_C4: 1>
RBF_CONST = <RadialBasisFunction.RBF_CONST: 2>
RBF_GAUSSIAN = <RadialBasisFunction.RBF_GAUSSIAN: 0>
RadialBasisFunction.name -> str
property value
class pcms.TransferOperator
apply(self: pcms.TransferOperator, source: pcms.Field, target: pcms.Field) → None

Transfer the source field onto the target

class pcms.UniformGrid1D
property bot_left

Bottom-left corner coordinates

closest_cell_id(self: pcms.UniformGrid1D, point: numpy.ndarray[numpy.float64]) → int

Get the cell ID that contains or is closest to the given point

property divisions

Number of divisions in each dimension

property edge_length

Edge length in each dimension

get_cell_bbox(self: pcms.UniformGrid1D, cell_index: int) → pcms::AABBox<1>

Get the bounding box of a cell

get_num_cells(self: pcms.UniformGrid1D) → int

Get the total number of cells in the grid

class pcms.UniformGrid2D
property bot_left

Bottom-left corner coordinates

closest_cell_id(self: pcms.UniformGrid2D, point: numpy.ndarray[numpy.float64]) → int

Get the cell ID that contains or is closest to the given point

property divisions

Number of divisions in each dimension

property edge_length

Edge length in each dimension

get_cell_bbox(self: pcms.UniformGrid2D, cell_index: int) → pcms::AABBox<2>

Get the bounding box of a cell

get_num_cells(self: pcms.UniformGrid2D) → int

Get the total number of cells in the grid

class pcms.UniformGrid3D
property bot_left

Bottom-left corner coordinates

closest_cell_id(self: pcms.UniformGrid3D, point: numpy.ndarray[numpy.float64]) → int

Get the cell ID that contains or is closest to the given point

property divisions

Number of divisions in each dimension

property edge_length

Edge length in each dimension

get_cell_bbox(self: pcms.UniformGrid3D, cell_index: int) → pcms::AABBox<3>

Get the bounding box of a cell

get_num_cells(self: pcms.UniformGrid3D) → int

Get the total number of cells in the grid

class pcms.ValueBasis

The basis a value’s components are expressed in. The default is the scalar basis.

rank(self: pcms.ValueBasis) → int
property scaling
property system
property variance
class pcms.ValueView

Values (num_points × num_components) tagged with the basis their components are in

extent(self: pcms.ValueView, r: int) → int
get_basis(self: pcms.ValueView) → pcms.ValueBasis
get_value_type(self: pcms.ValueView) → pcms.FieldValueType
get_values(self: pcms.ValueView) → numpy.ndarray
rank(self: pcms.ValueView) → int
size(self: pcms.ValueView) → int
class pcms.Variance

Index variance: Contravariant components are on the basis dx/dq^i, Covariant on the dual grad q^i

Members:

Contravariant

Covariant

Contravariant = <Variance.Contravariant: 0>
Covariant = <Variance.Covariant: 1>
Variance.name -> str
property value
class pcms.VarianceSignature

The variance of each index of a value

rank(self: pcms.VarianceSignature) → int
pcms.create_cartesian_to_cylindrical() → pcms.CoordinateMap

Map from Cartesian (x, y, z) to cylindrical (R, theta, Z) points

pcms.create_conservative_projection(source_space: pcms.FunctionSpace, target_space: pcms.FunctionSpace, mass_matrix_type: pcms.MassMatrixType = <MassMatrixType.Consistent: 0>) → pcms.TransferOperator

Create a mesh-intersection conservative projection between order-1 Lagrange spaces on Omega_h meshes. Mesh intersection, quadrature setup, and mass-matrix factorization happen here and are cached; call apply() repeatedly.

pcms.create_control_variate_projection(source: pcms.PointEvaluatorFactory, target_space: pcms.FunctionSpace, samples_per_element: int, seed: int = 8675309, mass_matrix_type: pcms.MassMatrixType = <MassMatrixType.Consistent: 0>, to_source: Optional[pcms::Immutable<pcms::CoordinateMap>] = None) → pcms.TransferOperator

Create a Monte Carlo (control-variate) conservative projection onto an order-1 Omega_h Lagrange space. Sample-point generation, the control-variate interpolator, and the mass-matrix factorization are cached; call apply() repeatedly. to_source maps the target’s coordinate system to the source’s, or None if they are the same.

pcms.create_copy(source_space: pcms.FunctionSpace, target_space: pcms.FunctionSpace) → pcms.TransferOperator

Create a copy operator for function spaces sharing a layout.

pcms.create_cylindrical_to_cartesian() → pcms.CoordinateMap

Map from cylindrical (R, theta, Z) to Cartesian (x, y, z) points

pcms.create_interpolator(*args, **kwargs)

Overloaded function.

  1. create_interpolator(source: pcms.PointEvaluatorFactory, target_space: pcms.FunctionSpace, policy: pcms.OutOfBoundsPolicy = <pcms.OutOfBoundsPolicy object at 0x7fb8576f0930>) -> pcms.TransferOperator

Create an interpolator from any PointEvaluatorFactory (a FunctionSpace or an operator source such as gradient()) to the target space’s DOF holders. Localization is performed here and cached; call apply() repeatedly. To transfer across coordinate systems, bind with a map (source.get_geometry().bind(target_space, policy, map)) and pass the BoundPoints.

  1. create_interpolator(source: pcms.PointEvaluatorFactory, target_space: pcms.FunctionSpace, bound: pcms.BoundPoints) -> pcms.TransferOperator

Create an interpolator that reuses bound, a binding of the target space’s DOF holders by source’s geometry (source.get_geometry().bind(target_space)), so a field and its gradient can share one localization.

pcms.create_lagrange_space(geometry: pcms.Geometry, order: int, num_components: int, backend: pcms.LagrangeBackend = <LagrangeBackend.MeshFields: 0>, layout_name: str = '') → pcms.FunctionSpace

Create a Lagrange FunctionSpace of order order on an Omega_h geometry (backend OmegaH: orders 0 and 1; MeshFields: orders 1 and 2) or a uniform-grid geometry (orders 0 and 1, backend ignored); spaces on one geometry accept each other’s BoundPoints.

pcms.create_polynomial_reconstruction_space(geometry: pcms.Geometry, options: pcms.MLSOptions = <pcms.MLSOptions object at 0x7fb8576e8c70>) → pcms.FunctionSpace

Create an MLS reconstruction FunctionSpace on a point-cloud geometry (its sites are the DOF holders); options are the reconstruction parameters, the support search is the geometry’s

pcms.create_spline_space(geometry: pcms.Geometry) → pcms.FunctionSpace

Create a cubic (1D) or bicubic (2D) spline FunctionSpace on a uniform-grid geometry

pcms.curl(source: pcms.PointEvaluatorFactory) → pcms.PointEvaluatorFactory

A source whose evaluators write the curl of the field they are given; it accepts the BoundPoints of source’s geometry

pcms.divergence(source: pcms.PointEvaluatorFactory) → pcms.PointEvaluatorFactory

A source whose evaluators write the divergence of the field they are given; it accepts the BoundPoints of source’s geometry

pcms.evaluate(*args, **kwargs)

Overloaded function.

  1. evaluate(function: pcms.Function, points: pcms.CoordinateView, output: pcms.ValueView, op: pcms.DifferentialOperator = <DifferentialOperator.Value: 0>, policy: pcms.OutOfBoundsPolicy = <pcms.OutOfBoundsPolicy object at 0x7fb8576fab70>, map: Optional[pcms::Immutable<pcms::CoordinateMap>] = None) -> None

Evaluate op of the function at the points of a CoordinateView into output, a ValueView; binds the points on every call (use QueryPoints for repeated evaluation)

  1. evaluate(function: pcms.Function, points: pcms.CoordinateView, output: numpy.ndarray, op: pcms.DifferentialOperator = <DifferentialOperator.Value: 0>, policy: pcms.OutOfBoundsPolicy = <pcms.OutOfBoundsPolicy object at 0x7fb8576f0cf0>, map: Optional[pcms::Immutable<pcms::CoordinateMap>] = None) -> None

Evaluate the values of a scalar function at the points of a CoordinateView into a writeable C-contiguous float64 array; binds the points on every call (use QueryPoints for repeated evaluation)

pcms.gradient(source: pcms.PointEvaluatorFactory) → pcms.PointEvaluatorFactory

A source whose evaluators write the gradient of the field they are given; it accepts the BoundPoints of source’s geometry