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
#include "SystemVector.h"
38
39
40

namespace AMDiS {

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

183
184
185
186
    bool dualMeshTraverseRequired();

    void dualAssemble(AdaptInfo *adaptInfo, Flag flag);

187
188
189
    void createPrecon();


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

Thomas Witkowski's avatar
Thomas Witkowski committed
203
    /// Implementation of ProblemStatBase::getNumComponents()
204
205
    virtual int getNumComponents() 
    { 
206
      return nComponents; 
Thomas Witkowski's avatar
Thomas Witkowski committed
207
    }
208
209
210
211
212

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

218
    /// Writes output files. TODO: Make obsolete.
219
220
    void writeFiles(AdaptInfo *adaptInfo, bool force);

221
222
223
    /// Writes output files.
    void writeFiles(AdaptInfo &adaptInfo, bool force);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
227
    /// Adds an Operator to \ref A.
228
    void addMatrixOperator(Operator *op, int i, int j,
229
230
231
232
233
			   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);
234

Thomas Witkowski's avatar
Thomas Witkowski committed
235
    /// Adds an Operator to \ref rhs.
236
    void addVectorOperator(Operator *op, int i,
237
238
239
240
241
			   double *factor = NULL, double *estFactor = NULL);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
243
    /// Adds dirichlet boundary conditions.
244
    virtual void addDirichletBC(BoundaryType type, int row, int col,
245
246
				AbstractFunction<double, WorldVector<double> > *b);

247
248
249
    virtual void addDirichletBC(BoundaryType type, int row, int col,
				DOFVector<double> *vec);

Thomas Witkowski's avatar
Thomas Witkowski committed
250
    /// Adds neumann boundary conditions.
251
252
253
    virtual void addNeumannBC(BoundaryType type, int row, int col, 
			      AbstractFunction<double, WorldVector<double> > *n);

Thomas Witkowski's avatar
Thomas Witkowski committed
254
    /// Adds robin boundary conditions.
255
256
257
258
    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
259
    /// Adds periodic boundary conditions.
260
261
    virtual void addPeriodicBC(BoundaryType type, int row, int col);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
270
271

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

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

287
288
289
290
291
    inline const DOFVector<double>* getSolutionVector(int i = 0)
    {
      return solution->getDOFVector(i);
    }

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

298
299
300
301
302
    inline const DOFVector<double>* getRhsVector(int i = 0)
    {
      return rhs->getDOFVector(i);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

472
473
474
475
476
477
    /// Sets \ref writeAsmInfo;
    void setWriteAsmInfo(bool b)
    {
      writeAsmInfo = b;
    }

478
479
    /** \} */

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
492
493

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

Thomas Witkowski's avatar
Thomas Witkowski committed
499
500
501
502
503
504
505
  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);

506
  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
507
508
509
    
    /// Name of this problem.
    std::string name;
510

Thomas Witkowski's avatar
Thomas Witkowski committed
511
    /// Number of problem components
512
    int nComponents;
513
514

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
524
525
    /// Meshes of this problem.
    std::vector<Mesh*> meshes;
526

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

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
546
    /// Linear solver of this problem. Used in \ref solve().
547
    OEMSolver *solver;
548

Thomas Witkowski's avatar
Thomas Witkowski committed
549
550
    /// System vector  storing the calculated solution of the problem.
    SystemVector *solution;
551

Thomas Witkowski's avatar
Thomas Witkowski committed
552
553
    /// System vector for the right hand side 
    SystemVector *rhs;
554

Thomas Witkowski's avatar
Thomas Witkowski committed
555
556
    /// System matrix
    Matrix<DOFMatrix*> *systemMatrix;
557

558
559
560
    /// Composed system matrix
    SolverMatrix<Matrix<DOFMatrix*> > solverMatrix;

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
578
579
    /// Determines whether domain boundaries should be considered at assembling.
    bool useGetBound;
580

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

    /** \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
589
    RefinementManager *refinementManager;
590
591
592
593
594
595

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

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

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

    std::map<Operator*, Flag> opFlags;
624
625
626

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

#endif