20#ifndef OPM_GPU_PRESSURE_TRANSFER_POLICY_HEADER_INCLUDED
21#define OPM_GPU_PRESSURE_TRANSFER_POLICY_HEADER_INCLUDED
23#include <opm/simulators/linalg/PropertyTree.hpp>
24#include <opm/simulators/linalg/WellOperators.hpp>
25#include <opm/simulators/linalg/gpuistl/GpuSparseMatrixWrapper.hpp>
26#include <opm/simulators/linalg/gpuistl/GpuVector.hpp>
27#include <opm/simulators/linalg/gpuistl/detail/cpr_amg_operations.hpp>
36 template <
class Scalar>
37 using GpuPressureMatrixType = gpuistl::GpuSparseMatrixWrapper<Scalar>;
38 template <
class Scalar>
39 using GpuPressureVectorType = gpuistl::GpuVector<Scalar>;
40 template <
class Scalar>
41 using GpuSeqCoarseOperatorType = Dune::
44 template <
class Scalar,
class Comm>
51template <
class FineOperator,
class Communication,
class Scalar,
bool transpose = false>
56 using CoarseOperator =
typename Details::GpuCoarseOperatorType<Scalar, Communication>;
58 using ParallelInformation = Communication;
59 using FineVectorType =
typename FineOperator::domain_type;
63 const FineVectorType& weights,
66 : communication_(&
const_cast<Communication&
>(comm))
75 using CoarseMatrix =
typename CoarseOperator::matrix_type;
78 coarseLevelMatrix_ = std::make_shared<CoarseMatrix>(
fineLevelMatrix.getRowIndices(),
85 coarseLevelCommunication_.reset(communication_, [](Communication*) {});
87 this->
lhs_.resize(coarseLevelMatrix_->N());
88 this->
rhs_.resize(coarseLevelMatrix_->N());
91 this->
operator_ = std::make_shared<CoarseOperator>(*coarseLevelMatrix_);
99 coarseLevelMatrix_->getNonZeroValues() = 0.0;
102 detail::calculateCoarseEntries<Scalar, transpose>(
fineLevelMatrix, *coarseLevelMatrix_, weights_, pressure_var_index_);
111 detail::restrictVector<Scalar, transpose>(
fine, this->
rhs_, weights_, pressure_var_index_);
119 detail::prolongateVector<Scalar, transpose>(this->
lhs_, fine, weights_, pressure_var_index_);
127 const Communication& getCoarseLevelCommunication()
const
129 return *coarseLevelCommunication_;
132 std::size_t getPressureIndex()
const
134 return pressure_var_index_;
138 Communication* communication_;
139 const FineVectorType& weights_;
140 const std::size_t pressure_var_index_;
141 std::shared_ptr<Communication> coarseLevelCommunication_;
142 std::shared_ptr<typename CoarseOperator::matrix_type> coarseLevelMatrix_;
Abstract base class for transfer between levels and creation of the coarse level system.
Definition twolevelmethodcpr.hh:49
FineOperatorType::range_type FineRangeType
The type of the range of the fine level operator.
Definition twolevelmethodcpr.hh:59
CoarseDomainType lhs_
The coarse level lhs.
Definition twolevelmethodcpr.hh:146
CoarseRangeType rhs_
The coarse level rhs.
Definition twolevelmethodcpr.hh:144
FineOperatorType::domain_type FineDomainType
The type of the domain of the fine level operator.
Definition twolevelmethodcpr.hh:63
std::shared_ptr< CoarseOperatorType > operator_
the coarse level linear operator.
Definition twolevelmethodcpr.hh:148
Hierarchical collection of key/value pairs.
Definition PropertyTree.hpp:39
Definition GpuPressureTransferPolicy.hpp:54
GpuPressureTransferPolicy * clone() const override
Clone the current object.
Definition GpuPressureTransferPolicy.hpp:122
void calculateCoarseEntries(const FineOperator &fineOperator) override
???.
Definition GpuPressureTransferPolicy.hpp:94
void createCoarseLevelSystem(const FineOperator &fineOperator) override
Algebraically creates the coarse level system.
Definition GpuPressureTransferPolicy.hpp:73
void moveToFineLevel(typename ParentType::FineDomainType &fine) override
Updates the fine level linear system after the correction of the coarse levels system.
Definition GpuPressureTransferPolicy.hpp:116
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:240
Algebraic twolevel methods.