GEOS
HypreExport.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_LINEARALGEBRA_INTERFACES_HYPREEXPORT_HPP_
21 #define GEOS_LINEARALGEBRA_INTERFACES_HYPREEXPORT_HPP_
22 
23 #include "common/DataTypes.hpp"
24 
25 namespace geos
26 {
27 
29 class HypreMatrix;
30 
32 class HypreVector;
33 
38 {
39 public:
40 
47 
55  HypreExport( HypreMatrix const & mat, integer targetRank );
56 
61 
74  template< typename OFFSET_TYPE, typename COLUMN_TYPE >
75  void exportCRS( HypreMatrix const & mat,
76  arrayView1d< OFFSET_TYPE > const & rowOffsets,
77  arrayView1d< COLUMN_TYPE > const & colIndices,
78  arrayView1d< real64 > const & values ) const;
79 
92  void exportVector( HypreVector const & vec,
93  arrayView1d< real64 > const & values ) const;
94 
108  HypreVector & vec ) const;
109 
110 private:
111 
113  integer m_targetRank = -1;
114 
116  MPI_Comm m_subComm = MPI_COMM_NULL;
117 };
118 
119 } // namespace geos
120 
121 #endif //GEOS_LINEARALGEBRA_INTERFACES_HYPREEXPORT_HPP_
Facilitates exporting Hypre matrix and associated vector objects (either in parallel or serial).
Definition: HypreExport.hpp:38
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:56
Wrapper class for hypre's ParVector.
Definition: HypreVector.hpp:51
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82