// ============================================================================ // == == // == 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 PetscSolverGlobalBlockMatrix.h */ #ifndef AMDIS_PETSC_SOLVER_GLOBAL_BLOCK_MATRIX_H #define AMDIS_PETSC_SOLVER_GLOBAL_BLOCK_MATRIX_H #include "AMDiS_fwd.h" #include "parallel/PetscSolver.h" namespace AMDiS { using namespace std; class PetscSolverGlobalBlockMatrix : public PetscSolver { public: PetscSolverGlobalBlockMatrix() : PetscSolver(), nComponents(0), nBlocks(-1) {} void fillPetscMatrix(Matrix *mat); void fillPetscRhs(SystemVector *vec); void solvePetscMatrix(SystemVector &vec, AdaptInfo *adaptInfo); void destroyMatrixData(); void destroyVectorData(); protected: /// Takes a DOF matrix and sends the values to the global PETSc matrix. void setDofMatrix(Mat& petscMat, DOFMatrix* mat, int dispRowBlock, int dispColBlock); /// Takes a DOF vector and sends its values to a given PETSc vector. void setDofVector(Vec& petscVec, DOFVector* vec); virtual void setBlockPreconditioner(PC &pc) { PCSetFromOptions(pc); } protected: vector nestMat; vector nestVec; Vec petscSolVec; /// Number of components (= number of unknowns in the PDE) int nComponents; /// Number of blocks for the solver, must be 1 <= nBlocks <= nComponents int nBlocks; /// Maps to each component number the block number the component is in. map componentInBlock; }; } #endif