GlobalMatrixSolver.h 3.37 KB
 Thomas Witkowski committed Feb 09, 2010 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 ``````// ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == == // ============================================================================ // == == // == TU Dresden == // == == // == Institut fr Wissenschaftliches Rechnen == // == Zellescher Weg 12-14 == // == 01069 Dresden == // == germany == // == == // ============================================================================ // == == // == https://gforge.zih.tu-dresden.de/projects/amdis/ == // == == // ============================================================================ /** \file GlobalMatrixSolver.h */ #ifndef AMDIS_GLOBALMATRIXSOLVER_H #define AMDIS_GLOBALMATRIXSOLVER_H #include "AMDiS_fwd.h" #include "Global.h" #include "ParallelDomainBase.h" #include "ProblemVec.h" #include "ProblemInstat.h" #include "petsc.h" #include "petscsys.h" #include "petscao.h" namespace AMDiS { class GlobalMatrixSolver : public ParallelDomainBase { public: GlobalMatrixSolver(ProblemVec *problemStat, ProblemInstatVec *problemInstat) : ParallelDomainBase(problemStat, problemInstat), d_nnz(NULL), o_nnz(NULL) {} ~GlobalMatrixSolver() {} void solve(); protected: /// Creates a new non zero pattern structure for the Petsc matrix. void createPetscNnzStructure(Matrix *mat); /** \brief * Create a PETSc matrix and PETSc vectors. The given DOF matrices are used to * create the nnz structure of the PETSc matrix and the values are transfered to it. * The given DOF vectors are used to the the values of the PETSc rhs vector. * * \param[in] mat * \param[in] vec */ void fillPetscMatrix(Matrix *mat, SystemVector *vec); /// Takes a dof matrix and sends the values to the global petsc matrix. void setDofMatrix(DOFMatrix* mat, int dispMult = 1, int dispAddRow = 0, int dispAddCol = 0); /// Takes a dof vector and sends its values to a given petsc vector. void setDofVector(Vec& petscVec, DOFVector* vec, int disMult = 1, int dispAdd = 0); void solvePetscMatrix(SystemVector &vec); protected: /// Petsc's matrix structure. Mat petscMatrix; /** \brief * Petsc's vector structures for the rhs vector, the solution vector and a * temporary vector for calculating the final residuum. */ Vec petscRhsVec, petscSolVec, petscTmpVec; /// Arrays definig the non zero pattern of Petsc's matrix. int *d_nnz, *o_nnz; }; typedef GlobalMatrixSolver ParallelDomainVec; } //namespace AMDiS #endif``````