DUNE PDELab (2.7)

recipe-blocking.cc

See explanation at Setting up blocked data structures

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <iostream>
#include <dune/pdelab.hh>
int main(int argc, char** argv)
{
try{
// Initialize Mpi
// need a grid in order to test grid functions
constexpr unsigned int dim = 2;
std::array<int,dim> N(Dune::filledArray<dim,int>(64));
typedef Dune::YaspGrid<dim> Grid;
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
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
typedef Dune::PDELab::LexicographicOrderingTag LexiographicOrderingTag;
// 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
typedef Dune::PDELab::EntityBlockedOrderingTag EntityOrderingTag;
// 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
typedef Dune::PDELab::CompositeGridFunctionSpace<VBE, // blocked vector backend
EntityOrderingTag,
SCALAR_GFS, SCALAR_GFS> GFS;
GFS gfs(U1,U2);
}
return 0;
}
catch (Dune::Exception &e){
std::cerr << "Dune reported error: " << e << std::endl;
return 1;
}
catch (...){
std::cerr << "Unknown exception thrown!" << std::endl;
return 1;
}
}
Base class for Dune-Exceptions.
Definition: exceptions.hh:94
vector space out of a tensor product of fields.
Definition: fvector.hh:96
static DUNE_EXPORT MPIHelper & instance(int &argc, char **&argv)
Get the singleton instance of the helper.
Definition: mpihelper.hh:234
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
A grid function space.
Definition: gridfunctionspace.hh:186
base class for tuples of grid function spaces product of identical grid function spaces base class th...
Definition: powergridfunctionspace.hh:49
[ provides Dune::Grid ]
Definition: yaspgrid.hh:165
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
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Apr 27, 22:29, 2024)