warp.fem.FunctionSpace#

class warp.fem.FunctionSpace(basis)[source]#

Interface class for function spaces, i.e. geometry + interpolation basis.

The value of a function f at a position x is generally computed as

f(x) = L(x)[sum_i f_i N_i(x)]

with:
  • f_i the value of the ith node’s degrees-of-freedom (dof)

  • N_i(x) the weight associated to the node at x

  • L(x) local linear transformation from node-space to world-space

Parameters:

basis (BasisSpace)

__init__(basis)[source]#
Parameters:

basis (BasisSpace)

Methods

__init__(basis)

divergence_valid()

Whether divergence of this field can be computed.

dof_value(space_value, node_weight, ...)

Compute the projection of a world-space value onto the basis of a single degree of freedom.

gradient_valid()

Whether gradient operator can be computed.

local_value_map_inner(elt_arg, ...)

Build the local value map transforming from node to world space.

local_value_map_outer(elt_arg, ...)

Build the local value map transforming vector-valued from node to world space.

make_field([space_partition])

Create a zero-initialized discrete field over the function space holding values for all degrees of freedom of nodes in a space partition.

node_basis_element(dof_coord)

Basis element for node degrees of freedom.

node_count()

Number of nodes in the interpolation basis.

space_divergence(dof_value, ...)

Assemble the world-space divergence of the function space.

space_gradient(dof_value, ...)

Assemble the world-space gradient of the function space.

space_value(dof_value, node_weight, ...)

Assemble the world-space value of the function space.

trace()

Trace of the function space over lower-dimensional elements of the geometry.

value_basis_element(dof_coord)

Basis element for the function space values.

Attributes

basis

Underlying basis space.

degree

Maximum polynomial degree of the underlying basis.

dimension

Function space embedding dimension.

element_kind

Kind of element the function space is expressed over.

geometry

Underlying geometry.

name

topology

Underlying geometry.

dtype

Value type of the interpolation functions.

dof_dtype

Data type of the degrees of freedom of each node.

weight_dtype

Data type of the shape functions associated to each node.

LocalValueMap

Type of the local map for transforming vector-valued functions from reference to world space.

VALUE_DOF_COUNT

Number of degrees of freedom per value, as a Warp constant.

NODE_DOF_COUNT

Number of degrees of freedom per node, as a Warp constant.

ORDER

Polynomial degree of the function space, used to determine integration order.

dtype: type#

Value type of the interpolation functions.

dof_dtype: type#

Data type of the degrees of freedom of each node.

weight_dtype: type#

Data type of the shape functions associated to each node.

LocalValueMap: type#

Type of the local map for transforming vector-valued functions from reference to world space.

VALUE_DOF_COUNT: int#

Number of degrees of freedom per value, as a Warp constant.

NODE_DOF_COUNT: int#

Number of degrees of freedom per node, as a Warp constant.

ORDER: int#

Polynomial degree of the function space, used to determine integration order.

node_count()[source]#

Number of nodes in the interpolation basis.

Return type:

int

property topology: SpaceTopology[source]#

Underlying geometry.

property basis: BasisSpace[source]#

Underlying basis space.

property geometry: Geometry[source]#

Underlying geometry.

property element_kind: ElementKind[source]#

Kind of element the function space is expressed over.

property dimension: int[source]#

Function space embedding dimension.

property degree: int[source]#

Maximum polynomial degree of the underlying basis.

property name[source]#
trace()[source]#

Trace of the function space over lower-dimensional elements of the geometry.

Return type:

FunctionSpace

make_field(space_partition=None)[source]#

Create a zero-initialized discrete field over the function space holding values for all degrees of freedom of nodes in a space partition.

Parameters:

space_partition – If provided, the subset of nodes to consider

See also: make_space_partition()

gradient_valid()[source]#

Whether gradient operator can be computed. Only for scalar and vector fields as higher-order tensors are not supported yet.

Return type:

bool

divergence_valid()[source]#

Whether divergence of this field can be computed. Only for vector and tensor fields with same dimension as embedding geometry.

Return type:

bool

static node_basis_element(dof_coord)[source]#

Basis element for node degrees of freedom.

Assumes 0 <= dof_coord < NODE_DOF_COUNT

Parameters:

dof_coord (int)

static value_basis_element(dof_coord)[source]#

Basis element for the function space values.

Assumes 0 <= dof_coord < VALUE_DOF_COUNT.

Parameters:

dof_coord (int)

static local_value_map_inner(elt_arg, element_index, coords)[source]#

Build the local value map transforming from node to world space.

Parameters:
  • elt_arg (SpaceTopology.ElementArg)

  • element_index (ElementIndex)

  • coords (Coords)

static local_value_map_outer(elt_arg, element_index, coords)[source]#

Build the local value map transforming vector-valued from node to world space.

Parameters:
  • elt_arg (SpaceTopology.ElementArg)

  • element_index (ElementIndex)

  • coords (Coords)

static space_value(dof_value, node_weight, local_value_map)[source]#

Assemble the world-space value of the function space.

Parameters:
  • dof_value (-) – node value in the degrees-of-freedom basis

  • node_weight (-) – weight associated to the node, as given per the basis space

  • local_value_map (-) – data encoding local transformation from node space to world space, as given per local_map_value_(inn|out)er

static space_gradient(
dof_value,
node_weight_gradient,
local_value_map,
)[source]#

Assemble the world-space gradient of the function space.

Parameters:
  • dof_value (-) – node value in the degrees-of-freedom basis

  • node_weight_gradient (-) – gradient of the weight associated to the node, either w.r.t element or world space

  • local_value_map (-) – data encoding local transformation from node space to world space, as given per local_map_value_(inn|out)er

static space_divergence(
dof_value,
node_weight_gradient,
local_value_map,
)[source]#

Assemble the world-space divergence of the function space.

Parameters:
  • dof_value (-) – node value in the degrees-of-freedom basis

  • node_weight_gradient (-) – gradient of the weight associated to the node, either w.r.t element or world space

  • local_value_map (-) – data encoding local transformation from node space to world space, as given per local_map_value_(inn|out)er

static dof_value(space_value, node_weight, local_value_map)[source]#

Compute the projection of a world-space value onto the basis of a single degree of freedom.

Parameters:
  • space_value (-) – world-space value

  • node_weight (-) – weight associated to the node, as given per the basis space

  • local_value_map (-) – data encoding local transformation from node space to world space, as given per local_map_value_(inn|out)er