ProblemVec.h 18.2 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
#include "SystemVector.h"
38
39
40
41
42
43

namespace AMDiS {

  class ProblemVec : public ProblemStatBase,
		     public StandardProblemIteration
  {
44
  protected:
45
46
47
48
49
50
    // 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;

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

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

      exactSolutionFcts.resize(nComponents);
Thomas Witkowski's avatar
Thomas Witkowski committed
87
    }
88

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

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


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

Thomas Witkowski's avatar
Thomas Witkowski committed
101
    /// Used in \ref initialize().
102
    virtual void createFeSpace(DOFAdmin *admin);
103

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

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

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

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

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

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

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

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

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

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

176
177
    bool dualMeshTraverseRequired();

178
179
    void dualAssemble(AdaptInfo *adaptInfo, Flag flag, 
		      bool asmMatrix = true, bool asmVector = true);
180

181
182
183
    void createPrecon();


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

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

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

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

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

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

221
    /// Adds an operator to \ref A.
222
    void addMatrixOperator(Operator *op, int i, int j,
223
224
			   double *factor = NULL, double *estFactor = NULL);

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

229
    /// Adds an operator to \ref rhs.
230
    void addVectorOperator(Operator *op, int i,
231
232
			   double *factor = NULL, double *estFactor = NULL);

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

237
238
    /// Adds a Dirichlet boundary condition, where the rhs is given by an 
    /// abstract function.
239
    virtual void addDirichletBC(BoundaryType type, int row, int col,
240
241
				AbstractFunction<double, WorldVector<double> > *b);

242
243
    /// Adds a Dirichlet boundary condition, where the rhs is given by a DOF
    /// vector.
244
245
246
    virtual void addDirichletBC(BoundaryType type, int row, int col,
				DOFVector<double> *vec);

247
248
    /// Adds a Neumann boundary condition, where the rhs is given by an
    /// abstract function.
249
250
251
    virtual void addNeumannBC(BoundaryType type, int row, int col, 
			      AbstractFunction<double, WorldVector<double> > *n);

252
253
254
255
256
257
    /// Adds a Neumann boundary condition, where the rhs is given by an DOF
    /// vector.
    virtual void addNeumannBC(BoundaryType type, int row, int col, 
			      DOFVector<double> *n);

    /// Adds Robin boundary condition.
258
259
260
261
    virtual void addRobinBC(BoundaryType type, int row, int col, 
			    AbstractFunction<double, WorldVector<double> > *n,
			    AbstractFunction<double, WorldVector<double> > *r);

262
    /// Adds a periodic boundary condition.
263
264
    virtual void addPeriodicBC(BoundaryType type, int row, int col);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
273
274

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

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

290
291
292
293
294
    inline const DOFVector<double>* getSolutionVector(int i = 0)
    {
      return solution->getDOFVector(i);
    }

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

301
302
303
304
305
    inline const DOFVector<double>* getRhsVector(int i = 0)
    {
      return rhs->getDOFVector(i);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

414
415
416
417
418
419
    /** \} */

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

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

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

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

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

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
463
    ///
464
    AbstractFunction<double, WorldVector<double> > *getExactSolutionFct(int i = 0) 
465
    {
466
      return exactSolutionFcts[i];
467
468
    }

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

475
476
477
478
479
480
    /// Sets \ref writeAsmInfo;
    void setWriteAsmInfo(bool b)
    {
      writeAsmInfo = b;
    }

481
482
    /** \} */

Thomas Witkowski's avatar
Thomas Witkowski committed
483
484
485
486
    /** \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
487
    void writeResidualMesh(int comp, AdaptInfo *adaptInfo, std::string name);
488

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
495
496

    /// Returns \ref fileWriters.
497
498
    std::vector<FileWriterInterface*>& getFileWriterList() 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
499
500
      return fileWriters;
    }
501

Thomas Witkowski's avatar
Thomas Witkowski committed
502
503
504
505
506
507
508
  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);

509
  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
510
511
512
    
    /// Name of this problem.
    std::string name;
513

Thomas Witkowski's avatar
Thomas Witkowski committed
514
    /// Number of problem components
515
    int nComponents;
516
517

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
527
528
    /// Meshes of this problem.
    std::vector<Mesh*> meshes;
529

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

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
549
    /// Linear solver of this problem. Used in \ref solve().
550
    OEMSolver *solver;
551

Thomas Witkowski's avatar
Thomas Witkowski committed
552
553
    /// System vector  storing the calculated solution of the problem.
    SystemVector *solution;
554

Thomas Witkowski's avatar
Thomas Witkowski committed
555
556
    /// System vector for the right hand side 
    SystemVector *rhs;
557

Thomas Witkowski's avatar
Thomas Witkowski committed
558
559
    /// System matrix
    Matrix<DOFMatrix*> *systemMatrix;
560

561
562
563
    /// Composed system matrix
    SolverMatrix<Matrix<DOFMatrix*> > solverMatrix;

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
581
582
    /// Determines whether domain boundaries should be considered at assembling.
    bool useGetBound;
583

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

    /** \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
592
    RefinementManager *refinementManager;
593
594
595
596
597
598

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

604
605
606
607
608
609
610
611
612
613
614
615
    /** \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;
616
617
618
619
620
621
622
    
    /** \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;
623

624
625
    /// If true, AMDiS prints information about the assembling procedure to the screen.
    bool writeAsmInfo;
626
627
628
629
  };
}

#endif