Added conversion preconditioner.

This commit is contained in:
Kjetil Olsen Lye 2023-03-31 13:47:10 +02:00
parent 0923698667
commit 0269f7215c
2 changed files with 78 additions and 0 deletions

View File

@ -172,9 +172,15 @@ if(CUDA_FOUND)
list (APPEND PUBLIC_HEADER_FILES opm/simulators/linalg/cuistl/detail/has_function.hpp)
list (APPEND PUBLIC_HEADER_FILES opm/simulators/linalg/cuistl/detail/preconditioner_should_call_post_pre.hpp)
list (APPEND PUBLIC_HEADER_FILES opm/simulators/linalg/cuistl/PreconditionerAdapter.hpp)
<<<<<<< HEAD
list (APPEND PUBLIC_HEADER_FILES opm/simulators/linalg/cuistl/CuSeqILU0.hpp)
list (APPEND PUBLIC_HEADER_FILES opm/simulators/linalg/cuistl/detail/fix_zero_diagonal.hpp)
list (APPEND PUBLIC_HEADER_FILES opm/simulators/linalg/cuistl/PreconditionerConvertFieldTypeAdapter.hpp)
=======
list (APPEND PUBLIC_HEADER_FILES opm/simulators/linalg/cuistl/PreconditionerConvertFieldTypeAdapter.hpp)
>>>>>>> 05ee1a855 (Added conversion preconditioner.)
endif()

View File

@ -0,0 +1,72 @@
/*
Copyright 2022-2023 SINTEF AS
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_CUISTL_PRECONDIDTIONER_SHOULD_CALL_POST_PRE_HPP
#define OPM_CUISTL_PRECONDIDTIONER_SHOULD_CALL_POST_PRE_HPP
#include <opm/simulators/linalg/cuistl/detail/has_function.hpp>
namespace Opm::cuistl::detail
{
<<<<<<< HEAD
//! @brief Tests (compile time) if the preconditioner type needs to call pre() before a call to apply()
=======
//! @brief Tests (compile time) if the preconditioner type needs to call pre
>>>>>>> 3e014de90 (Added CuSeqILU0 with the preconditioner adapter.)
//!
//! @note This is mostly used to avoid unneeded copying back and front to the GPU, as well
//! as avoiding communication.
template <class PreconditionerType>
constexpr bool
shouldCallPreconditionerPre()
{
if constexpr (has_should_call_pre<PreconditionerType>::value) {
return PreconditionerType::shouldCallPre();
} else {
// If the preconditioner type does not have a way of signalling the need
// to call pre(), we should always call it. This is because it could be an
// old design.
return true;
}
}
<<<<<<< HEAD
//! @brief Tests (compile time) if the preconditioner type needs to call post() after a call to apply(...)
=======
//! @brief Tests (compile time) if the preconditioner type needs to call pre
>>>>>>> 3e014de90 (Added CuSeqILU0 with the preconditioner adapter.)
//!
//! @note This is mostly used to avoid unneeded copying back and front to the GPU, as well
//! as avoiding communication.
template <class PreconditionerType>
constexpr bool
shouldCallPreconditionerPost()
{
if constexpr (has_should_call_post<PreconditionerType>::value) {
return PreconditionerType::shouldCallPost();
} else {
// If the preconditioner type does not have a way of signalling the need
// to call post(), we should always call it. This is because it could be an
// old design.
return true;
}
}
} // namespace Opm::cuistl::detail
#endif