* class responsible for the local integration:
*
* @code
+ * template <int dim>
+ * class LocalIntegrator : public Subscriptor
+ * {
+ * void cell(typename MeshWorker::IntegrationWorker<dim>::CellInfo& info) const;
+ * void bdry(typename MeshWorker::IntegrationWorker<dim>::FaceInfo& info) const;
+ * void face(typename MeshWorker::IntegrationWorker<dim>::FaceInfo& info1,
+ * typename MeshWorker::IntegrationWorker<dim>::FaceInfo& info2) const;
+ * };
+ * @endcode
+ * The three functions in there must have exactly this signature and
+ * should do the integration on cells, boundary and interior faces,
+ * respectively.
+ *
+ * Then, create the AssemblingIntegrator object, where the second
+ * template argument decides on what kind of global data is
+ * assembled. In the following, we decide to assemble a simple
+ * SparseMatrix with no block structure:
+ *
+ * @code
+ * LocalIntegrator<dim> loc;
+ * MeshWorker::AssemblingIntegrator<dim, MeshWorker::Assembler::MatrixSimple<SparseMatrix<double> >, LocalIntegrator<dim> >
+ * integrator(loc);
+ * @endcode
+ *
+ * Before we can run the integration loop, we have to initialize
+ * several data structures in our AssemblingIntegrator. For instance,
+ * we have to decide on the quadrature rule or we may need more than
+ * the default update flags.
+ *
+ * @code
+ * integrator.initialize_gauss_quadrature(2,2,2);
+ * integrator.add_update_flags(update_values | update_gradients, true, true, true, true);
+ * integrator.initialize(system_matrix);
+ * @endcode
+ *
+ * Finally, we set up the structures needed by the integration_loop()
+ * and run it.
+ *
+ * @code
+ * MeshWorker::IntegrationInfoBox<dim> info_box(dof_handler);
+ * info_box.initialize(integrator, fe, mapping);
+ *
+ * MeshWorker::integration_loop(dof_handler.begin_active(), dof_handler.end(),
+ * info_box, integrator);
* @endcode
*
* @author Guido Kanschat, 2009
* and allocate space for
* data vectors.
*
- * @param fe is only used
- * to determine the type of
- * the element and can be a
- * null pointer to FEValues,
- * FEVaceValues or
- * FESubfaceValues.
- *
* @param el is the finite
* element of the DoFHandler.
*
* the subset of @p indices
* used.
*
- * @param block is the block
- * number processed, or zero if
- * no base elements are used.
+ * @param component is the first
+ * index in @p values, @p
+ * gradients and @p hessians
+ * entered in this function.
+ *
+ * @param n_comp is the number
+ * of components to be filled.
*
* @param start is the first
* index of this block in @p
<a name="Intro"></a>
-<h1>This will be an example of the new MeshWorker framework and will be available soon</h1>
+<h1>Example of the MeshWorker framework with an advection problem</h1>
<h3>Overview</h3>
-This example is devoted to the <em>discontinuous Galerkin method</em>,
-or in short: DG method. It solves the same problem as step-12 (see
-there for a description of the problem and discretization), but here
-we use the MeshWorker framework in order to save reprogramming the
-cell/face loops.
+This example is devoted to the MeshWorker framework and the
+<em>discontinuous Galerkin method</em>, or in short: DG method. It
+solves the same problem as @ref step_12 "step-12" (see there for a description of the
+problem and discretization), but here we use the MeshWorker framework
+in order to save reprogramming the cell/face loops.
+
+In particular the loops of DG methods turn out to be complex, because
+for the face terms, we have to distinguish the cases of boundary,
+regular interior faces and interior faces with hanging nodes,
+respectively. The MeshWorker framework implements the standard loop
+over all cells and faces in MeshWorker::loop() and takes care of
+distinguishing between all the different faces.
<h3>Implementation</h3>
// @sect3{Integrating cell and face matrices}
//
- // In order to use the MeshWorker
- // framework, we need to define a
- // worker object, which serves three
- // purposes. First, it performs the
- // local integration on each mesh
- // cell. Second, it controls the loop
- // over cells and faces and the data
- // being generated. This part is
- // easily implemented here, since the
- // default structure can be
- // used. Finally, through its base
- // class from the
- // MeshWorker::Assembler namespace,
- // this object determines, how locally
- // produced data is assembled into
- // the global system.
- //
- // The fist base class is
- // MeshWorker::IntegrationWorker. It
- // has all the control structures the
- // generic loop needs. Fortunately,
- // most of them have reasonable
- // default values. The others will be
- // set below.
- //
- // The second base class is
- // MeshWorker::Assembler::SystemSimple,
- // which will assemble the matrices
- // and residuals on cells and faces,
- // respectively, into the global
- // system. The "simple" indicates
- // that we do not want to use
- // sophisticated block structures.
+ // We define a class that fits into
+ // the MeshWorker framework. Since it
+ // will be used by
+ // MeshWorker::AssemblingIntegrator,
+ // it needs the functions for cell,
+ // boundary and interior face
+ // integration specified exactly as
+ // below.
+
+ // The base class Subscriptor is
+ // needed so that
+ // MeshWorker::AssemblingIntegrator
+ // can store a SmartPointer to an
+ // object of this class.
template <int dim>
class DGIntegrator : public Subscriptor
{
void bdry(FaceInfo& info) const;
void face(FaceInfo& info1, FaceInfo& info2) const;
- // Additionally, like in step 12,
+ // Additionally, like in @ref
+ // step_12 "step-12",
// we have objects of the
// functions used in this class.
private:
};
// @sect4{The local integrators}
+
// These functions are analogous to
// step 12 and differ only in the
// data structures. Instead of
// This is the magic object, which
// knows everything about the data
- // structures and local
- // integration (the latter through
- // our object @p dg). This is the
- // object doing the work in the
- // function MeshWorker::loop, which
- // is implicitly called
- // below. After @p dg did the local
+ // structures and local integration
+ // (the latter through our object
+ // @p dg). This is the object doing
+ // the work in the function
+ // MeshWorker::loop(), which is
+ // implicitly called by
+ // MeshWorker::integration_loop()
+ // below.
+ // After @p dg did the local
// integration, the
// MeshWorker::Assembler::SystemSimple
// object distributes these into
// the global sparse matrix and the
// right hand side vector.
+ //
+ // It turns out,
+ // MeshWorker::AssemblingIntegrator
+ // itself is not that clever at
+ // all, but all its capabilities
+ // are provided by the two later
+ // template arguments. By
+ // exchanging
+ // MeshWorker::Assembler::SystemSimple,
+ // we could for instance assemble a
+ // BlockMatrix or just a Vector
+ // instead.
MeshWorker::AssemblingIntegrator<dim, MeshWorker::Assembler::SystemSimple<SparseMatrix<double>, Vector<double> >, DGIntegrator<dim> >
integrator(dg);
* write into a matrix but only allocate
* sparsity pattern entries.
*
- * As explained in the @ref hp_paper "hp
- * paper" and in @ref step_27 "step-27",
+ * As explained in the
+ * @ref hp_paper "hp paper"
+ * and in @ref step_27 "step-27",
* first allocating a sparsity pattern
* and later coming back and allocating
* additional entries for those matrix
* of the C++ standard library which uses a temporary object. The
* function simply exchanges the data of the two vectors.
*
- * @ingroup PETScWrappers
* @relates PETScWrappers::BlockVector
* @author Wolfgang Bangerth, 2000
*/
// $Id$
// Version: $Name$
//
-// Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors
+// Copyright (C) 2004, 2005, 2006, 2007, 2009 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* of the C++ standard library which uses a temporary object. The
* function simply exchanges the data of the two vectors.
*
- * @ingroup PETScWrappers
* @relates PETScWrappers::MPI::BlockVector
* @author Wolfgang Bangerth, 2000
*/
// $Id$
// Version: $Name$
//
-// Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors
+// Copyright (C) 2004, 2005, 2006, 2007, 2009 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* of the C++ standard library which uses a temporary object. The
* function simply exchanges the data of the two vectors.
*
- * @ingroup PETScWrappers
* @relates PETScWrappers::MPI::Vector
* @author Wolfgang Bangerth, 2004
*/
* of the C++ standard library which uses a temporary object. The
* function simply exchanges the data of the two vectors.
*
- * @ingroup PETScWrappers
* @relates PETScWrappers::Vector
* @author Wolfgang Bangerth, 2004
*/
* of the C++ standard library which uses a temporary object. The
* function simply exchanges the data of the two vectors.
*
- * @ingroup PETScWrappers
* @relates PETScWrappers::VectorBase
* @author Wolfgang Bangerth, 2004
*/
* of the C++ standard library which uses a temporary object. The
* function simply exchanges the data of the two vectors.
*
- * @ingroup TrilinosWrappers
* @relates TrilinosWrappers::MPI::BlockVector
* @author Martin Kronbichler, Wolfgang Bangerth, 2008
*/
* of the C++ standard library which uses a temporary object. The
* function simply exchanges the data of the two vectors.
*
- * @ingroup TrilinosWrappers
* @relates TrilinosWrappers::BlockVector
* @author Martin Kronbichler, 2008
*/
* of the C++ standard library which uses a temporary object. The
* function simply exchanges the data of the two vectors.
*
- * @ingroup TrilinosWrappers
* @relates TrilinosWrappers::MPI::Vector
* @author Martin Kronbichler, Wolfgang Bangerth, 2008
*/
* of the C++ standard library which uses a temporary object. The
* function simply exchanges the data of the two vectors.
*
- * @ingroup TrilinosWrappers
* @relates TrilinosWrappers::Vector
* @author Martin Kronbichler, Wolfgang Bangerth, 2008
*/
* the C standard library which uses a temporary object. The function
* simply exchanges the data of the two vectors.
*
- * @ingroup TrilinosWrappers
* @relates TrilinosWrappers::VectorBase
* @author Martin Kronbichler, Wolfgang Bangerth, 2008
*/