// ============================================================================ // == == // == 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" #include "parallel/PetscSolverGlobalMatrix.h" #include "parallel/PetscSolverSchur.h" namespace AMDiS { class PetscProblemStat : public ParallelProblemStatBase { public: PetscProblemStat(std::string nameStr, ProblemIterationInterface *problemIteration = NULL) : ParallelProblemStatBase(nameStr, problemIteration) { string name(""); Parameters::get("parallel->solver", name); if (name == "petsc-schur") { #ifdef HAVE_PETSC_DEV petscSolver = new PetscSolverSchur(); #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(); } else { ERROR_EXIT("No parallel solver %s available!\n", name.c_str()); } } ~PetscProblemStat() { delete petscSolver; } void addToMeshDistributor(MeshDistributor& m) { ParallelProblemStatBase::addToMeshDistributor(m); meshDistributor->setBoundaryDofRequirement(petscSolver->getBoundaryDofRequirement()); } void solve(AdaptInfo *adaptInfo, bool fixedMatrix = false); protected: PetscSolver *petscSolver; }; typedef PetscProblemStat ParallelProblemStat; } // namespace AMDiS #endif