![]() |
Blitz Support : |
From: Julian Cummings (cummings_at_[hidden])
Date: 2004-06-04 13:32:45
Hi Martin,
I figured out why your sample code would not compile. The code at line
821 of
<blitz/array/stencilops.h> is missing the "typename" keyword. I have
added this
missing keyword here and in a couple other functions in this header
file. With this
fix, your code compiles and runs just fine.
As for the issue you raised with the <blitz/array/stencils.h> file, I
agree that we
should be using the blitz:: qualifier internally and not relying on a
using directive.
There is a macro BZ_BLITZ_SCOPE that applies the blitz:: qualifier if
the compiler
supports namespaces, so I have added this within the definition of the macro
BZ_END_STENCIL_WITH_SHAPE.
Both of these bug fixes will be checked into the cvs repository in the
near future.
Thank you for bringing these bugs to my attention.
Regards, Julian C.
Martin Davis wrote:
>Hi,
>
>Sorry for the interruption.
>
>I've been trying to work out why the below code will not compile.
>(note: The test suite builds and works okay).
>Perhaps I am missing something?
>Any assistance for fixing this would be greatly appreciated.
>
>
>
>On a different note, usually I avoid "using" a namespace (I would prefer to use "blitz::").
>However, I suspect that the following define:
>array/stencils.h: #define BZ_END_STENCIL_WITH_SHAPE(MINS,MAXS) }
>would not work without the line "BZ_USING_NAMESPACE(blitz)". (As TinyVector is not qualified with blitz::).
>
>Thanks,
>
>Martin
>
>
>
>>>cat UnitMain.cpp
>>>
>>>
>//-(This is line 1)---------------------------------------------------------------
>#include <blitz/array.h>
>#include <blitz/array/stencil-et.h>
>#include <iostream>
>
>BZ_USING_NAMESPACE(blitz)
>
>BZ_DECLARE_STENCIL2(update_e_3D_stencil,E,H)
> E = curl(H);
>BZ_END_STENCIL_WITH_SHAPE(blitz::shape(-1,-1,-1),blitz::shape(+1,+1,+1))
>
>int main(int argc, char * argv[], char * env[])
>{
> Array<TinyVector<double,3>, 3> H(25,25,25);
> Array<TinyVector<double,3>, 3> E(25,25,25);
>
> H = 0;
>
> applyStencil(update_e_3D_stencil(), E, H);
>
> std::cout << H;
>
> return(0);
>}
>
>
>
>>>make
>>>
>>>
>gcc -O2 -Wall -c UnitMain.cpp
>In file included from /usr/include/blitz/array/stencils.cc:9:
>/usr/include/blitz/array/stencilops.h: In function `T::T_numtype
> blitz::curl(T&) [with T = blitz::FastArrayIterator<blitz::TinyVector<double,
> 3>, 3>]':
>
>/usr/include/blitz/array/fastiter.h:241: instantiated from `void blitz::FastArrayIterator<T_numtype, N_rank>::operator=(P_numtype) [with P_numtype = blitz::TinyVector<double, 3>, int N_rank = 3]'
>
>/usr/include/blitz/array/stencils.cc:9: instantiated from `static void update_e_3D_stencil::apply(T1&, T2&, T3, T4, T5, T6, T7, T8, T9, T10, T11) [with T1 = blitz::FastArrayIterator<blitz::TinyVector<double, 3>, 3>, T2 = blitz::FastArrayIterator<blitz::TinyVector<double, 3>, 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>]'
>
>/usr/include/blitz/array/stencils.cc:281: 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 = update_e_3D_stencil, T_numtype1 = blitz::TinyVector<double, 3>, T_array2 = blitz::Array<blitz::TinyVector<double, 3>, 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]'
>
>/usr/include/blitz/array/stencils.cc:508: instantiated from `void blitz::applyStencil(const T_stencil&, blitz::Array<T_numtype1, N_rank>&, T_array2&) [with T_stencil = update_e_3D_stencil, T_numtype1 = blitz::TinyVector<double, 3>, int N_rank = 3,
>T_array2 = blitz::Array<blitz::TinyVector<double, 3>, 3>]'
>UnitMain.cpp:19: instantiated from here
>
>/usr/include/blitz/array/stencilops.h:821: invalid use of member `
> blitz::FastArrayIterator<blitz::TinyVector<double, 3>, 3>::T_numtype'
>
>make: *** [UnitMain.o] Error 1
>
>
>
>>>gcc --version
>>>
>>>
>gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
>Copyright (C) 2002 Free Software Foundation, Inc.
>
>
>_____________________________________________________________
>Free, simple, fast, memorable email
>Become you_at_[hidden] at http://www.emailaccount.com/
>_______________________________________________
>Blitz-support mailing list
>Blitz-support_at_[hidden]
>http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
>
>
-- Dr. Julian C. Cummings E-mail: cummings_at_[hidden] California Institute of Technology Phone: 626-395-2543 1200 E. California Blvd., Mail Code 158-79 Fax: 626-584-5917 Pasadena, CA 91125