File: include/demo/solver.hpp
1// --------------------------------------------------------------------------------------------------2// SPDX-License-Identifier: Apache-2.03// SPDX-FileCopyrightText: 2026 cpdocs developers4// --------------------------------------------------------------------------------------------------5#pragma once6 7#include <cstddef>8 9/// A small solver whose API grows with the enabled project features.10namespace demo {11 12/// Settings shared by every solver configuration.13struct settings {14 /// Maximum number of iterations.15 std::size_t iterations{100};16 /// Convergence tolerance.17 double tolerance{1e-8};18};19 20/// Solve on the calling thread.21double solve(settings const& options) noexcept;22 23#if DEMO_HAVE_MPI24/// Opaque MPI communicator handle.25struct communicator {26 /// Rank of the calling process.27 int rank{};28};29 30/// Solve distributed over the ranks of a communicator.31double solve(settings const& options, communicator const& world) noexcept;32#endif33 34#if DEMO_HAVE_CUDA35/// CUDA device selection.36struct device {37 /// Device ordinal.38 int ordinal{};39};40 41/// Solve on a CUDA device.42double solve(settings const& options, device const& gpu) noexcept;43#endif44 45namespace detail {46/// Implementation detail, hidden by api.hide.cpp-namespaces.47int scratch_size(settings const& options) noexcept;48} // namespace detail49 50} // namespace demo