Loading...
Searching...
No Matches
HypreDataStructures.hpp
/*
Copyright 2025 Equinor ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_HYPRE_DATA_STRUCTURES_HPP
#define OPM_HYPRE_DATA_STRUCTURES_HPP
#include <HYPRE.h>
#include <HYPRE_parcsr_ls.h>
#include <_hypre_utilities.h>
#include <vector>
namespace Opm::gpuistl
{
struct ParallelInfo {
std::vector<int> local_dune_to_local_hypre;
std::vector<int> local_dune_to_global_hypre;
std::vector<int> local_hypre_to_local_dune;
HYPRE_Int N_owned;
HYPRE_Int dof_offset;
bool owner_first;
};
struct SparsityPattern {
std::vector<HYPRE_Int> ncols;
std::vector<HYPRE_BigInt> rows;
std::vector<HYPRE_BigInt> cols;
HYPRE_Int nnz;
};
struct HypreHostDataArrays {
std::vector<HYPRE_Int> row_indexes;
std::vector<HYPRE_BigInt> indices;
std::vector<HYPRE_Real> continuous_vector_values;
};
struct HypreDeviceDataArrays {
HYPRE_Int* ncols_device = nullptr;
HYPRE_BigInt* rows_device = nullptr;
HYPRE_BigInt* cols_device = nullptr;
HYPRE_Int* row_indexes_device = nullptr;
HYPRE_BigInt* indices_device = nullptr;
HYPRE_Real* vector_buffer_device = nullptr;
HYPRE_Real* matrix_buffer_device = nullptr;
};
} // namespace Opm::gpuistl
#endif // OPM_HYPRE_DATA_STRUCTURES_HPP
Opm::gpuistl::HypreDeviceDataArrays
GPU device memory arrays for HYPRE operations with GPU backend.
Definition HypreDataStructures.hpp:137
Opm::gpuistl::HypreDeviceDataArrays::vector_buffer_device
HYPRE_Real * vector_buffer_device
Device buffer for vector operations Used when input type and backend are different,...
Definition HypreDataStructures.hpp:149
Opm::gpuistl::HypreDeviceDataArrays::ncols_device
HYPRE_Int * ncols_device
Mirrors host data arrays.
Definition HypreDataStructures.hpp:139
Opm::gpuistl::HypreDeviceDataArrays::matrix_buffer_device
HYPRE_Real * matrix_buffer_device
Device buffer for matrix values, only needed for CPU input + GPU backend.
Definition HypreDataStructures.hpp:155
Opm::gpuistl::HypreHostDataArrays
Host arrays for HYPRE matrix and vector data transfers.
Definition HypreDataStructures.hpp:106
Opm::gpuistl::HypreHostDataArrays::indices
std::vector< HYPRE_BigInt > indices
Global DOF indices for owned degrees of freedom.
Definition HypreDataStructures.hpp:120
Opm::gpuistl::HypreHostDataArrays::continuous_vector_values
std::vector< HYPRE_Real > continuous_vector_values
Temporary buffer for vector values in non-owner-first ordering.
Definition HypreDataStructures.hpp:128
Opm::gpuistl::HypreHostDataArrays::row_indexes
std::vector< HYPRE_Int > row_indexes
Pre-computed row start indexes for HYPRE_IJMatrixSetValues2.
Definition HypreDataStructures.hpp:113
Opm::gpuistl::ParallelInfo
Parallel domain decomposition information for HYPRE-Dune interface.
Definition HypreDataStructures.hpp:37
Opm::gpuistl::ParallelInfo::owner_first
bool owner_first
Whether owned DOFs appear first in local Dune ordering.
Definition HypreDataStructures.hpp:77
Opm::gpuistl::ParallelInfo::local_dune_to_global_hypre
std::vector< int > local_dune_to_global_hypre
Mapping from local Dune indices to global HYPRE indices.
Definition HypreDataStructures.hpp:51
Opm::gpuistl::ParallelInfo::local_dune_to_local_hypre
std::vector< int > local_dune_to_local_hypre
Mapping from local Dune indices to local HYPRE indices.
Definition HypreDataStructures.hpp:44
Opm::gpuistl::ParallelInfo::local_hypre_to_local_dune
std::vector< int > local_hypre_to_local_dune
Mapping from local HYPRE indices to local Dune indices.
Definition HypreDataStructures.hpp:59
Opm::gpuistl::ParallelInfo::dof_offset
HYPRE_Int dof_offset
Global index offset for this process's owned DOFs.
Definition HypreDataStructures.hpp:69
Opm::gpuistl::ParallelInfo::N_owned
HYPRE_Int N_owned
Number of DOFs owned by this MPI process.
Definition HypreDataStructures.hpp:62
Opm::gpuistl::SparsityPattern
Compressed Sparse Row (CSR) sparsity pattern for HYPRE matrix assembly.
Definition HypreDataStructures.hpp:86
Opm::gpuistl::SparsityPattern::rows
std::vector< HYPRE_BigInt > rows
Global row indices for owned rows (size: N_owned).
Definition HypreDataStructures.hpp:91
Opm::gpuistl::SparsityPattern::ncols
std::vector< HYPRE_Int > ncols
Non-zero entries per owned row (size: N_owned).
Definition HypreDataStructures.hpp:88
Opm::gpuistl::SparsityPattern::nnz
HYPRE_Int nnz
Number of non-zero entries in matrix.
Definition HypreDataStructures.hpp:97
Opm::gpuistl::SparsityPattern::cols
std::vector< HYPRE_BigInt > cols
Global column indices in CSR format (size: nnz).
Definition HypreDataStructures.hpp:94