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, ...)

Computes the projection of a world-space value onto the basis of a single degree of freedom :param - space_value: world-space value :param - node_weight: weight associated to the node, as given per the basis space :param - local_value_map: data encoding local transformation from node space to world space, as given per local_map_value_(inn|out)er

gradient_valid()

Whether gradient operator can be computed.

local_value_map_inner(elt_arg, ...)

Builds the local value map transforming from node to world space

local_value_map_outer(elt_arg, ...)

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

make_field([space_partition])

Creates 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, ...)

space_gradient(dof_value, ...)

Assembles the world-space gradient of the function space :param - dof_value: node value in the degrees-of-freedom basis :param - node_weight_gradient: gradient of the weight associated to the node, either w.r.t element or world space :param - local_value_map: data encoding local transformation from node space to world space, as given per local_map_value_(inn|out)er

space_value(dof_value, node_weight, ...)

Assembles the world-space value of the function space :param - dof_value: node value in the degrees-of-freedom basis :param - node_weight: weight associated to the node, as given per the basis space :param - local_value_map: data encoding local transformation from node space to world space, as given per local_map_value_(inn|out)er

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]#

Creates 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]#

Builds 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]#

Builds 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]#

Assembles the world-space value of the function space :param - dof_value: node value in the degrees-of-freedom basis :param - node_weight: weight associated to the node, as given per the basis space :param - local_value_map: data encoding local transformation from node space to world space, as given per local_map_value_(inn|out)er

Parameters:
  • dof_value (FunctionSpace.dof_dtype)

  • node_weight (FunctionSpace.weight_dtype)

  • local_value_map (FunctionSpace.LocalValueMap)

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

Assembles the world-space gradient of the function space :param - dof_value: node value in the degrees-of-freedom basis :param - node_weight_gradient: gradient of the weight associated to the node, either w.r.t element or world space :param - local_value_map: data encoding local transformation from node space to world space, as given per local_map_value_(inn|out)er

Parameters:
  • dof_value (FunctionSpace.dof_dtype)

  • node_weight_gradient (Any)

  • local_value_map (FunctionSpace.LocalValueMap)

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

” Assembles the world-space divergence of the function space :param - dof_value: node value in the degrees-of-freedom basis :param - node_weight_gradient: gradient of the weight associated to the node, either w.r.t element or world space :param - local_value_map: data encoding local transformation from node space to world space, as given per local_map_value_(inn|out)er

Parameters:
  • dof_value (FunctionSpace.dof_dtype)

  • node_weight_gradient (Any)

  • local_value_map (FunctionSpace.LocalValueMap)

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

Computes the projection of a world-space value onto the basis of a single degree of freedom :param - space_value: world-space value :param - node_weight: weight associated to the node, as given per the basis space :param - local_value_map: data encoding local transformation from node space to world space, as given per local_map_value_(inn|out)er

Parameters:
  • space_value (FunctionSpace.dtype)

  • node_weight (FunctionSpace.weight_dtype)

  • local_value_map (FunctionSpace.LocalValueMap)