NEML2 2.0.0
Loading...
Searching...
No Matches
neml2::discretization Namespace Reference

Functions

ATensor assemble (const ATensor &v_scattered, const ATensor &dof_map, Size ndof)
 This is the inverse operation of scatter. It assembles a scattered vector into a tensor given a DOF map.
 
void assemble_ (ATensor &v, const ATensor &v_scattered, const ATensor &dof_map)
 In-place version of assemble.
 
Tensor interpolate (const Tensor &elem_dofs, const Tensor &basis)
 Interpolate a tensor of values given evaluated basis functions.
 
Tensor scatter (const ATensor &v, const Tensor &dof_map)
 Scatter a vector associated with all degrees of freedom to a tensor specified by a DOF map.
 

Function Documentation

◆ assemble()

ATensor assemble ( const ATensor & v_scattered,
const ATensor & dof_map,
Size ndof )

This is the inverse operation of scatter. It assembles a scattered vector into a tensor given a DOF map.

Returns
a torch tensor with shape (Ndof)

◆ assemble_()

void assemble_ ( ATensor & v,
const ATensor & v_scattered,
const ATensor & dof_map )

In-place version of assemble.

◆ interpolate()

Tensor interpolate ( const Tensor & elem_dofs,
const Tensor & basis )

Interpolate a tensor of values given evaluated basis functions.

The input tensor elem_dofs must be of shape (..., Nelem, Ndofe;) where Nelem is the number of elements in the mesh, and Ndofe is the number of DOFs per element. The basis should have shape (..., Nelem, Ndofe, Nqp; ...). The trailing base shape (...) represents the points of interpolation.

Returns
a tensor with shape (Nelem, Nqp; ...) with trailing base shape matching the basis.

◆ scatter()

Tensor scatter ( const ATensor & v,
const Tensor & dof_map )

Scatter a vector associated with all degrees of freedom to a tensor specified by a DOF map.

dof_map must be of integer type, and its values represent the DOF indices to which the values of v should be scattered.

The input vector v should be a "vector" of shape (Ndof) where Ndof is the number of degrees of freedom.

Returns
a tensor with the same shape as dof_map.