30 const ext::shared_ptr<FdmMesher>& mesher)
32 i00_(new
Size[mesher->layout()->size()]),
33 i10_(new
Size[mesher->layout()->size()]),
34 i20_(new
Size[mesher->layout()->size()]),
35 i01_(new
Size[mesher->layout()->size()]),
36 i21_(new
Size[mesher->layout()->size()]),
37 i02_(new
Size[mesher->layout()->size()]),
38 i12_(new
Size[mesher->layout()->size()]),
39 i22_(new
Size[mesher->layout()->size()]),
40 a00_(new
Real[mesher->layout()->size()]),
41 a10_(new
Real[mesher->layout()->size()]),
42 a20_(new
Real[mesher->layout()->size()]),
43 a01_(new
Real[mesher->layout()->size()]),
44 a11_(new
Real[mesher->layout()->size()]),
45 a21_(new
Real[mesher->layout()->size()]),
46 a02_(new
Real[mesher->layout()->size()]),
47 a12_(new
Real[mesher->layout()->size()]),
48 a22_(new
Real[mesher->layout()->size()]),
52 && d0_ < mesher->layout()->dim().size()
53 && d1_ < mesher->layout()->dim().size(),
54 "inconsistent derivative directions");
56 for (
const auto& iter : *mesher->layout()) {
57 const Size i = iter.index();
59 i10_[i] = mesher->layout()->neighbourhood(iter,
d1_, -1);
60 i01_[i] = mesher->layout()->neighbourhood(iter,
d0_, -1);
61 i21_[i] = mesher->layout()->neighbourhood(iter,
d0_, 1);
62 i12_[i] = mesher->layout()->neighbourhood(iter,
d1_, 1);
63 i00_[i] = mesher->layout()->neighbourhood(iter,
d0_, -1,
d1_, -1);
64 i20_[i] = mesher->layout()->neighbourhood(iter,
d0_, 1,
d1_, -1);
65 i02_[i] = mesher->layout()->neighbourhood(iter,
d0_, -1,
d1_, 1);
66 i22_[i] = mesher->layout()->neighbourhood(iter,
d0_, 1,
d1_, 1);
113 << u.
size() <<
" vs " <<
mesher_->layout()->size());
125 for (
Size i=0; i < retVal.
size(); ++i) {
126 retVal[i] = a00[i]*u[i00[i]]
143 for (
Size i=0; i <
mesher_->layout()->size(); ++i) {
148 retVal(i, i ) +=
a11_[i];
165 for (
Size i=0; i < size; ++i) {
178 std::swap(d0_, m.d0_);
179 std::swap(d1_, m.d1_);
181 i00_.swap(m.i00_); i10_.swap(m.i10_); i20_.swap(m.i20_);
182 i01_.swap(m.i01_); i21_.swap(m.i21_); i02_.swap(m.i02_);
183 i12_.swap(m.i12_); i22_.swap(m.i22_);
184 a00_.swap(m.a00_); a10_.swap(m.a10_); a20_.swap(m.a20_);
185 a01_.swap(m.a01_); a21_.swap(m.a21_); a02_.swap(m.a02_);
186 a12_.swap(m.a12_); a22_.swap(m.a22_); a11_.swap(m.a11_);
1-D array used in linear algebra.
Size size() const
dimension of the array
std::unique_ptr< Size[]> i12_
SparseMatrix toMatrix() const override
std::unique_ptr< Size[]> i20_
std::unique_ptr< Real[]> a20_
std::unique_ptr< Size[]> i02_
std::unique_ptr< Size[]> i21_
std::unique_ptr< Real[]> a11_
std::unique_ptr< Size[]> i01_
std::unique_ptr< Real[]> a00_
std::unique_ptr< Real[]> a02_
std::unique_ptr< Size[]> i10_
Array apply(const Array &r) const override
NinePointLinearOp mult(const Array &u) const
ext::shared_ptr< FdmMesher > mesher_
std::unique_ptr< Real[]> a22_
std::unique_ptr< Real[]> a10_
void swap(NinePointLinearOp &m) noexcept
std::unique_ptr< Real[]> a12_
NinePointLinearOp()=default
std::unique_ptr< Real[]> a21_
std::unique_ptr< Size[]> i00_
std::unique_ptr< Size[]> i22_
std::unique_ptr< Real[]> a01_
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
memory layout of a fdm linear operator
const ext::shared_ptr< FdmMesher > mesher_
std::size_t Size
size of a container
boost::numeric::ublas::compressed_matrix< Real > SparseMatrix
nine point linear operator