ProblemVec.h 17.9 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
74
	computeExactError(false),
	boundaryConditionSet(false)
75
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
76
      GET_PARAMETER(0, name + "->components", "%d", &nComponents);
77
      TEST_EXIT(nComponents > 0)("components not set!\n");    
Thomas Witkowski's avatar
Thomas Witkowski committed
78
      estimator.resize(nComponents, NULL);
79
      marker.resize(nComponents, NULL);
80

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

182
183
184
    void createPrecon();


185
186
187
188
189
190
191
    /** \brief
     * Determines the execution order of the single adaption steps. If adapt is
     * true, mesh adaption will be performed. This allows to avoid mesh adaption,
     * e.g. in timestep adaption loops of timestep adaptive strategies.
     */
    virtual Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo = FULL_ITERATION);

Thomas Witkowski's avatar
Thomas Witkowski committed
192
    /// Returns number of managed problems
193
194
    virtual int getNumProblems() 
    { 
195
      return 1; 
Thomas Witkowski's avatar
Thomas Witkowski committed
196
    }
197

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

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

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

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

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

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

    /// Adds an Operator to \ref A.
    void addMatrixOperator(Operator &op, int i, int j,
			   double *factor = NULL, double *estFactor = NULL);
229

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

    /// Adds an Operator to \ref rhs.
    void addVectorOperator(Operator &op, int i,
			   double *factor = NULL, double *estFactor = NULL);
237

Thomas Witkowski's avatar
Thomas Witkowski committed
238
    /// Adds dirichlet boundary conditions.
239
    virtual void addDirichletBC(BoundaryType type, int row, int col,
240
241
				AbstractFunction<double, WorldVector<double> > *b);

Thomas Witkowski's avatar
Thomas Witkowski committed
242
    /// Adds neumann boundary conditions.
243
244
245
    virtual void addNeumannBC(BoundaryType type, int row, int col, 
			      AbstractFunction<double, WorldVector<double> > *n);

Thomas Witkowski's avatar
Thomas Witkowski committed
246
    /// Adds robin boundary conditions.
247
248
249
250
    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
251
    /// Adds periodic boundary conditions.
252
253
    virtual void addPeriodicBC(BoundaryType type, int row, int col);

Thomas Witkowski's avatar
Thomas Witkowski committed
254
    /// Implementation of ProblemStatBase::allowFirstRefinement().
255
256
    inline void allowFirstRefinement() 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
257
258
      allowFirstRef = true;
    }
Thomas Witkowski's avatar
Thomas Witkowski committed
259
260
261
262
263

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

Thomas Witkowski's avatar
Thomas Witkowski committed
268
269
270
    ///
    void assembleOnDifMeshes(FiniteElemSpace *rowFeSpace, 
			     FiniteElemSpace *colFeSpace,
Thomas Witkowski's avatar
Thomas Witkowski committed
271
			     Flag assembleFlag,
Thomas Witkowski's avatar
Thomas Witkowski committed
272
273
			     DOFMatrix *matrix, 
			     DOFVector<double> *vector);
274

Thomas Witkowski's avatar
Thomas Witkowski committed
275
276
277
278
279
280
281
282
    ///
    void assembleOnDifMeshes2(const FiniteElemSpace *mainFeSpace, 
			      const FiniteElemSpace *auxFeSpace,
			      Flag assembleFlag,
			      DOFMatrix *matrix,
			      DOFVector<double> *vector);

    ///
283
284
285
286
    void assembleBoundaryConditions(DOFVector<double> *rhs,
				    DOFVector<double> *solution,
				    Mesh *mesh,
				    Flag assembleFlag);
287
288
289
290
291
  
    /** \name getting methods
     * \{ 
     */

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

Thomas Witkowski's avatar
Thomas Witkowski committed
298
    /// Returns \ref rhs.
299
300
    inline SystemVector* getRHS() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
301
302
      return rhs; 
    }
303

Thomas Witkowski's avatar
Thomas Witkowski committed
304
    /// Returns \ref systemMatrix.
305
306
    inline Matrix<DOFMatrix*> *getSystemMatrix() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
307
308
      return systemMatrix; 
    }
309

Thomas Witkowski's avatar
Thomas Witkowski committed
310
    /// Returns a pointer to the corresponding DOFMatrix.
311
312
    inline DOFMatrix* getSystemMatrix(int row, int col) 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
313
314
315
316
      return (*systemMatrix)[row][col];
    }

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

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
346
    /// Returns \ref componentSpaces;
347
348
    inline std::vector<FiniteElemSpace*> getComponentFESpaces() 
    {
349
      return componentSpaces;
350
351
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
352
    /// Returns \ref estimator.
353
354
    inline std::vector<Estimator*> getEstimator() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
355
356
      return estimator; 
    }
357

Thomas Witkowski's avatar
Thomas Witkowski committed
358
    /// Returns \ref estimator.
359
360
    inline Estimator* getEstimator(int comp) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
361
362
      return estimator[comp]; 
    }
363

Thomas Witkowski's avatar
Thomas Witkowski committed
364
    /// Returns \ref refinementManager.
365
366
    inline RefinementManager* getRefinementManager(int comp) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
367
368
      return refinementManager; 
    }
369

Thomas Witkowski's avatar
Thomas Witkowski committed
370
    /// Returns \ref refinementManager.
371
372
    inline CoarseningManager* getCoarseningManager(int comp) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
373
374
      return coarseningManager; 
    }
375

Thomas Witkowski's avatar
Thomas Witkowski committed
376
    /// Returns \ref solver.
377
378
    inline OEMSolver* getSolver() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
379
380
      return solver; 
    }
381

Thomas Witkowski's avatar
Thomas Witkowski committed
382
    /// Returns \ref marker.
383
384
    inline Marker *getMarker(int comp) 
    { 
385
      return marker[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
386
    }
387

Thomas Witkowski's avatar
Thomas Witkowski committed
388
    /// Returns \ref marker.
389
390
    inline std::vector<Marker*> getMarker() 
    { 
391
      return marker; 
Thomas Witkowski's avatar
Thomas Witkowski committed
392
    }
393

Thomas Witkowski's avatar
Thomas Witkowski committed
394
    /// Returns the name of the problem
Thomas Witkowski's avatar
Thomas Witkowski committed
395
    inline virtual std::string getName() 
396
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
397
398
      return name; 
    }
399

Thomas Witkowski's avatar
Thomas Witkowski committed
400
    /// Returns \ref useGetBound.
401
402
    inline bool getBoundUsed() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
403
404
      return useGetBound; 
    }
405

406
407
408
409
410
411
    /// Returns \ref info.
    int getInfo()
    {
      return info;
    }

412
413
414
415
416
417
    /** \} */

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

Thomas Witkowski's avatar
Thomas Witkowski committed
418
    /// Sets \ref estimator.
419
420
    inline void setEstimator(std::vector<Estimator*> est) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
421
422
      estimator = est; 
    }
423

Thomas Witkowski's avatar
Thomas Witkowski committed
424
    /// Sets the FE space for the given component.
425
426
    inline void setFESpace(FiniteElemSpace *feSpace, int comp) 
    {
427
      feSpaces[comp] = feSpace;
Thomas Witkowski's avatar
Thomas Witkowski committed
428
    }
429

Thomas Witkowski's avatar
Thomas Witkowski committed
430
    /// Sets \ref estimator.
431
432
    inline void setEstimator(Estimator* est, int comp) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
433
434
      estimator[comp] = est; 
    }
435

Thomas Witkowski's avatar
Thomas Witkowski committed
436
    /// Sets \ref marker.
437
438
    inline void setMarker(Marker* mark, int comp) 
    { 
439
      marker[comp] = mark; 
Thomas Witkowski's avatar
Thomas Witkowski committed
440
    }
441

Thomas Witkowski's avatar
Thomas Witkowski committed
442
    /// Sets \ref solver.
443
444
    inline void setSolver(OEMSolver* sol) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
445
446
      solver = sol; 
    }
447

Thomas Witkowski's avatar
Thomas Witkowski committed
448
    ///
449
450
    inline void setAssembleMatrixOnlyOnce(int i, int j, bool value = true) 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
451
      assembleMatrixOnlyOnce[i][j] = value;
452
453
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
454
    ///
455
    void setExactSolutionFct(AbstractFunction<double, WorldVector<double> > *fct,
456
457
			     int component) 
    {
458
459
460
      exactSolutionFcts[component] = fct;
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
461
    ///
462
463
    AbstractFunction<double, WorldVector<double> > *getExactSolutionFct(int component) 
    {
464
465
466
      return exactSolutionFcts[component];
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
467
    ///
468
469
    void setComputeExactError(bool v) 
    {
470
471
472
      computeExactError = v;
    }

473
474
    /** \} */

Thomas Witkowski's avatar
Thomas Witkowski committed
475
476
477
478
    /** \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
479
    void writeResidualMesh(int comp, AdaptInfo *adaptInfo, std::string name);
480

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
487
488

    /// Returns \ref fileWriters.
489
490
    std::vector<FileWriterInterface*>& getFileWriterList() 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
491
492
      return fileWriters;
    }
493

Thomas Witkowski's avatar
Thomas Witkowski committed
494
495
496
497
498
499
500
  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);

501
  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
502
503
504
    
    /// Name of this problem.
    std::string name;
505

Thomas Witkowski's avatar
Thomas Witkowski committed
506
    /// Number of problem components
507
    int nComponents;
508
509

    /** \brief
Thomas Witkowski's avatar
Thomas Witkowski committed
510
511
512
     * 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.
513
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
514
515
516
    int nMeshes;

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

Thomas Witkowski's avatar
Thomas Witkowski committed
519
520
    /// Meshes of this problem.
    std::vector<Mesh*> meshes;
521

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

Thomas Witkowski's avatar
Thomas Witkowski committed
525
    /// Pointer to the meshes for the different problem components
Thomas Witkowski's avatar
Thomas Witkowski committed
526
    std::vector<Mesh*> componentMeshes;
527
528

    /** \brief
Thomas Witkowski's avatar
Thomas Witkowski committed
529
530
531
     * 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.
532
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
533
534
535
    ComponentTraverseInfo traverseInfo;
    
    /// Responsible for element marking.
536
    std::vector<Marker*> marker;
537

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

Thomas Witkowski's avatar
Thomas Witkowski committed
541
    /// Linear solver of this problem. Used in \ref solve().
542
    OEMSolver *solver;
543

Thomas Witkowski's avatar
Thomas Witkowski committed
544
545
    /// System vector  storing the calculated solution of the problem.
    SystemVector *solution;
546

Thomas Witkowski's avatar
Thomas Witkowski committed
547
548
    /// System vector for the right hand side 
    SystemVector *rhs;
549

Thomas Witkowski's avatar
Thomas Witkowski committed
550
551
    /// System matrix
    Matrix<DOFMatrix*> *systemMatrix;
552

553
554
555
    /// Composed system matrix
    SolverMatrix<Matrix<DOFMatrix*> > solverMatrix;

556
557
558
559
560
561
562
    /** \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
563
    std::vector< std::vector< bool > > assembleMatrixOnlyOnce;
564
565
566

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

Thomas Witkowski's avatar
Thomas Witkowski committed
573
574
    /// Determines whether domain boundaries should be considered at assembling.
    bool useGetBound;
575

Thomas Witkowski's avatar
Thomas Witkowski committed
576
577
    /// Writes the meshes and solution after the adaption loop.
    std::vector<FileWriterInterface*> fileWriters;
578
579
580
581
582
583

    /** \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
584
    RefinementManager *refinementManager;
585
586
587
588
589
590

    /** \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
591
    CoarseningManager *coarseningManager;
592
  
Thomas Witkowski's avatar
Thomas Witkowski committed
593
594
    /// Info level.
    int info;
595

Thomas Witkowski's avatar
Thomas Witkowski committed
596
597
    /// Allows one refinement although the adapt tolerance is reached already.
    bool allowFirstRef;
598
599
600
601
602
603
604
605
606
607
608
609
610

    /** \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;
611
612
613
614
615
616
617
    
    /** \brief
     * If at least on boundary condition is set, this variable is true. It is used
     * to ensure that no operators are added after boundary condition were set. If
     * this would happen, boundary conditions could set wrong on off diagonal matrices.
     */
    bool boundaryConditionSet;
618
619
620
621

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

    std::map<Operator*, Flag> opFlags;
622
623
624
625
  };
}

#endif