ProblemVec.h 17.4 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

namespace AMDiS {

40
41
42
43
44
45
46
  struct OperatorPos 
  {
    int row, col;
    double *factor, *estFactor;
    Flag operatorType;
  };

47
48
49
  class ProblemVec : public ProblemStatBase,
		     public StandardProblemIteration
  {
50
  protected:
51
52
53
54
55
56
    // 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;

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

Thomas Witkowski's avatar
Thomas Witkowski committed
80
81
      assembleMatrixOnlyOnce.resize(nComponents);
      assembledMatrix.resize(nComponents);
82
      for (int i = 0; i < nComponents; i++) {
Thomas Witkowski's avatar
Thomas Witkowski committed
83
84
	assembleMatrixOnlyOnce[i].resize(nComponents);
	assembledMatrix[i].resize(nComponents);
85
	for (int j = 0; j < nComponents; j++) {
Thomas Witkowski's avatar
Thomas Witkowski committed
86
87
	  assembleMatrixOnlyOnce[i][j] = false;
	  assembledMatrix[i][j] = false;
88
89
	}
      }
90
91

      exactSolutionFcts.resize(nComponents);
Thomas Witkowski's avatar
Thomas Witkowski committed
92
    }
93

Thomas Witkowski's avatar
Thomas Witkowski committed
94
95
    /// Destructor
    virtual ~ProblemVec() {}
96

Thomas Witkowski's avatar
Thomas Witkowski committed
97
    /// Initialisation of the problem.
98
99
100
101
102
    virtual void initialize(Flag initFlag,
			    ProblemVec *adoptProblem = NULL,
			    Flag adoptFlag = INIT_NOTHING);


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

Thomas Witkowski's avatar
Thomas Witkowski committed
106
    /// Used in \ref initialize().
107
    virtual void createFESpace(DOFAdmin *admin);
108

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

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

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

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

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

124
125
126
127
    /** \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.
     */
128
129
130
131
132
133
    virtual void doOtherStuff();

    /** \brief
     * Implementation of ProblemStatBase::solve(). Deligates the solving
     * of problems system to \ref solver.
     */
134
    virtual void solve(AdaptInfo *adaptInfo, bool fixedMatrix = false);
135
136
137
138
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

    /** \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
164
    virtual void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) {}
165
166
167
168
169

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

    /** \brief
     * Implementation of ProblemStatBase::buildAfterCoarsen().
174
175
     * Assembles \ref A and \ref rhs. With the last two parameters, assembling
     * can be restricted to matrices or vectors only.
176
     */
177
178
179
    virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag,
				   bool assembleMatrix = true,
				   bool assembleVector = true);
180

181
182
    void buildAfterCoarsen_sebastianMode(AdaptInfo *adaptInfo, Flag flag);

183
184
185
    void createPrecon();


186
187
188
189
190
191
192
    /** \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
193
    /// Returns number of managed problems
194
195
    virtual int getNumProblems() 
    { 
196
      return 1; 
Thomas Witkowski's avatar
Thomas Witkowski committed
197
    }
198

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

    /** \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.
     */
209
210
    virtual ProblemStatBase *getProblem(int number = 0) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
211
      return this; 
Thomas Witkowski's avatar
Thomas Witkowski committed
212
    }
213

214
    /// Writes output files. TODO: Make obsolete.
215
216
    void writeFiles(AdaptInfo *adaptInfo, bool force);

217
218
219
    /// Writes output files.
    void writeFiles(AdaptInfo &adaptInfo, bool force);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
223
    /// Adds an Operator to \ref A.
224
225
    void addMatrixOperator(Operator *op, int i, int j,
			   double *factor = NULL,
226
			   double *estFactor = NULL);
227

Thomas Witkowski's avatar
Thomas Witkowski committed
228
    /// Adds an Operator to \ref rhs.
229
230
    void addVectorOperator(Operator *op, int i,
			   double *factor = NULL,
231
			   double *estFactor = NULL);
232

Thomas Witkowski's avatar
Thomas Witkowski committed
233
    /// Adds dirichlet boundary conditions.
234
    virtual void addDirichletBC(BoundaryType type, int row, int col,
235
236
				AbstractFunction<double, WorldVector<double> > *b);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
241
    /// Adds robin boundary conditions.
242
243
244
245
    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
246
    /// Adds periodic boundary conditions.
247
248
    virtual void addPeriodicBC(BoundaryType type, int row, int col);

Thomas Witkowski's avatar
Thomas Witkowski committed
249
    /// Implementation of ProblemStatBase::allowFirstRefinement().
250
251
    inline void allowFirstRefinement() 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
252
253
      allowFirstRef = true;
    }
Thomas Witkowski's avatar
Thomas Witkowski committed
254
255
256
257
258

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

Thomas Witkowski's avatar
Thomas Witkowski committed
263
264
265
    ///
    void assembleOnDifMeshes(FiniteElemSpace *rowFeSpace, 
			     FiniteElemSpace *colFeSpace,
Thomas Witkowski's avatar
Thomas Witkowski committed
266
			     Flag assembleFlag,
Thomas Witkowski's avatar
Thomas Witkowski committed
267
268
			     DOFMatrix *matrix, 
			     DOFVector<double> *vector);
269

Thomas Witkowski's avatar
Thomas Witkowski committed
270
271
272
273
274
275
276
277
    ///
    void assembleOnDifMeshes2(const FiniteElemSpace *mainFeSpace, 
			      const FiniteElemSpace *auxFeSpace,
			      Flag assembleFlag,
			      DOFMatrix *matrix,
			      DOFVector<double> *vector);

    ///
278
279
280
281
    void assembleBoundaryConditions(DOFVector<double> *rhs,
				    DOFVector<double> *solution,
				    Mesh *mesh,
				    Flag assembleFlag);
282
283
284
285
286
  
    /** \name getting methods
     * \{ 
     */

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

Thomas Witkowski's avatar
Thomas Witkowski committed
293
    /// Returns \ref rhs.
294
295
    inline SystemVector* getRHS() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
296
297
      return rhs; 
    }
298

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

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

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

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
341
    /// Returns \ref componentSpaces;
342
343
    inline std::vector<FiniteElemSpace*> getComponentFESpaces() 
    {
344
      return componentSpaces;
345
346
    }

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

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

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

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

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

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
395
    /// Returns \ref useGetBound.
396
397
    inline bool getBoundUsed() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
398
399
      return useGetBound; 
    }
400

401
402
403
404
405
406
    /// Returns \ref info.
    int getInfo()
    {
      return info;
    }

407
408
409
410
411
412
    /** \} */

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

Thomas Witkowski's avatar
Thomas Witkowski committed
413
    /// Sets \ref estimator.
414
415
    inline void setEstimator(std::vector<Estimator*> est) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
416
417
      estimator = est; 
    }
418

Thomas Witkowski's avatar
Thomas Witkowski committed
419
    /// Sets the FE space for the given component.
420
421
    inline void setFESpace(FiniteElemSpace *feSpace, int comp) 
    {
422
      feSpaces[comp] = feSpace;
Thomas Witkowski's avatar
Thomas Witkowski committed
423
    }
424

Thomas Witkowski's avatar
Thomas Witkowski committed
425
    /// Sets \ref estimator.
426
427
    inline void setEstimator(Estimator* est, int comp) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
428
429
      estimator[comp] = est; 
    }
430

Thomas Witkowski's avatar
Thomas Witkowski committed
431
    /// Sets \ref marker.
432
433
    inline void setMarker(Marker* mark, int comp) 
    { 
434
      marker[comp] = mark; 
Thomas Witkowski's avatar
Thomas Witkowski committed
435
    }
436

Thomas Witkowski's avatar
Thomas Witkowski committed
437
    /// Sets \ref solver.
438
439
    inline void setSolver(OEMSolver* sol) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
440
441
      solver = sol; 
    }
442

Thomas Witkowski's avatar
Thomas Witkowski committed
443
    ///
444
445
    inline void setAssembleMatrixOnlyOnce(int i, int j, bool value = true) 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
446
      assembleMatrixOnlyOnce[i][j] = value;
447
448
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
449
    ///
450
    void setExactSolutionFct(AbstractFunction<double, WorldVector<double> > *fct,
451
452
			     int component) 
    {
453
454
455
      exactSolutionFcts[component] = fct;
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
456
    ///
457
458
    AbstractFunction<double, WorldVector<double> > *getExactSolutionFct(int component) 
    {
459
460
461
      return exactSolutionFcts[component];
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
462
    ///
463
464
    void setComputeExactError(bool v) 
    {
465
466
467
      computeExactError = v;
    }

468
469
    /** \} */

Thomas Witkowski's avatar
Thomas Witkowski committed
470
471
472
473
    /** \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
474
    void writeResidualMesh(int comp, AdaptInfo *adaptInfo, std::string name);
475

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
482
483

    /// Returns \ref fileWriters.
484
485
    std::vector<FileWriterInterface*>& getFileWriterList() 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
486
487
      return fileWriters;
    }
488

Thomas Witkowski's avatar
Thomas Witkowski committed
489
490
491
492
493
494
495
  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);

496
  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
497
498
499
    
    /// Name of this problem.
    std::string name;
500

Thomas Witkowski's avatar
Thomas Witkowski committed
501
    /// Number of problem components
502
    int nComponents;
503
504

    /** \brief
Thomas Witkowski's avatar
Thomas Witkowski committed
505
506
507
     * 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.
508
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
509
510
511
    int nMeshes;

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

Thomas Witkowski's avatar
Thomas Witkowski committed
514
515
    /// Meshes of this problem.
    std::vector<Mesh*> meshes;
516

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

Thomas Witkowski's avatar
Thomas Witkowski committed
520
    /// Pointer to the meshes for the different problem components
Thomas Witkowski's avatar
Thomas Witkowski committed
521
    std::vector<Mesh*> componentMeshes;
522
523

    /** \brief
Thomas Witkowski's avatar
Thomas Witkowski committed
524
525
526
     * 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.
527
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
528
529
530
    ComponentTraverseInfo traverseInfo;
    
    /// Responsible for element marking.
531
    std::vector<Marker*> marker;
532

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

Thomas Witkowski's avatar
Thomas Witkowski committed
536
    /// Linear solver of this problem. Used in \ref solve().
537
    OEMSolver *solver;
538

Thomas Witkowski's avatar
Thomas Witkowski committed
539
540
    /// System vector  storing the calculated solution of the problem.
    SystemVector *solution;
541

Thomas Witkowski's avatar
Thomas Witkowski committed
542
543
    /// System vector for the right hand side 
    SystemVector *rhs;
544

Thomas Witkowski's avatar
Thomas Witkowski committed
545
546
    /// System matrix
    Matrix<DOFMatrix*> *systemMatrix;
547

548
549
550
    /// Composed system matrix
    SolverMatrix<Matrix<DOFMatrix*> > solverMatrix;

551
552
553
554
555
556
557
    /** \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
558
    std::vector< std::vector< bool > > assembleMatrixOnlyOnce;
559
560
561

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

Thomas Witkowski's avatar
Thomas Witkowski committed
568
569
    /// Determines whether domain boundaries should be considered at assembling.
    bool useGetBound;
570

Thomas Witkowski's avatar
Thomas Witkowski committed
571
572
    /// Writes the meshes and solution after the adaption loop.
    std::vector<FileWriterInterface*> fileWriters;
573
574
575
576
577
578

    /** \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
579
    RefinementManager *refinementManager;
580
581
582
583
584
585

    /** \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
586
    CoarseningManager *coarseningManager;
587
  
Thomas Witkowski's avatar
Thomas Witkowski committed
588
589
    /// Info level.
    int info;
590

Thomas Witkowski's avatar
Thomas Witkowski committed
591
592
    /// Allows one refinement although the adapt tolerance is reached already.
    bool allowFirstRef;
593
594
595
596
597
598
599
600
601
602
603
604
605

    /** \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;
606
607
608
609

    std::map<Operator*, std::vector<OperatorPos> > operators;

    std::map<Operator*, Flag> opFlags;
610
611
612
613
  };
}

#endif