ProblemVec.h 17.7 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file ProblemVec.h */

#ifndef AMDIS_PROBLEMVEC_H
#define AMDIS_PROBLEMVEC_H

Thomas Witkowski's avatar
Thomas Witkowski committed
25
26
27
#include <vector>
#include <list>

28
29
30
31
32
#include "ProblemStatBase.h"
#include "Parameters.h"
#include "Boundary.h"
#include "MatrixVector.h"
#include "StandardProblemIteration.h"
33
#include "ElementFileWriter.h"
Thomas Witkowski's avatar
Thomas Witkowski committed
34
#include "ComponentTraverseInfo.h"
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

namespace AMDiS {

  template<typename t1, typename t2> class AbstractFunction;
  class Operator;
  class SystemVector;
  class DOFMatrix;
  class FiniteElemSpace;
  class Estimator;
  class Marker;
  class AdaptStationary;
  class AdaptInfo;
  class FileWriterInterface;
  class CoarseningManager;
  class RefinementManager;
  class Mesh;
  template<typename T> class OEMSolver;
  template<typename T> class Preconditioner;
  template<typename T> class MatVecMultiplier;

  class ProblemVec : public ProblemStatBase,
		     public StandardProblemIteration
  {
  public:
    /** \brief
     * constructor
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
62
    ProblemVec(const std::string &nameStr,
63
64
	       ProblemIterationInterface *problemIteration = NULL)
      : StandardProblemIteration(this),
Thomas Witkowski's avatar
Thomas Witkowski committed
65
	name(nameStr),
66
	nComponents(-1),
Thomas Witkowski's avatar
Thomas Witkowski committed
67
68
69
70
71
72
73
74
75
76
77
78
	nMeshes(0),
	traverseInfo(0),
	solver(NULL),
	solution(NULL),
	rhs(NULL),
	systemMatrix(NULL),
	matVec(NULL),
	leftPrecon(NULL),
	rightPrecon(NULL),
	useGetBound(true),
	info(10),
	allowFirstRef(false),
79
	computeExactError(false)
80
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
81
      GET_PARAMETER(0, name + "->components", "%d", &nComponents);
82
83
      TEST_EXIT(nComponents > 0)("components not set!\n");    

Thomas Witkowski's avatar
Thomas Witkowski committed
84
      estimator.resize(nComponents, NULL);
85
      marker.resize(nComponents, NULL);
86

Thomas Witkowski's avatar
Thomas Witkowski committed
87
88
      assembleMatrixOnlyOnce.resize(nComponents);
      assembledMatrix.resize(nComponents);
89
      for (int i = 0; i < nComponents; i++) {
Thomas Witkowski's avatar
Thomas Witkowski committed
90
91
	assembleMatrixOnlyOnce[i].resize(nComponents);
	assembledMatrix[i].resize(nComponents);
92
	for (int j = 0; j < nComponents; j++) {
Thomas Witkowski's avatar
Thomas Witkowski committed
93
94
	  assembleMatrixOnlyOnce[i][j] = false;
	  assembledMatrix[i][j] = false;
95
96
	}
      }
97
98

      exactSolutionFcts.resize(nComponents);
Thomas Witkowski's avatar
Thomas Witkowski committed
99
    }
100

Thomas Witkowski's avatar
Thomas Witkowski committed
101
102
    /// Destructor
    virtual ~ProblemVec() {}
103

Thomas Witkowski's avatar
Thomas Witkowski committed
104
    /// Initialisation of the problem.
105
106
107
108
109
    virtual void initialize(Flag initFlag,
			    ProblemVec *adoptProblem = NULL,
			    Flag adoptFlag = INIT_NOTHING);


Thomas Witkowski's avatar
Thomas Witkowski committed
110
    /// Used in \ref initialize().
111
112
    virtual void createMesh();

Thomas Witkowski's avatar
Thomas Witkowski committed
113
    /// Used in \ref initialize().
114
115
    virtual void createFESpace();

Thomas Witkowski's avatar
Thomas Witkowski committed
116
    /// Used in \ref initialize().
117
118
    virtual void createMatricesAndVectors();

Thomas Witkowski's avatar
Thomas Witkowski committed
119
    /// Used in \ref initialize().
120
121
    virtual void createSolver();

Thomas Witkowski's avatar
Thomas Witkowski committed
122
    /// Used in \ref initialize().
123
124
    virtual void createEstimator();

Thomas Witkowski's avatar
Thomas Witkowski committed
125
    /// Used in \ref initialize().
126
127
    virtual void createMarker();

Thomas Witkowski's avatar
Thomas Witkowski committed
128
    /// Used in \ref initialize().
129
130
    virtual void createFileWriter();

Thomas Witkowski's avatar
Thomas Witkowski committed
131
    /// Used in \ref initialize().
132
133
134
135
136
137
    virtual void doOtherStuff();

    /** \brief
     * Implementation of ProblemStatBase::solve(). Deligates the solving
     * of problems system to \ref solver.
     */
138
    virtual void solve(AdaptInfo *adaptInfo, bool fixedMatrix = false);
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167

    /** \brief
     * Implementation of ProblemStatBase::estimate(). Deligates the estimation
     * to \ref estimator.
     */
    virtual void estimate(AdaptInfo *adaptInfo);

    /** \brief
     * Implementation of ProblemStatBase::markElements().
     * Deligated to \ref adapt.
     */
    virtual Flag markElements(AdaptInfo *adaptInfo);

    /** \brief
     * Implementation of ProblemStatBase::refineMesh(). Deligated to the
     * RefinementManager of \ref adapt.
     */
    virtual Flag refineMesh(AdaptInfo *adaptInfo);

    /** \brief
     * Implementation of ProblemStatBase::coarsenMesh(). Deligated to the
     * CoarseningManager of \ref adapt.
     */
    virtual Flag coarsenMesh(AdaptInfo *adaptInfo);

    /** \brief
     * Implementation of ProblemStatBase::buildBeforeRefine().
     * Does nothing here.
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
168
    virtual void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) {}
169
170
171
172
173

    /** \brief
     * Implementation of ProblemStatBase::buildBeforeCoarsen().
     * Does nothing here.
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
174
    virtual void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag) {}
175
176
177

    /** \brief
     * Implementation of ProblemStatBase::buildAfterCoarsen().
178
179
     * Assembles \ref A and \ref rhs. With the last two parameters, assembling
     * can be restricted to matrices or vectors only.
180
     */
181
182
183
    virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag,
				   bool assembleMatrix = true,
				   bool assembleVector = true);
184
185
186
187
188
189
190
191

    /** \brief
     * 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.
     */
    virtual Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo = FULL_ITERATION);

Thomas Witkowski's avatar
Thomas Witkowski committed
192
    /// Returns number of managed problems
193
194
    virtual int getNumProblems() { 
      return 1; 
Thomas Witkowski's avatar
Thomas Witkowski committed
195
    }
196

Thomas Witkowski's avatar
Thomas Witkowski committed
197
    /// Implementation of ProblemStatBase::getNumComponents()
198
    virtual int getNumComponents() { 
199
      return nComponents; 
Thomas Witkowski's avatar
Thomas Witkowski committed
200
    }
201
202
203
204
205

    /** \brief
     * Returns the problem with the given number. If only one problem
     * is managed by this master problem, the number hasn't to be given.
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
206
207
    virtual ProblemStatBase *getProblem(int number = 0) { 
      return this; 
Thomas Witkowski's avatar
Thomas Witkowski committed
208
    }
209

Thomas Witkowski's avatar
Thomas Witkowski committed
210
    /// Writes output files.
211
212
    void writeFiles(AdaptInfo *adaptInfo, bool force);

Thomas Witkowski's avatar
Thomas Witkowski committed
213
    /// Interpolates fct to \ref solution.
Thomas Witkowski's avatar
Thomas Witkowski committed
214
    void interpolInitialSolution(std::vector<AbstractFunction<double, WorldVector<double> >*> *fct);
215

Thomas Witkowski's avatar
Thomas Witkowski committed
216
    /// Adds an Operator to \ref A.
217
218
    void addMatrixOperator(Operator *op, int i, int j,
			   double *factor = NULL,
219
220
			   double *estFactor = NULL,
			   bool fake = false);
221

Thomas Witkowski's avatar
Thomas Witkowski committed
222
    /// Adds an Operator to \ref rhs.
223
224
    void addVectorOperator(Operator *op, int i,
			   double *factor = NULL,
225
226
			   double *estFactor = NULL,
			   bool fake = false);
227

Thomas Witkowski's avatar
Thomas Witkowski committed
228
    /// Adds dirichlet boundary conditions.
229
230
231
    virtual void addDirichletBC(BoundaryType type, int system,
				AbstractFunction<double, WorldVector<double> > *b);

Thomas Witkowski's avatar
Thomas Witkowski committed
232
    /// Adds neumann boundary conditions.
233
234
235
    virtual void addNeumannBC(BoundaryType type, int row, int col, 
			      AbstractFunction<double, WorldVector<double> > *n);

Thomas Witkowski's avatar
Thomas Witkowski committed
236
    /// Adds robin boundary conditions.
237
238
239
240
    virtual void addRobinBC(BoundaryType type, int row, int col, 
			    AbstractFunction<double, WorldVector<double> > *n,
			    AbstractFunction<double, WorldVector<double> > *r);

Thomas Witkowski's avatar
Thomas Witkowski committed
241
    /// Adds periodic boundary conditions.
242
243
    virtual void addPeriodicBC(BoundaryType type, int row, int col);

Thomas Witkowski's avatar
Thomas Witkowski committed
244
    /// Implementation of ProblemStatBase::allowFirstRefinement().
245
    inline void allowFirstRefinement() {
Thomas Witkowski's avatar
Thomas Witkowski committed
246
247
      allowFirstRef = true;
    }
Thomas Witkowski's avatar
Thomas Witkowski committed
248
249
250
251
252

    /** \brief
     * This function assembles a DOFMatrix and a DOFVector for the case,
     * the meshes from row and col FE-space are equal.
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
253
254
    void assembleOnOneMesh(FiniteElemSpace *feSpace, 
			   Flag assembleFlag,
Thomas Witkowski's avatar
Thomas Witkowski committed
255
256
			   DOFMatrix *matrix, DOFVector<double> *vector);

Thomas Witkowski's avatar
Thomas Witkowski committed
257
258
259
    ///
    void assembleOnDifMeshes(FiniteElemSpace *rowFeSpace, 
			     FiniteElemSpace *colFeSpace,
Thomas Witkowski's avatar
Thomas Witkowski committed
260
			     Flag assembleFlag,
Thomas Witkowski's avatar
Thomas Witkowski committed
261
262
			     DOFMatrix *matrix, 
			     DOFVector<double> *vector);
263

Thomas Witkowski's avatar
Thomas Witkowski committed
264
265
266
267
268
269
270
271
    ///
    void assembleOnDifMeshes2(const FiniteElemSpace *mainFeSpace, 
			      const FiniteElemSpace *auxFeSpace,
			      Flag assembleFlag,
			      DOFMatrix *matrix,
			      DOFVector<double> *vector);

    ///
272
273
274
275
    void assembleBoundaryConditions(DOFVector<double> *rhs,
				    DOFVector<double> *solution,
				    Mesh *mesh,
				    Flag assembleFlag);
276
277
278
279
280
281
282
  
    // ===== getting-methods ======================================================

    /** \name getting methods
     * \{ 
     */

Thomas Witkowski's avatar
Thomas Witkowski committed
283
    /// Returns \ref solution.
284
    inline SystemVector* getSolution() { 
Thomas Witkowski's avatar
Thomas Witkowski committed
285
286
      return solution; 
    }
287

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

Thomas Witkowski's avatar
Thomas Witkowski committed
293
    /// Returns \ref systemMatrix.
294
    inline Matrix<DOFMatrix*> *getSystemMatrix() { 
Thomas Witkowski's avatar
Thomas Witkowski committed
295
296
      return systemMatrix; 
    }
297

Thomas Witkowski's avatar
Thomas Witkowski committed
298
299
300
301
302
303
    /// Returns a pointer to the corresponding DOFMatrix.
    inline DOFMatrix* getSystemMatrix(int row, int col) {
      return (*systemMatrix)[row][col];
    }

    /// Returns mesh of given component
304
305
    inline Mesh* getMesh(int comp) {
      FUNCNAME("ProblemVec::getMesh()");
Thomas Witkowski's avatar
Thomas Witkowski committed
306
      TEST_EXIT(comp < static_cast<int>(componentMeshes.size()) && comp >= 0)
307
	("invalid component number\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
308
      return componentMeshes[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
309
    }
310

Thomas Witkowski's avatar
Thomas Witkowski committed
311
    /// Returns \ref meshes
Thomas Witkowski's avatar
Thomas Witkowski committed
312
    inline std::vector<Mesh*> getMeshes() {
Thomas Witkowski's avatar
Thomas Witkowski committed
313
314
      return meshes; 
    }
315

Thomas Witkowski's avatar
Thomas Witkowski committed
316
    /// Returns \ref feSpace_.
317
318
    inline FiniteElemSpace* getFESpace(int comp) { 
      FUNCNAME("ProblemVec::getFESpace()");
319
      TEST_EXIT(comp < static_cast<int>(componentSpaces.size()) && comp >= 0)
320
	("invalid component number\n");
321
      return componentSpaces[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
322
    }
323

Thomas Witkowski's avatar
Thomas Witkowski committed
324
    /// Returns \ref feSpaces.
Thomas Witkowski's avatar
Thomas Witkowski committed
325
    inline std::vector<FiniteElemSpace*> getFESpaces() { 
326
      return feSpaces; 
Thomas Witkowski's avatar
Thomas Witkowski committed
327
    }
328

Thomas Witkowski's avatar
Thomas Witkowski committed
329
    /// Returns \ref componentSpaces;
Thomas Witkowski's avatar
Thomas Witkowski committed
330
    inline std::vector<FiniteElemSpace*> getComponentFESpaces() {
331
      return componentSpaces;
332
333
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
334
    /// Returns \ref estimator.
Thomas Witkowski's avatar
Thomas Witkowski committed
335
    inline std::vector<Estimator*> getEstimator() { 
Thomas Witkowski's avatar
Thomas Witkowski committed
336
337
      return estimator; 
    }
338

Thomas Witkowski's avatar
Thomas Witkowski committed
339
    /// Returns \ref estimator.
340
    inline Estimator* getEstimator(int comp) { 
Thomas Witkowski's avatar
Thomas Witkowski committed
341
342
      return estimator[comp]; 
    }
343

Thomas Witkowski's avatar
Thomas Witkowski committed
344
    /// Returns \ref refinementManager.
345
    inline RefinementManager* getRefinementManager(int comp) { 
Thomas Witkowski's avatar
Thomas Witkowski committed
346
347
      return refinementManager; 
    }
348

Thomas Witkowski's avatar
Thomas Witkowski committed
349
    /// Returns \ref refinementManager.
350
    inline CoarseningManager* getCoarseningManager(int comp) { 
Thomas Witkowski's avatar
Thomas Witkowski committed
351
352
      return coarseningManager; 
    }
353

Thomas Witkowski's avatar
Thomas Witkowski committed
354
    /// Returns \ref solver.
355
    inline OEMSolver<SystemVector>* getSolver() { 
Thomas Witkowski's avatar
Thomas Witkowski committed
356
357
      return solver; 
    }
358

Thomas Witkowski's avatar
Thomas Witkowski committed
359
    /// Returns \ref marker.
360
    inline Marker *getMarker(int comp) { 
361
      return marker[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
362
    }
363

Thomas Witkowski's avatar
Thomas Witkowski committed
364
    /// Returns \ref marker.
Thomas Witkowski's avatar
Thomas Witkowski committed
365
    inline std::vector<Marker*> getMarker() { 
366
      return marker; 
Thomas Witkowski's avatar
Thomas Witkowski committed
367
    }
368

Thomas Witkowski's avatar
Thomas Witkowski committed
369
    /// Returns the name of the problem
Thomas Witkowski's avatar
Thomas Witkowski committed
370
    inline virtual const std::string& getName() { 
Thomas Witkowski's avatar
Thomas Witkowski committed
371
372
      return name; 
    }
373

Thomas Witkowski's avatar
Thomas Witkowski committed
374
    /// Returns \ref useGetBound.
375
    inline bool getBoundUsed() { 
Thomas Witkowski's avatar
Thomas Witkowski committed
376
377
      return useGetBound; 
    }
378

Thomas Witkowski's avatar
Thomas Witkowski committed
379
    /// Returns \ref leftPrecon.
380
    inline Preconditioner<SystemVector> *getLeftPrecon() { 
Thomas Witkowski's avatar
Thomas Witkowski committed
381
382
      return leftPrecon; 
    }
383

Thomas Witkowski's avatar
Thomas Witkowski committed
384
    /// Returns \ref rightPrecon.
385
    inline Preconditioner<SystemVector> *getRightPrecon() { 
Thomas Witkowski's avatar
Thomas Witkowski committed
386
387
      return rightPrecon; 
    }
388
389
390
391
392
393
394
395
396

    /** \} */

    // ===== setting-methods ======================================================

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

Thomas Witkowski's avatar
Thomas Witkowski committed
397
    /// Sets \ref estimator.
Thomas Witkowski's avatar
Thomas Witkowski committed
398
    inline void setEstimator(std::vector<Estimator*> est) { 
Thomas Witkowski's avatar
Thomas Witkowski committed
399
400
      estimator = est; 
    }
401

Thomas Witkowski's avatar
Thomas Witkowski committed
402
    /// Sets the FE space for the given component.
403
    inline void setFESpace(FiniteElemSpace *feSpace, int comp) {
404
      feSpaces[comp] = feSpace;
Thomas Witkowski's avatar
Thomas Witkowski committed
405
    }
406

Thomas Witkowski's avatar
Thomas Witkowski committed
407
    /// Sets \ref estimator.
408
    inline void setEstimator(Estimator* est, int comp) { 
Thomas Witkowski's avatar
Thomas Witkowski committed
409
410
      estimator[comp] = est; 
    }
411

Thomas Witkowski's avatar
Thomas Witkowski committed
412
    /// Sets \ref marker.
413
414
    inline void setMarker(Marker* mark, int comp) { 
      marker[comp] = mark; 
Thomas Witkowski's avatar
Thomas Witkowski committed
415
    }
416

Thomas Witkowski's avatar
Thomas Witkowski committed
417
    /// Sets \ref solver.
418
    inline void setSolver(OEMSolver<SystemVector>* sol) { 
Thomas Witkowski's avatar
Thomas Witkowski committed
419
420
      solver = sol; 
    }
421

Thomas Witkowski's avatar
Thomas Witkowski committed
422
    /// Sets \ref leftPrecon.
423
    inline void setLeftPrecon(Preconditioner<SystemVector> *p) {
Thomas Witkowski's avatar
Thomas Witkowski committed
424
425
      leftPrecon = p;
    }
426

Thomas Witkowski's avatar
Thomas Witkowski committed
427
    /// Sets \ref rightPrecon.
428
    inline void setRightPrecon(Preconditioner<SystemVector> *p) {
Thomas Witkowski's avatar
Thomas Witkowski committed
429
430
      rightPrecon = p;
    }
431

Thomas Witkowski's avatar
Thomas Witkowski committed
432
    ///
433
    inline void setAssembleMatrixOnlyOnce(int i, int j, bool value = true) {
Thomas Witkowski's avatar
Thomas Witkowski committed
434
      assembleMatrixOnlyOnce[i][j] = value;
435
436
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
437
    ///
438
439
440
441
442
    void setExactSolutionFct(AbstractFunction<double, WorldVector<double> > *fct,
			     int component) {
      exactSolutionFcts[component] = fct;
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
443
    ///
444
445
446
447
    AbstractFunction<double, WorldVector<double> > *getExactSolutionFct(int component) {
      return exactSolutionFcts[component];
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
448
    ///
449
450
451
452
    void setComputeExactError(bool v) {
      computeExactError = v;
    }

453
454
    /** \} */

Thomas Witkowski's avatar
Thomas Witkowski committed
455
456
457
458
459
    /** \brief
     * Outputs the mesh of the given component, but the values are taken from the 
     * residual error estimator. 
     */
    void writeResidualMesh(int comp, AdaptInfo *adaptInfo, const std::string name);
460

461
462
    // ===== Serializable implementation =====
  
Thomas Witkowski's avatar
Thomas Witkowski committed
463
    /// Function that implements the serialization procedure.
Thomas Witkowski's avatar
Thomas Witkowski committed
464
    virtual void serialize(std::ostream &out);
465

Thomas Witkowski's avatar
Thomas Witkowski committed
466
    /// Function that implements the deserialization procedure.
Thomas Witkowski's avatar
Thomas Witkowski committed
467
    virtual void deserialize(std::istream &in);
468

Thomas Witkowski's avatar
Thomas Witkowski committed
469
470

    /// Returns \ref fileWriters.
Thomas Witkowski's avatar
Thomas Witkowski committed
471
    std::vector<FileWriterInterface*> getFileWriterList() {
Thomas Witkowski's avatar
Thomas Witkowski committed
472
473
      return fileWriters;
    }
474

Thomas Witkowski's avatar
Thomas Witkowski committed
475
476
477
478
479
480
481
  protected:
    /** \brief
     * If the exact solution is known, the problem can compute the exact
     * error instead of the error estimation. This is done in this function.
     */
    void computeError(AdaptInfo *adaptInfo);

482
  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
483
484
485
    
    /// Name of this problem.
    std::string name;
486

Thomas Witkowski's avatar
Thomas Witkowski committed
487
    /// Number of problem components
488
    int nComponents;
489
490

    /** \brief
Thomas Witkowski's avatar
Thomas Witkowski committed
491
492
493
     * 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.
494
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
495
496
497
    int nMeshes;

    /// FE spaces of this problem.
498
    std::vector<FiniteElemSpace*> feSpaces;
499

Thomas Witkowski's avatar
Thomas Witkowski committed
500
501
    /// Meshes of this problem.
    std::vector<Mesh*> meshes;
502

Thomas Witkowski's avatar
Thomas Witkowski committed
503
    /// Pointer to the fe spaces for the different problem components
504
    std::vector<FiniteElemSpace*> componentSpaces;
505

Thomas Witkowski's avatar
Thomas Witkowski committed
506
    /// Pointer to the meshes for the different problem components
Thomas Witkowski's avatar
Thomas Witkowski committed
507
    std::vector<Mesh*> componentMeshes;
508
509

    /** \brief
Thomas Witkowski's avatar
Thomas Witkowski committed
510
511
512
     * 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.
513
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
514
515
516
    ComponentTraverseInfo traverseInfo;
    
    /// Responsible for element marking.
517
    std::vector<Marker*> marker;
518

Thomas Witkowski's avatar
Thomas Witkowski committed
519
520
    /// Estimator of this problem. Used in \ref estimate().
    std::vector<Estimator*> estimator;
521

Thomas Witkowski's avatar
Thomas Witkowski committed
522
523
    /// Linear solver of this problem. Used in \ref solve().
    OEMSolver<SystemVector> *solver;
524

Thomas Witkowski's avatar
Thomas Witkowski committed
525
526
    /// System vector  storing the calculated solution of the problem.
    SystemVector *solution;
527

Thomas Witkowski's avatar
Thomas Witkowski committed
528
529
    /// System vector for the right hand side 
    SystemVector *rhs;
530

Thomas Witkowski's avatar
Thomas Witkowski committed
531
532
    /// System matrix
    Matrix<DOFMatrix*> *systemMatrix;
533

534
535
536
537
538
539
540
    /** \brief
     * 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.
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
541
    std::vector< std::vector< bool > > assembleMatrixOnlyOnce;
542
543
544

    /** \brief
     * If [i][j] of this field is set to true, the corresponding DOFMatrix of
Thomas Witkowski's avatar
Thomas Witkowski committed
545
     * the systemMatrix has been assembled at least once. This field is used
546
547
548
     * to determine, if assembling of a matrix can be ommitted, if it is set
     * to be assembled only once.
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
549
    std::vector< std::vector< bool > > assembledMatrix;
550

Thomas Witkowski's avatar
Thomas Witkowski committed
551
552
    /// Matrix-vector multiplication
    MatVecMultiplier<SystemVector> *matVec;
553

Thomas Witkowski's avatar
Thomas Witkowski committed
554
555
    /// Left preconditioner. Used in \ref solver.
    Preconditioner<SystemVector> *leftPrecon;
556

Thomas Witkowski's avatar
Thomas Witkowski committed
557
558
    /// Right preconditioner. Used in \ref solver.
    Preconditioner<SystemVector> *rightPrecon;
559

Thomas Witkowski's avatar
Thomas Witkowski committed
560
561
    /// Determines whether domain boundaries should be considered at assembling.
    bool useGetBound;
562

Thomas Witkowski's avatar
Thomas Witkowski committed
563
564
    /// Writes the meshes and solution after the adaption loop.
    std::vector<FileWriterInterface*> fileWriters;
565
566
567
568
569
570

    /** \brief
     * 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
571
    RefinementManager *refinementManager;
572
573
574
575
576
577

    /** \brief
     * 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
578
    CoarseningManager *coarseningManager;
579
  
Thomas Witkowski's avatar
Thomas Witkowski committed
580
581
    /// Info level.
    int info;
582

Thomas Witkowski's avatar
Thomas Witkowski committed
583
584
    /// Allows one refinement although the adapt tolerance is reached already.
    bool allowFirstRef;
585
586
587
588
589
590
591
592
593
594
595
596
597

    /** \brief
     * 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.
     */
    std::vector<AbstractFunction<double, WorldVector<double> >*> exactSolutionFcts;

    /** \brief
     * If true, the error is not estimated but computed from the exact solution
     * defined by \ref exactSolutionFcts.
     */
    bool computeExactError;
598
599
600
601
  };
}

#endif