GEOS
EpetraUtils.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 
19 #ifndef GEOS_LINEARALGEBRA_INTERFACES_EPETRAUTILS_HPP_
20 #define GEOS_LINEARALGEBRA_INTERFACES_EPETRAUTILS_HPP_
21 
22 #include "common/DataTypes.hpp"
23 
24 #ifdef GEOS_USE_MPI
25 #include <Epetra_MpiComm.h>
26 #else
27 #include <Epetra_SerialComm.h>
28 #endif
29 
30 namespace geos
31 {
32 
33 namespace trilinos
34 {
35 
36 // Check matching requirements on index/value types between GEOSX and PETSc
37 
38 static_assert( sizeof( long long ) == sizeof( geos::globalIndex ),
39  "long long and geos::globalIndex must have the same size" );
40 
41 static_assert( std::is_signed< long long >::value == std::is_signed< geos::globalIndex >::value,
42  "long long and geos::globalIndex must both be signed or unsigned" );
43 
44 static_assert( std::is_same< double, geos::real64 >::value,
45  "double and geos::real64 must be the same type" );
46 
47 #ifdef GEOS_USE_MPI
49 using EpetraComm = Epetra_MpiComm;
50 #else
52 using EpetraComm = Epetra_SerialComm;
53 #endif
54 
60 inline long long * toEpetraLongLong( globalIndex * const index )
61 {
62  return reinterpret_cast< long long * >(index);
63 }
64 
70 inline long long const * toEpetraLongLong( globalIndex const * const index )
71 {
72  return reinterpret_cast< long long const * >(index);
73 }
74 
75 } // namespace trilinos
76 
77 } // namespace geos
78 
79 #endif //GEOS_LINEARALGEBRA_INTERFACES_EPETRAUTILS_HPP_
Epetra_SerialComm EpetraComm
Serial fallback alias for Epetra communicator.
Definition: EpetraUtils.hpp:52
long long * toEpetraLongLong(globalIndex *const index)
Converts a non-const array from GEOSX globalIndex type to Epetra long long.
Definition: EpetraUtils.hpp:60
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:88