ProblemVec.h 17 KB
Newer Older
1
2
3
4
5
6
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
7
// ==  TU Dresden                                                            ==
8
// ==                                                                        ==
9
10
11
// ==  Institut fr Wissenschaftliches Rechnen                               ==
// ==  Zellescher Weg 12-14                                                  ==
// ==  01069 Dresden                                                         ==
12
13
14
15
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
16
// ==  https://gforge.zih.tu-dresden.de/projects/amdis/                      ==
17
18
19
20
21
22
23
24
// ==                                                                        ==
// ============================================================================

/** \file ProblemVec.h */

#ifndef AMDIS_PROBLEMVEC_H
#define AMDIS_PROBLEMVEC_H

Thomas Witkowski's avatar
Thomas Witkowski committed
25
26
#include <vector>
#include <list>
27
#include "AMDiS_fwd.h"
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
#include "AbstractFunction.h"
#include "SolverMatrix.h"
37
38
39
40
41
42

namespace AMDiS {

  class ProblemVec : public ProblemStatBase,
		     public StandardProblemIteration
  {
43
  protected:
44
45
46
47
48
49
    // Defines a mapping type from dof indices to world coordinates.
    typedef std::map<DegreeOfFreedom, WorldVector<double> > DofToCoord;

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

50
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
51
    /// Constructor
Thomas Witkowski's avatar
Thomas Witkowski committed
52
    ProblemVec(std::string nameStr,
53
54
	       ProblemIterationInterface *problemIteration = NULL)
      : StandardProblemIteration(this),
Thomas Witkowski's avatar
Thomas Witkowski committed
55
	name(nameStr),
56
	nComponents(-1),
Thomas Witkowski's avatar
Thomas Witkowski committed
57
58
59
60
61
62
63
64
65
	nMeshes(0),
	traverseInfo(0),
	solver(NULL),
	solution(NULL),
	rhs(NULL),
	systemMatrix(NULL),
	useGetBound(true),
	info(10),
	allowFirstRef(false),
66
	computeExactError(false)
67
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
68
      GET_PARAMETER(0, name + "->components", "%d", &nComponents);
69
      TEST_EXIT(nComponents > 0)("components not set!\n");    
Thomas Witkowski's avatar
Thomas Witkowski committed
70
      estimator.resize(nComponents, NULL);
71
      marker.resize(nComponents, NULL);
72

Thomas Witkowski's avatar
Thomas Witkowski committed
73
74
      assembleMatrixOnlyOnce.resize(nComponents);
      assembledMatrix.resize(nComponents);
75
      for (int i = 0; i < nComponents; i++) {
Thomas Witkowski's avatar
Thomas Witkowski committed
76
77
	assembleMatrixOnlyOnce[i].resize(nComponents);
	assembledMatrix[i].resize(nComponents);
78
	for (int j = 0; j < nComponents; j++) {
Thomas Witkowski's avatar
Thomas Witkowski committed
79
80
	  assembleMatrixOnlyOnce[i][j] = false;
	  assembledMatrix[i][j] = false;
81
82
	}
      }
83
84

      exactSolutionFcts.resize(nComponents);
Thomas Witkowski's avatar
Thomas Witkowski committed
85
    }
86

Thomas Witkowski's avatar
Thomas Witkowski committed
87
88
    /// Destructor
    virtual ~ProblemVec() {}
89

Thomas Witkowski's avatar
Thomas Witkowski committed
90
    /// Initialisation of the problem.
91
92
93
94
95
    virtual void initialize(Flag initFlag,
			    ProblemVec *adoptProblem = NULL,
			    Flag adoptFlag = INIT_NOTHING);


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

Thomas Witkowski's avatar
Thomas Witkowski committed
99
    /// Used in \ref initialize().
100
    virtual void createFESpace(DOFAdmin *admin);
101

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
108
    /// Used in \ref initialize().
109
110
    virtual void createEstimator();

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

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

117
118
119
120
    /** \brief
     * 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.
     */
121
122
123
124
125
126
    virtual void doOtherStuff();

    /** \brief
     * Implementation of ProblemStatBase::solve(). Deligates the solving
     * of problems system to \ref solver.
     */
127
    virtual void solve(AdaptInfo *adaptInfo, bool fixedMatrix = false);
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

    /** \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
157
    virtual void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) {}
158
159
160
161
162

    /** \brief
     * Implementation of ProblemStatBase::buildBeforeCoarsen().
     * Does nothing here.
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
163
    virtual void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag) {}
164
165
166

    /** \brief
     * Implementation of ProblemStatBase::buildAfterCoarsen().
167
168
     * Assembles \ref A and \ref rhs. With the last two parameters, assembling
     * can be restricted to matrices or vectors only.
169
     */
170
171
172
    virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag,
				   bool assembleMatrix = true,
				   bool assembleVector = true);
173

174
175
176
    void createPrecon();


177
178
179
180
181
182
183
    /** \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
184
    /// Returns number of managed problems
185
186
    virtual int getNumProblems() 
    { 
187
      return 1; 
Thomas Witkowski's avatar
Thomas Witkowski committed
188
    }
189

Thomas Witkowski's avatar
Thomas Witkowski committed
190
    /// Implementation of ProblemStatBase::getNumComponents()
191
192
    virtual int getNumComponents() 
    { 
193
      return nComponents; 
Thomas Witkowski's avatar
Thomas Witkowski committed
194
    }
195
196
197
198
199

    /** \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.
     */
200
201
    virtual ProblemStatBase *getProblem(int number = 0) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
202
      return this; 
Thomas Witkowski's avatar
Thomas Witkowski committed
203
    }
204

Thomas Witkowski's avatar
Thomas Witkowski committed
205
    /// Writes output files.
206
207
    void writeFiles(AdaptInfo *adaptInfo, bool force);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
211
    /// Adds an Operator to \ref A.
212
213
    void addMatrixOperator(Operator *op, int i, int j,
			   double *factor = NULL,
214
			   double *estFactor = NULL);
215

Thomas Witkowski's avatar
Thomas Witkowski committed
216
    /// Adds an Operator to \ref rhs.
217
218
    void addVectorOperator(Operator *op, int i,
			   double *factor = NULL,
219
			   double *estFactor = NULL);
220

Thomas Witkowski's avatar
Thomas Witkowski committed
221
    /// Adds dirichlet boundary conditions.
222
    virtual void addDirichletBC(BoundaryType type, int row, int col,
223
224
				AbstractFunction<double, WorldVector<double> > *b);

Thomas Witkowski's avatar
Thomas Witkowski committed
225
    /// Adds neumann boundary conditions.
226
227
228
    virtual void addNeumannBC(BoundaryType type, int row, int col, 
			      AbstractFunction<double, WorldVector<double> > *n);

Thomas Witkowski's avatar
Thomas Witkowski committed
229
    /// Adds robin boundary conditions.
230
231
232
233
    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
234
    /// Adds periodic boundary conditions.
235
236
    virtual void addPeriodicBC(BoundaryType type, int row, int col);

Thomas Witkowski's avatar
Thomas Witkowski committed
237
    /// Implementation of ProblemStatBase::allowFirstRefinement().
238
239
    inline void allowFirstRefinement() 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
240
241
      allowFirstRef = true;
    }
Thomas Witkowski's avatar
Thomas Witkowski committed
242
243
244
245
246

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

Thomas Witkowski's avatar
Thomas Witkowski committed
251
252
253
    ///
    void assembleOnDifMeshes(FiniteElemSpace *rowFeSpace, 
			     FiniteElemSpace *colFeSpace,
Thomas Witkowski's avatar
Thomas Witkowski committed
254
			     Flag assembleFlag,
Thomas Witkowski's avatar
Thomas Witkowski committed
255
256
			     DOFMatrix *matrix, 
			     DOFVector<double> *vector);
257

Thomas Witkowski's avatar
Thomas Witkowski committed
258
259
260
261
262
263
264
265
    ///
    void assembleOnDifMeshes2(const FiniteElemSpace *mainFeSpace, 
			      const FiniteElemSpace *auxFeSpace,
			      Flag assembleFlag,
			      DOFMatrix *matrix,
			      DOFVector<double> *vector);

    ///
266
267
268
269
    void assembleBoundaryConditions(DOFVector<double> *rhs,
				    DOFVector<double> *solution,
				    Mesh *mesh,
				    Flag assembleFlag);
270
271
272
273
274
  
    /** \name getting methods
     * \{ 
     */

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
287
    /// Returns \ref systemMatrix.
288
289
    inline Matrix<DOFMatrix*> *getSystemMatrix() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
290
291
      return systemMatrix; 
    }
292

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
308
    /// Returns \ref meshes
309
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) 
    { 
317
      FUNCNAME("ProblemVec::getFESpace()");
318
      TEST_EXIT(comp < static_cast<int>(componentSpaces.size()) && comp >= 0)
319
	("invalid component number\n");
320
      return componentSpaces[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
321
    }
322

Thomas Witkowski's avatar
Thomas Witkowski committed
323
    /// Returns \ref feSpaces.
324
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;
330
331
    inline std::vector<FiniteElemSpace*> getComponentFESpaces() 
    {
332
      return componentSpaces;
333
334
    }

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
353
    /// Returns \ref refinementManager.
354
355
    inline CoarseningManager* getCoarseningManager(int comp) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
356
357
      return coarseningManager; 
    }
358

Thomas Witkowski's avatar
Thomas Witkowski committed
359
    /// Returns \ref solver.
360
361
    inline OEMSolver* getSolver() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
362
363
      return solver; 
    }
364

Thomas Witkowski's avatar
Thomas Witkowski committed
365
    /// Returns \ref marker.
366
367
    inline Marker *getMarker(int comp) 
    { 
368
      return marker[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
369
    }
370

Thomas Witkowski's avatar
Thomas Witkowski committed
371
    /// Returns \ref marker.
372
373
    inline std::vector<Marker*> getMarker() 
    { 
374
      return marker; 
Thomas Witkowski's avatar
Thomas Witkowski committed
375
    }
376

Thomas Witkowski's avatar
Thomas Witkowski committed
377
    /// Returns the name of the problem
Thomas Witkowski's avatar
Thomas Witkowski committed
378
    inline virtual std::string getName() 
379
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
380
381
      return name; 
    }
382

Thomas Witkowski's avatar
Thomas Witkowski committed
383
    /// Returns \ref useGetBound.
384
385
    inline bool getBoundUsed() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
386
387
      return useGetBound; 
    }
388

389
390
391
392
393
394
    /// Returns \ref info.
    int getInfo()
    {
      return info;
    }

395
396
397
398
399
400
    /** \} */

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

Thomas Witkowski's avatar
Thomas Witkowski committed
401
    /// Sets \ref estimator.
402
403
    inline void setEstimator(std::vector<Estimator*> est) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
404
405
      estimator = est; 
    }
406

Thomas Witkowski's avatar
Thomas Witkowski committed
407
    /// Sets the FE space for the given component.
408
409
    inline void setFESpace(FiniteElemSpace *feSpace, int comp) 
    {
410
      feSpaces[comp] = feSpace;
Thomas Witkowski's avatar
Thomas Witkowski committed
411
    }
412

Thomas Witkowski's avatar
Thomas Witkowski committed
413
    /// Sets \ref estimator.
414
415
    inline void setEstimator(Estimator* est, int comp) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
416
417
      estimator[comp] = est; 
    }
418

Thomas Witkowski's avatar
Thomas Witkowski committed
419
    /// Sets \ref marker.
420
421
    inline void setMarker(Marker* mark, int comp) 
    { 
422
      marker[comp] = mark; 
Thomas Witkowski's avatar
Thomas Witkowski committed
423
    }
424

Thomas Witkowski's avatar
Thomas Witkowski committed
425
    /// Sets \ref solver.
426
427
    inline void setSolver(OEMSolver* sol) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
428
429
      solver = sol; 
    }
430

Thomas Witkowski's avatar
Thomas Witkowski committed
431
    ///
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
    void setExactSolutionFct(AbstractFunction<double, WorldVector<double> > *fct,
439
440
			     int component) 
    {
441
442
443
      exactSolutionFcts[component] = fct;
    }

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

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

456
457
    /** \} */

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

Thomas Witkowski's avatar
Thomas Witkowski committed
464
    /// Function that implements the serialization procedure.
Thomas Witkowski's avatar
Thomas Witkowski committed
465
    virtual void serialize(std::ostream &out);
466

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

Thomas Witkowski's avatar
Thomas Witkowski committed
470
471

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

Thomas Witkowski's avatar
Thomas Witkowski committed
477
478
479
480
481
482
483
  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);

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

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

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

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

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

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

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
524
    /// Linear solver of this problem. Used in \ref solve().
525
    OEMSolver *solver;
526

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

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

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

536
537
538
    /// Composed system matrix
    SolverMatrix<Matrix<DOFMatrix*> > solverMatrix;

539
540
541
542
543
544
545
    /** \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
546
    std::vector< std::vector< bool > > assembleMatrixOnlyOnce;
547
548
549

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

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

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

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

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

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

    /** \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;
594
595
596
597
  };
}

#endif