ProblemStat.hpp 19.2 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
44
#include <amdis/gridfunctions/DOFVectorView.hpp>

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

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

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

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

63
64
    friend class ProblemInstat<Traits>;

65
  public: // typedefs and static constants
66

67
    using GlobalBasis = typename Traits::GlobalBasis;
Praetorius, Simon's avatar
Praetorius, Simon committed
68
    using GridView    = typename GlobalBasis::GridView;
69
70
71
    // TODO(FM): Make this GridView::Grid::HostGrid as soon as AdaptiveGrid is a complete metagrid
    using HostGrid    = typename GridView::Grid;
    using Grid        = AdaptiveGrid<HostGrid>;
Praetorius, Simon's avatar
Praetorius, Simon committed
72
    using Element     = typename GridView::template Codim<0>::Entity;
73
    using WorldVector = typename Element::Geometry::GlobalCoordinate;
74
    using WorldMatrix = FieldMatrix<typename WorldVector::field_type, WorldVector::dimension, WorldVector::dimension>;
75

76
    /// Dimension of the grid
77
    static constexpr int dim = Grid::dimension;
78

79
    /// Dimension of the world
80
    static constexpr int dow = Grid::dimensionworld;
81

82
    using LinearSolverTraits = BackendTraits<GlobalBasis, typename Traits::CoefficientType>;
83
    using LinearSolverType = LinearSolverInterface<LinearSolverTraits>;
84
85
86
87
88
    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>;
89

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

99
    /// Constructor taking additionally a grid that is used
100
    /// instead of the default created grid, \ref ProblemStat
101
102
    template <class Grid_>
    ProblemStat(std::string const& name, Grid_&& grid)
103
      : ProblemStat(name)
104
    {
105
      adoptGrid(Grid::instance(FWD(grid)));
106
107
    }

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

117

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

Praetorius, Simon's avatar
Praetorius, Simon committed
125
126
127
128
129
130
131
132
    /// \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);

133

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

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


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

Praetorius, Simon's avatar
Praetorius, Simon committed
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
    /// 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
227
    template <class Operator, class TreePath = RootTreePath>
228
229
    void addVectorOperator(BoundaryType b, Operator const& op, TreePath path = {})
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
230
      using I = typename GridView::Intersection;
231
      rhs_->addOperator(tag::boundary_operator<I>{boundaryManager_,b}, op, path);
232
    }
233
    /** @} */
234

235

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

    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
271
272
    /** @} */

273

274
  public:
275

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

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

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

295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
    /// 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
315
    /// Writes output files. If force=true write even if timestep out of write rhythm.
316
    void writeFiles(AdaptInfo& adaptInfo, bool force = false);
317

Praetorius, Simon's avatar
Praetorius, Simon committed
318

319
  public: // get-methods
320

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

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

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

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

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

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

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

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

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

355
356
357

    /// Return a mutable view to a solution component
    template <class TreePath = RootTreePath>
Praetorius, Simon's avatar
Praetorius, Simon committed
358
    auto solution(TreePath path = {})
359
    {
360
      assert(bool(solution_) && "You have to call initialize() before.");
361
      return solution_->child(path);
362
    }
363

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


Praetorius, Simon's avatar
Praetorius, Simon committed
373
  public: // set-methods
374

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

381
382
    /// Wrap the solver reference into a non-destroying shared_ptr, or move it
    /// into a new shared_ptr if it is a temporary.
383
384
385
    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
386
    {
387
      setSolver(Dune::wrap_or_move(FWD(solver)));
Praetorius, Simon's avatar
Praetorius, Simon committed
388
389
    }

390

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

402
    /// Wrap the grid into a non-destroying shared_ptr
403
404
    template <class Grid_>
    void setGrid(Grid_&& grid)
Praetorius, Simon's avatar
Praetorius, Simon committed
405
    {
406
      setGrid(Grid::instance(FWD(grid)));
Praetorius, Simon's avatar
Praetorius, Simon committed
407
408
    }

409
410
411
412
413
414

    /// 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
415
    {
416
      auto it = marker_.emplace(marker->name(), std::move(marker));
Praetorius, Simon's avatar
Praetorius, Simon committed
417
      if (marker_.size() > 1)
418
        it.first->second->setMaximumMarking(true);
Praetorius, Simon's avatar
Praetorius, Simon committed
419
420
    }

421
422
    /// Wrap the reference into a non-destroying shared_ptr or move it into a
    /// new shared_ptr if it is a temporary.
423
424
425
    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
426
    {
427
428
429
430
431
432
433
434
435
436
437
438
439
440
      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
441
442
    }

443

444
  protected: // initialization methods
445

Praetorius, Simon's avatar
Praetorius, Simon committed
446
447
448
449
450
451
    void createGlobalBasis();
    void createGrid();
    void createMatricesAndVectors();
    void createSolver();
    void createMarker();
    void createFileWriter();
452

453
    void adoptGlobalBasis(std::shared_ptr<GlobalBasis> globalBasis)
454
    {
455
      globalBasis_ = std::move(globalBasis);
456
      initGlobalBasis();
457
458
    }

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

467
    void adoptGrid(std::shared_ptr<Grid> grid)
468
469
470
471
    {
      adoptGrid(grid, std::make_shared<BoundaryManager<Grid>>(grid));
    }

Praetorius, Simon's avatar
Praetorius, Simon committed
472
  private:
473

Praetorius, Simon's avatar
Praetorius, Simon committed
474
475
    void createGlobalBasisImpl(std::true_type);
    void createGlobalBasisImpl(std::false_type);
476

477
    void initGlobalBasis();
478

479
  private:
480
    /// Name of this problem.
481
    std::string name_;
482

483
    /// Grid of this problem.
Praetorius, Simon's avatar
Praetorius, Simon committed
484
    std::shared_ptr<Grid> grid_;
485

486
    /// Name of the grid
487
    std::string gridName_ = "mesh";
488

489
490
491
    /// Management of boundary conditions
    std::shared_ptr<BoundaryManager<Grid>> boundaryManager_;

492
    /// FE space of this problem.
493
    std::shared_ptr<GlobalBasis> globalBasis_;
494

495
    /// A FileWriter object
496
    std::list<std::shared_ptr<FileWriterInterface>> filewriter_;
497

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

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

504
    /// An object of the linearSolver Interface
505
    std::shared_ptr<LinearSolverType> linearSolver_;
506

Praetorius, Simon's avatar
Praetorius, Simon committed
507
    /// Matrix that is filled during assembling
508
    std::shared_ptr<SystemMatrix> systemMatrix_;
509

Praetorius, Simon's avatar
Praetorius, Simon committed
510
    /// Vector with the solution components
511
    std::shared_ptr<CoefficientVector> solution_;
512

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

Praetorius, Simon's avatar
Praetorius, Simon committed
517
518
519
520
    /// 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_;

521

522
523
  private: // some internal data-structures

524
525
    DirichletBCs<GlobalBasis, GlobalBasis> dirichletBCs_;
    PeriodicBCs<GlobalBasis, GlobalBasis> periodicBCs_;
526
  };
527

Praetorius, Simon's avatar
Praetorius, Simon committed
528

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

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

544
545
546
547
  // mark templates as explicitly instantiated in cpp file
  extern template class ProblemStat<YaspGridBasis<2,1>>;
  extern template class ProblemStat<YaspGridBasis<2,2>>;

548
} // end namespace AMDiS
549
550

#include "ProblemStat.inc.hpp"