GEOSX
HypreUtils.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_HYPREUTILS_HPP_
20 #define GEOSX_LINEARALGEBRA_INTERFACES_HYPREUTILS_HPP_
21 
22 #include "common/DataTypes.hpp"
23 
24 #include <HYPRE_krylov.h>
25 #include <HYPRE_parcsr_ls.h>
26 
27 namespace geosx
28 {
29 
35 inline HYPRE_Int toHYPRE_Int( integer const index )
36 {
37  return LvArray::integerConversion< HYPRE_Int >( index );
38 }
39 
45 inline HYPRE_BigInt toHYPRE_BigInt( globalIndex const index )
46 {
47  return LvArray::integerConversion< HYPRE_BigInt >( index );
48 }
49 
55 inline HYPRE_BigInt * toHYPRE_BigInt( globalIndex * const index )
56 {
57  return reinterpret_cast< HYPRE_BigInt * >(index);
58 }
59 
65 inline HYPRE_BigInt const * toHYPRE_BigInt( globalIndex const * const index )
66 {
67  return reinterpret_cast< HYPRE_BigInt const * >(index);
68 }
69 
74 {
77 
80 
82  using DestroyFunc = HYPRE_Int (*)( HYPRE_Solver );
83 
88 };
89 
94 {
96  using SetPrecondFunc = HYPRE_Int ( * )( HYPRE_Solver,
97  HYPRE_PtrToParSolverFcn,
98  HYPRE_PtrToParSolverFcn,
100 
102  using SetupFunc = HYPRE_Int ( * )( HYPRE_Solver,
106 
108  using SolveFunc = HYPRE_Int ( * )( HYPRE_Solver,
112 
114  using GetNumIter = HYPRE_Int ( * )( HYPRE_Solver solver,
115  HYPRE_Int * num_iterations );
116 
118  using GetFinalNorm = HYPRE_Int ( * )( HYPRE_Solver solver,
119  HYPRE_Real * norm );
120 
122  using DestroyFunc = HYPRE_Int ( * )( HYPRE_Solver );
123 
124  SetPrecondFunc setPrecond{};
126  SolveFunc solve{};
127  GetNumIter getNumIter{};
128  GetFinalNorm getFinalNorm{};
130 };
131 
136 {
139 };
140 
141 }
142 
143 #endif /*GEOSX_LINEARALGEBRA_INTERFACES_HYPREUTILS_HPP_*/
HYPRE_Int(*)(HYPRE_Solver solver, HYPRE_Real *norm) GetFinalNorm
Alias for get final residual norm function type.
Definition: HypreUtils.hpp:119
HYPRE_Int(*)(HYPRE_Solver, HYPRE_ParCSRMatrix, HYPRE_ParVector, HYPRE_ParVector) ApplyFunc
Alias for apply function type.
Definition: HypreUtils.hpp:79
ApplyFunc apply
pointer to apply function
Definition: HypreUtils.hpp:85
long long int globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:128
DestroyFunc destroy
pointer to destroy function
Definition: HypreUtils.hpp:86
Container for hypre preconditioner auxiliary data.
Definition: HypreUtils.hpp:135
HYPRE_Int(*)(HYPRE_Solver, HYPRE_ParCSRMatrix, HYPRE_ParVector, HYPRE_ParVector) SetupFunc
Alias for setup function type.
Definition: HypreUtils.hpp:76
HYPRE_BigInt toHYPRE_BigInt(globalIndex const index)
Convert GEOSX global index value to hypre bigint.
Definition: HypreUtils.hpp:45
array1d< HYPRE_Int > point_marker_array
array1d of unique tags for local degrees of freedom
Definition: HypreUtils.hpp:137
SetupFunc setup
pointer to setup function
Definition: HypreUtils.hpp:84
Container for hypre preconditioner function pointers.
Definition: HypreUtils.hpp:73
hypre_ParVector_struct * HYPRE_ParVector
ParVector pointer alias.
Definition: HypreVector.hpp:42
HYPRE_Int(*)(HYPRE_Solver solver, HYPRE_Int *num_iterations) GetNumIter
Alias for get number of iterations function type.
Definition: HypreUtils.hpp:115
HYPRE_Int(*)(HYPRE_Solver, HYPRE_ParCSRMatrix, HYPRE_ParVector, HYPRE_ParVector) SolveFunc
Alias for solve function type.
Definition: HypreUtils.hpp:111
Container for hypre Krylov solver function pointers.
Definition: HypreUtils.hpp:93
array1d< HYPRE_ParVector > nullSpacePointer
Hypre pointer to the near null kernel.
Definition: HypreUtils.hpp:138
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:122
hypre_ParCSRMatrix_struct * HYPRE_ParCSRMatrix
ParCSRMatrix pointer alias.
Definition: HypreMatrix.hpp:45
hypre_Solver_struct * HYPRE_Solver
Solver pointer alias.
HYPRE_Int(*)(HYPRE_Solver, HYPRE_ParCSRMatrix, HYPRE_ParVector, HYPRE_ParVector) SetupFunc
Alias for setup function type.
Definition: HypreUtils.hpp:105
DestroyFunc aux_destroy
pointer to auxillary destroy function
Definition: HypreUtils.hpp:87
HYPRE_Int(*)(HYPRE_Solver, HYPRE_PtrToParSolverFcn, HYPRE_PtrToParSolverFcn, HYPRE_Solver) SetPrecondFunc
Alias for set preconditioner function type.
Definition: HypreUtils.hpp:99
HYPRE_Int(*)(HYPRE_Solver) DestroyFunc
Alias for destroy function type.
Definition: HypreUtils.hpp:122
HYPRE_Int(*)(HYPRE_Solver) DestroyFunc
Alias for destroy function type.
Definition: HypreUtils.hpp:82
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...
Definition: Array.hpp:55
HYPRE_Int toHYPRE_Int(integer const index)
Convert GEOSX integer value to hypre int.
Definition: HypreUtils.hpp:35