19#ifndef TESTS_SAMPLE_PROBLEM_HPP
20#define TESTS_SAMPLE_PROBLEM_HPP
25#include "arccore/alina/ValueTypeInterface.h"
28template <
typename ValueType,
typename ColType,
typename PtrType,
typename RhsType>
31std::vector<ValueType>& val,
32std::vector<ColType>& col,
33std::vector<PtrType>& ptr,
34std::vector<RhsType>& rhs,
35double anisotropy = 1.0)
37 ptrdiff_t n3 = n * n * n;
49 const auto one = Arcane::Alina::math::identity<ValueType>();
52 double hy = hx * anisotropy;
53 double hz = hy * anisotropy;
56 for (ptrdiff_t k = 0, idx = 0; k < n; ++k) {
57 for (ptrdiff_t j = 0; j < n; ++j) {
58 for (ptrdiff_t i = 0; i < n; ++i, ++idx) {
60 col.push_back(idx - n * n);
61 val.push_back(-1.0 / (hz * hz) * one);
65 col.push_back(idx - n);
66 val.push_back(-1.0 / (hy * hy) * one);
70 col.push_back(idx - 1);
71 val.push_back(-1.0 / (hx * hx) * one);
75 val.push_back((2 / (hx * hx) + 2 / (hy * hy) + 2 / (hz * hz)) * one);
78 col.push_back(idx + 1);
79 val.push_back(-1.0 / (hx * hx) * one);
83 col.push_back(idx + n);
84 val.push_back(-1.0 / (hy * hy) * one);
88 col.push_back(idx + n * n);
89 val.push_back(-1.0 / (hz * hz) * one);
92 rhs.push_back(Arcane::Alina::math::constant<RhsType>(1.0));
93 ptr.push_back(
static_cast<PtrType
>(col.size()));