Assemblies
Finite-element method are known to produce elementary vectors and matrices, computed at the mesh-element level, that must be assembled into a big vector and a big matrix, through the provision of the indices, rows and columns, that correspond to the element nodes (degrees of freedom, to be precise). Navpactos offers a easy way to achieve these operations.
First, a VectorAssembler and a MatrixAssembler shall be used, giving them a size (two for the matrix if it is not square). Then the values are assembled in a declarative way as almost always in Navpactos. Get the symbolic indices, the symbolic values and add it to the Assembler. Then indices generally come from FeConnectivity objects.
Once the different assembly operation are added, a VectorAssembly or MatrixAssembly can be obtained. These objects are immutable.
What is the need for a ScalarAssembler, since all is assembled in the same place? The tensor arguments given in a assembling operation may indeed depend upon a dummy index: in that usual case, the assembly will be done through a loop on the range of values of the dummy index. The assembly is then a scalar, vector or matrix that is obtained by an integration of tensors over an index. Indices (rows, columns) and values may depend on that dummy index: in FEM cases, the index is the element index, as nodes indices and elementary tensors depend upon it.
SuperTensors
SuperScalar, SuperVector and SuperMatrix are generalisations of Navpactos Tensors (Scalar, Vector and Matrix) that may embed an assembly. For instance, a SuperMatrix can be created with a MatrixAssembly, and then it is possible to use it in the same kind of expressions as for Tensors.
Note: some operations may prove costly, as the computation of the determinant.
MatrixAssembly matrixAssemblyA = ...;
auto superMatrixA = SuperMatrix__get(matrixAssemblyA);
auto superMatrixB = transpose(superMatrixA)*superMatrixA;
auto superScalarA = trace(superMatrixA);
auto superScalarB = norm2(superMatrixA);
These objects are purely declarative.
SmartTensors
SmartScalar, SmartVector and SmartMatrix are defined with a SuperTensor and a specification of storage. Thus they store internally all what is needed for assemblies and the result specified by the SuperTensor.
It is possible to give a SmartTensorMap at the entry level in order to reuse all the SmartTensors yet associated with given assemblies.
A special kind of SmartMatrix is the DirectSmartMatrix, standing for a regular matrix used in linear systems. Its construction needs a SparseSolver specification.
In design optimization problems, the cost function is given as a SuperScalar and thus may involve assemblies. As an example, a mass criterion needs a sum over the elements.