ProblemStat.hpp 19 KB
Newer Older
1
2
3
4
#pragma once

#include <list>
#include <map>
5
6
7
8
9
#include <memory>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
10

11
12
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
13
#include <dune/grid/common/grid.hh>
14
15
#include <amdis/AdaptInfo.hpp>
#include <amdis/CreatorInterface.hpp>
Praetorius, Simon's avatar
Praetorius, Simon committed
16
#include <amdis/CreatorMap.hpp>
17
#include <amdis/DirichletBC.hpp>
Praetorius, Simon's avatar
Praetorius, Simon committed
18
//#include <amdis/Estimator.hpp>
19
20
21
#include <amdis/Flag.hpp>
#include <amdis/Initfile.hpp>
#include <amdis/LinearAlgebra.hpp>
22
#include <amdis/OperatorList.hpp>
23
#include <amdis/Marker.hpp>
24
#include <amdis/MeshCreator.hpp>
25
#include <amdis/PeriodicBC.hpp>
26
27
28
29
30
#include <amdis/ProblemStatBase.hpp>
#include <amdis/ProblemStatTraits.hpp>
#include <amdis/StandardProblemIteration.hpp>

#include <amdis/common/TupleUtility.hpp>
31
#include <amdis/common/TypeTraits.hpp>
32
33

#include <amdis/GridFunctions.hpp>
34
#include <amdis/gridfunctions/DiscreteFunction.hpp>
35
36
#include <amdis/gridfunctions/DOFVectorView.hpp>

37
#include <amdis/FileWriterInterface.hpp>
38

39
40
#include <amdis/typetree/TreeData.hpp>
#include <amdis/typetree/TreePath.hpp>
41

42
namespace AMDiS
43
{
44
45
46
47
  // forward declaration
  template <class Traits>
  class ProblemInstat;

48
  template <class Traits>
49
  class ProblemStat
Praetorius, Simon's avatar
Praetorius, Simon committed
50
      : public ProblemStatBase
51
      , public StandardProblemIterationAdaptor<ProblemStat<Traits>>
52
  {
53
    using Self = ProblemStat;
54

55
56
    friend class ProblemInstat<Traits>;

57
  public: // typedefs and static constants
58

59
    using GlobalBasis = typename Traits::GlobalBasis;
Praetorius, Simon's avatar
Praetorius, Simon committed
60
61
62
    using GridView    = typename GlobalBasis::GridView;
    using Grid        = typename GridView::Grid;
    using Element     = typename GridView::template Codim<0>::Entity;
63
    using WorldVector = typename Element::Geometry::GlobalCoordinate;
64
    using WorldMatrix = FieldMatrix<typename WorldVector::field_type, WorldVector::dimension, WorldVector::dimension>;
65

66
    /// Dimension of the grid
67
    static constexpr int dim = Grid::dimension;
68

69
    /// Dimension of the world
70
    static constexpr int dow = Grid::dimensionworld;
71

72
73
    using SystemMatrix = DOFMatrix<GlobalBasis, GlobalBasis, typename Traits::CoefficientType>;
    using SystemVector = DOFVector<GlobalBasis, typename Traits::CoefficientType>;
74
75
76
77
    using LinearSolverTraits = SolverTraits<typename SystemMatrix::BaseMatrix,
                                            typename SystemVector::BaseVector,
                                            typename SystemVector::BaseVector,
                                            GlobalBasis>;
78

79
80
    using LinearSolverType = LinearSolverInterface<LinearSolverTraits>;
    using CommInfo = typename LinearSolverTraits::Comm;
81

82
  public:
83
84
    /**
     * \brief Constructor. Takes the name of the problem that is used to
85
     * access values corresponding to this problem in the parameter file.
86
     **/
87
    explicit ProblemStat(std::string const& name)
88
      : name_(name)
89
    {}
90

91
92
    /// Constructor taking additionally a reference to a grid that is used
    /// instead of the default created grid, \ref ProblemStat
93
94
    ProblemStat(std::string const& name, Grid& grid)
      : ProblemStat(name)
95
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
96
      adoptGrid(Dune::stackobject_to_shared_ptr(grid));
97
98
99
100
    }

    /// \brief Constructor taking a grid reference and a basis reference.
    /// Stores pointers to both.
101
102
    ProblemStat(std::string const& name, Grid& grid, GlobalBasis& globalBasis)
      : ProblemStat(name, grid)
103
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
104
      adoptGlobalBasis(Dune::stackobject_to_shared_ptr(globalBasis));
105
    }
Praetorius, Simon's avatar
Praetorius, Simon committed
106

107

108
    /**
109
     * \brief Initialisation of the problem.
110
     *
111
112
113
     * Parameters read in initialize() for problem with name 'PROB'
     *   MESH[0]->global refinements:  nr of initial global refinements
     **/
Praetorius, Simon's avatar
Praetorius, Simon committed
114
    void initialize(Flag initFlag, Self* adoptProblem = nullptr, Flag adoptFlag = INIT_NOTHING);
115

116

Praetorius, Simon's avatar
Praetorius, Simon committed
117
    /// Add an operator to \ref A.
118
    /** @{ */
Praetorius, Simon's avatar
Praetorius, Simon committed
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
    /// Operator evaluated on the whole element
    /**
     * Adds an operator to the list of element operators to be assembled in
     * quadrature points inside the element.
     *
     * \param op   A (pre-) local operator, \see LocalOperator, \see GridFunctionOperator
     * \param row  TreePath identifying the sub-basis in the global basis tree
     *             corresponding to the row basis. \see treepath()
     * \param col  TreePath identifying the sub-basis in the global basis tree
     *             corresponding to the column basis. \see treepath()
     *
     * Example:
     * ```
     * auto op = makeOperator(tag::test_trial{}, 1.0/tau);
     * prob.addMatrixOperator(op, _0, _0);
     * ```
     **/
Praetorius, Simon's avatar
Praetorius, Simon committed
136
    template <class Operator, class RowTreePath = RootTreePath, class ColTreePath = RootTreePath>
137
138
139
140
    void addMatrixOperator(Operator const& op, RowTreePath row = {}, ColTreePath col = {})
    {
      systemMatrix_->addOperator(tag::element_operator<Element>{}, op, row, col);
    }
141

Praetorius, Simon's avatar
Praetorius, Simon committed
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
    /// Operator evaluated on the boundary of the domain with boundary index `b`
    /**
     * Adds an operator to the list of boundary operators to be assembled in
     * quadrature points on the boundary intersections.
     *
     * \param b    Boundary indentifier where to assemble this operator. Can be
     *             constructed from an integer. \see BoundaryType
     * \param op   A (pre-) local operator, \see LocalOperator, \see GridFunctionOperator
     * \param row  TreePath identifying the sub-basis in the global basis tree
     *             corresponding to the row basis. \see treepath()
     * \param col  TreePath identifying the sub-basis in the global basis tree
     *             corresponding to the column basis. \see treepath()
     *
     * Example:
     * ```
     * auto op = makeOperator(tag::test_trial{}, alpha);
     * prob.addMatrixOperator(BoundaryType{1}, op, _0, _0);
     * ```
     **/
Praetorius, Simon's avatar
Praetorius, Simon committed
161
    template <class Operator, class RowTreePath = RootTreePath, class ColTreePath = RootTreePath>
162
163
    void addMatrixOperator(BoundaryType b, Operator const& op, RowTreePath row = {}, ColTreePath col = {})
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
164
      using I = typename GridView::Intersection;
165
      systemMatrix_->addOperator(tag::boundary_operator<I>{boundaryManager_,b}, op, row, col);
166
    }
167
    /** @} */
168
169


Praetorius, Simon's avatar
Praetorius, Simon committed
170
    /// Add an operator to \ref rhs.
171
    /** @{ */
Praetorius, Simon's avatar
Praetorius, Simon committed
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
    /// Operator evaluated on the whole element
    /**
     * Adds an operator to the list of element operators to be assembled in
     * quadrature points inside the element.
     *
     * \param op    A (pre-) local operator, \see LocalOperator, \see GridFunctionOperator
     * \param path  TreePath identifying the sub-basis in the global basis tree
     *              corresponding to the row basis. \see treepath()
     *
     * Example:
     * ```
     * auto op = makeOperator(tag::test{}, probInstat.getOldSolution(0) / tau);
     * prob.addVectorOperator(op, _0);
     * ```
     **/
Praetorius, Simon's avatar
Praetorius, Simon committed
187
    template <class Operator, class TreePath = RootTreePath>
188
189
190
191
    void addVectorOperator(Operator const& op, TreePath path = {})
    {
      rhs_->addOperator(tag::element_operator<Element>{}, op, path);
    }
192

Praetorius, Simon's avatar
Praetorius, Simon committed
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
    /// Operator evaluated on the boundary of the domain with boundary index `b`
    /**
     * Adds an operator to the list of boundary operators to be assembled in
     * quadrature points on the boundary intersections.
     *
     * \param b     Boundary indentifier where to assemble this operator. Can be
     *              constructed from an integer. \see BoundaryType
     * \param op    A (pre-) local operator, \see LocalOperator, \see GridFunctionOperator
     * \param path  TreePath identifying the sub-basis in the global basis tree
     *              corresponding to the row basis. \see treepath()
     *
     * Example:
     * ```
     * auto op = makeOperator(tag::test{}, [g](auto const& x) { return g(x); });
     * prob.addVectorOperator(BoundaryType{1}, op, _0);
     * ```
     **/
Praetorius, Simon's avatar
Praetorius, Simon committed
210
    template <class Operator, class TreePath = RootTreePath>
211
212
    void addVectorOperator(BoundaryType b, Operator const& op, TreePath path = {})
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
213
      using I = typename GridView::Intersection;
214
      rhs_->addOperator(tag::boundary_operator<I>{boundaryManager_,b}, op, path);
215
    }
216
    /** @} */
217

218

Praetorius, Simon's avatar
Praetorius, Simon committed
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
    /// Add boundary conditions to the system
    /** @{ */
    /// Dirichlet boundary condition
    /**
     * Enforce Dirichlet boundary values for the solution vector on boundary
     * regions identified by the predicate.
     *
     * \param predicate  Functor `bool(WorldVector)` returning true for all
     *                   DOFs on the boundary that should be assigned a value.
     * \param row        TreePath identifying the sub-basis in the global basis tree
     *                   corresponding to the row basis. \see treepath()
     * \param col        TreePath identifying the sub-basis in the global basis tree
     *                   corresponding to the column basis. \see treepath()
     * \param values     Functor `Range(WorldVector)` or any \ref GridFunction
     *                   that is evaluated in the DOFs identified by the predicate.
     *
     * Example:
     * ```
     * prob.addDirichletBC([](auto const& x) { return x[0] < 1.e-8; }, 0, 0,
     *                     [](auto const& x) { return 0.0; });
     * ```
     **/
241
    template <class Predicate, class RowTreePath, class ColTreePath, class Values>
242
    void addDirichletBC(Predicate const& predicate,
243
                        RowTreePath row, ColTreePath col,
Praetorius, Simon's avatar
Praetorius, Simon committed
244
                        Values const& values);
245
246
247
248
249
250
251
252
253

    template <class RowTreePath, class ColTreePath, class Values>
    void addDirichletBC(BoundaryType id,
                        RowTreePath row, ColTreePath col,
                        Values const& values);

    /// Add a periodic boundary conditions to the system, by specifying a face transformation
    /// y = A*x + b of coordinates. We assume, that A is orthonormal.
    void addPeriodicBC(BoundaryType id, WorldMatrix const& A, WorldVector const& b);
Praetorius, Simon's avatar
Praetorius, Simon committed
254
255
    /** @} */

256

257
  public:
258

259
260
261
262
263
    /// Implementation of \ref StandardProblemIteration::oneIteration.
    Flag oneIteration(AdaptInfo& adaptInfo, Flag toDo = FULL_ITERATION) override
    {
      return StandardProblemIteration::oneIteration(adaptInfo, toDo);
    }
264

265
    /// Implementation of \ref ProblemStatBase::buildAfterCoarse
266
267
268
269
    void buildAfterAdapt(AdaptInfo& adaptInfo,
                         Flag flag,
                         bool asmMatrix = true,
                         bool asmVector = true) override;
270

Praetorius, Simon's avatar
Praetorius, Simon committed
271
272
273
274
275
276
277
    /// \brief Assemble the linear system by calling \ref buildAfterAdapt with
    /// `asmMatrix` and `asmVector` set to true.
    void assemble(AdaptInfo& adaptInfo)
    {
      buildAfterAdapt(adaptInfo, Flag{0}, true, true);
    }

278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
    /// Implementation of \ref ProblemStatBase::solve
    void solve(AdaptInfo& adaptInfo,
               bool createMatrixData = true,
               bool storeMatrixData = false) override;

    /// Implementation of \ref ProblemStatBase::estimate.
    void estimate(AdaptInfo& adaptInfo) override { /* do nothing. */ }

    /// Implementation of \ref ProblemStatBase::refineMesh.
    Flag adaptGrid(AdaptInfo& adaptInfo) override;

    /// Implementation of \ref ProblemStatBase::markElements.
    Flag markElements(AdaptInfo& adaptInfo) override;

    /// Uniform global grid coarsening by up to n level
    Flag globalCoarsen(int n) override;

    /// Uniform global refinement by n level
    Flag globalRefine(int n) override;

298
    /// Writes output files.
299
    void writeFiles(AdaptInfo& adaptInfo, bool force = false);
300

301
302
303
    /// Backup the grid
    void backup(std::string const& filename) const;

304
305
306
    /// Implements \ref ProblemStatBase::backup
    void backup(AdaptInfo& adaptInfo) override;

307
308
309
    /// Retore the grid
    auto restore(std::string const& filename);

310
311
312
    /// Implements \ref ProblemStatBase::restore
    void restore(Flag initFlag) override;

Praetorius, Simon's avatar
Praetorius, Simon committed
313

314
  public: // get-methods
315

Praetorius, Simon's avatar
Praetorius, Simon committed
316
    /// Implementation of \ref ProblemStatBase::name
317
    std::string const& name() const override { return name_; }
Praetorius, Simon's avatar
Praetorius, Simon committed
318
319
320


    /// Return a reference to the grid, \ref grid
321
322
    std::shared_ptr<Grid>       grid()       { return grid_; }
    std::shared_ptr<Grid const> grid() const { return grid_; }
Praetorius, Simon's avatar
Praetorius, Simon committed
323
324

    /// Return the gridView of the leaf-level
325
    GridView gridView() const { return globalBasis_->gridView(); }
Praetorius, Simon's avatar
Praetorius, Simon committed
326

327
    /// Return the boundary manager to identify boundary segments
328
329
    std::shared_ptr<BoundaryManager<Grid>>       boundaryManager()       { return boundaryManager_; }
    std::shared_ptr<BoundaryManager<Grid> const> boundaryManager() const { return boundaryManager_; }
330

Praetorius, Simon's avatar
Praetorius, Simon committed
331
    /// Return the \ref globalBasis_
332
333
    std::shared_ptr<GlobalBasis>       globalBasis()       { return globalBasis_; }
    std::shared_ptr<GlobalBasis const> globalBasis() const { return globalBasis_; }
Praetorius, Simon's avatar
Praetorius, Simon committed
334
335

    /// Return a reference to the linear solver, \ref linearSolver
336
337
    std::shared_ptr<LinearSolverType>       solver()       { return linearSolver_; }
    std::shared_ptr<LinearSolverType const> solver() const { return linearSolver_; }
Praetorius, Simon's avatar
Praetorius, Simon committed
338

339
    /// Returns a reference to system-matrix, \ref systemMatrix_
340
341
    std::shared_ptr<SystemMatrix>       systemMatrix()       { return systemMatrix_; }
    std::shared_ptr<SystemMatrix const> systemMatrix() const { return systemMatrix_; }
342
343

    /// Returns a reference to the solution vector, \ref solution_
344
345
    std::shared_ptr<SystemVector>       solutionVector()       { return solution_; }
    std::shared_ptr<SystemVector const> solutionVector() const { return solution_; }
346
347

    /// Return a reference to the rhs system-vector, \ref rhs
348
349
    std::shared_ptr<SystemVector>       rhsVector()       { return rhs_; }
    std::shared_ptr<SystemVector const> rhsVector() const { return rhs_; }
350

351
352
353

    /// Return a mutable view to a solution component
    template <class TreePath = RootTreePath>
Praetorius, Simon's avatar
Praetorius, Simon committed
354
    auto solution(TreePath path = {})
355
    {
356
      assert(bool(solution_) && "You have to call initialize() before.");
357
      auto&& tp = makeTreePath(path);
358
      return makeDOFVectorView(*solution_, tp);
359
    }
360

361
362
    /// Return a const view to a solution component
    template <class TreePath = RootTreePath>
Praetorius, Simon's avatar
Praetorius, Simon committed
363
    auto solution(TreePath path = {}) const
364
    {
365
      assert(bool(solution_) && "You have to call initialize() before.");
366
      auto&& tp = makeTreePath(path);
367
      return makeDiscreteFunction(*solution_, tp);
368
    }
369
370


Praetorius, Simon's avatar
Praetorius, Simon committed
371
  public: // set-methods
372

373
    /// Set a new linear solver for the problem
374
    void setSolver(std::shared_ptr<LinearSolverType> solver)
375
    {
376
      linearSolver_ = solver;
377
378
    }

379
380
    /// Wrap the solver reference into a non-destroying shared_ptr, or move it
    /// into a new shared_ptr if it is a temporary.
381
382
383
    template <class S,
      REQUIRES(std::is_base_of<LinearSolverType, remove_cvref_t<S>>::value)>
    void setSolver(S&& solver)
Praetorius, Simon's avatar
Praetorius, Simon committed
384
    {
385
      setSolver(Dune::wrap_or_move(FWD(solver)));
Praetorius, Simon's avatar
Praetorius, Simon committed
386
387
    }

388

389
    /// Set the grid. Stores pointer and initializes feSpaces
Praetorius, Simon's avatar
Praetorius, Simon committed
390
    /// matrices and vectors, as well as markers and file-writers.
391
    void setGrid(std::shared_ptr<Grid> const& grid)
392
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
393
      adoptGrid(grid);
394
      createGlobalBasis();
395
      createMatricesAndVectors();
Praetorius, Simon's avatar
Praetorius, Simon committed
396
      createMarker();
397
398
399
      createFileWriter();
    }

400
    /// Wrap the grid into a non-destroying shared_ptr
Praetorius, Simon's avatar
Praetorius, Simon committed
401
402
403
404
405
    void setGrid(Grid& grid)
    {
      setGrid(Dune::stackobject_to_shared_ptr(grid));
    }

406
407
408
409
410
411

    /// Store the shared_ptr and the name of the marker in the problem
    /**
     * Note: multiple markers can be added but must have different names
     **/
    void addMarker(std::shared_ptr<Marker<Grid>> marker)
Praetorius, Simon's avatar
Praetorius, Simon committed
412
    {
413
      auto it = marker_.emplace(marker->name(), std::move(marker));
Praetorius, Simon's avatar
Praetorius, Simon committed
414
      if (marker_.size() > 1)
415
        it.first->second->setMaximumMarking(true);
Praetorius, Simon's avatar
Praetorius, Simon committed
416
417
    }

418
419
    /// Wrap the reference into a non-destroying shared_ptr or move it into a
    /// new shared_ptr if it is a temporary.
420
421
422
    template <class M,
      REQUIRES(std::is_base_of<Marker<Grid>, remove_cvref_t<M>>::value)>
    void addMarker(M&& marker)
Praetorius, Simon's avatar
Praetorius, Simon committed
423
    {
424
425
426
427
428
429
430
431
432
433
434
435
436
437
      addMarker(Dune::wrap_or_move(FWD(marker)));
    }

    /// Remove a marker with the given name from the problem
    void removeMarker(std::string name)
    {
      std::size_t num = marker_.erase(name);
      test_warning(num == 1, "A marker with the given name '{}' does not exist.", name);
    }

    /// Remove a marker from the problem
    void removeMarker(Marker<Grid> const& marker)
    {
      removeMarker(marker.name());
Praetorius, Simon's avatar
Praetorius, Simon committed
438
439
    }

440

441
  protected: // initialization methods
442

Praetorius, Simon's avatar
Praetorius, Simon committed
443
444
445
446
447
448
    void createGlobalBasis();
    void createGrid();
    void createMatricesAndVectors();
    void createSolver();
    void createMarker();
    void createFileWriter();
449

Praetorius, Simon's avatar
Praetorius, Simon committed
450
    void adoptGlobalBasis(std::shared_ptr<GlobalBasis> const& globalBasis)
451
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
452
      globalBasis_ = globalBasis;
453
      initGlobalBasis();
454
455
    }

456
457
    void adoptGrid(std::shared_ptr<Grid> const& grid,
                   std::shared_ptr<BoundaryManager<Grid>> const& boundaryManager)
458
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
459
      grid_ = grid;
460
      boundaryManager_ = boundaryManager;
461
      Parameters::get(name_ + "->mesh", gridName_);
462
    }
463

464
465
466
467
468
    void adoptGrid(std::shared_ptr<Grid> const& grid)
    {
      adoptGrid(grid, std::make_shared<BoundaryManager<Grid>>(grid));
    }

Praetorius, Simon's avatar
Praetorius, Simon committed
469
  private:
470

Praetorius, Simon's avatar
Praetorius, Simon committed
471
472
    void createGlobalBasisImpl(std::true_type);
    void createGlobalBasisImpl(std::false_type);
473

474
    void initGlobalBasis();
475

476
  private:
477
    /// Name of this problem.
478
    std::string name_;
479

480
    /// Grid of this problem.
Praetorius, Simon's avatar
Praetorius, Simon committed
481
    std::shared_ptr<Grid> grid_;
482

483
    /// Name of the grid
484
    std::string gridName_ = "mesh";
485

486
487
488
    /// Management of boundary conditions
    std::shared_ptr<BoundaryManager<Grid>> boundaryManager_;

489
    /// FE spaces of this problem.
490
    std::shared_ptr<GlobalBasis> globalBasis_;
491

492
    /// A FileWriter object
493
    std::list<std::shared_ptr<FileWriterInterface>> filewriter_;
494

495
    /// Pointer to the adaptation markers
496
    std::map<std::string, std::shared_ptr<Marker<Grid>>> marker_;
Praetorius, Simon's avatar
Praetorius, Simon committed
497
498
499

    /// Pointer to the estimators for this problem
//    std::vector<Estimator*> estimator;
500

501
    /// An object of the linearSolver Interface
502
    std::shared_ptr<LinearSolverType> linearSolver_;
503

Praetorius, Simon's avatar
Praetorius, Simon committed
504
    /// Matrix that is filled during assembling
505
    std::shared_ptr<SystemMatrix> systemMatrix_;
506

Praetorius, Simon's avatar
Praetorius, Simon committed
507
    /// Vector with the solution components
508
    std::shared_ptr<SystemVector> solution_;
509

Praetorius, Simon's avatar
Praetorius, Simon committed
510
    /// Vector (load-vector) corresponding to the right-hand side
511
    /// of the equation, filled during assembling
512
    std::shared_ptr<SystemVector> rhs_;
513

Praetorius, Simon's avatar
Praetorius, Simon committed
514
515
516
517
    /// A vector with the local element error estimates
    /// for each node in the basis tree, indexed by [to_string(treePath)][element index]
    std::map<std::string, std::vector<double>> estimates_;

518

519
520
  private: // some internal data-structures

521
522
    DirichletBCs<GlobalBasis, GlobalBasis> dirichletBCs_;
    PeriodicBCs<GlobalBasis, GlobalBasis> periodicBCs_;
523
  };
524

Praetorius, Simon's avatar
Praetorius, Simon committed
525

526
527
528
#if DUNE_HAVE_CXX_CLASS_TEMPLATE_ARGUMENT_DEDUCTION
  // Deduction rule
  template <class Grid, class GlobalBasis>
529
  ProblemStat(std::string const& name, Grid& grid, GlobalBasis& globalBasis)
530
531
532
533
534
535
    -> ProblemStat<DefaultProblemTraits<GlobalBasis>>;
#endif

  // Generator for ProblemStat with given Grid and GlobalBasis
  template <class Grid, class GlobalBasis>
  ProblemStat<DefaultProblemTraits<GlobalBasis>>
536
  makeProblemStat(std::string const& name, Grid& grid, GlobalBasis& globalBasis)
537
  {
538
    return {name, grid, globalBasis};
539
540
  }

541
542
543
544
  // mark templates as explicitly instantiated in cpp file
  extern template class ProblemStat<YaspGridBasis<2,1>>;
  extern template class ProblemStat<YaspGridBasis<2,2>>;

545
} // end namespace AMDiS
546
547

#include "ProblemStat.inc.hpp"