1 #ifndef GEOS_LINEARALGEBRA_INTERFACES_HYPRE_HYPREDRIVE_HPP_
2 #define GEOS_LINEARALGEBRA_INTERFACES_HYPRE_HYPREDRIVE_HPP_
16 class HypredriveSolverTestPeer;
27 enum class InputSource
41 InputSource
source = InputSource::generatedFallback;
65 void initializeRuntime();
67 void finalizeRuntime();
134 bool configureHypredrive(
HypreMatrix const & mat );
146 MPI_Comm
const &
comm );
153 void tagKrylovDofVector(
HypreVector const & vec )
const;
155 void syncExecutionAnnotations();
157 void closeExecutionAnnotations();
159 void syncLegacyResult()
const;
161 void destroyHypredrive();
163 void resetHypredriveState();
165 char const * solverNameForLogs()
const;
167 void reportGeneratedYamlFailure(
char const *
const reason );
172 friend class HypredriveSolverTestPeer;
179 bool m_hasExecutionContext =
false;
180 bool m_timestepScopeActive =
false;
181 bool m_newtonScopeActive =
false;
183 bool m_reportedGeneratedYamlFailure =
false;
184 size_t m_hypredriveGeneration = 0;
185 HYPREDRV_t m_hypredrive{};
186 bool m_linearSolverCreated =
false;
187 mutable HypreVector m_dummyRhs;
188 mutable HypreVector m_dummySol;
189 mutable HypreVector m_residual;
190 array1d< HYPRE_Int > m_krylovDofTags;
191 HYPRE_Int m_numKrylovDofTags = 1;
192 std::unique_ptr< HypreSolver > m_legacySolver;
Wrapper class for hypre's ParCSRMatrix.
Wrapper class for hypre's ParVector.
Linear solver adapter that routes GEOS Hypre systems through hypredrive.
void clear() override
Reset solver-owned state and destroy any active hypredrive object.
void solve(HypreVector const &rhs, HypreVector &sol) const override
Solve the linear system with hypredrive.
void setNearNullKernel(arrayView1d< HypreVector const > const &nearNullKernel) override
Set near-null-space modes to pass to HypreDrive during setup.
void setup(HypreMatrix const &mat) override
Build or refresh the solver/preconditioner for a matrix.
HypredriveSolver(LinearSolverParameters parameters)
Construct a hypredrive-backed linear solver.
void setExecutionContext(LinearSolverExecutionContext const &context) override
Update the execution metadata associated with subsequent solves.
void apply(HypreVector const &src, HypreVector &dst) const override
Apply the configured operator as a preconditioner action.
~HypredriveSolver() override
Destroys the managed hypredrive object and releases any fallback solver state.
Simple interface for linear solvers that allows to extract solution results.
LinearSolverResult m_result
Result of most recent solve (status, timings)
LinearSolverParameters m_params
Parameters for the solver.
LinearSolverParameters const & parameters() const
virtual MPI_Comm comm() const override
Get the MPI communicator the matrix was created with.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
std::string string
String type.
internal::StdVectorWrapper< T, Allocator, USE_STD_CONTAINER_BOUNDS_CHECKING > stdVector
Execution metadata associated with a linear-solver invocation.
Set of parameters for a linear solver or preconditioner.