GEOSX
HypreExport.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2019 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2019 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2019 TotalEnergies
8  * Copyright (c) 2019- GEOSX Contributors
9  * All right reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOS_LINEARALGEBRA_INTERFACES_HYPREEXPORT_HPP_
20 #define GEOS_LINEARALGEBRA_INTERFACES_HYPREEXPORT_HPP_
21 
22 #include "common/DataTypes.hpp"
23 
24 namespace geos
25 {
26 
28 class HypreMatrix;
29 
31 class HypreVector;
32 
37 {
38 public:
39 
46 
54  HypreExport( HypreMatrix const & mat, integer targetRank );
55 
60 
73  template< typename OFFSET_TYPE, typename COLUMN_TYPE >
74  void exportCRS( HypreMatrix const & mat,
75  arrayView1d< OFFSET_TYPE > const & rowOffsets,
76  arrayView1d< COLUMN_TYPE > const & colIndices,
77  arrayView1d< real64 > const & values ) const;
78 
91  void exportVector( HypreVector const & vec,
92  arrayView1d< real64 > const & values ) const;
93 
107  HypreVector & vec ) const;
108 
109 private:
110 
112  integer m_targetRank = -1;
113 
115  MPI_Comm m_subComm = MPI_COMM_NULL;
116 };
117 
118 } // namespace geos
119 
120 #endif //GEOS_LINEARALGEBRA_INTERFACES_HYPREEXPORT_HPP_
Facilitates exporting Hypre matrix and associated vector objects (either in parallel or serial).
Definition: HypreExport.hpp:37
HypreExport()
Parallel export constructor.
void exportVector(HypreVector const &vec, arrayView1d< real64 > const &values) const
Export the target vector into an array provided by the user.
void exportCRS(HypreMatrix const &mat, arrayView1d< OFFSET_TYPE > const &rowOffsets, arrayView1d< COLUMN_TYPE > const &colIndices, arrayView1d< real64 > const &values) const
Export the matrix into CRS arrays provided by the user.
~HypreExport()
Destructor.
HypreExport(HypreMatrix const &mat, integer targetRank)
Single-rank export constructor.
void importVector(arrayView1d< const real64 > const &values, HypreVector &vec) const
Import the target vector from an array provided by the user.
Wrapper class for hypre's ParCSRMatrix.
Definition: HypreMatrix.hpp:55
Wrapper class for hypre's ParVector.
Definition: HypreVector.hpp:50
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:220
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:122