ProblemStat.h 19.7 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/******************************************************************************
 *
 * AMDiS - Adaptive multidimensional simulations
 *
 * Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
 * Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
 *
 * Authors: 
 * Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 *
 * This file is part of AMDiS
 *
 * See also license.opensource.txt in the distribution.
 * 
 ******************************************************************************/
20
21


22

23
/** \file ProblemStat.h */
24

25
26
#ifndef AMDIS_PROBLEM_STAT_H
#define AMDIS_PROBLEM_STAT_H
27

Thomas Witkowski's avatar
Thomas Witkowski committed
28
29
#include <vector>
#include <list>
30
#include "AMDiS_fwd.h"
31
#include "ProblemStatBase.h"
32
#include "Initfile.h"
33
34
35
#include "Boundary.h"
#include "MatrixVector.h"
#include "StandardProblemIteration.h"
36
#include "io/ElementFileWriter.h"
Thomas Witkowski's avatar
Thomas Witkowski committed
37
#include "ComponentTraverseInfo.h"
38
#include "AbstractFunction.h"
39
#include "solver/SolverMatrix.h"
40
#include "SystemVector.h"
41
42
43

namespace AMDiS {

44
45
46
47
48
49
  struct OperatorPos 
  {
    int row, col;
    double *factor, *estFactor;
  };

50

51
52
53
54
55
56
57
  /**
   * \ingroup Problem 
   *
   * \brief
   * This class defines the stationary problem definition in sequential
   * computations. For parallel computations, see \ref ParallelProblemStatBase.
   **/
58
59
  class ProblemStatSeq : public ProblemStatBase,
			 public StandardProblemIteration
60
  {
61
  protected:
62
    // Defines a mapping type from dof indices to world coordinates.
63
    typedef std::map<DegreeOfFreedom, WorldVector<double> > DofToCoord;
64
65

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

68
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
69
    /// Constructor
70
    ProblemStatSeq(std::string nameStr,
71
		   ProblemIterationInterface *problemIteration = NULL);
72

Thomas Witkowski's avatar
Thomas Witkowski committed
73
    /// Destructor
Thomas Witkowski's avatar
Thomas Witkowski committed
74
    virtual ~ProblemStatSeq();
75

Thomas Witkowski's avatar
Thomas Witkowski committed
76
    /// Initialisation of the problem.
77
    virtual void initialize(Flag initFlag,
78
			    ProblemStatSeq *adoptProblem = NULL,
79
80
			    Flag adoptFlag = INIT_NOTHING);

Thomas Witkowski's avatar
Thomas Witkowski committed
81
    /// Used in \ref initialize().
82
83
    virtual void createMesh();

84
85
86
    /// Used in \ref initialize().
    virtual void createRefCoarseManager();

Thomas Witkowski's avatar
Thomas Witkowski committed
87
    /// Used in \ref initialize().
88
    virtual void createFeSpace(DOFAdmin *admin);
89

Thomas Witkowski's avatar
Thomas Witkowski committed
90
    /// Used in \ref initialize().
91
92
    virtual void createMatricesAndVectors();

Thomas Witkowski's avatar
Thomas Witkowski committed
93
    /// Used in \ref initialize().
94
95
    virtual void createSolver();

Thomas Witkowski's avatar
Thomas Witkowski committed
96
    /// Used in \ref initialize().
97
98
    virtual void createEstimator();

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

Thomas Witkowski's avatar
Thomas Witkowski committed
102
    /// Used in \ref initialize().
103
104
    virtual void createFileWriter();

105
106
    /// 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.
107
108
    virtual void doOtherStuff();

109
110
    /// Implementation of ProblemStatBase::solve(). Deligates the solving
    /// of problems system to \ref solver.
111
112
    void solve(AdaptInfo *adaptInfo,
	       bool createMatrixData = true,
113
	       bool storeMatrixData = false) override;
114

115
116
    /// Implementation of ProblemStatBase::estimate(). Deligates the estimation
    /// to \ref estimator.
117
    void estimate(AdaptInfo *adaptInfo) override;
118

119
120
    /// Implementation of ProblemStatBase::markElements().
    /// Deligated to \ref adapt.
121
    Flag markElements(AdaptInfo *adaptInfo) override;
122

123
124
    /// Implementation of ProblemStatBase::refineMesh(). Deligated to the
    /// RefinementManager of \ref adapt.
125
    Flag refineMesh(AdaptInfo *adaptInfo) override;
126

127
128
    /// Implementation of ProblemStatBase::coarsenMesh(). Deligated to the
    /// CoarseningManager of \ref adapt.
129
    Flag coarsenMesh(AdaptInfo *adaptInfo) override;
130

131
132
    /// Implementation of ProblemStatBase::buildBeforeRefine().
    /// Does nothing here.
133
    void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) override {}
134

135
136
    /// Implementation of ProblemStatBase::buildBeforeCoarsen().
    /// Does nothing here.
137
    void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag) override {}
138

139
140
141
    /// Implementation of ProblemStatBase::buildAfterCoarsen().
    /// Assembles \ref A and \ref rhs. With the last two parameters, assembling
    /// can be restricted to matrices or vectors only.
142
    void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag,
143
				   bool assembleMatrix = true,
144
				   bool assembleVector = true) override;
145

146
147
    bool dualMeshTraverseRequired();

148
149
    void dualAssemble(AdaptInfo *adaptInfo, Flag flag, 
		      bool asmMatrix = true, bool asmVector = true);
150

151
152
153
    /// 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.
154
    Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo = FULL_ITERATION) override;
155

Thomas Witkowski's avatar
Thomas Witkowski committed
156
    /// Returns number of managed problems
157
    int getNumProblems() override
158
    { 
159
      return 1; 
Thomas Witkowski's avatar
Thomas Witkowski committed
160
    }
161

162
    /// Implementation of ProblemStatBase::getNumComponents(), TODO: Wrong!!
163
164
    virtual int getNumComponents() 
    { 
165
      return nComponents; 
Thomas Witkowski's avatar
Thomas Witkowski committed
166
    }
167

168
169
    /// Returns the problem with the given number. If only one problem
    /// is managed by this master problem, the number hasn't to be given.
170
    ProblemStatBase *getProblem(int number = 0) override
171
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
172
      return this; 
Thomas Witkowski's avatar
Thomas Witkowski committed
173
    }
174

175
    /// Writes output files. TODO: Make obsolete.
176
177
    void writeFiles(AdaptInfo *adaptInfo, bool force);

178
179
180
    /// Writes output files.
    void writeFiles(AdaptInfo &adaptInfo, bool force);

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

184
    /// Adds an operator to \ref A.
185
    void addMatrixOperator(Operator *op, int i, int j,
186
			   double *factor = NULL, double *estFactor = NULL);
187

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

192
    /// Adds an operator to \ref rhs.
193
    void addVectorOperator(Operator *op, int i,
194
			   double *factor = NULL, double *estFactor = NULL);
195

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

200
201
    /// Adds a Dirichlet boundary condition, where the rhs is given by an 
    /// abstract function.
202
    virtual void addDirichletBC(BoundaryType type, int row, int col,
203
204
				AbstractFunction<double, WorldVector<double> > *b);

205
206
    /// Adds a Dirichlet boundary condition, where the rhs is given by a DOF
    /// vector.
207
208
209
    virtual void addDirichletBC(BoundaryType type, int row, int col,
				DOFVector<double> *vec);

210
211
    /// Adds a Neumann boundary condition, where the rhs is given by an
    /// abstract function.
212
213
214
    virtual void addNeumannBC(BoundaryType type, int row, int col, 
			      AbstractFunction<double, WorldVector<double> > *n);

215
216
217
218
219
220
    /// 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.
221
222
223
224
    virtual void addRobinBC(BoundaryType type, int row, int col, 
			    AbstractFunction<double, WorldVector<double> > *n,
			    AbstractFunction<double, WorldVector<double> > *r);

225
226
227
228
229
230
231
232
233
234
    /// Adds Robin boundary condition.
    virtual void addRobinBC(BoundaryType type, int row, int col, 
			    DOFVector<double> *n,
			    DOFVector<double> *r);

    /// Adds Robin boundary condition.
    virtual void addRobinBC(BoundaryType type, int row, int col, 
			    Operator *n,
			    Operator *r);

235
    /// Adds a periodic boundary condition.
236
237
    virtual void addPeriodicBC(BoundaryType type, int row, int col);

238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
    /// add boundary operator to matrix side
    virtual void addBoundaryMatrixOperator(BoundaryType type, 
          Operator *op, int row, int col);

    virtual void addBoundaryMatrixOperator(BoundaryType type, 
          Operator &op, int row, int col)
    {
      addBoundaryMatrixOperator(type, &op, row, col);
    }

    /// add boundary operator to rhs (vector) side
    virtual void addBoundaryVectorOperator(BoundaryType type, 
          Operator *op, int row);

    virtual void addBoundaryVectorOperator(BoundaryType type, 
          Operator &op, int row)
    {
      addBoundaryVectorOperator(type, &op, row);
    }

258
259
    /// This function assembles a DOFMatrix and a DOFVector for the case,
    /// the meshes from row and col FE-space are equal.
260
    void assembleOnOneMesh(const FiniteElemSpace *feSpace, 
Thomas Witkowski's avatar
Thomas Witkowski committed
261
			   Flag assembleFlag,
Thomas Witkowski's avatar
Thomas Witkowski committed
262
263
			   DOFMatrix *matrix, DOFVector<double> *vector);

Thomas Witkowski's avatar
Thomas Witkowski committed
264
265

    ///
266
267
268
269
    void assembleBoundaryConditions(DOFVector<double> *rhs,
				    DOFVector<double> *solution,
				    Mesh *mesh,
				    Flag assembleFlag);
270
271

 
272
273
274
275
    /** \name getting methods
     * \{ 
     */

Thomas Witkowski's avatar
Thomas Witkowski committed
276
    /// Returns \ref solution.
277
278
    inline SystemVector* getSolution() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
279
280
      return solution; 
    }
281

282
    inline DOFVector<double>* getSolution(int i)
283
284
285
286
    {
      return solution->getDOFVector(i);
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
287
    /// Returns \ref rhs.
288
    inline SystemVector* getRhs() 
289
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
290
291
      return rhs; 
    }
292

293
    inline DOFVector<double>* getRhsVector(int i = 0)
294
295
296
297
    {
      return rhs->getDOFVector(i);
    }

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

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

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
334
    /// Returns \ref feSpaces.
335
    inline std::vector<const FiniteElemSpace*>& getFeSpaces() 
336
    { 
337
      return feSpaces; 
Thomas Witkowski's avatar
Thomas Witkowski committed
338
    }
339

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

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

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

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

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

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

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

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

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

Praetorius, Simon's avatar
Praetorius, Simon committed
394
    /// Returns the name of the problem
395
    inline std::string getComponentName(int comp = 0)
Praetorius, Simon's avatar
Praetorius, Simon committed
396
397
398
399
400
401
    {
      TEST_EXIT(comp < static_cast<int>(componentNames.size()) && comp >= 0)
	("invalid component number\n");
      return componentNames[comp];
    }

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
    /// Returns \ref deserialized;
    bool isDeserialized()
    {
      return deserialized;
    }

420
421
422
423
424
425
    /** \} */

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

Thomas Witkowski's avatar
Thomas Witkowski committed
426
    /// Sets \ref estimator.
427
    inline void setEstimator(std::vector<Estimator*> est) 
428
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
429
430
      estimator = est; 
    }
431

Thomas Witkowski's avatar
Thomas Witkowski committed
432
    /// Sets the FE space for the given component.
433
    inline void setFeSpace(const FiniteElemSpace *feSpace, int comp = 0) 
434
    {
435
      feSpaces[comp] = feSpace;
Thomas Witkowski's avatar
Thomas Witkowski committed
436
    }
437

438
    void setComponentSpace(int comp, const FiniteElemSpace *feSpace)
439
440
441
442
443
444
445
446
447
    {
      if (static_cast<int>(componentSpaces.size()) < nComponents)
        componentSpaces.resize(nComponents);
      TEST_EXIT(comp >= 0 && comp < nComponents)
        ("Component number not in feasable range!");

      componentSpaces[comp] = feSpace;
    }
    
Thomas Witkowski's avatar
Thomas Witkowski committed
448
    /// Sets \ref estimator.
449
    inline void setEstimator(Estimator* est, int comp = 0) 
450
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
451
452
      estimator[comp] = est; 
    }
453

Thomas Witkowski's avatar
Thomas Witkowski committed
454
    /// Sets \ref marker.
455
    inline void setMarker(Marker* mark, int comp = 0) 
456
    { 
457
      marker[comp] = mark; 
Thomas Witkowski's avatar
Thomas Witkowski committed
458
    }
459

Thomas Witkowski's avatar
Thomas Witkowski committed
460
    /// Sets \ref solver.
461
    inline void setSolver(LinearSolverInterface* sol) 
462
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
463
464
      solver = sol; 
    }
465

466
467
468
469
470
    void setSolverMatrix(SolverMatrix<Matrix<DOFMatrix*> >& solverMatrix_)
    {
      solverMatrix.setMatrix(*solverMatrix_.getOriginalMat());
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
471
    ///
472
    inline void setAssembleMatrixOnlyOnce(int i = 0, int j = 0, bool value = true) 
473
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
474
      assembleMatrixOnlyOnce[i][j] = value;
475
476
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
477
    ///
478
    void setExactSolutionFct(AbstractFunction<double, WorldVector<double> > *fct,
479
480
			     int component) 
    {
481
482
483
      exactSolutionFcts[component] = fct;
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
484
    ///
485
    AbstractFunction<double, WorldVector<double> > *getExactSolutionFct(int i = 0) 
486
    {
487
      return exactSolutionFcts[i];
488
489
    }

490
    ///
491
    std::vector< AbstractFunction<double, WorldVector<double> >* > getExactSolutionFcts() 
492
493
494
495
    {
      return exactSolutionFcts;
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
496
    ///
497
498
    void setComputeExactError(bool v) 
    {
499
500
501
      computeExactError = v;
    }

502
503
504
505
506
507
    /// Sets \ref writeAsmInfo;
    void setWriteAsmInfo(bool b)
    {
      writeAsmInfo = b;
    }

508
    void setMeshes(std::vector<Mesh*> meshes_)
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
    {
      meshes = meshes_;
      nMeshes = static_cast<int>(meshes.size());
    }

    void setComponentMesh(int comp, Mesh* mesh)
    {
      if (static_cast<int>(componentMeshes.size()) < nComponents)
        componentMeshes.resize(nComponents);
      TEST_EXIT(comp >= 0 && comp < nComponents)
        ("Component number not in feasable range!");

      componentMeshes[comp] = mesh;
    }

    void setRefinementManager(RefinementManager *ref)
    {
      refinementManager = ref;
    }

    void setCoarseningManager(CoarseningManager *coarse)
    {
      coarseningManager = coarse;
    }
533
534
    /** \} */

535
536
    /// Outputs the mesh of the given component, but the values are taken from
    /// the residual error estimator. 
537
    void writeResidualMesh(int comp, AdaptInfo *adaptInfo, std::string name);
538

Thomas Witkowski's avatar
Thomas Witkowski committed
539
    /// Function that implements the serialization procedure.
540
    void serialize(std::ostream &out) override;
541

Thomas Witkowski's avatar
Thomas Witkowski committed
542
    /// Function that implements the deserialization procedure.
543
    void deserialize(std::istream &in) override;
Thomas Witkowski's avatar
Thomas Witkowski committed
544
545

    /// Returns \ref fileWriters.
546
    std::vector<FileWriterInterface*>& getFileWriterList() 
547
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
548
549
      return fileWriters;
    }
550
551
552
553
554
555
556
557
558
559
    
    double getSolutionTime()
    {
      return solutionTime;
    }
    
    double getBuildTime()
    {
      return buildTime;
    }
560

Thomas Witkowski's avatar
Thomas Witkowski committed
561
  protected:
562
563
    /// If the exact solution is known, the problem can compute the exact
    /// error instead of the error estimation. This is done in this function.
Thomas Witkowski's avatar
Thomas Witkowski committed
564
565
    void computeError(AdaptInfo *adaptInfo);

566
  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
567
568
    
    /// Name of this problem.
569
    std::string name;
570

Thomas Witkowski's avatar
Thomas Witkowski committed
571
    /// Number of problem components
572
    int nComponents;
573

574
575
    /// Stores the names for all components. Is used for naming the solution
    /// vectors, \ref solution.
576
    std::vector<std::string> componentNames;
577

578
579
580
    /// 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.
Thomas Witkowski's avatar
Thomas Witkowski committed
581
582
583
    int nMeshes;

    /// FE spaces of this problem.
584
    std::vector<const FiniteElemSpace*> feSpaces;
585

Thomas Witkowski's avatar
Thomas Witkowski committed
586
    /// Meshes of this problem.
587
    std::vector<Mesh*> meshes;
588

Thomas Witkowski's avatar
Thomas Witkowski committed
589
    /// Pointer to the fe spaces for the different problem components
590
    std::vector<const FiniteElemSpace*> componentSpaces;
591

Thomas Witkowski's avatar
Thomas Witkowski committed
592
    /// Pointer to the meshes for the different problem components
593
    std::vector<Mesh*> componentMeshes;
594

595
596
597
    /// 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.
Thomas Witkowski's avatar
Thomas Witkowski committed
598
599
600
    ComponentTraverseInfo traverseInfo;
    
    /// Responsible for element marking.
601
    std::vector<Marker*> marker;
602

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

Thomas Witkowski's avatar
Thomas Witkowski committed
606
    /// Linear solver of this problem. Used in \ref solve().
607
    LinearSolverInterface *solver;
608

Thomas Witkowski's avatar
Thomas Witkowski committed
609
610
    /// System vector  storing the calculated solution of the problem.
    SystemVector *solution;
611

Thomas Witkowski's avatar
Thomas Witkowski committed
612
613
    /// System vector for the right hand side 
    SystemVector *rhs;
614

Thomas Witkowski's avatar
Thomas Witkowski committed
615
616
    /// System matrix
    Matrix<DOFMatrix*> *systemMatrix;
617

618
619
620
    /// Composed system matrix
    SolverMatrix<Matrix<DOFMatrix*> > solverMatrix;

621
622
623
624
625
    /// 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.
626
    std::vector<std::vector<bool> > assembleMatrixOnlyOnce;
627

628
629
630
631
    /// If [i][j] of this field is set to true, the corresponding DOFMatrix of
    /// the systemMatrix has been assembled at least once. This field is used
    /// to determine, if assembling of a matrix can be ommitted, if it is set
    /// to be assembled only once.
632
    std::vector<std::vector<bool> > assembledMatrix;
633

Thomas Witkowski's avatar
Thomas Witkowski committed
634
635
    /// Determines whether domain boundaries should be considered at assembling.
    bool useGetBound;
636

Thomas Witkowski's avatar
Thomas Witkowski committed
637
    /// Writes the meshes and solution after the adaption loop.
638
    std::vector<FileWriterInterface*> fileWriters;
639

640
641
642
    /// 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
643
    RefinementManager *refinementManager;
644

645
646
647
    /// 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
648
    CoarseningManager *coarseningManager;
649
  
Thomas Witkowski's avatar
Thomas Witkowski committed
650
651
    /// Info level.
    int info;
652

653
654
    /// If true, the stationary problem was deserialized from some serialization
    /// file.
655
656
    bool deserialized;

657
658
659
    /// 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.
660
    std::vector<AbstractFunction<double, WorldVector<double> >*> exactSolutionFcts;
661

662
663
    /// If true, the error is not estimated but computed from the exact solution
    /// defined by \ref exactSolutionFcts.
664
    bool computeExactError;
665
    
666
667
668
669
    /// 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.
670
    bool boundaryConditionSet;
671

672
673
    /// If true, AMDiS prints information about the assembling procedure to 
    /// the screen.
674
    bool writeAsmInfo;
675

676
    std::map<Operator*, std::vector<OperatorPos> > operators;
677
678
679
    
    double solutionTime;
    double buildTime;
680
  };
681
682
683
684

#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
  typedef ProblemStatSeq ProblemStat;
#endif
685
686
687
}

#endif