ProblemVec.h 18.1 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
#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
44
45
46
47
48
49
  private:
    // 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();

Thomas Witkowski's avatar
Thomas Witkowski committed
117
    /// Used in \ref initialize().
118
119
120
121
122
123
    virtual void doOtherStuff();

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

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

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

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

171
172
173
    void createPrecon();


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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
202
    /// Writes output files.
203
204
    void writeFiles(AdaptInfo *adaptInfo, bool force);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
313
    /// Returns \ref feSpace_.
314
315
    inline FiniteElemSpace* getFESpace(int comp) 
    { 
316
      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.
323
324
    inline std::vector<FiniteElemSpace*> getFESpaces() 
    { 
325
      return feSpaces; 
Thomas Witkowski's avatar
Thomas Witkowski committed
326
    }
327

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

455
456
    /** \} */

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
469
470

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

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

483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
    /** \brief
     * Create from the current problem a map from dof indices to world coordinates.
     * This function is used by the debugging function \ref writeDbgMatrix and \ref
     * readAndCompareDbgMatrix.
     */
    void createDofToCoordMap(DofToCoord &dofMap);

    /** \brief
     * Create from the current problem a map from world coordinates of all dofs to
     * the corresponding dof indices. This function is used by the debugging function 
     * \ref writeDbgMatrix and \ref readAndCompareDbgMatrix.
     */
    void createCoordToDofMap(CoordToDof &dofMap);

    /** \brief
     * This function writes the system matrix and the system vector to a file
     * for debugging. The entries of both, the matrix and the vector, are not
     * indicated by the dof indices, but by the world coordinates of the dofs.
     * This makes it possible to compare dof matrices, where the dof indices
     * are different, e.g., when using domain decomposition parallelization.
     */
    void writeDbgMatrix(std::string filename);

    /** \brief
     * Reads a file, that was created using the function \ref writeDbgMatrix, and
     * compares the date with the system matrix of this problem.
     */
    void readAndCompareDbgMatrix(std::string filename);

512
  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
513
514
515
    
    /// Name of this problem.
    std::string name;
516

Thomas Witkowski's avatar
Thomas Witkowski committed
517
    /// Number of problem components
518
    int nComponents;
519
520

    /** \brief
Thomas Witkowski's avatar
Thomas Witkowski committed
521
522
523
     * 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.
524
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
525
526
527
    int nMeshes;

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

Thomas Witkowski's avatar
Thomas Witkowski committed
530
531
    /// Meshes of this problem.
    std::vector<Mesh*> meshes;
532

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

Thomas Witkowski's avatar
Thomas Witkowski committed
536
    /// Pointer to the meshes for the different problem components
Thomas Witkowski's avatar
Thomas Witkowski committed
537
    std::vector<Mesh*> componentMeshes;
538
539

    /** \brief
Thomas Witkowski's avatar
Thomas Witkowski committed
540
541
542
     * 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.
543
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
544
545
546
    ComponentTraverseInfo traverseInfo;
    
    /// Responsible for element marking.
547
    std::vector<Marker*> marker;
548

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

Thomas Witkowski's avatar
Thomas Witkowski committed
552
    /// Linear solver of this problem. Used in \ref solve().
553
    OEMSolver *solver;
554

Thomas Witkowski's avatar
Thomas Witkowski committed
555
556
    /// System vector  storing the calculated solution of the problem.
    SystemVector *solution;
557

Thomas Witkowski's avatar
Thomas Witkowski committed
558
559
    /// System vector for the right hand side 
    SystemVector *rhs;
560

Thomas Witkowski's avatar
Thomas Witkowski committed
561
562
    /// System matrix
    Matrix<DOFMatrix*> *systemMatrix;
563

564
565
566
    /// Composed system matrix
    SolverMatrix<Matrix<DOFMatrix*> > solverMatrix;

567
568
569
570
571
572
573
    /** \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
574
    std::vector< std::vector< bool > > assembleMatrixOnlyOnce;
575
576
577

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

Thomas Witkowski's avatar
Thomas Witkowski committed
584
585
    /// Determines whether domain boundaries should be considered at assembling.
    bool useGetBound;
586

Thomas Witkowski's avatar
Thomas Witkowski committed
587
588
    /// Writes the meshes and solution after the adaption loop.
    std::vector<FileWriterInterface*> fileWriters;
589
590
591
592
593
594

    /** \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
595
    RefinementManager *refinementManager;
596
597
598
599
600
601

    /** \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
602
    CoarseningManager *coarseningManager;
603
  
Thomas Witkowski's avatar
Thomas Witkowski committed
604
605
    /// Info level.
    int info;
606

Thomas Witkowski's avatar
Thomas Witkowski committed
607
608
    /// Allows one refinement although the adapt tolerance is reached already.
    bool allowFirstRef;
609
610
611
612
613
614
615
616
617
618
619
620
621

    /** \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;
622
623
624
625
  };
}

#endif