ProblemVec.h 18.1 KB
Newer Older
1
2
3
4
5
6
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
7
// ==  TU Dresden                                                            ==
8
// ==                                                                        ==
9
10
11
// ==  Institut fr Wissenschaftliches Rechnen                               ==
// ==  Zellescher Weg 12-14                                                  ==
// ==  01069 Dresden                                                         ==
12
13
14
15
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
16
// ==  https://gforge.zih.tu-dresden.de/projects/amdis/                      ==
17
18
19
20
21
22
23
24
// ==                                                                        ==
// ============================================================================

/** \file ProblemVec.h */

#ifndef AMDIS_PROBLEMVEC_H
#define AMDIS_PROBLEMVEC_H

Thomas Witkowski's avatar
Thomas Witkowski committed
25
26
#include <vector>
#include <list>
27
#include "AMDiS_fwd.h"
28
29
30
31
32
#include "ProblemStatBase.h"
#include "Parameters.h"
#include "Boundary.h"
#include "MatrixVector.h"
#include "StandardProblemIteration.h"
33
#include "ElementFileWriter.h"
Thomas Witkowski's avatar
Thomas Witkowski committed
34
#include "ComponentTraverseInfo.h"
35
36
#include "AbstractFunction.h"
#include "SolverMatrix.h"
37
38
39

namespace AMDiS {

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

47
48
49
  class ProblemVec : public ProblemStatBase,
		     public StandardProblemIteration
  {
50
  protected:
51
52
53
54
55
56
    // Defines a mapping type from dof indices to world coordinates.
    typedef std::map<DegreeOfFreedom, WorldVector<double> > DofToCoord;

    // Defines a mapping type from dof indices to world coordinates.
    typedef std::map<WorldVector<double>, DegreeOfFreedom> CoordToDof;

57
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
58
    /// Constructor
Thomas Witkowski's avatar
Thomas Witkowski committed
59
    ProblemVec(std::string nameStr,
60
61
	       ProblemIterationInterface *problemIteration = NULL)
      : StandardProblemIteration(this),
Thomas Witkowski's avatar
Thomas Witkowski committed
62
	name(nameStr),
63
	nComponents(-1),
Thomas Witkowski's avatar
Thomas Witkowski committed
64
65
66
67
68
69
70
71
72
	nMeshes(0),
	traverseInfo(0),
	solver(NULL),
	solution(NULL),
	rhs(NULL),
	systemMatrix(NULL),
	useGetBound(true),
	info(10),
	allowFirstRef(false),
73
	computeExactError(false),
74
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
    void createPrecon();


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

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

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

    /** \brief
     * Returns the problem with the given number. If only one problem
     * is managed by this master problem, the number hasn't to be given.
     */
209
210
    virtual ProblemStatBase *getProblem(int number = 0) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
211
      return this; 
Thomas Witkowski's avatar
Thomas Witkowski committed
212
    }
213

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

480
481
    /** \} */

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
494
495

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /** \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;
618
619
620
621
622
623
624
    
    /** \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;
625
626
627
628

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

    std::map<Operator*, Flag> opFlags;
629
630
631

    /// If true, AMDiS prints information about the assembling procedure to the screen.
    bool writeAsmInfo;
632
633
634
635
  };
}

#endif