Skip to content
Snippets Groups Projects
PetscProblemStat.h 2.01 KiB
// ============================================================================
// ==                                                                        ==
// == 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"
#include "parallel/ParallelProblemStatBase.h"
#include "parallel/PetscSolver.h"

namespace AMDiS {
  
  class PetscProblemStat : public ParallelProblemStatBase
  {
  public:
    PetscProblemStat(std::string nameStr,
		     ProblemIterationInterface *problemIteration = NULL)
      : ParallelProblemStatBase(nameStr, problemIteration)
    {
      string name("");
      GET_PARAMETER(0, "parallel->solver", &name);
      
      if (name == "petsc-schur") {
#ifdef HAVE_PETSC_DEV
	petscSolver = new PetscSolverSchur(meshDistributor);
#else
	ERROR_EXIT("Petsc schur complement solver is only supported when petsc-dev is used!\n");
#endif
      } else if (name == "petsc" || name == "") {
	petscSolver = new PetscSolverGlobalMatrix(meshDistributor);
      } else {
	ERROR_EXIT("No parallel solver %s available!\n", name.c_str());
      }
    }

    ~PetscProblemStat()
    {
      delete petscSolver;
    }

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

  protected:
    PetscSolver *petscSolver;
  };

  typedef PetscProblemStat ParallelProblemStat;

} // namespace AMDiS
#endif