warp.fem.integrate#
- warp.fem.integrate(
- integrand,
- domain=None,
- quadrature=None,
- fields=None,
- values=None,
- accumulate_dtype=wp.float64,
- output_dtype=None,
- output=None,
- device=None,
- temporary_store=None,
- kernel_options=None,
- assembly=None,
- add=False,
- bsr_options=None,
Integrates a constant, linear or bilinear form, and returns a scalar, array, or sparse matrix, respectively.
- Parameters:
integrand (Integrand) – Form to be integrated, must have
integrand()decoratordomain (GeometryDomain | None) – Integration domain. If None, deduced from fields
quadrature (Quadrature | None) – Quadrature formula. If None, deduced from domain and fields degree.
fields (dict[str, FieldLike] | None) – Discrete, test, and trial fields to be passed to the integrand. Keys in the dictionary must match integrand parameter names.
values (dict[str, Any] | None) – Additional variable values to be passed to the integrand, can be of any type accepted by warp kernel launches. Keys in the dictionary must match integrand parameter names.
temporary_store (TemporaryStore | None) – shared pool from which to allocate temporary arrays
accumulate_dtype (type) – Scalar type to be used for accumulating integration samples
output (array | BsrMatrix | None) – Sparse matrix or warp array into which to store the result of the integration
output_dtype (type | None) – Scalar type for returned results in output is not provided. If None, defaults to accumulate_dtype
device – Device on which to perform the integration
kernel_options (dict[str, Any] | None) – Overloaded options to be passed to the kernel builder (e.g,
{"enable_backward": True})assembly (str | None) – Specifies the strategy for assembling the integrated vector or matrix: - “nodal”: For linear or bilinear forms, use the test function nodes as the quadrature points. Assumes Lagrange interpolation functions are used, and no differential or DG operator is evaluated on the test or trial functions. - “generic”: Single-pass integration and shape-function evaluation. Makes no assumption about the integrand’s content, but may lead to many redundant computations. - “dispatch”: For linear or bilinear forms, first evaluate the form at quadrature points then dispatch to nodes in a second pass. More efficient for integrands that are expensive to evaluate. Incompatible with at_node and node_index operators on test or trial functions. - None (default): Automatically picks a suitable assembly strategy (either “generic” or “dispatch”)
add (bool) – If True and output is provided, add the integration result to output instead of replacing its content
bsr_options (dict[str, Any] | None) – Additional options to be passed to the sparse matrix construction algorithm. See
warp.sparse.bsr_set_from_triplets()