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
215
			   double *estFactor = NULL,
			   bool fake = false);
216

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

397
398
399
400
401
402
    /** \} */

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

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

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

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

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

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

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

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

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

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

458
459
    /** \} */

Thomas Witkowski's avatar
Thomas Witkowski committed
460
461
462
463
    /** \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
464
    void writeResidualMesh(int comp, AdaptInfo *adaptInfo, std::string name);
465

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
472
473

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

538
539
540
    /// Composed system matrix
    SolverMatrix<Matrix<DOFMatrix*> > solverMatrix;

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

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