/* Copyright 2021 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 . */ #include #include #include #include #include #include #include #include #include namespace Opm { namespace Accelerator { template void Preconditioner::setOpencl(std::shared_ptr& context_, std::shared_ptr& queue_) { context = context_; queue = queue_; } template std::unique_ptr> Preconditioner::create(Type type, bool opencl_ilu_parallel, int verbosity) { switch (type ) { case Type::BILU0: return std::make_unique >(opencl_ilu_parallel, verbosity); case Type::CPR: return std::make_unique >(opencl_ilu_parallel, verbosity); case Type::BISAI: return std::make_unique >(opencl_ilu_parallel, verbosity); } OPM_THROW(std::logic_error, "Invalid preconditioner type " + std::to_string(static_cast(type))); } template bool Preconditioner::analyze_matrix(BlockedMatrix *mat, [[maybe_unused]] BlockedMatrix *jacMat) { return analyze_matrix(mat); } template bool Preconditioner::create_preconditioner(BlockedMatrix *mat, [[maybe_unused]] BlockedMatrix *jacMat) { return create_preconditioner(mat); } #define INSTANTIATE_BDA_FUNCTIONS(n) \ template std::unique_ptr > Preconditioner::create(Type, bool, int); \ template void Preconditioner::setOpencl(std::shared_ptr&, std::shared_ptr&); \ template bool Preconditioner::analyze_matrix(BlockedMatrix *, BlockedMatrix *); \ template bool Preconditioner::create_preconditioner(BlockedMatrix *, BlockedMatrix *); INSTANTIATE_BDA_FUNCTIONS(1); INSTANTIATE_BDA_FUNCTIONS(2); INSTANTIATE_BDA_FUNCTIONS(3); INSTANTIATE_BDA_FUNCTIONS(4); INSTANTIATE_BDA_FUNCTIONS(5); INSTANTIATE_BDA_FUNCTIONS(6); #undef INSTANTIATE_BDA_FUNCTIONS } //namespace Accelerator } //namespace Opm