PetscProblemStat.h 2.58 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ==  http://www.amdis-fem.org                                              ==
// ==                                                                        ==
// ============================================================================
//
// 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.



/** \file PetscProblemStat.h */

#ifndef AMDIS_PETSC_PROBLEM_STAT_H
#define AMDIS_PETSC_PROBLEM_STAT_H

#include "AMDiS_fwd.h"
#include "Global.h"
28
29
#include "parallel/ParallelProblemStatBase.h"
#include "parallel/PetscSolver.h"
30
#include "parallel/PetscSolverFeti.h"
Thomas Witkowski's avatar
Thomas Witkowski committed
31
32
#include "parallel/PetscSolverGlobalMatrix.h"
#include "parallel/PetscSolverSchur.h"
33
34
35
36
37
38
39
40

namespace AMDiS {
  
  class PetscProblemStat : public ParallelProblemStatBase
  {
  public:
    PetscProblemStat(std::string nameStr,
		     ProblemIterationInterface *problemIteration = NULL)
41
      : ParallelProblemStatBase(nameStr, problemIteration)
42
    {
43
      string name("");
44
      Parameters::get("parallel->solver", name);
45
46
47
      
      if (name == "petsc-schur") {
#ifdef HAVE_PETSC_DEV
48
	petscSolver = new PetscSolverSchur();
49
#else
50
51
52
53
54
55
56
	ERROR_EXIT("PETSc schur complement solver is only supported when petsc-dev is used!\n");
#endif
      } else if (name == "petsc-feti") {
#ifdef HAVE_PETSC_DEV
	petscSolver = new PetscSolverFeti();
#else
	ERROR_EXIT("PETSc FETI-DP solver is only supported when petsc-dev is used!\n");
57
58
#endif
      } else if (name == "petsc" || name == "") {
59
	petscSolver = new PetscSolverGlobalMatrix();
60
61
62
      } else {
	ERROR_EXIT("No parallel solver %s available!\n", name.c_str());
      }
63
    }
64
65

    ~PetscProblemStat()
66
67
68
    {
      delete petscSolver;
    }
69

Thomas Witkowski's avatar
Thomas Witkowski committed
70
71
72
73
74
75
76
    void addToMeshDistributor(MeshDistributor& m)
    {
      ParallelProblemStatBase::addToMeshDistributor(m);

      meshDistributor->setBoundaryDofRequirement(petscSolver->getBoundaryDofRequirement());
    }

77
78
79
    void solve(AdaptInfo *adaptInfo, bool fixedMatrix = false);

  protected:
80
    PetscSolver *petscSolver;
81
82
83
84
  };

  typedef PetscProblemStat ParallelProblemStat;

85
86
87
88
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
  typedef PetscProblemStat ProblemStat;
#endif

89
90
91
} // namespace AMDiS

#endif