GEOSX
PetscUtils.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 Total, S.A
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOSX_LINEARALGEBRA_INTERFACES_PETSCUTILS_HPP
20 #define GEOSX_LINEARALGEBRA_INTERFACES_PETSCUTILS_HPP
21 
22 #include "common/DataTypes.hpp"
23 #include <petscsys.h>
24 
25 namespace geosx
26 {
27 
33 inline PetscInt * toPetscInt( globalIndex * const index )
34 {
35  return reinterpret_cast< PetscInt * >(index);
36 }
37 
43 inline PetscInt const * toPetscInt( globalIndex const * const index )
44 {
45  return reinterpret_cast< PetscInt const * >(index);
46 }
47 
48 }
49 
50 #endif //GEOSX_LINEARALGEBRA_INTERFACES_PETSCUTILS_HPP
long long int globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:128
PetscInt * toPetscInt(globalIndex *const index)
Converts a non-const array from GEOSX globalIndex type to PetscInt.
Definition: PetscUtils.hpp:33