warp.fem.ImplicitField#

class warp.fem.ImplicitField(
domain,
func,
values=None,
grad_func=None,
div_func=None,
degree=0,
)[source]#

Field defined from an arbitrary function over a domain. Does not support autodiff yet, so if gradient/divergence evaluation is required corresponding functions must be provided.

Parameters:
  • domain (GeometryDomain) – Domain over which the field is defined

  • func (Function) – Warp function evaluating the field at a given position. Must accept at least one argument, with the first argument being the evaluation position (wp.vec2 or wp.vec3).

  • values (dict[str, Any] | None) – Optional dictionary of additional argument values to be passed to the evaluation function.

  • grad_func (Function | None) – Optional gradient evaluation function; must take same arguments as func

  • div_func (Function | None) – Optional divergence evaluation function; must take same arguments as func

  • degree – Optional hint for automatic determination of quadrature orders when integrating this field

__init__(
domain,
func,
values=None,
grad_func=None,
div_func=None,
degree=0,
)[source]#
Parameters:

Methods

__init__(domain, func[, values, grad_func, ...])

divergence_valid()

Whether divergence evaluation is available.

eval_arg_value(device)

Return the evaluation argument structure for device functions.

eval_degree(args)

Polynomial degree of the field is applicable, or hint for determination of interpolation order

eval_div_inner(args, s)

Device function evaluating the inner field divergence at a sample point

eval_div_outer(args, s)

Device function evaluating the outer field divergence at a sample point

eval_grad_inner(args, s)

Device function evaluating the inner field gradient at a sample point

eval_grad_outer(args, s)

Device function evaluating the outer field gradient at a sample point

eval_inner(args, s)

Device function evaluating the inner field value at a sample point

eval_outer(args, s)

Device function evaluating the outer field value at a sample point

eval_reference_grad_inner(args, s)

Device function evaluating the inner field gradient with respect to reference element coordinates at a sample point

eval_reference_grad_outer(args, s)

Device function evaluating the outer field gradient with respect to reference element coordinates at a sample point

fill_eval_arg(arg, device)

Fill the field-level arguments to be passed to device functions

gradient_valid()

Whether gradient evaluation is available.

make_deformed_geometry([relative])

Return a deformed version of the underlying geometry, with positions displaced according to this field's values.

notify_operator_usage(ops)

Make the Domain aware that the operators ops will be applied.

trace()

Return the trace of this field on domain sides.

Attributes

degree

Quadrature degree hint for the field.

divergence_dtype

Return type of the divergence operator.

dtype

Field value type if known, otherwise None.

element_kind

Kind of elements over which the field is defined.

geometry

Underlying geometry of the domain.

gradient_dtype

Return type of the (world space) gradient operator.

name

Unique name encoding the domain and argument structure.

reference_gradient_dtype

Return type of the reference space gradient operator.

values

Argument values passed to the evaluation function.

EvalArg

Structure containing field-level arguments passed to device functions for field evaluation.

ElementEvalArg

Structure combining geometry-level and field-level arguments passed to device functions for field evaluation.

property values[source]#

Argument values passed to the evaluation function.

property geometry: Geometry[source]#

Underlying geometry of the domain.

property element_kind: ElementKind[source]#

Kind of elements over which the field is defined.

property dtype[source]#

Field value type if known, otherwise None.

eval_arg_value(device)[source]#

Return the evaluation argument structure for device functions.

property degree: int[source]#

Quadrature degree hint for the field.

property name: str[source]#

Unique name encoding the domain and argument structure.

gradient_valid()[source]#

Whether gradient evaluation is available.

Return type:

bool

divergence_valid()[source]#

Whether divergence evaluation is available.

Return type:

bool

trace()[source]#

Return the trace of this field on domain sides.