PetscProblemStat.h 1.98 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
31
32
33
34
35
36
37

namespace AMDiS {
  
  class PetscProblemStat : public ParallelProblemStatBase
  {
  public:
    PetscProblemStat(std::string nameStr,
		     ProblemIterationInterface *problemIteration = NULL)
38
      : ParallelProblemStatBase(nameStr, problemIteration)
39
    {
40
41
42
43
44
      string name("");
      GET_PARAMETER(0, "parallel->solver", &name);
      
      if (name == "petsc-schur") {
#ifdef HAVE_PETSC_DEV
45
	petscSolver = new PetscSolverSchur();
46
47
48
49
#else
	ERROR_EXIT("Petsc schur complement solver is only supported when petsc-dev is used!\n");
#endif
      } else if (name == "petsc" || name == "") {
50
	petscSolver = new PetscSolverGlobalMatrix();
51
52
53
      } else {
	ERROR_EXIT("No parallel solver %s available!\n", name.c_str());
      }
54
    }
55
56

    ~PetscProblemStat()
57
58
59
    {
      delete petscSolver;
    }
60
61
62
63

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

  protected:
64
    PetscSolver *petscSolver;
65
66
67
68
69
70
71
  };

  typedef PetscProblemStat ParallelProblemStat;

} // namespace AMDiS

#endif