ProblemStat.hpp 18.7 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
14
#include <dune/grid/common/grid.hh>

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

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

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

38
#include <amdis/FileWriterInterface.hpp>
39

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

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

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

56
57
    friend class ProblemInstat<Traits>;

58
  public: // typedefs and static constants
59

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

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

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

73
74
    using SystemMatrix = DOFMatrix<GlobalBasis, GlobalBasis, typename Traits::CoefficientType>;
    using SystemVector = DOFVector<GlobalBasis, typename Traits::CoefficientType>;
75

76
    using LinearSolverType = LinearSolverInterface<typename SystemMatrix::BaseMatrix, typename SystemVector::BaseVector>;
77

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

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

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

103

104
    /**
105
     * \brief Initialisation of the problem.
106
     *
107
108
109
     * 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
110
    void initialize(Flag initFlag, Self* adoptProblem = nullptr, Flag adoptFlag = INIT_NOTHING);
111

112

Praetorius, Simon's avatar
Praetorius, Simon committed
113
    /// Add an operator to \ref A.
114
    /** @{ */
Praetorius, Simon's avatar
Praetorius, Simon committed
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
    /// 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
132
    template <class Operator, class RowTreePath = RootTreePath, class ColTreePath = RootTreePath>
133
134
135
136
    void addMatrixOperator(Operator const& op, RowTreePath row = {}, ColTreePath col = {})
    {
      systemMatrix_->addOperator(tag::element_operator<Element>{}, op, row, col);
    }
137

Praetorius, Simon's avatar
Praetorius, Simon committed
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
    /// 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
157
    template <class Operator, class RowTreePath = RootTreePath, class ColTreePath = RootTreePath>
158
159
    void addMatrixOperator(BoundaryType b, Operator const& op, RowTreePath row = {}, ColTreePath col = {})
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
160
      using I = typename GridView::Intersection;
161
      systemMatrix_->addOperator(tag::boundary_operator<I>{boundaryManager_,b}, op, row, col);
162
    }
163
    /** @} */
164
165


Praetorius, Simon's avatar
Praetorius, Simon committed
166
    /// Add an operator to \ref rhs.
167
    /** @{ */
Praetorius, Simon's avatar
Praetorius, Simon committed
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
    /// 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
183
    template <class Operator, class TreePath = RootTreePath>
184
185
186
187
    void addVectorOperator(Operator const& op, TreePath path = {})
    {
      rhs_->addOperator(tag::element_operator<Element>{}, op, path);
    }
188

Praetorius, Simon's avatar
Praetorius, Simon committed
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
    /// 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
206
    template <class Operator, class TreePath = RootTreePath>
207
208
    void addVectorOperator(BoundaryType b, Operator const& op, TreePath path = {})
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
209
      using I = typename GridView::Intersection;
210
      rhs_->addOperator(tag::boundary_operator<I>{boundaryManager_,b}, op, path);
211
    }
212
    /** @} */
213

214

Praetorius, Simon's avatar
Praetorius, Simon committed
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
    /// 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; });
     * ```
     **/
237
    template <class Predicate, class RowTreePath, class ColTreePath, class Values>
238
    void addDirichletBC(Predicate const& predicate,
239
                        RowTreePath row, ColTreePath col,
Praetorius, Simon's avatar
Praetorius, Simon committed
240
                        Values const& values);
241
242
243
244
245
246
247
248
249

    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
250
251
    /** @} */

252

253
  public:
254

255
256
257
258
259
    /// Implementation of \ref StandardProblemIteration::oneIteration.
    Flag oneIteration(AdaptInfo& adaptInfo, Flag toDo = FULL_ITERATION) override
    {
      return StandardProblemIteration::oneIteration(adaptInfo, toDo);
    }
260

261
    /// Implementation of \ref ProblemStatBase::buildAfterCoarse
262
263
264
265
    void buildAfterAdapt(AdaptInfo& adaptInfo,
                         Flag flag,
                         bool asmMatrix = true,
                         bool asmVector = true) override;
266

Praetorius, Simon's avatar
Praetorius, Simon committed
267
268
269
270
271
272
273
    /// \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);
    }

274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
    /// 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;

294
    /// Writes output files.
295
    void writeFiles(AdaptInfo& adaptInfo, bool force = false);
296

297
298
299
    /// Backup the grid
    void backup(std::string const& filename) const;

300
301
302
    /// Implements \ref ProblemStatBase::backup
    void backup(AdaptInfo& adaptInfo) override;

303
304
305
    /// Retore the grid
    auto restore(std::string const& filename);

306
307
308
    /// Implements \ref ProblemStatBase::restore
    void restore(Flag initFlag) override;

Praetorius, Simon's avatar
Praetorius, Simon committed
309

310
  public: // get-methods
311

Praetorius, Simon's avatar
Praetorius, Simon committed
312
    /// Implementation of \ref ProblemStatBase::name
313
    std::string const& name() const override { return name_; }
Praetorius, Simon's avatar
Praetorius, Simon committed
314
315
316


    /// Return a reference to the grid, \ref grid
317
318
    std::shared_ptr<Grid>       grid()       { return grid_; }
    std::shared_ptr<Grid const> grid() const { return grid_; }
Praetorius, Simon's avatar
Praetorius, Simon committed
319
320

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

323
    /// Return the boundary manager to identify boundary segments
324
325
    std::shared_ptr<BoundaryManager<Grid>>       boundaryManager()       { return boundaryManager_; }
    std::shared_ptr<BoundaryManager<Grid> const> boundaryManager() const { return boundaryManager_; }
326

Praetorius, Simon's avatar
Praetorius, Simon committed
327
    /// Return the \ref globalBasis_
328
329
    std::shared_ptr<GlobalBasis>       globalBasis()       { return globalBasis_; }
    std::shared_ptr<GlobalBasis const> globalBasis() const { return globalBasis_; }
Praetorius, Simon's avatar
Praetorius, Simon committed
330
331

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

335
    /// Returns a reference to system-matrix, \ref systemMatrix_
336
337
    std::shared_ptr<SystemMatrix>       systemMatrix()       { return systemMatrix_; }
    std::shared_ptr<SystemMatrix const> systemMatrix() const { return systemMatrix_; }
338
339

    /// Returns a reference to the solution vector, \ref solution_
340
341
    std::shared_ptr<SystemVector>       solutionVector()       { return solution_; }
    std::shared_ptr<SystemVector const> solutionVector() const { return solution_; }
342
343

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

347
348
349

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

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


Praetorius, Simon's avatar
Praetorius, Simon committed
367
  public: // set-methods
368

369
    /// Set a new linear solver for the problem
370
    void setSolver(std::shared_ptr<LinearSolverType> solver)
371
    {
372
      linearSolver_ = solver;
373
374
    }

375
376
    /// Wrap the solver reference into a non-destroying shared_ptr, or move it
    /// into a new shared_ptr if it is a temporary.
377
378
379
    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
380
    {
381
      setSolver(Dune::wrap_or_move(FWD(solver)));
Praetorius, Simon's avatar
Praetorius, Simon committed
382
383
    }

384

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

396
    /// Wrap the grid into a non-destroying shared_ptr
Praetorius, Simon's avatar
Praetorius, Simon committed
397
398
399
400
401
    void setGrid(Grid& grid)
    {
      setGrid(Dune::stackobject_to_shared_ptr(grid));
    }

402
403
404
405
406
407

    /// 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
408
    {
409
      auto it = marker_.emplace(marker->name(), std::move(marker));
Praetorius, Simon's avatar
Praetorius, Simon committed
410
      if (marker_.size() > 1)
411
        it.first->second->setMaximumMarking(true);
Praetorius, Simon's avatar
Praetorius, Simon committed
412
413
    }

414
415
    /// Wrap the reference into a non-destroying shared_ptr or move it into a
    /// new shared_ptr if it is a temporary.
416
417
418
    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
419
    {
420
421
422
423
424
425
426
427
428
429
430
431
432
433
      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
434
435
    }

436

437
  protected: // initialization methods
438

Praetorius, Simon's avatar
Praetorius, Simon committed
439
440
441
442
443
444
    void createGlobalBasis();
    void createGrid();
    void createMatricesAndVectors();
    void createSolver();
    void createMarker();
    void createFileWriter();
445

Praetorius, Simon's avatar
Praetorius, Simon committed
446
    void adoptGlobalBasis(std::shared_ptr<GlobalBasis> const& globalBasis)
447
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
448
      globalBasis_ = globalBasis;
449
      initGlobalBasis();
450
451
    }

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

460
461
462
463
464
    void adoptGrid(std::shared_ptr<Grid> const& grid)
    {
      adoptGrid(grid, std::make_shared<BoundaryManager<Grid>>(grid));
    }

Praetorius, Simon's avatar
Praetorius, Simon committed
465
  private:
466

Praetorius, Simon's avatar
Praetorius, Simon committed
467
468
    void createGlobalBasisImpl(std::true_type);
    void createGlobalBasisImpl(std::false_type);
469

470
    void initGlobalBasis();
471

472
  private:
473
    /// Name of this problem.
474
    std::string name_;
475

476
    /// Grid of this problem.
Praetorius, Simon's avatar
Praetorius, Simon committed
477
    std::shared_ptr<Grid> grid_;
478

479
    /// Name of the grid
480
    std::string gridName_ = "mesh";
481

482
483
484
    /// Management of boundary conditions
    std::shared_ptr<BoundaryManager<Grid>> boundaryManager_;

485
    /// FE spaces of this problem.
486
    std::shared_ptr<GlobalBasis> globalBasis_;
487

488
    /// A FileWriter object
489
    std::list<std::shared_ptr<FileWriterInterface>> filewriter_;
490

491
    /// Pointer to the adaptation markers
492
    std::map<std::string, std::shared_ptr<Marker<Grid>>> marker_;
Praetorius, Simon's avatar
Praetorius, Simon committed
493
494
495

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

497
    /// An object of the linearSolver Interface
498
    std::shared_ptr<LinearSolverType> linearSolver_;
499

Praetorius, Simon's avatar
Praetorius, Simon committed
500
    /// Matrix that is filled during assembling
501
    std::shared_ptr<SystemMatrix> systemMatrix_;
502

Praetorius, Simon's avatar
Praetorius, Simon committed
503
    /// Vector with the solution components
504
    std::shared_ptr<SystemVector> solution_;
505

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

Praetorius, Simon's avatar
Praetorius, Simon committed
510
511
512
513
    /// 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_;

514

515
516
  private: // some internal data-structures

517
518
    DirichletBCs<GlobalBasis, GlobalBasis> dirichletBCs_;
    PeriodicBCs<GlobalBasis, GlobalBasis> periodicBCs_;
519
  };
520

Praetorius, Simon's avatar
Praetorius, Simon committed
521

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

  // Generator for ProblemStat with given Grid and GlobalBasis
  template <class Grid, class GlobalBasis>
  ProblemStat<DefaultProblemTraits<GlobalBasis>>
532
  makeProblemStat(std::string const& name, Grid& grid, GlobalBasis& globalBasis)
533
  {
534
    return {name, grid, globalBasis};
535
536
  }

537
538
539
540
  // mark templates as explicitly instantiated in cpp file
  extern template class ProblemStat<YaspGridBasis<2,1>>;
  extern template class ProblemStat<YaspGridBasis<2,2>>;

541
} // end namespace AMDiS
542
543

#include "ProblemStat.inc.hpp"