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
219
220
    void addMatrixOperator(Operator *op, int i, int j,
			   double *factor = NULL,
			   double *estFactor = NULL);

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
234
    /// Adds robin boundary conditions.
235
236
237
238
    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
239
    /// Adds periodic boundary conditions.
240
241
    virtual void addPeriodicBC(BoundaryType type, int row, int col);

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

    /** \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
251
252
    void assembleOnOneMesh(FiniteElemSpace *feSpace, 
			   Flag assembleFlag,
Thomas Witkowski's avatar
Thomas Witkowski committed
253
254
			   DOFMatrix *matrix, DOFVector<double> *vector);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /** \} */

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

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

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

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

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

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

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

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

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

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

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

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

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

451
452
    /** \} */

Thomas Witkowski's avatar
Thomas Witkowski committed
453
454
455
456
457
    /** \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);
458

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
467
468

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

Thomas Witkowski's avatar
Thomas Witkowski committed
473
474
475
476
477
478
479
  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);

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

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

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

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

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

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

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

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

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

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

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

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

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

532
533
534
535
536
537
538
    /** \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
539
    std::vector< std::vector< bool > > assembleMatrixOnlyOnce;
540
541
542

    /** \brief
     * If [i][j] of this field is set to true, the corresponding DOFMatrix of
Thomas Witkowski's avatar
Thomas Witkowski committed
543
     * the systemMatrix has been assembled at least once. This field is used
544
545
546
     * 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
547
    std::vector< std::vector< bool > > assembledMatrix;
548

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

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

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

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

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

    /** \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
569
    RefinementManager *refinementManager;
570
571
572
573
574
575

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

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

    /** \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;
596
597
598
599
  };
}

#endif