ProblemStat.h 19.4 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/******************************************************************************
 *
 * AMDiS - Adaptive multidimensional simulations
 *
 * Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
 * Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
 *
 * Authors: 
 * Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 *
 * This file is part of AMDiS
 *
 * See also license.opensource.txt in the distribution.
 * 
 ******************************************************************************/
20
21


22

23
/** \file ProblemStat.h */
24

25
26
#ifndef AMDIS_PROBLEM_STAT_H
#define AMDIS_PROBLEM_STAT_H
27

Thomas Witkowski's avatar
Thomas Witkowski committed
28
29
#include <vector>
#include <list>
30
#include "AMDiS_fwd.h"
31
#include "ProblemStatBase.h"
32
#include "Initfile.h"
33
34
35
#include "Boundary.h"
#include "MatrixVector.h"
#include "StandardProblemIteration.h"
36
#include "io/ElementFileWriter.h"
Thomas Witkowski's avatar
Thomas Witkowski committed
37
#include "ComponentTraverseInfo.h"
38
#include "AbstractFunction.h"
39
#include "solver/SolverMatrix.h"
40
#include "SystemVector.h"
41
42
43

namespace AMDiS {

44
45
  using namespace std;

46
47
48
49
50
51
  struct OperatorPos 
  {
    int row, col;
    double *factor, *estFactor;
  };

52

53
54
55
56
57
58
59
  /**
   * \ingroup Problem 
   *
   * \brief
   * This class defines the stationary problem definition in sequential
   * computations. For parallel computations, see \ref ParallelProblemStatBase.
   **/
60
61
  class ProblemStatSeq : public ProblemStatBase,
			 public StandardProblemIteration
62
  {
63
  protected:
64
    // Defines a mapping type from dof indices to world coordinates.
65
    typedef map<DegreeOfFreedom, WorldVector<double> > DofToCoord;
66
67

    // Defines a mapping type from dof indices to world coordinates.
68
    typedef map<WorldVector<double>, DegreeOfFreedom> CoordToDof;
69

70
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
71
    /// Constructor
72
    ProblemStatSeq(string nameStr,
73
		   ProblemIterationInterface *problemIteration = nullptr);
74

Thomas Witkowski's avatar
Thomas Witkowski committed
75
    /// Destructor
Thomas Witkowski's avatar
Thomas Witkowski committed
76
    virtual ~ProblemStatSeq();
77

Thomas Witkowski's avatar
Thomas Witkowski committed
78
    /// Initialisation of the problem.
79
    virtual void initialize(Flag initFlag,
80
			    ProblemStatSeq *adoptProblem = nullptr,
81
82
			    Flag adoptFlag = INIT_NOTHING);

Thomas Witkowski's avatar
Thomas Witkowski committed
83
    /// Used in \ref initialize().
84
85
    virtual void createMesh();

86
87
88
    /// Used in \ref initialize().
    virtual void createRefCoarseManager();

Thomas Witkowski's avatar
Thomas Witkowski committed
89
    /// Used in \ref initialize().
90
    virtual void createFeSpace(DOFAdmin *admin);
91

Thomas Witkowski's avatar
Thomas Witkowski committed
92
    /// Used in \ref initialize().
93
94
    virtual void createMatricesAndVectors();

Thomas Witkowski's avatar
Thomas Witkowski committed
95
    /// Used in \ref initialize().
96
97
    virtual void createSolver();

Thomas Witkowski's avatar
Thomas Witkowski committed
98
    /// Used in \ref initialize().
99
100
    virtual void createEstimator();

Thomas Witkowski's avatar
Thomas Witkowski committed
101
    /// Used in \ref initialize().
102
103
    virtual void createMarker();

Thomas Witkowski's avatar
Thomas Witkowski committed
104
    /// Used in \ref initialize().
105
106
    virtual void createFileWriter();

107
108
    /// Used in \ref initialize(). This function is deprecated and should not 
    /// be used anymore. There is no guarantee that it will work in the future.
109
110
    virtual void doOtherStuff();

111
112
    /// Implementation of ProblemStatBase::solve(). Deligates the solving
    /// of problems system to \ref solver.
113
114
    void solve(AdaptInfo *adaptInfo,
	       bool createMatrixData = true,
115
	       bool storeMatrixData = false) override;
116

117
118
    /// Implementation of ProblemStatBase::estimate(). Deligates the estimation
    /// to \ref estimator.
119
    void estimate(AdaptInfo *adaptInfo) override;
120

121
122
    /// Implementation of ProblemStatBase::markElements().
    /// Deligated to \ref adapt.
123
    Flag markElements(AdaptInfo *adaptInfo) override;
124

125
126
    /// Implementation of ProblemStatBase::refineMesh(). Deligated to the
    /// RefinementManager of \ref adapt.
127
    Flag refineMesh(AdaptInfo *adaptInfo) override;
128

129
130
    /// Implementation of ProblemStatBase::coarsenMesh(). Deligated to the
    /// CoarseningManager of \ref adapt.
131
    Flag coarsenMesh(AdaptInfo *adaptInfo) override;
132

133
134
    /// Implementation of ProblemStatBase::buildBeforeRefine().
    /// Does nothing here.
135
    void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) override {}
136

137
138
    /// Implementation of ProblemStatBase::buildBeforeCoarsen().
    /// Does nothing here.
139
    void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag) override {}
140

141
142
143
    /// Implementation of ProblemStatBase::buildAfterCoarsen().
    /// Assembles \ref A and \ref rhs. With the last two parameters, assembling
    /// can be restricted to matrices or vectors only.
144
    void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag,
145
				   bool assembleMatrix = true,
146
				   bool assembleVector = true) override;
147

148
149
    bool dualMeshTraverseRequired();

150
151
    void dualAssemble(AdaptInfo *adaptInfo, Flag flag, 
		      bool asmMatrix = true, bool asmVector = true);
152

153
154
155
    /// Determines the execution order of the single adaption steps. If adapt is
    /// true, mesh adaption will be performed. This allows to avoid mesh adaption,
    /// e.g. in timestep adaption loops of timestep adaptive strategies.
156
    Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo = FULL_ITERATION) override;
157

Thomas Witkowski's avatar
Thomas Witkowski committed
158
    /// Returns number of managed problems
159
    int getNumProblems() override
160
    { 
161
      return 1; 
Thomas Witkowski's avatar
Thomas Witkowski committed
162
    }
163

164
    /// Implementation of ProblemStatBase::getNumComponents(), TODO: Wrong!!
165
166
    virtual int getNumComponents() 
    { 
167
      return nComponents; 
Thomas Witkowski's avatar
Thomas Witkowski committed
168
    }
169

170
171
    /// Returns the problem with the given number. If only one problem
    /// is managed by this master problem, the number hasn't to be given.
172
    ProblemStatBase *getProblem(int number = 0) override
173
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
174
      return this; 
Thomas Witkowski's avatar
Thomas Witkowski committed
175
    }
176

177
    /// Writes output files. TODO: Make obsolete.
178
179
    void writeFiles(AdaptInfo *adaptInfo, bool force);

180
181
182
    /// Writes output files.
    void writeFiles(AdaptInfo &adaptInfo, bool force);

Thomas Witkowski's avatar
Thomas Witkowski committed
183
    /// Interpolates fct to \ref solution.
184
    void interpolInitialSolution(vector<AbstractFunction<double, WorldVector<double> >*> *fct);
185

186
    /// Adds an operator to \ref A.
187
    void addMatrixOperator(Operator *op, int i, int j,
188
			   double *factor = nullptr, double *estFactor = nullptr);
189

190
    /// Adds an operator to \ref A.
191
    void addMatrixOperator(Operator &op, int i, int j,
192
			   double *factor = nullptr, double *estFactor = nullptr);
193

194
    /// Adds an operator to \ref rhs.
195
    void addVectorOperator(Operator *op, int i,
196
			   double *factor = nullptr, double *estFactor = nullptr);
197

198
    /// Adds an operator to \ref rhs.
199
    void addVectorOperator(Operator &op, int i,
200
			   double *factor = nullptr, double *estFactor = nullptr);
201

202
203
    /// Adds a Dirichlet boundary condition, where the rhs is given by an 
    /// abstract function.
204
    virtual void addDirichletBC(BoundaryType type, int row, int col,
205
206
				AbstractFunction<double, WorldVector<double> > *b);

207
208
    /// Adds a Dirichlet boundary condition, where the rhs is given by a DOF
    /// vector.
209
210
211
    virtual void addDirichletBC(BoundaryType type, int row, int col,
				DOFVector<double> *vec);

212
213
    /// Adds a Neumann boundary condition, where the rhs is given by an
    /// abstract function.
214
215
216
    virtual void addNeumannBC(BoundaryType type, int row, int col, 
			      AbstractFunction<double, WorldVector<double> > *n);

217
218
219
220
221
222
    /// Adds a Neumann boundary condition, where the rhs is given by an DOF
    /// vector.
    virtual void addNeumannBC(BoundaryType type, int row, int col, 
			      DOFVector<double> *n);

    /// Adds Robin boundary condition.
223
224
225
226
    virtual void addRobinBC(BoundaryType type, int row, int col, 
			    AbstractFunction<double, WorldVector<double> > *n,
			    AbstractFunction<double, WorldVector<double> > *r);

227
228
229
230
231
232
233
234
235
236
    /// Adds Robin boundary condition.
    virtual void addRobinBC(BoundaryType type, int row, int col, 
			    DOFVector<double> *n,
			    DOFVector<double> *r);

    /// Adds Robin boundary condition.
    virtual void addRobinBC(BoundaryType type, int row, int col, 
			    Operator *n,
			    Operator *r);

237
    /// Adds a periodic boundary condition.
238
239
    virtual void addPeriodicBC(BoundaryType type, int row, int col);

240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
    /// add boundary operator to matrix side
    virtual void addBoundaryMatrixOperator(BoundaryType type, 
          Operator *op, int row, int col);

    virtual void addBoundaryMatrixOperator(BoundaryType type, 
          Operator &op, int row, int col)
    {
      addBoundaryMatrixOperator(type, &op, row, col);
    }

    /// add boundary operator to rhs (vector) side
    virtual void addBoundaryVectorOperator(BoundaryType type, 
          Operator *op, int row);

    virtual void addBoundaryVectorOperator(BoundaryType type, 
          Operator &op, int row)
    {
      addBoundaryVectorOperator(type, &op, row);
    }

260
261
    /// This function assembles a DOFMatrix and a DOFVector for the case,
    /// the meshes from row and col FE-space are equal.
262
    void assembleOnOneMesh(const FiniteElemSpace *feSpace, 
Thomas Witkowski's avatar
Thomas Witkowski committed
263
			   Flag assembleFlag,
Thomas Witkowski's avatar
Thomas Witkowski committed
264
265
			   DOFMatrix *matrix, DOFVector<double> *vector);

Thomas Witkowski's avatar
Thomas Witkowski committed
266
267

    ///
268
269
270
271
    void assembleBoundaryConditions(DOFVector<double> *rhs,
				    DOFVector<double> *solution,
				    Mesh *mesh,
				    Flag assembleFlag);
272
273

 
274
275
276
277
    /** \name getting methods
     * \{ 
     */

Thomas Witkowski's avatar
Thomas Witkowski committed
278
    /// Returns \ref solution.
279
280
    inline SystemVector* getSolution() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
281
282
      return solution; 
    }
283

284
    inline DOFVector<double>* getSolution(int i)
285
286
287
288
    {
      return solution->getDOFVector(i);
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
289
    /// Returns \ref rhs.
290
    inline SystemVector* getRhs() 
291
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
292
293
      return rhs; 
    }
294

295
    inline DOFVector<double>* getRhsVector(int i = 0)
296
297
298
299
    {
      return rhs->getDOFVector(i);
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
300
    /// Returns \ref systemMatrix.
301
302
    inline Matrix<DOFMatrix*> *getSystemMatrix() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
303
304
      return systemMatrix; 
    }
305

Thomas Witkowski's avatar
Thomas Witkowski committed
306
    /// Returns a pointer to the corresponding DOFMatrix.
307
308
    inline DOFMatrix* getSystemMatrix(int row, int col) 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
309
310
311
312
      return (*systemMatrix)[row][col];
    }

    /// Returns mesh of given component
313
    inline Mesh* getMesh(int comp = 0) 
314
    {
315
      FUNCNAME("ProblemStatSeq::getMesh()");
Thomas Witkowski's avatar
Thomas Witkowski committed
316
      TEST_EXIT(comp < static_cast<int>(componentMeshes.size()) && comp >= 0)
317
	("invalid component number\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
318
      return componentMeshes[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
319
    }
320

Thomas Witkowski's avatar
Thomas Witkowski committed
321
    /// Returns \ref meshes
322
    inline vector<Mesh*> getMeshes() 
323
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
324
325
      return meshes; 
    }
326

Thomas Witkowski's avatar
Thomas Witkowski committed
327
    /// Returns \ref feSpace_.
328
    inline const FiniteElemSpace* getFeSpace(int comp = 0) 
329
    { 
330
      FUNCNAME("ProblemStatSeq::getFeSpace()");
331
      TEST_EXIT(comp < static_cast<int>(componentSpaces.size()) && comp >= 0)
332
	("invalid component number\n");
333
      return componentSpaces[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
334
    }
335

Thomas Witkowski's avatar
Thomas Witkowski committed
336
    /// Returns \ref feSpaces.
337
    inline vector<const FiniteElemSpace*>& getFeSpaces() 
338
    { 
339
      return feSpaces; 
Thomas Witkowski's avatar
Thomas Witkowski committed
340
    }
341

Thomas Witkowski's avatar
Thomas Witkowski committed
342
    /// Returns \ref componentSpaces;
343
    inline vector<const FiniteElemSpace*>& getComponentSpaces() 
344
    {
345
      return componentSpaces;
346
347
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
348
    /// Returns \ref estimator.
349
    inline vector<Estimator*> getEstimators() 
350
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
351
352
      return estimator; 
    }
353

Thomas Witkowski's avatar
Thomas Witkowski committed
354
    /// Returns \ref estimator.
355
    inline Estimator* getEstimator(int comp = 0) 
356
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
357
358
      return estimator[comp]; 
    }
359

Thomas Witkowski's avatar
Thomas Witkowski committed
360
    /// Returns \ref refinementManager.
361
    inline RefinementManager* getRefinementManager(int comp = 0) 
362
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
363
364
      return refinementManager; 
    }
365

Thomas Witkowski's avatar
Thomas Witkowski committed
366
    /// Returns \ref refinementManager.
367
    inline CoarseningManager* getCoarseningManager(int comp = 0) 
368
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
369
370
      return coarseningManager; 
    }
371

Thomas Witkowski's avatar
Thomas Witkowski committed
372
    /// Returns \ref solver.
373
    inline LinearSolver* getSolver() 
374
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
375
376
      return solver; 
    }
377

Thomas Witkowski's avatar
Thomas Witkowski committed
378
    /// Returns \ref marker.
379
    inline Marker *getMarker(int comp = 0) 
380
    { 
381
      return marker[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
382
    }
383

Thomas Witkowski's avatar
Thomas Witkowski committed
384
    /// Returns \ref marker.
385
    inline vector<Marker*> getMarkers() 
386
    { 
387
      return marker; 
Thomas Witkowski's avatar
Thomas Witkowski committed
388
    }
389

Thomas Witkowski's avatar
Thomas Witkowski committed
390
    /// Returns the name of the problem
391
    inline string getName() override
392
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
393
394
      return name; 
    }
395

Praetorius, Simon's avatar
Praetorius, Simon committed
396
397
398
399
400
401
402
403
    /// Returns the name of the problem
    inline string getComponentName(int comp = 0)
    {
      TEST_EXIT(comp < static_cast<int>(componentNames.size()) && comp >= 0)
	("invalid component number\n");
      return componentNames[comp];
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
404
    /// Returns \ref useGetBound.
405
406
    inline bool getBoundUsed() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
407
408
      return useGetBound; 
    }
409

410
411
412
413
414
415
    /// Returns \ref info.
    int getInfo()
    {
      return info;
    }

416
417
418
419
420
421
    /// Returns \ref deserialized;
    bool isDeserialized()
    {
      return deserialized;
    }

422
423
424
425
426
427
    /** \} */

    /** \name setting methods
     * \{ 
     */

Thomas Witkowski's avatar
Thomas Witkowski committed
428
    /// Sets \ref estimator.
429
    inline void setEstimator(vector<Estimator*> est) 
430
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
431
432
      estimator = est; 
    }
433

Thomas Witkowski's avatar
Thomas Witkowski committed
434
    /// Sets the FE space for the given component.
435
    inline void setFeSpace(const FiniteElemSpace *feSpace, int comp = 0) 
436
    {
437
      feSpaces[comp] = feSpace;
Thomas Witkowski's avatar
Thomas Witkowski committed
438
    }
439

440
    void setComponentSpace(int comp, const FiniteElemSpace *feSpace)
441
442
443
444
445
446
447
448
449
    {
      if (static_cast<int>(componentSpaces.size()) < nComponents)
        componentSpaces.resize(nComponents);
      TEST_EXIT(comp >= 0 && comp < nComponents)
        ("Component number not in feasable range!");

      componentSpaces[comp] = feSpace;
    }
    
Thomas Witkowski's avatar
Thomas Witkowski committed
450
    /// Sets \ref estimator.
451
    inline void setEstimator(Estimator* est, int comp = 0) 
452
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
453
454
      estimator[comp] = est; 
    }
455

Thomas Witkowski's avatar
Thomas Witkowski committed
456
    /// Sets \ref marker.
457
    inline void setMarker(Marker* mark, int comp = 0) 
458
    { 
459
      marker[comp] = mark; 
Thomas Witkowski's avatar
Thomas Witkowski committed
460
    }
461

Thomas Witkowski's avatar
Thomas Witkowski committed
462
    /// Sets \ref solver.
463
    inline void setSolver(LinearSolver* sol) 
464
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
465
466
      solver = sol; 
    }
467

468
469
470
471
472
    void setSolverMatrix(SolverMatrix<Matrix<DOFMatrix*> >& solverMatrix_)
    {
      solverMatrix.setMatrix(*solverMatrix_.getOriginalMat());
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
473
    ///
474
    inline void setAssembleMatrixOnlyOnce(int i = 0, int j = 0, bool value = true) 
475
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
476
      assembleMatrixOnlyOnce[i][j] = value;
477
478
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
479
    ///
480
    void setExactSolutionFct(AbstractFunction<double, WorldVector<double> > *fct,
481
482
			     int component) 
    {
483
484
485
      exactSolutionFcts[component] = fct;
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
486
    ///
487
    AbstractFunction<double, WorldVector<double> > *getExactSolutionFct(int i = 0) 
488
    {
489
      return exactSolutionFcts[i];
490
491
    }

492
493
494
495
496
497
    ///
    vector< AbstractFunction<double, WorldVector<double> >* > getExactSolutionFcts() 
    {
      return exactSolutionFcts;
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
498
    ///
499
500
    void setComputeExactError(bool v) 
    {
501
502
503
      computeExactError = v;
    }

504
505
506
507
508
509
    /// Sets \ref writeAsmInfo;
    void setWriteAsmInfo(bool b)
    {
      writeAsmInfo = b;
    }

510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
    void setMeshes(vector<Mesh*> meshes_)
    {
      meshes = meshes_;
      nMeshes = static_cast<int>(meshes.size());
    }

    void setComponentMesh(int comp, Mesh* mesh)
    {
      if (static_cast<int>(componentMeshes.size()) < nComponents)
        componentMeshes.resize(nComponents);
      TEST_EXIT(comp >= 0 && comp < nComponents)
        ("Component number not in feasable range!");

      componentMeshes[comp] = mesh;
    }

    void setRefinementManager(RefinementManager *ref)
    {
      refinementManager = ref;
    }

    void setCoarseningManager(CoarseningManager *coarse)
    {
      coarseningManager = coarse;
    }
535
536
    /** \} */

537
538
    /// Outputs the mesh of the given component, but the values are taken from
    /// the residual error estimator. 
539
    void writeResidualMesh(int comp, AdaptInfo *adaptInfo, string name);
540

Thomas Witkowski's avatar
Thomas Witkowski committed
541
    /// Function that implements the serialization procedure.
542
    void serialize(ostream &out) override;
543

Thomas Witkowski's avatar
Thomas Witkowski committed
544
    /// Function that implements the deserialization procedure.
545
    void deserialize(istream &in) override;
546

Thomas Witkowski's avatar
Thomas Witkowski committed
547
548

    /// Returns \ref fileWriters.
549
    vector<FileWriterInterface*>& getFileWriterList() 
550
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
551
552
      return fileWriters;
    }
553

Thomas Witkowski's avatar
Thomas Witkowski committed
554
  protected:
555
556
    /// If the exact solution is known, the problem can compute the exact
    /// error instead of the error estimation. This is done in this function.
Thomas Witkowski's avatar
Thomas Witkowski committed
557
558
    void computeError(AdaptInfo *adaptInfo);

559
  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
560
561
    
    /// Name of this problem.
562
    string name;
563

Thomas Witkowski's avatar
Thomas Witkowski committed
564
    /// Number of problem components
565
    int nComponents;
566

567
568
569
570
    /// Stores the names for all components. Is used for naming the solution
    /// vectors, \ref solution.
    vector<string> componentNames;

571
572
573
    /// Number of problem meshes. If all components are defined on the same mesh,
    /// this number is 1. Otherwise, this variable is the number of different meshes
    /// within the problem.
Thomas Witkowski's avatar
Thomas Witkowski committed
574
575
576
    int nMeshes;

    /// FE spaces of this problem.
577
    vector<const FiniteElemSpace*> feSpaces;
578

Thomas Witkowski's avatar
Thomas Witkowski committed
579
    /// Meshes of this problem.
580
    vector<Mesh*> meshes;
581

Thomas Witkowski's avatar
Thomas Witkowski committed
582
    /// Pointer to the fe spaces for the different problem components
583
    vector<const FiniteElemSpace*> componentSpaces;
584

Thomas Witkowski's avatar
Thomas Witkowski committed
585
    /// Pointer to the meshes for the different problem components
586
    vector<Mesh*> componentMeshes;
587

588
589
590
    /// Stores information about which meshes must be traversed to assemble the
    /// specific components. I.e., it was implemented to make use of different
    /// meshes for different components.
Thomas Witkowski's avatar
Thomas Witkowski committed
591
592
593
    ComponentTraverseInfo traverseInfo;
    
    /// Responsible for element marking.
594
    vector<Marker*> marker;
595

Thomas Witkowski's avatar
Thomas Witkowski committed
596
    /// Estimator of this problem. Used in \ref estimate().
597
    vector<Estimator*> estimator;
598

Thomas Witkowski's avatar
Thomas Witkowski committed
599
    /// Linear solver of this problem. Used in \ref solve().
600
    LinearSolver *solver;
601

Thomas Witkowski's avatar
Thomas Witkowski committed
602
603
    /// System vector  storing the calculated solution of the problem.
    SystemVector *solution;
604

Thomas Witkowski's avatar
Thomas Witkowski committed
605
606
    /// System vector for the right hand side 
    SystemVector *rhs;
607

Thomas Witkowski's avatar
Thomas Witkowski committed
608
609
    /// System matrix
    Matrix<DOFMatrix*> *systemMatrix;
610

611
612
613
    /// Composed system matrix
    SolverMatrix<Matrix<DOFMatrix*> > solverMatrix;

614
615
616
617
618
    /// Some DOFMatrices of the systemMatrix may be assembled only once (for
    /// example if they are independent of the time or older solutions). If
    /// [i][j] of this field is set to true, the corresponding DOFMatrix will
    /// be assembled only once. All other matrices will be assembled at every
    /// time step.
619
    vector<vector<bool> > assembleMatrixOnlyOnce;
620

621
622
623
624
    /// If [i][j] of this field is set to true, the corresponding DOFMatrix of
    /// the systemMatrix has been assembled at least once. This field is used
    /// to determine, if assembling of a matrix can be ommitted, if it is set
    /// to be assembled only once.
625
    vector<vector<bool> > assembledMatrix;
626

Thomas Witkowski's avatar
Thomas Witkowski committed
627
628
    /// Determines whether domain boundaries should be considered at assembling.
    bool useGetBound;
629

Thomas Witkowski's avatar
Thomas Witkowski committed
630
    /// Writes the meshes and solution after the adaption loop.
631
    vector<FileWriterInterface*> fileWriters;
632

633
634
635
    /// All actions of mesh refinement are performed by refinementManager.
    /// If new refinement algorithms should be realized, one has to override
    /// RefinementManager and give one instance of it to AdaptStationary.
Thomas Witkowski's avatar
Thomas Witkowski committed
636
    RefinementManager *refinementManager;
637

638
639
640
    /// All actions of mesh coarsening are performed by coarseningManager.
    /// If new coarsening algorithms should be realized, one has to override
    /// CoarseningManager and give one instance of it to AdaptStationary.
Thomas Witkowski's avatar
Thomas Witkowski committed
641
    CoarseningManager *coarseningManager;
642
  
Thomas Witkowski's avatar
Thomas Witkowski committed
643
644
    /// Info level.
    int info;
645

646
647
    /// If true, the stationary problem was deserialized from some serialization
    /// file.
648
649
    bool deserialized;

650
651
652
    /// This vectors stores pointers to functions defining the exact solution of
    /// the problem. This may be used to compute the real error of the computed
    /// solution.
653
    vector<AbstractFunction<double, WorldVector<double> >*> exactSolutionFcts;
654

655
656
    /// If true, the error is not estimated but computed from the exact solution
    /// defined by \ref exactSolutionFcts.
657
    bool computeExactError;
658
    
659
660
661
662
    /// If at least on boundary condition is set, this variable is true. It is 
    /// used to ensure that no operators are added after boundary condition were
    /// set. If this would happen, boundary conditions could set wrong on off 
    /// diagonal matrices.
663
    bool boundaryConditionSet;
664

665
666
    /// If true, AMDiS prints information about the assembling procedure to 
    /// the screen.
667
    bool writeAsmInfo;
668

669
    map<Operator*, vector<OperatorPos> > operators;
670
  };
671
672
673
674

#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
  typedef ProblemStatSeq ProblemStat;
#endif
675
676
677
}

#endif