DUNE PDELab (git)
recipe-blocking.cc
See explanation at Setting up blocked data structures
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <iostream>
#include <dune/common/filledarray.hh>
#include <dune/common/parallel/mpihelper.hh>
#include <dune/grid/yaspgrid.hh>
#include <dune/pdelab.hh>
int main(int argc, char** argv)
{
// Initialize Mpi
Dune::MPIHelper::instance(argc, argv);
// need a grid in order to test grid functions
constexpr unsigned int dim = 2;
Dune::FieldVector<double,dim> L(5.0);
std::array<int,dim> N(Dune::filledArray<dim,int>(64));
Grid grid(L,N);
using DF = double;
using GV = decltype(grid.leafGridView());
// instantiate finite element maps
FEM fem(grid.leafGridView());
//Set up constraints
// [Scalar grid function space]
// Set up scalar grid function space
typedef Dune::PDELab::GridFunctionSpace<GV, FEM, Constraints, Dune::PDELab::ISTL::VectorBackend<>> SCALAR_GFS;
SCALAR_GFS U1(grid.leafGridView(),fem); U1.name("U1");
SCALAR_GFS U2(grid.leafGridView(),fem); U2.name("U2");
{
// [Lexiographic blocked type]
// Use lexiographical blocked ordering
// Set up power grid function space
using VBE = Dune::PDELab::ISTL::VectorBackend<Dune::PDELab::ISTL::Blocking::fixed>; // blocking vector backend
dim, // block size
VBE, // blocked vector backend
LexiographicOrderingTag> GFS;
GFS gfs(U1,U2);
}
{
// [Entity blocked type]
// Use entity blocked ordering
// Setting up a composite grid function space with the same scalar grid function space in both components
using VBE = Dune::PDELab::ISTL::VectorBackend<Dune::PDELab::ISTL::Blocking::fixed>; // blocking vector backend
EntityOrderingTag,
SCALAR_GFS, SCALAR_GFS> GFS;
GFS gfs(U1,U2);
}
}
static DUNE_EXPORT MPIHelper & instance(int &argc, char **&argv)
Get the singleton instance of the helper.
Definition: mpihelper.hh:252
base class for tuples of grid function spaces base class that holds implementation of the methods thi...
Definition: compositegridfunctionspace.hh:53
Dirichlet Constraints construction.
Definition: conforming.hh:38
base class for tuples of grid function spaces product of identical grid function spaces base class th...
Definition: powergridfunctionspace.hh:49
Definition: qkfem.hh:20
Utility to generate an array with a certain value.
Helpers for dealing with MPI.
Indicate blocking of the unknowns by grid entity.
Definition: tags.hh:53
Indicate lexicographic ordering of the unknowns of non-leaf grid function spaces.
Definition: tags.hh:63
|
Legal Statements / Impressum |
Hosted by TU Dresden |
generated with Hugo v0.111.3
(Nov 23, 23:29, 2024)