E
E
erthalion2014-02-06 17:52:03
C++ / C#
erthalion, 2014-02-06 17:52:03

Using stencil in blitz++ 0.10

Perhaps someone used this library and knows what the trouble is (already asked on stackoverflow , but so far I have not found an answer).
I'm trying to use stencil object according to Blitz++ 0.10 User Guide, but here's the code:

#include <blitz/array.h>
#include <blitz/array/stencil-et.h>
#include <blitz/array/stencilops.h>
#include <blitz/array/stencil-et-macros.h>
 
BZ_USING_NAMESPACE(blitz)
 
BZ_DECLARE_STENCIL2(test,A,B)
    B = Laplacian3D(A);
BZ_END_STENCIL
 
int main(int argc, const char *argv[])
{
    Array<long double, 3> A(2, 2, 2), B(2, 2, 2);
    applyStencil(test(), A, B);
    return 0;
}

when compiled it produces the following
test.cpp: In static member function ‘static void test::apply(T1&, T2&, T3, T4, T5, T6, T7, T8, T9, T10, T11) [with T1 = blitz::FastArrayIterator<long double, 3>, T2 = blitz::FastArrayIterator<long double, 3>, T3 = blitz::dummy<double>, T4 = blitz::dummy<double>, T5 = blitz::dummy<double>, T6 = blitz::dummy<double>, T7 = blitz::dummy<double>, T8 = blitz::dummy<double>, T9 = blitz::dummy<double>, T10 = blitz::dummy<double>, T11 = blitz::dummy<double>]’:
blitz/include/blitz/array/stencils.cc:288:13:   instantiated from ‘void blitz::applyStencil_imp(const T_stencil&, blitz::Array<T_numtype1, 3>&, T_array2&, T_array3&, T_array4&, T_array5&, T_array6&, T_array7&, T_array8&, T_array9&, T_array10&, T_array11&) [with T_stencil = test, T_numtype1 = long double, T_array2 = blitz::Array<long double, 3>, T_array3 = blitz::dummyArray, T_array4 = blitz::dummyArray, T_array5 = blitz::dummyArray, T_array6 = blitz::dummyArray, T_array7 = blitz::dummyArray, T_array8 = blitz::dummyArray, T_array9 = blitz::dummyArray, T_array10 = blitz::dummyArray, T_array11 = blitz::dummyArray]’
  itz/include/blitz/array/stencils.cc:515:5:   instantiated from ‘void blitz::applyStencil(const T_stencil&, blitz::Array<T_numtype1, N_rank>&, T_array2&) [with T_stencil▽= test, T_numtype1 = long double, int N_rank = 3, T_array2 = blitz::Array<long double, 3>]’
test.cpp:15:30:   instantiated from here
test.cpp:9:5: error: no matching function for call to ‘Laplacian3D(blitz::FastArrayIterator<long double, 3>&)’
test.cpp:9:5: note: candidates are:
blitz/include/blitz/array/stencil-classes.cc:15348:3: note: template<class T1> blitz::_bz_ArrayExpr<blitz::Laplacian3D_et<typename blitz::asExpr<T>::T_expr::T_range_result, typename blitz::asExpr<T>::T_expr::T_numtype> > blitz::Laplacian3D(const blitz::ETBase<T>&)
blitz/include/blitz/array/stencil-classes.cc:15356:3: note: template<class T, int N> blitz::_bz_ArrayExpr<blitz::Laplacian3D_et<typename blitz::asExpr<blitz::Array<T, N> >::T_expr::T_range_result, T> > blitz::Laplacian3D(const blitz::Array<T, N>&)
blitz/include/blitz/array/stencil-classes.cc:15361:3: note: template<class T, int N> blitz::_bz_ArrayExpr<blitz::Laplacian3D_et<typename blitz::asExpr<blitz::Array<T, N> >::T_expr::T_range_result, T> > blitz::Laplacian3D(blitz::Array<T, N>&)
In file included from blitz/include/blitz/array/stencil-et.h:398:0,
                 from test.cpp:2:
blitz/include/blitz/array/stencil-classes.cc: In function ‘blitz::_bz_ArrayExpr<blitz::Laplacian3D_et<typename blitz::asExpr<T>::T_expr::T_range_result, typename blitz::asExpr<T>::T_expr::T_numtype> > blitz::Laplacian3D(const blitz::ETBase<T>&) [with T1 = blitz::stencilExtent<3, long double>, typename blitz::asExpr<T>::T_expr::T_numtype = blitz::stencilExtent<3, long double>, typename blitz::asExpr<T>::T_expr::T_range_result = blitz::_bz_ArrayExpr<blitz::_bz_ArrayExprConstant<blitz::stencilExtent<3, long double> > >]’:
test.cpp:9:5:   instantiated from ‘static void test::apply(T1&, T2&, T3, T4, T5, T6, T7, T8, T9, T10, T11) [with T1 = blitz::stencilExtent<3, long double>, T2 = blitz::stencilExtent<3, long double>, T3 = blitz::dummy<double>, T4 = blitz::dummy<double>, T5 = blitz::dummy<double>, T6 = blitz::dummy<double>, T7 = blitz::dummy<double>, T8 = blitz::dummy<double>, T9 = blitz::dummy<double>, T10 = blitz::dummy<double>, T11 = blitz::dummy<double>]’
blitz/include/blitz/array/stencils.cc:113:5:   instantiated from ‘void blitz::calcStencilExtent(T_extent&, const T_stencil&, const blitz::Array<T_numtype1, N_rank>&, const T_array2&, const T_array3&, const T_array4&, const T_array5&, const T_array6&, const T_array7&, const T_array8&, const T_array9&, const T_array10&, const T_array11&) [with T_extent = blitz::stencilExtent<3, long double>, int N_rank = 3, T_stencil = test, T_numtype1 = long double, T_array2 = blitz::Array<long double, 3>, T_array3 = blitz::dummyArray, T_array4 = blitz::dummyArray, T_array5 = blitz::dummyArray, T_array6 = blitz::dummyArray, T_array7 = blitz::dummyArray, T_array8 = blitz::dummyArray, T_array9 = blitz::dummyArray, T_array10 = blitz::dummyArray, T_array11 = blitz::dummyArray]’
blitz/include/blitz/array/stencils.cc:161:5:   instantiated from ‘static void blitz::_getStencilExtent<hasExtents>::getStencilExtent(blitz::TinyVector<int, N_rank>&, blitz::TinyVector<int, N_rank>&, const T_stencil&, blitz::Array<T_numtype1, N_rank>&, T_array2&, T_array3&, T_array4&, T_array5&, T_array6&, T_array7&, T_array8&, T_array9&, T_array10&, T_array11&) [with int N_rank = 3, T_stencil = test, T_numtype1 = long double, T_array2 = blitz::Array<long double, 3>, T_array3 = blitz::dummyArray, T_array4 = blitz::dummyArray, T_array5 = blitz::dummyArray, T_array6 = blitz::dummyArray, T_array7 = blitz::dummyArray, T_array8 = blitz::dummyArray, T_array9 = blitz::dummyArray, T_array10 = blitz::dummyArray, T_array11 = blitz::dummyArray, int hasExtents = 0]’
blitz/include/blitz/array/stencils.cc:195:5:   instantiated from ‘void blitz::getStencilExtent(blitz::TinyVector<int, N_rank>&, blitz::TinyVector<int, N_rank>&, const T_stencil&, blitz::Array<T_numtype1, N_rank>&, T_array2&, T_array3&, T_array4&, T_array5&, T_array6&, T_array7&, T_array8&, T_array9&, T_array10&, T_array11&) [with int N_rank = 3, T_stencil = test, T_numtype1 = long double, T_array2 = blitz::Array<long double, 3>, T_array3 = blitz::dummyArray, T_array4 = blitz::dummyArray, T_array5 = blitz::dummyArray, T_array6 = blitz::dummyArray, T_array7 = blitz::dummyArray, T_array8 = blitz::dummyArray, T_array9 = blitz::dummyArray, T_array10 = blitz::dummyArray, T_array11 = blitz::dummyArray]’
blitz/include/blitz/array/stencils.cc:216:5:   instantiated from ‘void blitz::applyStencil_imp(const T_stencil&, blitz::Array<T_numtype1, 3>&, T_array2&, T_array3&, T_array4&, T_array5&, T_array6&, T_array7&, T_array8&, T_array9&, T_array10&, T_array11&) [with T_stencil = test, T_numtype1 = long double, T_array2 = blitz::Array<long double, 3>, T_array3 = blitz::dummyArray, T_array4 = blitz::dummyArray, T_array5 = blitz::dummyArray, T_array6 = blitz::dummyArray, T_array7 = blitz::dummyArray, T_array8 = blitz::dummyArray, T_array9 = blitz::dummyArray, T_array10 = blitz::dummyArray, T_array11 = blitz::dummyArray]’
blitz/include/blitz/array/stencils.cc:515:5:   instantiated from ‘void blitz::applyStencil(const T_stencil&, blitz::Array<T_numtype1, N_rank>&, T_array2&) [with T_stencil = test, T_numtype1 = long double, int N_rank = 3, T_array2 = blitz::Array<long double, 3>]’
test.cpp:15:30:   instantiated from here
blitz/include/blitz/array/stencil-classes.cc:15351:126: error: ‘const class blitz::stencilExtent<3, long double>’ has no member named ‘domain’

Actually, I don’t understand at all what I’m doing wrong, and how exactly to call this unfortunate Laplacian3D?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lolshto, 2014-02-07
@erthalion

judging by the library code, you need to call Laplacian3D directly from main, not from the "stencil". The latter, as I understand it, is needed if you want to perform some actions on all elements of the matrices. And inside you are not given arrays, but their elements.
But I'm not a pro at blitz at all, I just passed by and looked at the code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question