kipe.fenicsx.points module
Spatial sampler at points: fenicsx.points.
PointSampler evaluates a field of the solver at given points. Its entries are in the
order of the points; for a vector field, the components of each point one after another. This
order is fixed by the study file, so the data do not depend on the number of ranks (see
kipe.sampling).
A small, complete sampler: the how-to “Write a spatial sampler” in the documentation walks through it.
- class kipe.fenicsx.points.PointSampler(field: str, source: dolfinx.fem.FunctionSpace, points: list[list[float]], comm: mpi4py.MPI.Comm = mpi4py.MPI.COMM_WORLD)[source]
Bases:
SpatialSamplerEvaluates a field at given points.
Each point is evaluated by one rank: the lowest rank that owns a cell containing it. A point on the boundary between the cells of two ranks lies in cells of both.
- Parameters:
field – name of the observed field
source – the field’s function space, on the solver’s mesh
points – coordinates of the points, one row per point
comm – communicator of the run
- Raises:
StudyFileError – if the points do not have the coordinates of the mesh’s dimension, or a point lies outside the mesh
- kipe.fenicsx.points.build_point_sampler(options: PointSamplingOptions, fields: list[str], solver: ForwardSolver, comm: mpi4py.MPI.Comm = mpi4py.MPI.COMM_WORLD) PointSampler[source]
Construct a
PointSamplerfrom thespatial_samplingoptions of a measurement.- Parameters:
options –
spatial_samplingoptions of the measurementfields – names of the fields the measurement observes; exactly one
solver – the forward solver, which provides the field’s function space
comm – communicator of the run
- Returns:
the sampler