A stencil matrix consists of 27-stencils on each hexahedron and local stiffness matrices on each other element like quadrangles, edges and corners. The advantage of a stencil matrix is that the evaluation of a stencil matrix is much faster and that it costs less memory to store a stencil matrix. On the other hand the construction of a stencil matrix requires a local stiffness matrix. Futhermore, there exists no multigrid restriction operator for local stencil matrices.
For the construction of a stencil matrix, two template parameters are required:
class Sten_matrix<Dtype, Stencil_type>
The first is for the data type and the second is needed to define the stencil type. The following three stencil types are defined up to now
Stencil_variable, Stencil_constant_z, Stencil_constant, Not_constant_direction_marker
These stencil types indicate of the stencils on each hexahedron should be constant or not. Constant stencils require less storage and are faster. But they cannot be used in case of variable coefficients or in case of certain deformations of the domain. For example, the type Stencil_constant_z can be used on a cylinder but the type Stencil_constant not.
Example:
Local_stiffness_matrix<double> LocStiff_Laplace(grid);
LocStiff_Laplace.Calculate(grad(v_())*grad(w_())); Sten_matrix<double, Stencil_constant_z> > Laplace(grid); Laplace = LocStiff_Laplace; // calculates 27-stencils from local stiffness matrices on each hexahedron f = Laplace(u);
Last modified: Mon Feb 7 16:19:57 MET 2000