ProblemStat.h 20.1 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
170
171
    
    virtual int getNumAddComponents()
    {
      return nAddComponents;
    }
172

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

180
    /// Writes output files. TODO: Make obsolete.
181
182
    void writeFiles(AdaptInfo *adaptInfo, bool force);

183
184
185
    /// Writes output files.
    void writeFiles(AdaptInfo &adaptInfo, bool force);

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

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

193
    /// Adds an operator to \ref A.
194
    void addMatrixOperator(Operator &op, int i, int j,
195
			   double *factor = NULL, double *estFactor = NULL);
196

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

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

205
206
    /// Adds a Dirichlet boundary condition, where the rhs is given by an 
    /// abstract function.
207
    virtual void addDirichletBC(BoundaryType type, int row, int col,
208
209
				AbstractFunction<double, WorldVector<double> > *b);

210
211
    /// Adds a Dirichlet boundary condition, where the rhs is given by a DOF
    /// vector.
212
213
214
    virtual void addDirichletBC(BoundaryType type, int row, int col,
				DOFVector<double> *vec);

215
216
    /// Adds a Neumann boundary condition, where the rhs is given by an
    /// abstract function.
217
218
219
    virtual void addNeumannBC(BoundaryType type, int row, int col, 
			      AbstractFunction<double, WorldVector<double> > *n);

220
221
222
223
224
225
    /// 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.
226
227
228
229
    virtual void addRobinBC(BoundaryType type, int row, int col, 
			    AbstractFunction<double, WorldVector<double> > *n,
			    AbstractFunction<double, WorldVector<double> > *r);

230
231
232
233
234
235
236
237
238
239
    /// 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);

240
    /// Adds a periodic boundary condition.
241
242
    virtual void addPeriodicBC(BoundaryType type, int row, int col);

243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
    /// 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);
    }

263
264
    /// This function assembles a DOFMatrix and a DOFVector for the case,
    /// the meshes from row and col FE-space are equal.
265
    void assembleOnOneMesh(const FiniteElemSpace *feSpace, 
Thomas Witkowski's avatar
Thomas Witkowski committed
266
			   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
272
273
274
    void assembleBoundaryConditions(DOFVector<double> *rhs,
				    DOFVector<double> *solution,
				    Mesh *mesh,
				    Flag assembleFlag);
275
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
    inline DOFVector<double>* getSolution(int i)
288
289
290
291
    {
      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
    inline DOFVector<double>* getRhsVector(int i = 0)
299
300
301
302
    {
      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("ProblemStatSeq::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
    inline std::vector<Mesh*> getMeshes() 
326
    {
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 const FiniteElemSpace* getFeSpace(int comp = 0) 
332
    { 
333
      FUNCNAME("ProblemStatSeq::getFeSpace()");
334
      TEST_EXIT(comp < static_cast<int>(componentSpaces.size()) && comp >= 0)
335
	("invalid component number: %d\n", comp);
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<const 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<const FiniteElemSpace*>& getComponentSpaces() 
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
    inline LinearSolverInterface* getSolver() 
377
    { 
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
394
    inline std::string getName() override
395
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
396
397
      return name; 
    }
398

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

Thomas Witkowski's avatar
Thomas Witkowski committed
407
    /// Returns \ref useGetBound.
408
409
    inline bool getBoundUsed() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
410
411
      return useGetBound; 
    }
412

413
414
415
416
417
418
    /// Returns \ref info.
    int getInfo()
    {
      return info;
    }

419
420
421
422
423
424
    /// Returns \ref deserialized;
    bool isDeserialized()
    {
      return deserialized;
    }

425
426
427
428
429
430
    /** \} */

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

Thomas Witkowski's avatar
Thomas Witkowski committed
431
    /// Sets \ref estimator.
432
    inline void setEstimator(std::vector<Estimator*> est) 
433
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
434
435
      estimator = est; 
    }
436

Thomas Witkowski's avatar
Thomas Witkowski committed
437
    /// Sets the FE space for the given component.
438
    inline void setFeSpace(const FiniteElemSpace *feSpace, int comp = 0) 
439
    {
440
      feSpaces[comp] = feSpace;
Thomas Witkowski's avatar
Thomas Witkowski committed
441
    }
442

443
444
445
446
447
    void setFeSpaces(std::vector<FiniteElemSpace const*> feSpaces_)
    {
      feSpaces = feSpaces_;
    }

448
    void setComponentSpace(int comp, const FiniteElemSpace *feSpace)
449
450
451
    {
      if (static_cast<int>(componentSpaces.size()) < nComponents)
        componentSpaces.resize(nComponents);
452
      TEST_EXIT(comp >= 0 && comp < nComponents + nAddComponents)
453
454
455
456
457
        ("Component number not in feasable range!");

      componentSpaces[comp] = feSpace;
    }
    
Thomas Witkowski's avatar
Thomas Witkowski committed
458
    /// Sets \ref estimator.
459
    inline void setEstimator(Estimator* est, int comp = 0) 
460
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
461
462
      estimator[comp] = est; 
    }
463

Thomas Witkowski's avatar
Thomas Witkowski committed
464
    /// Sets \ref marker.
465
    inline void setMarker(Marker* mark, int comp = 0) 
466
    { 
467
      marker[comp] = mark; 
Thomas Witkowski's avatar
Thomas Witkowski committed
468
    }
469

Thomas Witkowski's avatar
Thomas Witkowski committed
470
    /// Sets \ref solver.
471
    inline void setSolver(LinearSolverInterface* sol) 
472
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
473
474
      solver = sol; 
    }
475

476
477
478
479
480
    void setSolverMatrix(SolverMatrix<Matrix<DOFMatrix*> >& solverMatrix_)
    {
      solverMatrix.setMatrix(*solverMatrix_.getOriginalMat());
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
481
    ///
482
    inline void setAssembleMatrixOnlyOnce(int i = 0, int j = 0, bool value = true) 
483
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
484
      assembleMatrixOnlyOnce[i][j] = value;
485
486
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
487
    ///
488
    void setExactSolutionFct(AbstractFunction<double, WorldVector<double> > *fct,
489
490
			     int component) 
    {
491
492
493
      exactSolutionFcts[component] = fct;
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
494
    ///
495
    AbstractFunction<double, WorldVector<double> > *getExactSolutionFct(int i = 0) 
496
    {
497
      return exactSolutionFcts[i];
498
499
    }

500
    ///
501
    std::vector< AbstractFunction<double, WorldVector<double> >* > getExactSolutionFcts() 
502
503
504
505
    {
      return exactSolutionFcts;
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
506
    ///
507
508
    void setComputeExactError(bool v) 
    {
509
510
511
      computeExactError = v;
    }

512
513
514
515
516
517
    /// Sets \ref writeAsmInfo;
    void setWriteAsmInfo(bool b)
    {
      writeAsmInfo = b;
    }

518
    void setMeshes(std::vector<Mesh*> meshes_)
519
520
521
522
523
524
525
526
527
    {
      meshes = meshes_;
      nMeshes = static_cast<int>(meshes.size());
    }

    void setComponentMesh(int comp, Mesh* mesh)
    {
      if (static_cast<int>(componentMeshes.size()) < nComponents)
        componentMeshes.resize(nComponents);
528
      TEST_EXIT(comp >= 0 && comp < nComponents + nAddComponents)
529
530
531
532
533
534
535
536
537
538
539
540
541
542
        ("Component number not in feasable range!");

      componentMeshes[comp] = mesh;
    }

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

    void setCoarseningManager(CoarseningManager *coarse)
    {
      coarseningManager = coarse;
    }
543
544
    /** \} */

545
546
    /// Outputs the mesh of the given component, but the values are taken from
    /// the residual error estimator. 
547
    void writeResidualMesh(int comp, AdaptInfo *adaptInfo, std::string name);
548

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

Thomas Witkowski's avatar
Thomas Witkowski committed
552
    /// Function that implements the deserialization procedure.
553
    void deserialize(std::istream &in) override;
Thomas Witkowski's avatar
Thomas Witkowski committed
554
555

    /// Returns \ref fileWriters.
556
    std::vector<FileWriterInterface*>& getFileWriterList() 
557
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
558
559
      return fileWriters;
    }
560
561
562
563
564
565
566
567
568
569
    
    double getSolutionTime()
    {
      return solutionTime;
    }
    
    double getBuildTime()
    {
      return buildTime;
    }
570

Thomas Witkowski's avatar
Thomas Witkowski committed
571
  protected:
572
573
    /// 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
574
575
    void computeError(AdaptInfo *adaptInfo);

576
  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
577
578
    
    /// Name of this problem.
579
    std::string name;
580

Thomas Witkowski's avatar
Thomas Witkowski committed
581
    /// Number of problem components
582
    int nComponents;
583
584
585
    
    /// Number of additional components
    int nAddComponents;
586

587
588
    /// Stores the names for all components. Is used for naming the solution
    /// vectors, \ref solution.
589
    std::vector<std::string> componentNames;
590

591
592
593
    /// 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
594
595
596
    int nMeshes;

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

Thomas Witkowski's avatar
Thomas Witkowski committed
599
    /// Meshes of this problem.
600
    std::vector<Mesh*> meshes;
601

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

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

608
609
610
    /// 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
611
612
613
    ComponentTraverseInfo traverseInfo;
    
    /// Responsible for element marking.
614
    std::vector<Marker*> marker;
615

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

Thomas Witkowski's avatar
Thomas Witkowski committed
619
    /// Linear solver of this problem. Used in \ref solve().
620
    LinearSolverInterface *solver;
621

Thomas Witkowski's avatar
Thomas Witkowski committed
622
623
    /// System vector  storing the calculated solution of the problem.
    SystemVector *solution;
624

Thomas Witkowski's avatar
Thomas Witkowski committed
625
626
    /// System vector for the right hand side 
    SystemVector *rhs;
627

Thomas Witkowski's avatar
Thomas Witkowski committed
628
629
    /// System matrix
    Matrix<DOFMatrix*> *systemMatrix;
630

631
632
633
    /// Composed system matrix
    SolverMatrix<Matrix<DOFMatrix*> > solverMatrix;

634
635
636
637
638
    /// 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.
639
    std::vector<std::vector<bool> > assembleMatrixOnlyOnce;
640

641
642
643
644
    /// 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.
645
    std::vector<std::vector<bool> > assembledMatrix;
646

Thomas Witkowski's avatar
Thomas Witkowski committed
647
648
    /// Determines whether domain boundaries should be considered at assembling.
    bool useGetBound;
649

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

653
654
655
    /// 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
656
    RefinementManager *refinementManager;
657

658
659
660
    /// 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
661
    CoarseningManager *coarseningManager;
662
  
Thomas Witkowski's avatar
Thomas Witkowski committed
663
664
    /// Info level.
    int info;
665

666
667
    /// If true, the stationary problem was deserialized from some serialization
    /// file.
668
669
    bool deserialized;

670
671
672
    /// 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.
673
    std::vector<AbstractFunction<double, WorldVector<double> >*> exactSolutionFcts;
674

675
676
    /// If true, the error is not estimated but computed from the exact solution
    /// defined by \ref exactSolutionFcts.
677
    bool computeExactError;
678
    
679
680
681
682
    /// 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.
683
    bool boundaryConditionSet;
684

685
686
    /// If true, AMDiS prints information about the assembling procedure to 
    /// the screen.
687
    bool writeAsmInfo;
688

689
    std::map<Operator*, std::vector<OperatorPos> > operators;
690
691
692
    
    double solutionTime;
    double buildTime;
693
694
    
    template <class> friend class detail::CouplingProblemStat;
695
  };
696
697
698
699

#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
  typedef ProblemStatSeq ProblemStat;
#endif
700
701
702
}

#endif