1 // --------------------------------------------------------------------- 2 // 3 // Copyright (C) 2004 - 2018 by the deal.II authors 4 // 5 // This file is part of the deal.II library. 6 // 7 // The deal.II library is free software; you can use it, redistribute 8 // it, and/or modify it under the terms of the GNU Lesser General 9 // Public License as published by the Free Software Foundation; either 10 // version 2.1 of the License, or (at your option) any later version. 11 // The full text of the license can be found in the file LICENSE.md at 12 // the top level directory of deal.II. 13 // 14 // --------------------------------------------------------------------- 15 16 #ifndef dealii_petsc_full_matrix_h 17 # define dealii_petsc_full_matrix_h 18 19 20 # include <deal.II/base/config.h> 21 22 # ifdef DEAL_II_WITH_PETSC 23 24 # include <deal.II/lac/exceptions.h> 25 # include <deal.II/lac/petsc_matrix_base.h> 26 27 DEAL_II_NAMESPACE_OPEN 28 29 30 31 namespace PETScWrappers 32 { 33 /*! @addtogroup PETScWrappers 34 *@{ 35 */ 36 37 /** 38 * Implementation of a sequential dense matrix class based on PETSc. All the 39 * functionality is actually in the base class, except for the calls to 40 * generate a sequential dense matrix. This is possible since PETSc only 41 * works on an abstract matrix type and internally distributes to functions 42 * that do the actual work depending on the actual matrix type (much like 43 * using virtual functions). Only the functions creating a matrix of 44 * specific type differ, and are implemented in this particular class. 45 * 46 * @ingroup Matrix1 47 */ 48 class FullMatrix : public MatrixBase 49 { 50 public: 51 /** 52 * Declare type for container size. 53 */ 54 using size_type = types::global_dof_index; 55 56 57 /** 58 * Default constructor. Create an empty matrix. 59 */ 60 FullMatrix(); 61 62 63 /** 64 * Create a full matrix of dimensions @p m times @p n. 65 */ 66 FullMatrix(const size_type m, const size_type n); 67 68 69 /** 70 * Throw away the present matrix and generate one that has the same 71 * properties as if it were created by the constructor of this class with 72 * the same argument list as the present function. 73 */ 74 void 75 reinit(const size_type m, const size_type n); 76 77 78 /** 79 * Return a reference to the MPI communicator object in use with this 80 * matrix. Since this is a sequential matrix, it returns the MPI_COMM_SELF 81 * communicator. 82 */ 83 virtual const MPI_Comm & 84 get_mpi_communicator() const override; 85 86 private: 87 /** 88 * Do the actual work for the respective reinit() function and the 89 * matching constructor, i.e. create a matrix. Getting rid of the previous 90 * matrix is left to the caller. 91 */ 92 void 93 do_reinit(const size_type m, const size_type n); 94 }; 95 96 /*@}*/ 97 } // namespace PETScWrappers 98 99 100 DEAL_II_NAMESPACE_CLOSE 101 102 # endif // DEAL_II_WITH_PETSC 103 104 #endif 105 /*---------------------------- petsc_full_matrix.h --------------------------*/ 106