GEOS
EpetraExport.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 Total, S.A
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_EPETRAEXPORT_HPP_
21 #define GEOS_LINEARALGEBRA_INTERFACES_EPETRAEXPORT_HPP_
22 
23 #include "common/DataTypes.hpp"
24 
25 #include <memory>
26 
27 class Epetra_Map;
28 class Epetra_Import;
29 
30 namespace geos
31 {
32 
34 class EpetraMatrix;
35 
37 class EpetraVector;
38 
43 {
44 public:
45 
53 
58 
66  EpetraExport( EpetraMatrix const & mat, integer targetRank );
67 
80  template< typename OFFSET_TYPE, typename COLUMN_TYPE >
81  void exportCRS( EpetraMatrix const & mat,
82  arrayView1d< OFFSET_TYPE > const & rowOffsets,
83  arrayView1d< COLUMN_TYPE > const & colIndices,
84  arrayView1d< real64 > const & values ) const;
85 
98  void exportVector( EpetraVector const & vec,
99  arrayView1d< real64 > const & values ) const;
100 
113  void importVector( arrayView1d< const real64 > const & values, EpetraVector & vec ) const;
114 
115 private:
116 
118  integer m_targetRank = -1;
119 
121  std::unique_ptr< Epetra_Map > m_serialMap;
122 
124  std::unique_ptr< Epetra_Import > m_serialImport;
125 };
126 
127 } // namespace geos
128 
129 #endif //GEOS_LINEARALGEBRA_INTERFACES_EPETRAEXPORT_HPP_
Facilitates exporting Epetra matrix and associated vector objects (either in parallel or serial).
void exportCRS(EpetraMatrix 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.
void importVector(arrayView1d< const real64 > const &values, EpetraVector &vec) const
Import the target vector from an array provided by the user.
~EpetraExport()
Destructor.
EpetraExport(EpetraMatrix const &mat, integer targetRank)
Single-rank export constructor.
EpetraExport()
Parallel export constructor.
void exportVector(EpetraVector const &vec, arrayView1d< real64 > const &values) const
Export the target vector into an array provided by the user.
Wrapper class for Epetra's CrsMatrix.
Wrapper around Trilinos' Epetra_Vector object.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82