cashocs.geometry.measure#
Extension of integration measures.
Functions
|
Generates a measure based on indices. |
Classes
|
Special type indicating an unconstrained type. |
|
A named integration measure, which can use strings for defining subdomains. |
- class cashocs.geometry.measure.NamedMeasure(*args, **kwargs)[source]#
Bases:
Measure
A named integration measure, which can use strings for defining subdomains.
See base class.
- Parameters:
integral_type (Literal['dx', 'ds', 'dS'])
domain (Optional[fenics.Mesh])
subdomain_id (str)
metadata (Optional[Dict])
subdomain_data (Optional[fenics.MeshFunction])
physical_groups (Optional[Dict[str, Dict[str, int]]])
- cashocs.geometry.measure.generate_measure(idx, measure)[source]#
Generates a measure based on indices.
Generates a
fenics.MeasureSum
or_EmptyMeasure
object corresponding tomeasure
and the subdomains / boundaries specified in idx. This is a convenient shortcut to writingdx(1) + dx(2) + dx(3)
in case many measures are involved.- Parameters:
idx (List[int]) – A list of indices for the boundary / volume markers that define the (new) measure.
measure (fenics.Measure) – The corresponding UFL measure.
- Returns:
The corresponding sum of the measures or an empty measure.
- Return type:
fenics.Measure | _EmptyMeasure
Examples
Here, we create a wrapper for the surface measure on the top and bottom of the unit square:
import fenics import cashocs mesh, _, boundaries, dx, ds, _ = cashocs.regular_mesh(25) top_bottom_measure = cashocs.geometry.generate_measure([3,4], ds) fenics.assemble(1*top_bottom_measure)