ProblemStat.h 20 KB
Newer Older
1
2
3
4
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
5
// ==  http://www.amdis-fem.org                                              ==
6
7
// ==                                                                        ==
// ============================================================================
8
9
10
11
12
13
14
15
16
17
18
19
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.


20

21
/** \file ProblemStat.h */
22

23
24
#ifndef AMDIS_PROBLEM_STAT_H
#define AMDIS_PROBLEM_STAT_H
25

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

namespace AMDiS {

42
43
  using namespace std;

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

51

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

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

67
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
68
    /// Constructor
69
    ProblemStatSeq(string nameStr,
70
		   ProblemIterationInterface *problemIteration = NULL)
71
      : StandardProblemIteration(this),
Thomas Witkowski's avatar
Thomas Witkowski committed
72
	name(nameStr),
73
	nComponents(-1),
Thomas Witkowski's avatar
Thomas Witkowski committed
74
75
76
77
78
79
80
	nMeshes(0),
	traverseInfo(0),
	solver(NULL),
	solution(NULL),
	rhs(NULL),
	systemMatrix(NULL),
	useGetBound(true),
81
82
        refinementManager(NULL),
        coarseningManager(NULL),
Thomas Witkowski's avatar
Thomas Witkowski committed
83
	info(10),
84
	deserialized(false),
85
	computeExactError(false),
86
87
	boundaryConditionSet(false),
	writeAsmInfo(false)
88
    {
89
      Parameters::get(name + "->components", nComponents);
90
      TEST_EXIT(nComponents > 0)("components not set!\n");    
Thomas Witkowski's avatar
Thomas Witkowski committed
91
      estimator.resize(nComponents, NULL);
92
      marker.resize(nComponents, NULL);
93

Thomas Witkowski's avatar
Thomas Witkowski committed
94
95
      assembleMatrixOnlyOnce.resize(nComponents);
      assembledMatrix.resize(nComponents);
96
      for (int i = 0; i < nComponents; i++) {
Thomas Witkowski's avatar
Thomas Witkowski committed
97
98
	assembleMatrixOnlyOnce[i].resize(nComponents);
	assembledMatrix[i].resize(nComponents);
99
	for (int j = 0; j < nComponents; j++) {
Thomas Witkowski's avatar
Thomas Witkowski committed
100
101
	  assembleMatrixOnlyOnce[i][j] = false;
	  assembledMatrix[i][j] = false;
102
103
	}
      }
104
105

      exactSolutionFcts.resize(nComponents);
Thomas Witkowski's avatar
Thomas Witkowski committed
106
    }
107

Thomas Witkowski's avatar
Thomas Witkowski committed
108
    /// Destructor
109
    virtual ~ProblemStatSeq() {}
110

Thomas Witkowski's avatar
Thomas Witkowski committed
111
    /// Initialisation of the problem.
112
    virtual void initialize(Flag initFlag,
113
			    ProblemStatSeq *adoptProblem = NULL,
114
115
			    Flag adoptFlag = INIT_NOTHING);

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

119
120
121
    /// Used in \ref initialize().
    virtual void createRefCoarseManager();

Thomas Witkowski's avatar
Thomas Witkowski committed
122
    /// Used in \ref initialize().
123
    virtual void createFeSpace(DOFAdmin *admin);
124

Thomas Witkowski's avatar
Thomas Witkowski committed
125
    /// Used in \ref initialize().
126
127
    virtual void createMatricesAndVectors();

Thomas Witkowski's avatar
Thomas Witkowski committed
128
    /// Used in \ref initialize().
129
130
    virtual void createSolver();

Thomas Witkowski's avatar
Thomas Witkowski committed
131
    /// Used in \ref initialize().
132
133
    virtual void createEstimator();

Thomas Witkowski's avatar
Thomas Witkowski committed
134
    /// Used in \ref initialize().
135
136
    virtual void createMarker();

Thomas Witkowski's avatar
Thomas Witkowski committed
137
    /// Used in \ref initialize().
138
139
    virtual void createFileWriter();

140
141
142
143
    /** \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.
     */
144
145
146
147
148
149
    virtual void doOtherStuff();

    /** \brief
     * Implementation of ProblemStatBase::solve(). Deligates the solving
     * of problems system to \ref solver.
     */
150
151
152
    void solve(AdaptInfo *adaptInfo,
	       bool createMatrixData = true,
	       bool storeMatrixData = false);
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181

    /** \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
182
    virtual void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) {}
183
184
185
186
187

    /** \brief
     * Implementation of ProblemStatBase::buildBeforeCoarsen().
     * Does nothing here.
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
188
    virtual void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag) {}
189
190
191

    /** \brief
     * Implementation of ProblemStatBase::buildAfterCoarsen().
192
193
     * Assembles \ref A and \ref rhs. With the last two parameters, assembling
     * can be restricted to matrices or vectors only.
194
     */
195
196
197
    virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag,
				   bool assembleMatrix = true,
				   bool assembleVector = true);
198

199
200
    void buildAfterCoarsen_sebastianMode(AdaptInfo *adaptInfo, Flag flag);

201
202
    bool dualMeshTraverseRequired();

203
204
    void dualAssemble(AdaptInfo *adaptInfo, Flag flag, 
		      bool asmMatrix = true, bool asmVector = true);
205

206
207
208
209
210
211
212
    /** \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
213
    /// Returns number of managed problems
214
215
    virtual int getNumProblems() 
    { 
216
      return 1; 
Thomas Witkowski's avatar
Thomas Witkowski committed
217
    }
218

Thomas Witkowski's avatar
Thomas Witkowski committed
219
    /// Implementation of ProblemStatBase::getNumComponents()
220
221
    virtual int getNumComponents() 
    { 
222
      return nComponents; 
Thomas Witkowski's avatar
Thomas Witkowski committed
223
    }
224
225
226
227
228

    /** \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.
     */
229
230
    virtual ProblemStatBase *getProblem(int number = 0) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
231
      return this; 
Thomas Witkowski's avatar
Thomas Witkowski committed
232
    }
233

234
    /// Writes output files. TODO: Make obsolete.
235
236
    void writeFiles(AdaptInfo *adaptInfo, bool force);

237
238
239
    /// Writes output files.
    void writeFiles(AdaptInfo &adaptInfo, bool force);

Thomas Witkowski's avatar
Thomas Witkowski committed
240
    /// Interpolates fct to \ref solution.
241
    void interpolInitialSolution(vector<AbstractFunction<double, WorldVector<double> >*> *fct);
242

243
    /// Adds an operator to \ref A.
244
    void addMatrixOperator(Operator *op, int i, int j,
245
246
			   double *factor = NULL, double *estFactor = NULL);

247
    /// Adds an operator to \ref A.
248
249
    void addMatrixOperator(Operator &op, int i, int j,
			   double *factor = NULL, double *estFactor = NULL);
250

251
    /// Adds an operator to \ref rhs.
252
    void addVectorOperator(Operator *op, int i,
253
254
			   double *factor = NULL, double *estFactor = NULL);

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

259
260
    /// Adds a Dirichlet boundary condition, where the rhs is given by an 
    /// abstract function.
261
    virtual void addDirichletBC(BoundaryType type, int row, int col,
262
263
				AbstractFunction<double, WorldVector<double> > *b);

264
265
    /// Adds a Dirichlet boundary condition, where the rhs is given by a DOF
    /// vector.
266
267
268
    virtual void addDirichletBC(BoundaryType type, int row, int col,
				DOFVector<double> *vec);

269
270
    /// Adds a Neumann boundary condition, where the rhs is given by an
    /// abstract function.
271
272
273
    virtual void addNeumannBC(BoundaryType type, int row, int col, 
			      AbstractFunction<double, WorldVector<double> > *n);

274
275
276
277
278
279
    /// 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.
280
281
282
283
    virtual void addRobinBC(BoundaryType type, int row, int col, 
			    AbstractFunction<double, WorldVector<double> > *n,
			    AbstractFunction<double, WorldVector<double> > *r);

284
285
286
287
288
289
290
291
292
293
    /// 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);

294
    /// Adds a periodic boundary condition.
295
296
    virtual void addPeriodicBC(BoundaryType type, int row, int col);

297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
    /// 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);
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
317
318
319
320
    /** \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
321
322
    void assembleOnOneMesh(FiniteElemSpace *feSpace, 
			   Flag assembleFlag,
Thomas Witkowski's avatar
Thomas Witkowski committed
323
324
			   DOFMatrix *matrix, DOFVector<double> *vector);

Thomas Witkowski's avatar
Thomas Witkowski committed
325
326

    ///
327
328
329
330
    void assembleBoundaryConditions(DOFVector<double> *rhs,
				    DOFVector<double> *solution,
				    Mesh *mesh,
				    Flag assembleFlag);
331
332
333
334
335
  
    /** \name getting methods
     * \{ 
     */

Thomas Witkowski's avatar
Thomas Witkowski committed
336
    /// Returns \ref solution.
337
338
    inline SystemVector* getSolution() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
339
340
      return solution; 
    }
341

342
    inline DOFVector<double>* getSolution(int i)
343
344
345
346
    {
      return solution->getDOFVector(i);
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
347
    /// Returns \ref rhs.
348
    inline SystemVector* getRhs() 
349
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
350
351
      return rhs; 
    }
352

353
354
355
356
357
    inline const DOFVector<double>* getRhsVector(int i = 0)
    {
      return rhs->getDOFVector(i);
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
358
    /// Returns \ref systemMatrix.
359
360
    inline Matrix<DOFMatrix*> *getSystemMatrix() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
361
362
      return systemMatrix; 
    }
363

Thomas Witkowski's avatar
Thomas Witkowski committed
364
    /// Returns a pointer to the corresponding DOFMatrix.
365
366
    inline DOFMatrix* getSystemMatrix(int row, int col) 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
367
368
369
370
      return (*systemMatrix)[row][col];
    }

    /// Returns mesh of given component
371
    inline Mesh* getMesh(int comp = 0) 
372
    {
373
      FUNCNAME("ProblemStatSeq::getMesh()");
Thomas Witkowski's avatar
Thomas Witkowski committed
374
      TEST_EXIT(comp < static_cast<int>(componentMeshes.size()) && comp >= 0)
375
	("invalid component number\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
376
      return componentMeshes[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
377
    }
378

Thomas Witkowski's avatar
Thomas Witkowski committed
379
    /// Returns \ref meshes
380
    inline vector<Mesh*> getMeshes() 
381
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
382
383
      return meshes; 
    }
384

Thomas Witkowski's avatar
Thomas Witkowski committed
385
    /// Returns \ref feSpace_.
386
    inline FiniteElemSpace* getFeSpace(int comp = 0) 
387
    { 
388
      FUNCNAME("ProblemStatSeq::getFeSpace()");
389
      TEST_EXIT(comp < static_cast<int>(componentSpaces.size()) && comp >= 0)
390
	("invalid component number\n");
391
      return componentSpaces[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
392
    }
393

Thomas Witkowski's avatar
Thomas Witkowski committed
394
    /// Returns \ref feSpaces.
395
    inline vector<FiniteElemSpace*> getFeSpaces() 
396
    { 
397
      return feSpaces; 
Thomas Witkowski's avatar
Thomas Witkowski committed
398
    }
399

Thomas Witkowski's avatar
Thomas Witkowski committed
400
    /// Returns \ref componentSpaces;
401
    inline vector<FiniteElemSpace*> getComponentFeSpaces() 
402
    {
403
      return componentSpaces;
404
405
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
406
    /// Returns \ref estimator.
407
    inline vector<Estimator*> getEstimators() 
408
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
409
410
      return estimator; 
    }
411

Thomas Witkowski's avatar
Thomas Witkowski committed
412
    /// Returns \ref estimator.
413
    inline Estimator* getEstimator(int comp = 0) 
414
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
415
416
      return estimator[comp]; 
    }
417

Thomas Witkowski's avatar
Thomas Witkowski committed
418
    /// Returns \ref refinementManager.
419
    inline RefinementManager* getRefinementManager(int comp = 0) 
420
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
421
422
      return refinementManager; 
    }
423

Thomas Witkowski's avatar
Thomas Witkowski committed
424
    /// Returns \ref refinementManager.
425
    inline CoarseningManager* getCoarseningManager(int comp = 0) 
426
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
427
428
      return coarseningManager; 
    }
429

Thomas Witkowski's avatar
Thomas Witkowski committed
430
    /// Returns \ref solver.
431
432
    inline OEMSolver* getSolver() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
433
434
      return solver; 
    }
435

Thomas Witkowski's avatar
Thomas Witkowski committed
436
    /// Returns \ref marker.
437
    inline Marker *getMarker(int comp = 0) 
438
    { 
439
      return marker[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
440
    }
441

Thomas Witkowski's avatar
Thomas Witkowski committed
442
    /// Returns \ref marker.
443
    inline vector<Marker*> getMarkers() 
444
    { 
445
      return marker; 
Thomas Witkowski's avatar
Thomas Witkowski committed
446
    }
447

Thomas Witkowski's avatar
Thomas Witkowski committed
448
    /// Returns the name of the problem
449
    inline virtual string getName() 
450
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
451
452
      return name; 
    }
453

Thomas Witkowski's avatar
Thomas Witkowski committed
454
    /// Returns \ref useGetBound.
455
456
    inline bool getBoundUsed() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
457
458
      return useGetBound; 
    }
459

460
461
462
463
464
465
    /// Returns \ref info.
    int getInfo()
    {
      return info;
    }

466
467
468
469
470
471
    /// Returns \ref deserialized;
    bool isDeserialized()
    {
      return deserialized;
    }

472
473
474
475
476
477
    /** \} */

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

Thomas Witkowski's avatar
Thomas Witkowski committed
478
    /// Sets \ref estimator.
479
    inline void setEstimator(vector<Estimator*> est) 
480
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
481
482
      estimator = est; 
    }
483

Thomas Witkowski's avatar
Thomas Witkowski committed
484
    /// Sets the FE space for the given component.
485
    inline void setFeSpace(FiniteElemSpace *feSpace, int comp = 0) 
486
    {
487
      feSpaces[comp] = feSpace;
Thomas Witkowski's avatar
Thomas Witkowski committed
488
    }
489

Thomas Witkowski's avatar
Thomas Witkowski committed
490
    /// Sets \ref estimator.
491
    inline void setEstimator(Estimator* est, int comp = 0) 
492
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
493
494
      estimator[comp] = est; 
    }
495

Thomas Witkowski's avatar
Thomas Witkowski committed
496
    /// Sets \ref marker.
497
    inline void setMarker(Marker* mark, int comp = 0) 
498
    { 
499
      marker[comp] = mark; 
Thomas Witkowski's avatar
Thomas Witkowski committed
500
    }
501

Thomas Witkowski's avatar
Thomas Witkowski committed
502
    /// Sets \ref solver.
503
504
    inline void setSolver(OEMSolver* sol) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
505
506
      solver = sol; 
    }
507

Thomas Witkowski's avatar
Thomas Witkowski committed
508
    ///
509
    inline void setAssembleMatrixOnlyOnce(int i = 0, int j = 0, bool value = true) 
510
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
511
      assembleMatrixOnlyOnce[i][j] = value;
512
513
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
514
    ///
515
    void setExactSolutionFct(AbstractFunction<double, WorldVector<double> > *fct,
516
517
			     int component) 
    {
518
519
520
      exactSolutionFcts[component] = fct;
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
521
    ///
522
    AbstractFunction<double, WorldVector<double> > *getExactSolutionFct(int i = 0) 
523
    {
524
      return exactSolutionFcts[i];
525
526
    }

527
528
529
530
531
532
    ///
    vector< AbstractFunction<double, WorldVector<double> >* > getExactSolutionFcts() 
    {
      return exactSolutionFcts;
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
533
    ///
534
535
    void setComputeExactError(bool v) 
    {
536
537
538
      computeExactError = v;
    }

539
540
541
542
543
544
    /// Sets \ref writeAsmInfo;
    void setWriteAsmInfo(bool b)
    {
      writeAsmInfo = b;
    }

545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
    void setMeshes(vector<Mesh*> meshes_)
    {
      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;
    }
570
571
    /** \} */

Thomas Witkowski's avatar
Thomas Witkowski committed
572
573
574
575
    /** \brief
     * Outputs the mesh of the given component, but the values are taken from the 
     * residual error estimator. 
     */
576
    void writeResidualMesh(int comp, AdaptInfo *adaptInfo, string name);
577

Thomas Witkowski's avatar
Thomas Witkowski committed
578
    /// Function that implements the serialization procedure.
579
    virtual void serialize(ostream &out);
580

Thomas Witkowski's avatar
Thomas Witkowski committed
581
    /// Function that implements the deserialization procedure.
582
    virtual void deserialize(istream &in);
583

Thomas Witkowski's avatar
Thomas Witkowski committed
584
585

    /// Returns \ref fileWriters.
586
    vector<FileWriterInterface*>& getFileWriterList() 
587
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
588
589
      return fileWriters;
    }
590

Thomas Witkowski's avatar
Thomas Witkowski committed
591
592
593
594
595
596
597
  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);

598
  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
599
600
    
    /// Name of this problem.
601
    string name;
602

Thomas Witkowski's avatar
Thomas Witkowski committed
603
    /// Number of problem components
604
    int nComponents;
605
606

    /** \brief
Thomas Witkowski's avatar
Thomas Witkowski committed
607
608
609
     * 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.
610
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
611
612
613
    int nMeshes;

    /// FE spaces of this problem.
614
    vector<FiniteElemSpace*> feSpaces;
615

Thomas Witkowski's avatar
Thomas Witkowski committed
616
    /// Meshes of this problem.
617
    vector<Mesh*> meshes;
618

Thomas Witkowski's avatar
Thomas Witkowski committed
619
    /// Pointer to the fe spaces for the different problem components
620
    vector<FiniteElemSpace*> componentSpaces;
621

Thomas Witkowski's avatar
Thomas Witkowski committed
622
    /// Pointer to the meshes for the different problem components
623
    vector<Mesh*> componentMeshes;
624
625

    /** \brief
Thomas Witkowski's avatar
Thomas Witkowski committed
626
627
628
     * 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.
629
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
630
631
632
    ComponentTraverseInfo traverseInfo;
    
    /// Responsible for element marking.
633
    vector<Marker*> marker;
634

Thomas Witkowski's avatar
Thomas Witkowski committed
635
    /// Estimator of this problem. Used in \ref estimate().
636
    vector<Estimator*> estimator;
637

Thomas Witkowski's avatar
Thomas Witkowski committed
638
    /// Linear solver of this problem. Used in \ref solve().
639
    OEMSolver *solver;
640

Thomas Witkowski's avatar
Thomas Witkowski committed
641
642
    /// System vector  storing the calculated solution of the problem.
    SystemVector *solution;
643

Thomas Witkowski's avatar
Thomas Witkowski committed
644
645
    /// System vector for the right hand side 
    SystemVector *rhs;
646

Thomas Witkowski's avatar
Thomas Witkowski committed
647
648
    /// System matrix
    Matrix<DOFMatrix*> *systemMatrix;
649

650
651
652
    /// Composed system matrix
    SolverMatrix<Matrix<DOFMatrix*> > solverMatrix;

653
654
655
656
657
658
659
    /** \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.
     */
660
    vector<vector<bool> > assembleMatrixOnlyOnce;
661
662
663

    /** \brief
     * If [i][j] of this field is set to true, the corresponding DOFMatrix of
Thomas Witkowski's avatar
Thomas Witkowski committed
664
     * the systemMatrix has been assembled at least once. This field is used
665
666
667
     * to determine, if assembling of a matrix can be ommitted, if it is set
     * to be assembled only once.
     */
668
    vector<vector<bool> > assembledMatrix;
669

Thomas Witkowski's avatar
Thomas Witkowski committed
670
671
    /// Determines whether domain boundaries should be considered at assembling.
    bool useGetBound;
672

Thomas Witkowski's avatar
Thomas Witkowski committed
673
    /// Writes the meshes and solution after the adaption loop.
674
    vector<FileWriterInterface*> fileWriters;
675
676
677
678
679
680

    /** \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
681
    RefinementManager *refinementManager;
682
683
684
685
686
687

    /** \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
688
    CoarseningManager *coarseningManager;
689
  
Thomas Witkowski's avatar
Thomas Witkowski committed
690
691
    /// Info level.
    int info;
692

693
694
695
    /// If true, the stationary problem was deserialized from some serialization file.
    bool deserialized;

696
697
698
699
700
    /** \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.
     */
701
    vector<AbstractFunction<double, WorldVector<double> >*> exactSolutionFcts;
702
703
704
705
706
707

    /** \brief
     * If true, the error is not estimated but computed from the exact solution
     * defined by \ref exactSolutionFcts.
     */
    bool computeExactError;
708
709
710
711
712
713
714
    
    /** \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;
715

716
717
    /// If true, AMDiS prints information about the assembling procedure to the screen.
    bool writeAsmInfo;
718

719
    map<Operator*, vector<OperatorPos> > operators;
720

721
    map<Operator*, Flag> opFlags;
722
  };
723
724
725
726

#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
  typedef ProblemStatSeq ProblemStat;
#endif
727
728
729
}

#endif