ProblemStat.hpp 18.6 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/common/shared_ptr.hh>

15
#include <dune/grid/common/grid.hh>
16

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

37
#include <amdis/common/SharedPtr.hpp>
38
#include <amdis/common/TupleUtility.hpp>
39
#include <amdis/common/TypeTraits.hpp>
40
41

#include <amdis/GridFunctions.hpp>
42
#include <amdis/gridfunctions/DiscreteFunction.hpp>
43

Praetorius, Simon's avatar
Praetorius, Simon committed
44
#include <amdis/io/FileWriterBase.hpp>
45

46
47
#include <amdis/typetree/TreeData.hpp>
#include <amdis/typetree/TreePath.hpp>
48

49
namespace AMDiS
50
{
51
52
53
54
  // forward declaration
  template <class Traits>
  class ProblemInstat;

55
  template <class Traits>
56
  class ProblemStat
Praetorius, Simon's avatar
Praetorius, Simon committed
57
      : public ProblemStatBase
58
      , public StandardProblemIterationAdaptor<ProblemStat<Traits>>
59
  {
60
    using Self = ProblemStat;
61

62
63
    friend class ProblemInstat<Traits>;

64
  public: // typedefs and static constants
65

66
    using GlobalBasis = typename Traits::GlobalBasis;
Praetorius, Simon's avatar
Praetorius, Simon committed
67
    using GridView    = typename GlobalBasis::GridView;
Praetorius, Simon's avatar
Praetorius, Simon committed
68
    using Grid        = AdaptiveGrid_t<typename GridView::Grid>;
Praetorius, Simon's avatar
Praetorius, Simon committed
69
    using Element     = typename GridView::template Codim<0>::Entity;
70
    using WorldVector = typename Element::Geometry::GlobalCoordinate;
71
    using WorldMatrix = FieldMatrix<typename WorldVector::field_type, WorldVector::dimension, WorldVector::dimension>;
72

73
    /// Dimension of the grid
74
    static constexpr int dim = Grid::dimension;
75

76
    /// Dimension of the world
77
    static constexpr int dow = Grid::dimensionworld;
78

79
    using LinearSolverTraits = BackendTraits<GlobalBasis, typename Traits::CoefficientType>;
80
    using LinearSolverType = LinearSolverInterface<LinearSolverTraits>;
81
82
83
84
85
    using CommunicationType = typename LinearSolverTraits::Comm;

    using SystemMatrix = BiLinearForm<GlobalBasis, GlobalBasis, typename Traits::CoefficientType>;
    using SystemVector = LinearForm<GlobalBasis, typename Traits::CoefficientType>;
    using CoefficientVector = DOFVector<GlobalBasis, typename Traits::CoefficientType>;
86

87
  public:
88
89
    /**
     * \brief Constructor. Takes the name of the problem that is used to
90
     * access values corresponding to this problem in the parameter file.
91
     **/
92
    explicit ProblemStat(std::string const& name)
93
      : name_(name)
94
    {}
95

96
    /// Constructor taking additionally a grid that is used
97
    /// instead of the default created grid, \ref ProblemStat
98
99
    template <class Grid_>
    ProblemStat(std::string const& name, Grid_&& grid)
100
      : ProblemStat(name)
101
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
102
      adoptGrid(wrap_or_share(FWD(grid)));
103
104
    }

105
106
    /// \brief Constructor taking a grid and basis
    /// Wraps both in shared pointers.
Praetorius, Simon's avatar
Praetorius, Simon committed
107
108
    template <class Grid_, class Basis_>
    ProblemStat(std::string const& name, Grid_&& grid, Basis_&& globalBasis)
109
      : ProblemStat(name, FWD(grid))
110
    {
111
      adoptGlobalBasis(wrap_or_share(FWD(globalBasis)));
112
    }
Praetorius, Simon's avatar
Praetorius, Simon committed
113

114

Praetorius, Simon's avatar
Praetorius, Simon committed
115
    /// \brief Initialisation of the problem.
116
    /**
Praetorius, Simon's avatar
Praetorius, Simon committed
117
118
     * Parameters read in initialize()
     *   - `[GRID_NAME]->global refinements`:  nr of initial global refinements
119
     **/
Praetorius, Simon's avatar
Praetorius, Simon committed
120
    void initialize(Flag initFlag, Self* adoptProblem = nullptr, Flag adoptFlag = INIT_NOTHING);
121

Praetorius, Simon's avatar
Praetorius, Simon committed
122
123
124
125
126
127
128
129
    /// \brief Read the grid and solution from backup files and initialize the problem
    /**
     * Parameters read in restore() for problem with name 'PROB'
     *   - `[PROB]->restore->grid`:      name of the grid backup file
     *   - `[PROB]->restore->solution`:  name of the solution backup file
     **/
    void restore(Flag initFlag);

130

Praetorius, Simon's avatar
Praetorius, Simon committed
131
    /// Add an operator to \ref A.
132
    /** @{ */
Praetorius, Simon's avatar
Praetorius, Simon committed
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
    /// 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
150
    template <class Operator, class RowTreePath = RootTreePath, class ColTreePath = RootTreePath>
151
152
153
154
    void addMatrixOperator(Operator const& op, RowTreePath row = {}, ColTreePath col = {})
    {
      systemMatrix_->addOperator(tag::element_operator<Element>{}, op, row, col);
    }
155

Praetorius, Simon's avatar
Praetorius, Simon committed
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.
     *
Praetorius, Simon's avatar
Praetorius, Simon committed
161
     * \param b    Boundary identifier where to assemble this operator. Can be
Praetorius, Simon's avatar
Praetorius, Simon committed
162
163
164
165
166
167
168
169
170
171
172
173
174
     *             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
175
    template <class Operator, class RowTreePath = RootTreePath, class ColTreePath = RootTreePath>
176
177
    void addMatrixOperator(BoundaryType b, Operator const& op, RowTreePath row = {}, ColTreePath col = {})
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
178
      using I = typename GridView::Intersection;
179
      systemMatrix_->addOperator(tag::boundary_operator<I>{boundaryManager_,b}, op, row, col);
180
    }
181
    /** @} */
182
183


Praetorius, Simon's avatar
Praetorius, Simon committed
184
    /// Add an operator to \ref rhs.
185
    /** @{ */
Praetorius, Simon's avatar
Praetorius, Simon committed
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
    /// 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
201
    template <class Operator, class TreePath = RootTreePath>
202
203
204
205
    void addVectorOperator(Operator const& op, TreePath path = {})
    {
      rhs_->addOperator(tag::element_operator<Element>{}, op, path);
    }
206

Praetorius, Simon's avatar
Praetorius, Simon committed
207
208
209
210
211
    /// 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.
     *
Praetorius, Simon's avatar
Praetorius, Simon committed
212
     * \param b     Boundary identifier where to assemble this operator. Can be
Praetorius, Simon's avatar
Praetorius, Simon committed
213
214
215
216
217
218
219
220
221
222
223
     *              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
224
    template <class Operator, class TreePath = RootTreePath>
225
226
    void addVectorOperator(BoundaryType b, Operator const& op, TreePath path = {})
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
227
      using I = typename GridView::Intersection;
228
      rhs_->addOperator(tag::boundary_operator<I>{boundaryManager_,b}, op, path);
229
    }
230
    /** @} */
231

232

Praetorius, Simon's avatar
Praetorius, Simon committed
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
    /// 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; });
     * ```
     **/
255
    template <class Predicate, class RowTreePath, class ColTreePath, class Values>
256
    void addDirichletBC(Predicate const& predicate,
257
                        RowTreePath row, ColTreePath col,
Praetorius, Simon's avatar
Praetorius, Simon committed
258
                        Values const& values);
259
260
261
262
263
264
265
266
267

    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
268
269
    /** @} */

270

271
  public:
272

273
274
275
276
277
    /// Implementation of \ref StandardProblemIteration::oneIteration.
    Flag oneIteration(AdaptInfo& adaptInfo, Flag toDo = FULL_ITERATION) override
    {
      return StandardProblemIteration::oneIteration(adaptInfo, toDo);
    }
278

279
    /// Implementation of \ref ProblemStatBase::buildAfterCoarse
280
281
282
283
    void buildAfterAdapt(AdaptInfo& adaptInfo,
                         Flag flag,
                         bool asmMatrix = true,
                         bool asmVector = true) override;
284

Praetorius, Simon's avatar
Praetorius, Simon committed
285
286
287
288
289
290
291
    /// \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);
    }

292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
    /// 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;

Praetorius, Simon's avatar
Praetorius, Simon committed
312
    /// Writes output files. If force=true write even if timestep out of write rhythm.
313
    void writeFiles(AdaptInfo& adaptInfo, bool force = false);
314

Praetorius, Simon's avatar
Praetorius, Simon committed
315

316
  public: // get-methods
317

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

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

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

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

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

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

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

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

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

352
353
354

    /// Return a mutable view to a solution component
    template <class TreePath = RootTreePath>
Praetorius, Simon's avatar
Praetorius, Simon committed
355
    auto solution(TreePath path = {})
356
    {
357
      assert(bool(solution_) && "You have to call initialize() before.");
358
      return solution_->child(path);
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
      return solution_->child(path);
367
    }
368
369


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

372
    /// Set a new linear solver for the problem
Praetorius, Simon's avatar
Praetorius, Simon committed
373
374
    template <class Solver_>
    void setSolver(Solver_&& solver)
375
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
376
      linearSolver_ = wrap_or_share(FWD(solver));
Praetorius, Simon's avatar
Praetorius, Simon committed
377
378
    }

379

380
    /// Set the grid. Stores pointer and initializes feSpaces
Praetorius, Simon's avatar
Praetorius, Simon committed
381
    /// matrices and vectors, as well as markers and file-writers.
Praetorius, Simon's avatar
Praetorius, Simon committed
382
383
384
    /// If grid is given as reference, wrap it into a non-destroying shared_ptr
    template <class Grid_>
    void setGrid(Grid_&& grid)
385
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
386
      adoptGrid(wrap_or_share(FWD(grid)));
387
      createGlobalBasis();
388
      createMatricesAndVectors();
Praetorius, Simon's avatar
Praetorius, Simon committed
389
      createMarker();
390
391
392
      createFileWriter();
    }

393
394
395
396
397

    /// Store the shared_ptr and the name of the marker in the problem
    /**
     * Note: multiple markers can be added but must have different names
     **/
Praetorius, Simon's avatar
Praetorius, Simon committed
398
399
    template <class Marker_>
    void addMarker(Marker_&& m)
Praetorius, Simon's avatar
Praetorius, Simon committed
400
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
401
402
      auto marker = wrap_or_share(FWD(m));
      auto it = marker_.emplace(marker->name(), marker);
Praetorius, Simon's avatar
Praetorius, Simon committed
403
      if (marker_.size() > 1)
404
        it.first->second->setMaximumMarking(true);
Praetorius, Simon's avatar
Praetorius, Simon committed
405
406
    }

407
408
409
410
411
412
413
414
415
416
417
    /// 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
418
419
    }

420

421
  protected: // initialization methods
422

Praetorius, Simon's avatar
Praetorius, Simon committed
423
424
425
426
427
428
    void createGlobalBasis();
    void createGrid();
    void createMatricesAndVectors();
    void createSolver();
    void createMarker();
    void createFileWriter();
429

430
    void adoptGlobalBasis(std::shared_ptr<GlobalBasis> globalBasis)
431
    {
432
      globalBasis_ = std::move(globalBasis);
433
      initGlobalBasis();
434
435
    }

Praetorius, Simon's avatar
Praetorius, Simon committed
436
    void adoptGrid(std::shared_ptr<Grid> const& grid,
437
                   std::shared_ptr<BoundaryManager<Grid>> const& boundaryManager)
438
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
439
      grid_ = grid;
440
      boundaryManager_ = boundaryManager;
441
      Parameters::get(name_ + "->mesh", gridName_);
442
    }
443

Praetorius, Simon's avatar
Praetorius, Simon committed
444
445
446
447
448
449
    void adoptGrid(std::shared_ptr<Grid> const& grid)
    {
      adoptGrid(grid, std::make_shared<BoundaryManager<Grid>>(grid));
    }

    void adoptGrid(std::shared_ptr<typename Grid::HostGrid> const& hostGrid)
450
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
451
      auto grid = std::make_shared<Grid>(hostGrid);
452
453
454
      adoptGrid(grid, std::make_shared<BoundaryManager<Grid>>(grid));
    }

Praetorius, Simon's avatar
Praetorius, Simon committed
455
  private:
456

Praetorius, Simon's avatar
Praetorius, Simon committed
457
458
    void createGlobalBasisImpl(std::true_type);
    void createGlobalBasisImpl(std::false_type);
459

460
    void initGlobalBasis();
461

462
  private:
463
    /// Name of this problem.
464
    std::string name_;
465

466
    /// Grid of this problem.
Praetorius, Simon's avatar
Praetorius, Simon committed
467
    std::shared_ptr<Grid> grid_;
468

469
    /// Name of the grid
470
    std::string gridName_ = "mesh";
471

472
473
474
    /// Management of boundary conditions
    std::shared_ptr<BoundaryManager<Grid>> boundaryManager_;

475
    /// FE space of this problem.
476
    std::shared_ptr<GlobalBasis> globalBasis_;
477

478
    /// A FileWriter object
479
    std::list<std::shared_ptr<FileWriterInterface>> filewriter_;
480

481
    /// Pointer to the adaptation markers
482
    std::map<std::string, std::shared_ptr<Marker<Grid>>> marker_;
Praetorius, Simon's avatar
Praetorius, Simon committed
483
484
485

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

487
    /// An object of the linearSolver Interface
488
    std::shared_ptr<LinearSolverType> linearSolver_;
489

Praetorius, Simon's avatar
Praetorius, Simon committed
490
    /// Matrix that is filled during assembling
491
    std::shared_ptr<SystemMatrix> systemMatrix_;
492

Praetorius, Simon's avatar
Praetorius, Simon committed
493
    /// Vector with the solution components
494
    std::shared_ptr<CoefficientVector> solution_;
495

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

Praetorius, Simon's avatar
Praetorius, Simon committed
500
501
502
503
    /// 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_;

504

505
506
  private: // some internal data-structures

507
508
    DirichletBCs<GlobalBasis, GlobalBasis> dirichletBCs_;
    PeriodicBCs<GlobalBasis, GlobalBasis> periodicBCs_;
509
  };
510

Praetorius, Simon's avatar
Praetorius, Simon committed
511

512
513
514
#if DUNE_HAVE_CXX_CLASS_TEMPLATE_ARGUMENT_DEDUCTION
  // Deduction rule
  template <class Grid, class GlobalBasis>
515
  ProblemStat(std::string const& name, Grid& grid, GlobalBasis& globalBasis)
516
517
518
519
520
521
    -> ProblemStat<DefaultProblemTraits<GlobalBasis>>;
#endif

  // Generator for ProblemStat with given Grid and GlobalBasis
  template <class Grid, class GlobalBasis>
  ProblemStat<DefaultProblemTraits<GlobalBasis>>
522
  makeProblemStat(std::string const& name, Grid& grid, GlobalBasis& globalBasis)
523
  {
524
    return {name, grid, globalBasis};
525
526
  }

527
528
529
530
  // mark templates as explicitly instantiated in cpp file
  extern template class ProblemStat<YaspGridBasis<2,1>>;
  extern template class ProblemStat<YaspGridBasis<2,2>>;

531
} // end namespace AMDiS
532
533

#include "ProblemStat.inc.hpp"