Reference documentation for deal.II version Git f1b24f0 2017-02-26 20:08:05 +0100
Namespaces | Classes | Functions
MeshWorker Namespace Reference

Namespaces

 Assembler
 

Classes

class  DoFInfo
 
class  DoFInfoBox
 
class  IntegrationInfo
 
class  IntegrationInfoBox
 
class  LocalIntegrator
 
class  LocalResults
 
class  LoopControl
 
class  MGVectorData
 
class  VectorData
 
class  VectorDataBase
 
class  VectorSelector
 

Functions

template<class INFOBOX , class DOFINFO , int dim, int spacedim, class ITERATOR >
void cell_action (ITERATOR cell, DoFInfoBox< dim, DOFINFO > &dof_info, INFOBOX &info, const std_cxx11::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &cell_worker, const std_cxx11::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &boundary_worker, const std_cxx11::function< void(DOFINFO &, DOFINFO &, typename INFOBOX::CellInfo &, typename INFOBOX::CellInfo &)> &face_worker, const LoopControl &loop_control)
 
template<int dim, int spacedim, class DOFINFO , class INFOBOX , class ASSEMBLER , class ITERATOR >
void loop (ITERATOR begin, typename identity< ITERATOR >::type end, DOFINFO &dinfo, INFOBOX &info, const std_cxx11::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &cell_worker, const std_cxx11::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &boundary_worker, const std_cxx11::function< void(DOFINFO &, DOFINFO &, typename INFOBOX::CellInfo &, typename INFOBOX::CellInfo &)> &face_worker, ASSEMBLER &assembler, const LoopControl &lctrl=LoopControl())
 
template<int dim, int spacedim, class ITERATOR , class ASSEMBLER >
void integration_loop (ITERATOR begin, typename identity< ITERATOR >::type end, DoFInfo< dim, spacedim > &dof_info, IntegrationInfoBox< dim, spacedim > &box, const LocalIntegrator< dim, spacedim > &integrator, ASSEMBLER &assembler, const LoopControl &lctrl=LoopControl())
 

Detailed Description

A collection of functions and classes for the mesh loops that are an ubiquitous part of each finite element program.

The workhorse of this namespace is the loop() function, which implements a completely generic loop over all mesh cells. Since the calls to loop() are error-prone due to its generality, for many applications it is advisable to derive a class from MeshWorker::LocalIntegrator and use the less general integration_loop() instead.

The loop() depends on certain objects handed to it as arguments. These objects are of two types, info objects like DoFInfo and IntegrationInfo and worker objects like LocalWorker and IntegrationWorker.

Worker objects usually do two different jobs: first, they compute the local contribution of a cell or face to the global operation. Second, they assemble this local contribution into the global result, whether a functional, a form or a bilinear form. While the first job is particular to the problem being solved, the second is generic and only depends on the data structures. Therefore, base classes for workers assembling into global data are provided in the namespace Assembler.

Template argument types

The functions loop() and cell_action() take some arguments which are template parameters. Let us list the minimum requirements for these classes here and describe their properties.

ITERATOR

Any object that has an operator++() and points to a TriaObjectAccessor.

DOFINFO

For an example implementation, refer to the class template DoFInfo. In order to work with cell_action() and loop(), DOFINFO needs to follow the following interface.

class DOFINFO
{
private:
DOFINFO();
DOFINFO(const DOFINFO&);
DOFINFO& operator=(const DOFINFO&);
public:
template <class CellIt>
void reinit(const CellIt& c);
template <class CellIt, class FaceIt>
void reinit(const CellIt& c, const FaceIt& f, unsigned int n);
template <class CellIt, class FaceIt>
void reinit(const CellIt& c, const FaceIt& f, unsigned int n,
unsigned int s);
friend template class DoFInfoBox<int dim, DOFINFO>;
};

The three private functions are called by DoFInfoBox and should not be needed elsewhere. Obviously, they can be made public and then the friend declaration at the end may be missing.

Additionally, you will need at least one public constructor. Furthermore DOFINFO is pretty useless yet: functions to interface with INTEGRATIONINFO and ASSEMBLER are needed.

DOFINFO objects are gathered in a DoFInfoBox. In those objects, we store the results of local operations on each cell and its faces. Once all this information has been gathered, an ASSEMBLER is used to assemble it into golbal data.

INFOBOX

This type is exemplified in IntegrationInfoBox. It collects the input data for actions on cells and faces in INFO objects (see below). It provides the following interface to loop() and cell_action():

class INFOBOX
{
public:
template <int dim, class DOFINFO>
void post_cell(const DoFInfoBox<dim, DOFINFO>&);
template <int dim, class DOFINFO>
void post_faces(const DoFInfoBox<dim, DOFINFO>&);
INFO cell;
INFO boundary;
INFO face;
INFO subface;
INFO neighbor;
};

The main purpose of this class is gathering the five INFO objects, which contain the temporary data used on each cell or face. The requirements on these objects are listed below. Here, we only note that there need to be these 5 objects with the names listed above.

The two function templates are call back functions called in cell_action(). The first is called before the faces are worked on, the second after the faces.

INFO

See IntegrationInfo for an example of these objects. They contain the temporary data needed on each cell or face to compute the result. The MeshWorker only uses the interface

class INFO
{
public:
void reinit(const DOFINFO& i);
};

Simplified interfaces

Since the loop() is fairly general, a specialization integration_loop() is available, which is a wrapper around loop() with a simplified interface.

The integration_loop() function loop takes most of the information that it needs to pass to loop() from an IntegrationInfoBox object. Its use is explained in step-12, but in short it requires functions that do the local integration on a cell, interior or boundary face, and it needs an object (called "assembler") that copies these local contributions into the global matrix and right hand side objects.

Before we can run the integration loop, we have to initialize several data structures in our IntegrationWorker and assembler objects. For instance, we have to decide on the quadrature rule or we may need more than the default update flags.

Author
Guido Kanschat
Date
2009