GEOSX
EpetraExport.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_EPETRAEXPORT_HPP_
20 #define GEOS_LINEARALGEBRA_INTERFACES_EPETRAEXPORT_HPP_
21 
22 #include "common/DataTypes.hpp"
23 
24 #include <memory>
25 
26 class Epetra_Map;
27 class Epetra_Import;
28 
29 namespace geos
30 {
31 
33 class EpetraMatrix;
34 
36 class EpetraVector;
37 
42 {
43 public:
44 
52 
57 
65  EpetraExport( EpetraMatrix const & mat, integer targetRank );
66 
79  template< typename OFFSET_TYPE, typename COLUMN_TYPE >
80  void exportCRS( EpetraMatrix const & mat,
81  arrayView1d< OFFSET_TYPE > const & rowOffsets,
82  arrayView1d< COLUMN_TYPE > const & colIndices,
83  arrayView1d< real64 > const & values ) const;
84 
97  void exportVector( EpetraVector const & vec,
98  arrayView1d< real64 > const & values ) const;
99 
112  void importVector( arrayView1d< const real64 > const & values, EpetraVector & vec ) const;
113 
114 private:
115 
117  integer m_targetRank = -1;
118 
120  std::unique_ptr< Epetra_Map > m_serialMap;
121 
123  std::unique_ptr< Epetra_Import > m_serialImport;
124 };
125 
126 } // namespace geos
127 
128 #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:220
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:122