ProblemStat.h 19.1 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
  /** \brief
   * This class defines the stationary problem definition in sequential
   * computations. For parallel computations, see 
   * \ref ParallelProblemStatBase.
   */
  class ProblemStatSeq : public ProblemStatBase,
			 public StandardProblemIteration
58
  {
59
  protected:
60
    // Defines a mapping type from dof indices to world coordinates.
61
    typedef map<DegreeOfFreedom, WorldVector<double> > DofToCoord;
62 63

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /** \brief
     * Implementation of ProblemStatBase::solve(). Deligates the solving
     * of problems system to \ref solver.
     */
144
    virtual void solve(AdaptInfo *adaptInfo, bool fixedMatrix = false);
145 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

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

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

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

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

193 194
    bool dualMeshTraverseRequired();

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

198 199 200
    void createPrecon();


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
320 321

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

467 468 469 470 471 472
    /** \} */

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

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

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

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

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

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

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

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
522
    ///
523 524
    void setComputeExactError(bool v) 
    {
525 526 527
      computeExactError = v;
    }

528 529 530 531 532 533
    /// Sets \ref writeAsmInfo;
    void setWriteAsmInfo(bool b)
    {
      writeAsmInfo = b;
    }

534 535
    /** \} */

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

Thomas Witkowski's avatar
Thomas Witkowski committed
542
    /// Function that implements the serialization procedure.
543
    virtual void serialize(ostream &out);
544

Thomas Witkowski's avatar
Thomas Witkowski committed
545
    /// Function that implements the deserialization procedure.
546
    virtual void deserialize(istream &in);
547

Thomas Witkowski's avatar
Thomas Witkowski committed
548 549

    /// Returns \ref fileWriters.
550
    vector<FileWriterInterface*>& getFileWriterList() 
551
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
552 553
      return fileWriters;
    }
554

Thomas Witkowski's avatar
Thomas Witkowski committed
555 556 557 558 559 560 561
  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);

562
  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
563 564
    
    /// Name of this problem.
565
    string name;
566

Thomas Witkowski's avatar
Thomas Witkowski committed
567
    /// Number of problem components
568
    int nComponents;
569 570

    /** \brief
Thomas Witkowski's avatar
Thomas Witkowski committed
571 572 573
     * 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.
574
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
575 576 577
    int nMeshes;

    /// FE spaces of this problem.
578
    vector<FiniteElemSpace*> feSpaces;
579

Thomas Witkowski's avatar
Thomas Witkowski committed
580
    /// Meshes of this problem.
581
    vector<Mesh*> meshes;
582

Thomas Witkowski's avatar
Thomas Witkowski committed
583
    /// Pointer to the fe spaces for the different problem components
584
    vector<FiniteElemSpace*> componentSpaces;
585

Thomas Witkowski's avatar
Thomas Witkowski committed
586
    /// Pointer to the meshes for the different problem components
587
    vector<Mesh*> componentMeshes;
588 589

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
602
    /// Linear solver of this problem. Used in \ref solve().
603
    OEMSolver *solver;
604

Thomas Witkowski's avatar
Thomas Witkowski committed
605 606
    /// System vector  storing the calculated solution of the problem.
    SystemVector *solution;
607

Thomas Witkowski's avatar
Thomas Witkowski committed
608 609
    /// System vector for the right hand side 
    SystemVector *rhs;
610

Thomas Witkowski's avatar
Thomas Witkowski committed
611 612
    /// System matrix
    Matrix<DOFMatrix*> *systemMatrix;
613

614 615 616
    /// Composed system matrix
    SolverMatrix<Matrix<DOFMatrix*> > solverMatrix;

617 618 619 620 621 622 623
    /** \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.
     */
624
    vector<vector<bool> > assembleMatrixOnlyOnce;
625 626 627

    /** \brief
     * If [i][j] of this field is set to true, the corresponding DOFMatrix of
Thomas Witkowski's avatar
Thomas Witkowski committed
628
     * the systemMatrix has been assembled at least once. This field is used
629 630 631
     * to determine, if assembling of a matrix can be ommitted, if it is set
     * to be assembled only once.
     */
632
    vector<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
    vector<FileWriterInterface*> fileWriters;
639 640 641 642 643 644

    /** \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
645
    RefinementManager *refinementManager;
646 647 648 649 650 651

    /** \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
652
    CoarseningManager *coarseningManager;
653
  
Thomas Witkowski's avatar
Thomas Witkowski committed
654 655
    /// Info level.
    int info;
656

657 658 659
    /// If true, the stationary problem was deserialized from some serialization file.
    bool deserialized;

660 661 662 663 664
    /** \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.
     */
665
    vector<AbstractFunction<double, WorldVector<double> >*> exactSolutionFcts;
666 667 668 669 670 671

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

680 681
    /// If true, AMDiS prints information about the assembling procedure to the screen.
    bool writeAsmInfo;
682

683
    map<Operator*, vector<OperatorPos> > operators;
684

685
    map<Operator*, Flag> opFlags;
686
  };
687 688 689 690

#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
  typedef ProblemStatSeq ProblemStat;
#endif
691 692 693
}

#endif