ProblemStat.h 19.2 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
71
	       ProblemIterationInterface *problemIteration = NULL)
      : 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
81
	nMeshes(0),
	traverseInfo(0),
	solver(NULL),
	solution(NULL),
	rhs(NULL),
	systemMatrix(NULL),
	useGetBound(true),
	info(10),
82
	deserialized(false),
83
	computeExactError(false),
84
85
	boundaryConditionSet(false),
	writeAsmInfo(false)
86
    {
87
      Parameters::get(name + "->components", nComponents);
88
      TEST_EXIT(nComponents > 0)("components not set!\n");    
Thomas Witkowski's avatar
Thomas Witkowski committed
89
      estimator.resize(nComponents, NULL);
90
      marker.resize(nComponents, NULL);
91

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

      exactSolutionFcts.resize(nComponents);
Thomas Witkowski's avatar
Thomas Witkowski committed
104
    }
105

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
117
    /// Used in \ref initialize().
118
    virtual void createFeSpace(DOFAdmin *admin);
119

Thomas Witkowski's avatar
Thomas Witkowski committed
120
    /// Used in \ref initialize().
121
122
    virtual void createMatricesAndVectors();

Thomas Witkowski's avatar
Thomas Witkowski committed
123
    /// Used in \ref initialize().
124
125
    virtual void createSolver();

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

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

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

135
136
137
138
    /** \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.
     */
139
140
141
142
143
144
    virtual void doOtherStuff();

    /** \brief
     * Implementation of ProblemStatBase::solve(). Deligates the solving
     * of problems system to \ref solver.
     */
145
    virtual void solve(AdaptInfo *adaptInfo, bool fixedMatrix = false);
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174

    /** \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
175
    virtual void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) {}
176
177
178
179
180

    /** \brief
     * Implementation of ProblemStatBase::buildBeforeCoarsen().
     * Does nothing here.
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
181
    virtual void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag) {}
182
183
184

    /** \brief
     * Implementation of ProblemStatBase::buildAfterCoarsen().
185
186
     * Assembles \ref A and \ref rhs. With the last two parameters, assembling
     * can be restricted to matrices or vectors only.
187
     */
188
189
190
    virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag,
				   bool assembleMatrix = true,
				   bool assembleVector = true);
191

192
193
    void buildAfterCoarsen_sebastianMode(AdaptInfo *adaptInfo, Flag flag);

194
195
    bool dualMeshTraverseRequired();

196
197
    void dualAssemble(AdaptInfo *adaptInfo, Flag flag, 
		      bool asmMatrix = true, bool asmVector = true);
198

199
200
201
202
203
204
205
    /** \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
206
    /// Returns number of managed problems
207
208
    virtual int getNumProblems() 
    { 
209
      return 1; 
Thomas Witkowski's avatar
Thomas Witkowski committed
210
    }
211

Thomas Witkowski's avatar
Thomas Witkowski committed
212
    /// Implementation of ProblemStatBase::getNumComponents()
213
214
    virtual int getNumComponents() 
    { 
215
      return nComponents; 
Thomas Witkowski's avatar
Thomas Witkowski committed
216
    }
217
218
219
220
221

    /** \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.
     */
222
223
    virtual ProblemStatBase *getProblem(int number = 0) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
224
      return this; 
Thomas Witkowski's avatar
Thomas Witkowski committed
225
    }
226

227
    /// Writes output files. TODO: Make obsolete.
228
229
    void writeFiles(AdaptInfo *adaptInfo, bool force);

230
231
232
    /// Writes output files.
    void writeFiles(AdaptInfo &adaptInfo, bool force);

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

236
    /// Adds an operator to \ref A.
237
    void addMatrixOperator(Operator *op, int i, int j,
238
239
			   double *factor = NULL, double *estFactor = NULL);

240
    /// Adds an operator to \ref A.
241
242
    void addMatrixOperator(Operator &op, int i, int j,
			   double *factor = NULL, double *estFactor = NULL);
243

244
    /// Adds an operator to \ref rhs.
245
    void addVectorOperator(Operator *op, int i,
246
247
			   double *factor = NULL, double *estFactor = NULL);

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

252
253
    /// Adds a Dirichlet boundary condition, where the rhs is given by an 
    /// abstract function.
254
    virtual void addDirichletBC(BoundaryType type, int row, int col,
255
256
				AbstractFunction<double, WorldVector<double> > *b);

257
258
    /// Adds a Dirichlet boundary condition, where the rhs is given by a DOF
    /// vector.
259
260
261
    virtual void addDirichletBC(BoundaryType type, int row, int col,
				DOFVector<double> *vec);

262
263
    /// Adds a Neumann boundary condition, where the rhs is given by an
    /// abstract function.
264
265
266
    virtual void addNeumannBC(BoundaryType type, int row, int col, 
			      AbstractFunction<double, WorldVector<double> > *n);

267
268
269
270
271
272
    /// 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.
273
274
275
276
    virtual void addRobinBC(BoundaryType type, int row, int col, 
			    AbstractFunction<double, WorldVector<double> > *n,
			    AbstractFunction<double, WorldVector<double> > *r);

277
278
279
280
281
282
283
284
285
286
    /// 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);

287
    /// Adds a periodic boundary condition.
288
289
    virtual void addPeriodicBC(BoundaryType type, int row, int col);

290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
    /// 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
310
311
312
313
    /** \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
314
315
    void assembleOnOneMesh(FiniteElemSpace *feSpace, 
			   Flag assembleFlag,
Thomas Witkowski's avatar
Thomas Witkowski committed
316
317
			   DOFMatrix *matrix, DOFVector<double> *vector);

Thomas Witkowski's avatar
Thomas Witkowski committed
318
319

    ///
320
321
322
323
    void assembleBoundaryConditions(DOFVector<double> *rhs,
				    DOFVector<double> *solution,
				    Mesh *mesh,
				    Flag assembleFlag);
324
325
326
327
328
  
    /** \name getting methods
     * \{ 
     */

Thomas Witkowski's avatar
Thomas Witkowski committed
329
    /// Returns \ref solution.
330
331
    inline SystemVector* getSolution() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
332
333
      return solution; 
    }
334

335
    inline DOFVector<double>* getSolution(int i)
336
337
338
339
    {
      return solution->getDOFVector(i);
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
340
    /// Returns \ref rhs.
341
    inline SystemVector* getRhs() 
342
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
343
344
      return rhs; 
    }
345

346
347
348
349
350
    inline const DOFVector<double>* getRhsVector(int i = 0)
    {
      return rhs->getDOFVector(i);
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
351
    /// Returns \ref systemMatrix.
352
353
    inline Matrix<DOFMatrix*> *getSystemMatrix() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
354
355
      return systemMatrix; 
    }
356

Thomas Witkowski's avatar
Thomas Witkowski committed
357
    /// Returns a pointer to the corresponding DOFMatrix.
358
359
    inline DOFMatrix* getSystemMatrix(int row, int col) 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
360
361
362
363
      return (*systemMatrix)[row][col];
    }

    /// Returns mesh of given component
364
    inline Mesh* getMesh(int comp = 0) 
365
    {
366
      FUNCNAME("ProblemStatSeq::getMesh()");
Thomas Witkowski's avatar
Thomas Witkowski committed
367
      TEST_EXIT(comp < static_cast<int>(componentMeshes.size()) && comp >= 0)
368
	("invalid component number\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
369
      return componentMeshes[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
370
    }
371

Thomas Witkowski's avatar
Thomas Witkowski committed
372
    /// Returns \ref meshes
373
    inline vector<Mesh*> getMeshes() 
374
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
375
376
      return meshes; 
    }
377

Thomas Witkowski's avatar
Thomas Witkowski committed
378
    /// Returns \ref feSpace_.
379
    inline FiniteElemSpace* getFeSpace(int comp = 0) 
380
    { 
381
      FUNCNAME("ProblemStatSeq::getFeSpace()");
382
      TEST_EXIT(comp < static_cast<int>(componentSpaces.size()) && comp >= 0)
383
	("invalid component number\n");
384
      return componentSpaces[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
385
    }
386

Thomas Witkowski's avatar
Thomas Witkowski committed
387
    /// Returns \ref feSpaces.
388
    inline vector<FiniteElemSpace*> getFeSpaces() 
389
    { 
390
      return feSpaces; 
Thomas Witkowski's avatar
Thomas Witkowski committed
391
    }
392

Thomas Witkowski's avatar
Thomas Witkowski committed
393
    /// Returns \ref componentSpaces;
394
    inline vector<FiniteElemSpace*> getComponentFeSpaces() 
395
    {
396
      return componentSpaces;
397
398
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
399
    /// Returns \ref estimator.
400
    inline vector<Estimator*> getEstimators() 
401
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
402
403
      return estimator; 
    }
404

Thomas Witkowski's avatar
Thomas Witkowski committed
405
    /// Returns \ref estimator.
406
    inline Estimator* getEstimator(int comp = 0) 
407
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
408
409
      return estimator[comp]; 
    }
410

Thomas Witkowski's avatar
Thomas Witkowski committed
411
    /// Returns \ref refinementManager.
412
    inline RefinementManager* getRefinementManager(int comp = 0) 
413
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
414
415
      return refinementManager; 
    }
416

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

Thomas Witkowski's avatar
Thomas Witkowski committed
423
    /// Returns \ref solver.
424
425
    inline OEMSolver* getSolver() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
426
427
      return solver; 
    }
428

Thomas Witkowski's avatar
Thomas Witkowski committed
429
    /// Returns \ref marker.
430
    inline Marker *getMarker(int comp = 0) 
431
    { 
432
      return marker[comp]; 
Thomas Witkowski's avatar
Thomas Witkowski committed
433
    }
434

Thomas Witkowski's avatar
Thomas Witkowski committed
435
    /// Returns \ref marker.
436
    inline vector<Marker*> getMarkers() 
437
    { 
438
      return marker; 
Thomas Witkowski's avatar
Thomas Witkowski committed
439
    }
440

Thomas Witkowski's avatar
Thomas Witkowski committed
441
    /// Returns the name of the problem
442
    inline virtual string getName() 
443
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
444
445
      return name; 
    }
446

Thomas Witkowski's avatar
Thomas Witkowski committed
447
    /// Returns \ref useGetBound.
448
449
    inline bool getBoundUsed() 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
450
451
      return useGetBound; 
    }
452

453
454
455
456
457
458
    /// Returns \ref info.
    int getInfo()
    {
      return info;
    }

459
460
461
462
463
464
    /// Returns \ref deserialized;
    bool isDeserialized()
    {
      return deserialized;
    }

465
466
467
468
469
470
    /** \} */

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

Thomas Witkowski's avatar
Thomas Witkowski committed
471
    /// Sets \ref estimator.
472
    inline void setEstimator(vector<Estimator*> est) 
473
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
474
475
      estimator = est; 
    }
476

Thomas Witkowski's avatar
Thomas Witkowski committed
477
    /// Sets the FE space for the given component.
478
    inline void setFeSpace(FiniteElemSpace *feSpace, int comp = 0) 
479
    {
480
      feSpaces[comp] = feSpace;
Thomas Witkowski's avatar
Thomas Witkowski committed
481
    }
482

Thomas Witkowski's avatar
Thomas Witkowski committed
483
    /// Sets \ref estimator.
484
    inline void setEstimator(Estimator* est, int comp = 0) 
485
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
486
487
      estimator[comp] = est; 
    }
488

Thomas Witkowski's avatar
Thomas Witkowski committed
489
    /// Sets \ref marker.
490
    inline void setMarker(Marker* mark, int comp = 0) 
491
    { 
492
      marker[comp] = mark; 
Thomas Witkowski's avatar
Thomas Witkowski committed
493
    }
494

Thomas Witkowski's avatar
Thomas Witkowski committed
495
    /// Sets \ref solver.
496
497
    inline void setSolver(OEMSolver* sol) 
    { 
Thomas Witkowski's avatar
Thomas Witkowski committed
498
499
      solver = sol; 
    }
500

Thomas Witkowski's avatar
Thomas Witkowski committed
501
    ///
502
    inline void setAssembleMatrixOnlyOnce(int i = 0, int j = 0, bool value = true) 
503
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
504
      assembleMatrixOnlyOnce[i][j] = value;
505
506
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
507
    ///
508
    void setExactSolutionFct(AbstractFunction<double, WorldVector<double> > *fct,
509
510
			     int component) 
    {
511
512
513
      exactSolutionFcts[component] = fct;
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
514
    ///
515
    AbstractFunction<double, WorldVector<double> > *getExactSolutionFct(int i = 0) 
516
    {
517
      return exactSolutionFcts[i];
518
519
    }

520
521
522
523
524
525
    ///
    vector< AbstractFunction<double, WorldVector<double> >* > getExactSolutionFcts() 
    {
      return exactSolutionFcts;
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
526
    ///
527
528
    void setComputeExactError(bool v) 
    {
529
530
531
      computeExactError = v;
    }

532
533
534
535
536
537
    /// Sets \ref writeAsmInfo;
    void setWriteAsmInfo(bool b)
    {
      writeAsmInfo = b;
    }

538
539
    /** \} */

Thomas Witkowski's avatar
Thomas Witkowski committed
540
541
542
543
    /** \brief
     * Outputs the mesh of the given component, but the values are taken from the 
     * residual error estimator. 
     */
544
    void writeResidualMesh(int comp, AdaptInfo *adaptInfo, string name);
545

Thomas Witkowski's avatar
Thomas Witkowski committed
546
    /// Function that implements the serialization procedure.
547
    virtual void serialize(ostream &out);
548

Thomas Witkowski's avatar
Thomas Witkowski committed
549
    /// Function that implements the deserialization procedure.
550
    virtual void deserialize(istream &in);
551

Thomas Witkowski's avatar
Thomas Witkowski committed
552
553

    /// Returns \ref fileWriters.
554
    vector<FileWriterInterface*>& getFileWriterList() 
555
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
556
557
      return fileWriters;
    }
558

Thomas Witkowski's avatar
Thomas Witkowski committed
559
560
561
562
563
564
565
  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);

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

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

    /** \brief
Thomas Witkowski's avatar
Thomas Witkowski committed
575
576
577
     * 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.
578
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
579
580
581
    int nMeshes;

    /// FE spaces of this problem.
582
    vector<FiniteElemSpace*> feSpaces;
583

Thomas Witkowski's avatar
Thomas Witkowski committed
584
    /// Meshes of this problem.
585
    vector<Mesh*> meshes;
586

Thomas Witkowski's avatar
Thomas Witkowski committed
587
    /// Pointer to the fe spaces for the different problem components
588
    vector<FiniteElemSpace*> componentSpaces;
589

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
606
    /// Linear solver of this problem. Used in \ref solve().
607
    OEMSolver *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
626
627
    /** \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.
     */
628
    vector<vector<bool> > assembleMatrixOnlyOnce;
629
630
631

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

Thomas Witkowski's avatar
Thomas Witkowski committed
638
639
    /// Determines whether domain boundaries should be considered at assembling.
    bool useGetBound;
640

Thomas Witkowski's avatar
Thomas Witkowski committed
641
    /// Writes the meshes and solution after the adaption loop.
642
    vector<FileWriterInterface*> fileWriters;
643
644
645
646
647
648

    /** \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
649
    RefinementManager *refinementManager;
650
651
652
653
654
655

    /** \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
656
    CoarseningManager *coarseningManager;
657
  
Thomas Witkowski's avatar
Thomas Witkowski committed
658
659
    /// Info level.
    int info;
660

661
662
663
    /// If true, the stationary problem was deserialized from some serialization file.
    bool deserialized;

664
665
666
667
668
    /** \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.
     */
669
    vector<AbstractFunction<double, WorldVector<double> >*> exactSolutionFcts;
670
671
672
673
674
675

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

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

687
    map<Operator*, vector<OperatorPos> > operators;
688

689
    map<Operator*, Flag> opFlags;
690
  };
691
692
693
694

#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
  typedef ProblemStatSeq ProblemStat;
#endif
695
696
697
}

#endif