ProblemVec.h 17.8 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
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);

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
259
    /// Implementation of ProblemStatBase::allowFirstRefinement().
260
261
    inline void allowFirstRefinement() 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
262
263
      allowFirstRef = true;
    }
Thomas Witkowski's avatar
Thomas Witkowski committed
264
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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
296
    /// Returns \ref systemMatrix.
297
298
    inline Matrix<DOFMatrix*> *getSystemMatrix() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
299
300
      return systemMatrix; 
    }
301

Thomas Witkowski's avatar
Thomas Witkowski committed
302
    /// Returns a pointer to the corresponding DOFMatrix.
303
304
    inline DOFMatrix* getSystemMatrix(int row, int col) 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
305
306
307
308
      return (*systemMatrix)[row][col];
    }

    /// Returns mesh of given component
309
310
    inline Mesh* getMesh(int comp) 
    {
311
      FUNCNAME("ProblemVec::getMesh()");
Thomas Witkowski's avatar
Thomas Witkowski committed
312
      TEST_EXIT(comp < static_cast<int>(componentMeshes.size()) && comp >= 0)
313
	("invalid component number\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
314
      return componentMeshes[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
315
    }
316

Thomas Witkowski's avatar
Thomas Witkowski committed
317
    /// Returns \ref meshes
318
319
    inline std::vector<Mesh*> getMeshes() 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
320
321
      return meshes; 
    }
322

Thomas Witkowski's avatar
Thomas Witkowski committed
323
    /// Returns \ref feSpace_.
324
325
    inline FiniteElemSpace* getFESpace(int comp) 
    { 
326
      FUNCNAME("ProblemVec::getFESpace()");
327
      TEST_EXIT(comp < static_cast<int>(componentSpaces.size()) && comp >= 0)
328
	("invalid component number\n");
329
      return componentSpaces[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
330
    }
331

Thomas Witkowski's avatar
Thomas Witkowski committed
332
    /// Returns \ref feSpaces.
333
334
    inline std::vector<FiniteElemSpace*> getFESpaces() 
    { 
335
      return feSpaces; 
Thomas Witkowski's avatar
Thomas Witkowski committed
336
    }
337

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

Thomas Witkowski's avatar
Thomas Witkowski committed
344
    /// Returns \ref estimator.
345
346
    inline std::vector<Estimator*> getEstimator() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
347
348
      return estimator; 
    }
349

Thomas Witkowski's avatar
Thomas Witkowski committed
350
    /// Returns \ref estimator.
351
352
    inline Estimator* getEstimator(int comp) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
353
354
      return estimator[comp]; 
    }
355

Thomas Witkowski's avatar
Thomas Witkowski committed
356
    /// Returns \ref refinementManager.
357
358
    inline RefinementManager* getRefinementManager(int comp) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
359
360
      return refinementManager; 
    }
361

Thomas Witkowski's avatar
Thomas Witkowski committed
362
    /// Returns \ref refinementManager.
363
364
    inline CoarseningManager* getCoarseningManager(int comp) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
365
366
      return coarseningManager; 
    }
367

Thomas Witkowski's avatar
Thomas Witkowski committed
368
    /// Returns \ref solver.
369
370
    inline OEMSolver* getSolver() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
371
372
      return solver; 
    }
373

Thomas Witkowski's avatar
Thomas Witkowski committed
374
    /// Returns \ref marker.
375
376
    inline Marker *getMarker(int comp) 
    { 
377
      return marker[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
378
    }
379

Thomas Witkowski's avatar
Thomas Witkowski committed
380
    /// Returns \ref marker.
381
382
    inline std::vector<Marker*> getMarker() 
    { 
383
      return marker; 
Thomas Witkowski's avatar
Thomas Witkowski committed
384
    }
385

Thomas Witkowski's avatar
Thomas Witkowski committed
386
    /// Returns the name of the problem
Thomas Witkowski's avatar
Thomas Witkowski committed
387
    inline virtual std::string getName() 
388
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
389
390
      return name; 
    }
391

Thomas Witkowski's avatar
Thomas Witkowski committed
392
    /// Returns \ref useGetBound.
393
394
    inline bool getBoundUsed() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
395
396
      return useGetBound; 
    }
397

398
399
400
401
402
403
    /// Returns \ref info.
    int getInfo()
    {
      return info;
    }

404
405
406
407
408
409
    /** \} */

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

Thomas Witkowski's avatar
Thomas Witkowski committed
410
    /// Sets \ref estimator.
411
412
    inline void setEstimator(std::vector<Estimator*> est) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
413
414
      estimator = est; 
    }
415

Thomas Witkowski's avatar
Thomas Witkowski committed
416
    /// Sets the FE space for the given component.
417
418
    inline void setFESpace(FiniteElemSpace *feSpace, int comp) 
    {
419
      feSpaces[comp] = feSpace;
Thomas Witkowski's avatar
Thomas Witkowski committed
420
    }
421

Thomas Witkowski's avatar
Thomas Witkowski committed
422
    /// Sets \ref estimator.
423
424
    inline void setEstimator(Estimator* est, int comp) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
425
426
      estimator[comp] = est; 
    }
427

Thomas Witkowski's avatar
Thomas Witkowski committed
428
    /// Sets \ref marker.
429
430
    inline void setMarker(Marker* mark, int comp) 
    { 
431
      marker[comp] = mark; 
Thomas Witkowski's avatar
Thomas Witkowski committed
432
    }
433

Thomas Witkowski's avatar
Thomas Witkowski committed
434
    /// Sets \ref solver.
435
436
    inline void setSolver(OEMSolver* sol) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
437
438
      solver = sol; 
    }
439

Thomas Witkowski's avatar
Thomas Witkowski committed
440
    ///
441
442
    inline void setAssembleMatrixOnlyOnce(int i, int j, bool value = true) 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
443
      assembleMatrixOnlyOnce[i][j] = value;
444
445
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
446
    ///
447
    void setExactSolutionFct(AbstractFunction<double, WorldVector<double> > *fct,
448
449
			     int component) 
    {
450
451
452
      exactSolutionFcts[component] = fct;
    }

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

Thomas Witkowski's avatar
Thomas Witkowski committed
459
    ///
460
461
    void setComputeExactError(bool v) 
    {
462
463
464
      computeExactError = v;
    }

465
466
467
468
469
470
    /// Sets \ref writeAsmInfo;
    void setWriteAsmInfo(bool b)
    {
      writeAsmInfo = b;
    }

471
472
    /** \} */

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
485
486

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

551
552
553
    /// Composed system matrix
    SolverMatrix<Matrix<DOFMatrix*> > solverMatrix;

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

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

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

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

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

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

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

    /** \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;
609
610
611
612
613
614
615
    
    /** \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;
616
617
618
619

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

    std::map<Operator*, Flag> opFlags;
620
621
622

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

#endif