source: XIOS/dev/dev_olga/src/extern/blitz/include/blitz/array/stencils.cc @ 1022

Last change on this file since 1022 was 1022, checked in by mhnguyen, 7 years ago
File size: 23.0 KB
Line 
1/***************************************************************************
2 * blitz/array/stencils.cc  Apply stencils to arrays
3 *
4 * $Id$
5 *
6 * Copyright (C) 1997-2011 Todd Veldhuizen <tveldhui@acm.org>
7 *
8 * This file is a part of Blitz.
9 *
10 * Blitz is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation, either version 3
13 * of the License, or (at your option) any later version.
14 *
15 * Blitz is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with Blitz.  If not, see <http://www.gnu.org/licenses/>.
22 *
23 * Suggestions:          blitz-devel@lists.sourceforge.net
24 * Bugs:                 blitz-support@lists.sourceforge.net   
25 *
26 * For more information, please see the Blitz++ Home Page:
27 *    https://sourceforge.net/projects/blitz/
28 *
29 ****************************************************************************/
30#ifndef BZ_ARRAYSTENCILS_CC
31#define BZ_ARRAYSTENCILS_CC
32
33#ifndef BZ_ARRAYSTENCILS_H
34 #error <blitz/array/stencil.cc> must be included via <blitz/array/stencils.h>
35#endif
36
37BZ_NAMESPACE(blitz)
38
39// NEEDS_WORK:
40// o Need to allow scalar arguments as well as arrays
41// o Unit stride optimization
42// o Tiling
43// o Pass coordinate vector to stencil, so that where-like constructs
44//   can depend on location
45// o Maybe allow expression templates to be passed as
46//   array parameters?
47
48/*
49 * There are a lot of kludges in this code to work around the fact that
50 * you can't have default template parameters with function templates.
51 * Ideally, one would implement applyStencil(..) as:
52 *
53 * template<typename T_stencil, typename T_numtype1, typename T_array2,
54 *    class T_array3, typename T_array4, typename T_array5, typename T_array6,
55 *    class T_array7, typename T_array8, typename T_array9, typename T_array10,
56 *    class T_array11>
57 * void applyStencil(const T_stencil& stencil, Array<T_numtype1,3>& A,
58 *    T_array2& B = _dummyArray, T_array3& C = _dummyArray, ......)
59 *
60 * and allow for up to (say) 11 arrays to be passed.  But this doesn't
61 * appear to be legal C++.  Instead, 11 versions of applyStencil are
62 * provided, each one with a different number of array parameters,
63 * and these stubs fill in the _dummyArray parameters and invoke
64 * applyStencil_imp().
65 */
66
67template<int N_rank, typename T_numtype1, typename T_array2,
68    class T_array3, typename T_array4, typename T_array5, typename T_array6,
69    class T_array7, typename T_array8, typename T_array9, typename T_array10,
70    class T_array11>
71void checkShapes(const Array<T_numtype1,N_rank>& BZ_DEBUG_PARAM(A),
72    const T_array2& BZ_DEBUG_PARAM(B), const T_array3& BZ_DEBUG_PARAM(C),
73    const T_array4& BZ_DEBUG_PARAM(D), const T_array5& BZ_DEBUG_PARAM(E),
74    const T_array6& BZ_DEBUG_PARAM(F), const T_array7& BZ_DEBUG_PARAM(G), 
75    const T_array8& BZ_DEBUG_PARAM(H), const T_array9& BZ_DEBUG_PARAM(I),
76    const T_array10& BZ_DEBUG_PARAM(J), const T_array11& BZ_DEBUG_PARAM(K))
77{
78    BZPRECONDITION(areShapesConformable(A.shape(),B.shape())
79        && areShapesConformable(A.shape(),C.shape())
80        && areShapesConformable(A.shape(),D.shape())
81        && areShapesConformable(A.shape(),E.shape())
82        && areShapesConformable(A.shape(),F.shape())
83        && areShapesConformable(A.shape(),G.shape())
84        && areShapesConformable(A.shape(),H.shape())
85        && areShapesConformable(A.shape(),I.shape())
86        && areShapesConformable(A.shape(),J.shape())
87        && areShapesConformable(A.shape(),K.shape()));
88}
89
90template<typename T_extent, int N_rank, 
91    class T_stencil, typename T_numtype1, typename T_array2,
92    class T_array3, typename T_array4, typename T_array5, typename T_array6,
93    class T_array7, typename T_array8, typename T_array9, typename T_array10,
94    class T_array11>
95void calcStencilExtent(T_extent& At, const T_stencil& stencil, 
96    const Array<T_numtype1,N_rank>&,
97    const T_array2&, const T_array3&, const T_array4&, const T_array5&, 
98    const T_array6&, const T_array7&, const T_array8&, const T_array9&, 
99    const T_array10&, const T_array11&)
100{
101    // Interrogate the stencil to find out its extent
102    _bz_typename stencilExtent_traits<T_array2>::T_stencilExtent Bt;
103    _bz_typename stencilExtent_traits<T_array3>::T_stencilExtent Ct;
104    _bz_typename stencilExtent_traits<T_array4>::T_stencilExtent Dt;
105    _bz_typename stencilExtent_traits<T_array5>::T_stencilExtent Et;
106    _bz_typename stencilExtent_traits<T_array6>::T_stencilExtent Ft;
107    _bz_typename stencilExtent_traits<T_array7>::T_stencilExtent Gt;
108    _bz_typename stencilExtent_traits<T_array8>::T_stencilExtent Ht;
109    _bz_typename stencilExtent_traits<T_array9>::T_stencilExtent It;
110    _bz_typename stencilExtent_traits<T_array10>::T_stencilExtent Jt;
111    _bz_typename stencilExtent_traits<T_array11>::T_stencilExtent Kt;
112
113    stencil.apply(At, Bt, Ct, Dt, Et, Ft, Gt, Ht, It, Jt, Kt);
114    At.combine(Bt);
115    At.combine(Ct);
116    At.combine(Dt);
117    At.combine(Et);
118    At.combine(Ft);
119    At.combine(Gt);
120    At.combine(Ht);
121    At.combine(It);
122    At.combine(Jt);
123    At.combine(Kt);
124}
125
126template<int N_rank, typename T_stencil, typename T_numtype1, typename T_array2>
127RectDomain<N_rank> interiorDomain(const T_stencil& stencil,
128    const Array<T_numtype1,N_rank>& A,
129    const T_array2& B)
130{
131    RectDomain<N_rank> domain = A.domain();
132
133    // Interrogate the stencil to find out its extent
134    stencilExtent<3, T_numtype1> At;
135    calcStencilExtent(At, stencil, A, B, _dummyArray, _dummyArray, 
136        _dummyArray, _dummyArray, _dummyArray, _dummyArray, _dummyArray, 
137        _dummyArray, _dummyArray);
138
139    // Shrink the domain according to the stencil size
140    TinyVector<int,N_rank> lbound, ubound;
141    lbound = domain.lbound() - (At.min)();
142    ubound = domain.ubound() - (At.max)();
143    return RectDomain<N_rank>(lbound,ubound);
144}
145
146template<int hasExtents>
147struct _getStencilExtent {
148template<int N_rank,
149    class T_stencil, typename T_numtype1, typename T_array2,
150    class T_array3, typename T_array4, typename T_array5, typename T_array6,
151    class T_array7, typename T_array8, typename T_array9, typename T_array10,
152    class T_array11>
153static void getStencilExtent(TinyVector<int,N_rank>& minb,
154    TinyVector<int,N_rank>& maxb,
155    const T_stencil& stencil, Array<T_numtype1,N_rank>& A,
156    T_array2& B, T_array3& C, T_array4& D, T_array5& E, T_array6& F,
157    T_array7& G, T_array8& H, T_array9& I, T_array10& J, T_array11& K)
158{
159    // Interrogate the stencil to find out its extent
160    stencilExtent<N_rank, T_numtype1> At;
161    calcStencilExtent(At, stencil, A, B, C, D, E, F, G, H, I, J, K);
162    minb = (At.min)();
163    maxb = (At.max)();
164}
165};
166
167template<>
168struct _getStencilExtent<1> {
169template<int N_rank,
170    class T_stencil, typename T_numtype1, typename T_array2,
171    class T_array3, typename T_array4, typename T_array5, typename T_array6,
172    class T_array7, typename T_array8, typename T_array9, typename T_array10,
173    class T_array11>
174static inline void getStencilExtent(TinyVector<int,N_rank>& minb,
175    TinyVector<int,N_rank>& maxb,
176    const T_stencil& stencil, Array<T_numtype1,N_rank>&,
177    T_array2&, T_array3&, T_array4&, T_array5&, T_array6&,
178    T_array7&, T_array8&, T_array9&, T_array10&, T_array11&)
179{
180    stencil.getExtent(minb, maxb);
181}
182};
183
184template<int N_rank,
185    class T_stencil, typename T_numtype1, typename T_array2,
186    class T_array3, typename T_array4, typename T_array5, typename T_array6,
187    class T_array7, typename T_array8, typename T_array9, typename T_array10,
188    class T_array11>
189inline void getStencilExtent(TinyVector<int,N_rank>& minb,
190    TinyVector<int,N_rank>& maxb,
191    const T_stencil& stencil, Array<T_numtype1,N_rank>& A,
192    T_array2& B, T_array3& C, T_array4& D, T_array5& E, T_array6& F,
193    T_array7& G, T_array8& H, T_array9& I, T_array10& J, T_array11& K)
194{
195    _getStencilExtent<T_stencil::hasExtent>::getStencilExtent(
196        minb, maxb, stencil, A, B, C, D, E, F, G, H, I, J, K);
197}
198
199/*
200 * This version applies a stencil to a set of 3D arrays.  Up to 11 arrays
201 * may be used.  Any unused arrays are turned into dummyArray objects.
202 * Operations on dummyArray objects are translated into no-ops.
203 */
204template<typename T_stencil, typename T_numtype1, typename T_array2,
205    class T_array3, typename T_array4, typename T_array5, typename T_array6,
206    class T_array7, typename T_array8, typename T_array9, typename T_array10,
207    class T_array11>
208void applyStencil_imp(const T_stencil& stencil, Array<T_numtype1,3>& A,
209    T_array2& B, T_array3& C, T_array4& D, T_array5& E, T_array6& F,
210    T_array7& G, T_array8& H, T_array9& I, T_array10& J, T_array11& K)
211{
212    checkShapes(A,B,C,D,E,F,G,H,I,J,K);
213 
214    // Determine stencil extent
215    TinyVector<int,3> minb, maxb;
216    getStencilExtent(minb, maxb, stencil, A, B, C, D, E, F, G, H, I, J, K);
217
218    // Now determine the subdomain over which the stencil
219    // can be applied without worrying about overrunning the
220    // boundaries of the array
221    int stencil_lbound0 = minb(0);
222    int stencil_lbound1 = minb(1);
223    int stencil_lbound2 = minb(2);
224
225    int stencil_ubound0 = maxb(0);
226    int stencil_ubound1 = maxb(1);
227    int stencil_ubound2 = maxb(2);
228
229    int lbound0 = (extrema::max)(A.lbound(0), A.lbound(0) - stencil_lbound0);
230    int lbound1 = (extrema::max)(A.lbound(1), A.lbound(1) - stencil_lbound1);
231    int lbound2 = (extrema::max)(A.lbound(2), A.lbound(2) - stencil_lbound2);
232
233    int ubound0 = (extrema::min)(A.ubound(0), A.ubound(0) - stencil_ubound0);
234    int ubound1 = (extrema::min)(A.ubound(1), A.ubound(1) - stencil_ubound1);
235    int ubound2 = (extrema::min)(A.ubound(2), A.ubound(2) - stencil_ubound2);
236
237#if 0
238    cout << "Stencil bounds are:" << endl
239     << lbound0 << '\t' << ubound0 << endl
240     << lbound1 << '\t' << ubound1 << endl
241     << lbound2 << '\t' << ubound2 << endl;
242#endif
243
244    // Now do the actual loop
245    FastArrayIterator<T_numtype1,3> Aiter(A);
246    _bz_typename T_array2::T_iterator Biter(B);
247    _bz_typename T_array3::T_iterator Citer(C);
248    _bz_typename T_array4::T_iterator Diter(D);
249    _bz_typename T_array5::T_iterator Eiter(E);
250    _bz_typename T_array6::T_iterator Fiter(F);
251    _bz_typename T_array7::T_iterator Giter(G);
252    _bz_typename T_array8::T_iterator Hiter(H);
253    _bz_typename T_array9::T_iterator Iiter(I);
254    _bz_typename T_array10::T_iterator Jiter(J);
255    _bz_typename T_array11::T_iterator Kiter(K);
256
257    // Load the strides for the innermost loop
258    Aiter.loadStride(2);
259    Biter.loadStride(2);
260    Citer.loadStride(2);
261    Diter.loadStride(2);
262    Eiter.loadStride(2);
263    Fiter.loadStride(2);
264    Giter.loadStride(2);
265    Hiter.loadStride(2);
266    Iiter.loadStride(2);
267    Jiter.loadStride(2);
268    Kiter.loadStride(2);
269
270    for (int i=lbound0; i <= ubound0; ++i)
271    {
272      for (int j=lbound1; j <= ubound1; ++j)
273      {
274        Aiter.moveTo(i,j,lbound2);
275        Biter.moveTo(i,j,lbound2);
276        Citer.moveTo(i,j,lbound2);
277        Diter.moveTo(i,j,lbound2);
278        Eiter.moveTo(i,j,lbound2);
279        Fiter.moveTo(i,j,lbound2);
280        Giter.moveTo(i,j,lbound2);
281        Hiter.moveTo(i,j,lbound2);
282        Iiter.moveTo(i,j,lbound2);
283        Jiter.moveTo(i,j,lbound2);
284        Kiter.moveTo(i,j,lbound2);
285
286        for (int k=lbound2; k <= ubound2; ++k)
287        {
288            stencil.apply(Aiter, Biter, Citer, Diter, Eiter, Fiter, Giter,
289                Hiter, Iiter, Jiter, Kiter);
290
291            Aiter.advance();
292            Biter.advance();
293            Citer.advance();
294            Diter.advance();
295            Eiter.advance();
296            Fiter.advance();
297            Giter.advance();
298            Hiter.advance();
299            Iiter.advance();
300            Jiter.advance();
301            Kiter.advance();
302        }
303      }
304    }
305}
306
307/*
308 * This version applies a stencil to a set of 2D arrays.  Up to 11 arrays
309 * may be used.  Any unused arrays are turned into dummyArray objects.
310 * Operations on dummyArray objects are translated into no-ops.
311 */
312template<typename T_stencil, typename T_numtype1, typename T_array2,
313    class T_array3, typename T_array4, typename T_array5, typename T_array6,
314    class T_array7, typename T_array8, typename T_array9, typename T_array10,
315    class T_array11>
316void applyStencil_imp(const T_stencil& stencil, Array<T_numtype1,2>& A,
317    T_array2& B, T_array3& C, T_array4& D, T_array5& E, T_array6& F, 
318    T_array7& G, T_array8& H, T_array9& I, T_array10& J, T_array11& K)
319{
320    checkShapes(A,B,C,D,E,F,G,H,I,J,K);
321
322    // Determine stencil extent
323    TinyVector<int,2> minb, maxb;
324    getStencilExtent(minb, maxb, stencil, A, B, C, D, E, F, G, H, I, J, K);
325
326    // Now determine the subdomain over which the stencil
327    // can be applied without worrying about overrunning the
328    // boundaries of the array
329    int stencil_lbound0 = minb(0);
330    int stencil_lbound1 = minb(1);
331
332    int stencil_ubound0 = maxb(0);
333    int stencil_ubound1 = maxb(1);
334
335    int lbound0 = (extrema::max)(A.lbound(0), A.lbound(0) - stencil_lbound0);
336    int lbound1 = (extrema::max)(A.lbound(1), A.lbound(1) - stencil_lbound1);
337
338    int ubound0 = (extrema::min)(A.ubound(0), A.ubound(0) - stencil_ubound0);
339    int ubound1 = (extrema::min)(A.ubound(1), A.ubound(1) - stencil_ubound1);
340
341#if 0
342    cout << "Stencil bounds are:" << endl
343     << lbound0 << '\t' << ubound0 << endl
344     << lbound1 << '\t' << ubound1 << endl;
345#endif
346
347    // Now do the actual loop
348    FastArrayIterator<T_numtype1,2> Aiter(A);
349    _bz_typename T_array2::T_iterator Biter(B);
350    _bz_typename T_array3::T_iterator Citer(C);
351    _bz_typename T_array4::T_iterator Diter(D);
352    _bz_typename T_array5::T_iterator Eiter(E);
353    _bz_typename T_array6::T_iterator Fiter(F);
354    _bz_typename T_array7::T_iterator Giter(G);
355    _bz_typename T_array8::T_iterator Hiter(H);
356    _bz_typename T_array9::T_iterator Iiter(I);
357    _bz_typename T_array10::T_iterator Jiter(J);
358    _bz_typename T_array11::T_iterator Kiter(K);
359
360    // Load the strides for the innermost loop
361    Aiter.loadStride(1);
362    Biter.loadStride(1);
363    Citer.loadStride(1);
364    Diter.loadStride(1);
365    Eiter.loadStride(1);
366    Fiter.loadStride(1);
367    Giter.loadStride(1);
368    Hiter.loadStride(1);
369    Iiter.loadStride(1);
370    Jiter.loadStride(1);
371    Kiter.loadStride(1);
372
373    for (int i=lbound0; i <= ubound0; ++i)
374    {
375        Aiter.moveTo(i,lbound1);
376        Biter.moveTo(i,lbound1);
377        Citer.moveTo(i,lbound1);
378        Diter.moveTo(i,lbound1);
379        Eiter.moveTo(i,lbound1);
380        Fiter.moveTo(i,lbound1);
381        Giter.moveTo(i,lbound1);
382        Hiter.moveTo(i,lbound1);
383        Iiter.moveTo(i,lbound1);
384        Jiter.moveTo(i,lbound1);
385        Kiter.moveTo(i,lbound1);
386
387        for (int k=lbound1; k <= ubound1; ++k)
388        {
389            stencil.apply(Aiter, Biter, Citer, Diter, Eiter, Fiter, Giter,
390                Hiter, Iiter, Jiter, Kiter);
391
392            Aiter.advance();
393            Biter.advance();
394            Citer.advance();
395            Diter.advance();
396            Eiter.advance();
397            Fiter.advance();
398            Giter.advance();
399            Hiter.advance();
400            Iiter.advance();
401            Jiter.advance();
402            Kiter.advance();
403        }
404    }
405}
406
407/*
408 * This version applies a stencil to a set of 1D arrays.  Up to 11 arrays
409 * may be used.  Any unused arrays are turned into dummyArray objects.
410 * Operations on dummyArray objects are translated into no-ops.
411 */
412template<typename T_stencil, typename T_numtype1, typename T_array2,
413    class T_array3, typename T_array4, typename T_array5, typename T_array6,
414    class T_array7, typename T_array8, typename T_array9, typename T_array10,
415    class T_array11>
416void applyStencil_imp(const T_stencil& stencil, Array<T_numtype1,1>& A,
417    T_array2& B, T_array3& C, T_array4& D, T_array5& E, T_array6& F, 
418    T_array7& G, T_array8& H, T_array9& I, T_array10& J, T_array11& K)
419{
420    checkShapes(A,B,C,D,E,F,G,H,I,J,K);
421
422    // Determine stencil extent
423    TinyVector<int,1> minb, maxb;
424    getStencilExtent(minb, maxb, stencil, A, B, C, D, E, F, G, H, I, J, K);
425
426    // Now determine the subdomain over which the stencil
427    // can be applied without worrying about overrunning the
428    // boundaries of the array
429    int stencil_lbound0 = minb(0);
430    int stencil_ubound0 = maxb(0);
431
432    int lbound0 = (extrema::max)(A.lbound(0), A.lbound(0) - stencil_lbound0);
433    int ubound0 = (extrema::min)(A.ubound(0), A.ubound(0) - stencil_ubound0);
434
435#if 0
436    cout << "Stencil bounds are:" << endl
437     << lbound0 << '\t' << ubound0 << endl;
438#endif
439
440    // Now do the actual loop
441    FastArrayIterator<T_numtype1,1> Aiter(A);
442    _bz_typename T_array2::T_iterator Biter(B);
443    _bz_typename T_array3::T_iterator Citer(C);
444    _bz_typename T_array4::T_iterator Diter(D);
445    _bz_typename T_array5::T_iterator Eiter(E);
446    _bz_typename T_array6::T_iterator Fiter(F);
447    _bz_typename T_array7::T_iterator Giter(G);
448    _bz_typename T_array8::T_iterator Hiter(H);
449    _bz_typename T_array9::T_iterator Iiter(I);
450    _bz_typename T_array10::T_iterator Jiter(J);
451    _bz_typename T_array11::T_iterator Kiter(K);
452
453    // Load the strides for the innermost loop
454    Aiter.loadStride(0);
455    Biter.loadStride(0);
456    Citer.loadStride(0);
457    Diter.loadStride(0);
458    Eiter.loadStride(0);
459    Fiter.loadStride(0);
460    Giter.loadStride(0);
461    Hiter.loadStride(0);
462    Iiter.loadStride(0);
463    Jiter.loadStride(0);
464    Kiter.loadStride(0);
465
466    // Patch from Derrick Bass
467    Aiter.moveTo(lbound0);
468    Biter.moveTo(lbound0);
469    Citer.moveTo(lbound0);
470    Diter.moveTo(lbound0);
471    Eiter.moveTo(lbound0);
472    Fiter.moveTo(lbound0);
473    Giter.moveTo(lbound0);
474    Hiter.moveTo(lbound0);
475    Iiter.moveTo(lbound0);
476    Jiter.moveTo(lbound0);
477    Kiter.moveTo(lbound0);
478
479    for (int i=lbound0; i <= ubound0; ++i)
480    {
481        stencil.apply(Aiter, Biter, Citer, Diter, Eiter, Fiter, Giter,
482            Hiter, Iiter, Jiter, Kiter);
483
484        Aiter.advance();
485        Biter.advance();
486        Citer.advance();
487        Diter.advance();
488        Eiter.advance();
489        Fiter.advance();
490        Giter.advance();
491        Hiter.advance();
492        Iiter.advance();
493        Jiter.advance();
494        Kiter.advance();
495    }
496}
497
498/*
499 * These 11 versions of applyStencil handle from 1 to 11 array parameters.
500 * They pad their argument list with enough dummyArray objects to call
501 * applyStencil_imp with 11 array parameters.
502 */
503template<typename T_stencil, typename T_numtype1, int N_rank>
504inline void applyStencil(const T_stencil& stencil, Array<T_numtype1,N_rank>& A)
505{
506    applyStencil_imp(stencil, A, _dummyArray, _dummyArray,
507        _dummyArray, _dummyArray, _dummyArray, _dummyArray,
508        _dummyArray, _dummyArray, _dummyArray, _dummyArray);
509}
510
511template<typename T_stencil, typename T_numtype1, int N_rank, typename T_array2>
512inline void applyStencil(const T_stencil& stencil, Array<T_numtype1,N_rank>& A,
513    T_array2& B)
514{
515    applyStencil_imp(stencil, A, B, _dummyArray, _dummyArray,
516        _dummyArray, _dummyArray, _dummyArray, _dummyArray,
517        _dummyArray, _dummyArray, _dummyArray);
518}
519
520template<typename T_stencil, typename T_numtype1, int N_rank, typename T_array2,
521    class T_array3>
522inline void applyStencil(const T_stencil& stencil, Array<T_numtype1,N_rank>& A,
523    T_array2& B, T_array3& C)
524{
525    applyStencil_imp(stencil, A, B, C, _dummyArray, _dummyArray,
526        _dummyArray, _dummyArray, _dummyArray, _dummyArray, _dummyArray,
527        _dummyArray);
528}
529
530template<typename T_stencil, typename T_numtype1, int N_rank, typename T_array2,
531    class T_array3, typename T_array4>
532inline void applyStencil(const T_stencil& stencil, Array<T_numtype1,N_rank>& A,
533    T_array2& B, T_array3& C, T_array4& D)
534{
535    applyStencil_imp(stencil, A, B, C, D, _dummyArray, _dummyArray,
536        _dummyArray, _dummyArray, _dummyArray, _dummyArray, _dummyArray);
537}
538
539template<typename T_stencil, typename T_numtype1, int N_rank, typename T_array2,
540    class T_array3, typename T_array4, typename T_array5>
541inline void applyStencil(const T_stencil& stencil, Array<T_numtype1,N_rank>& A,
542   T_array2& B, T_array3& C, T_array4& D, T_array5& E)
543{
544    applyStencil_imp(stencil, A, B, C, D, E, _dummyArray,
545        _dummyArray, _dummyArray, _dummyArray, _dummyArray, _dummyArray);
546}
547
548template<typename T_stencil, typename T_numtype1, int N_rank, typename T_array2,
549    class T_array3, typename T_array4, typename T_array5, typename T_array6>
550inline void applyStencil(const T_stencil& stencil, Array<T_numtype1,N_rank>& A,
551   T_array2& B, T_array3& C, T_array4& D, T_array5& E, T_array6& F)
552{
553    applyStencil_imp(stencil, A, B, C, D, E, F,
554        _dummyArray, _dummyArray, _dummyArray, _dummyArray, _dummyArray);
555}
556
557template<typename T_stencil, typename T_numtype1, int N_rank, typename T_array2,
558    class T_array3, typename T_array4, typename T_array5, typename T_array6,
559    class T_array7>
560inline void applyStencil(const T_stencil& stencil, Array<T_numtype1,N_rank>& A,
561   T_array2& B, T_array3& C, T_array4& D, T_array5& E, T_array6& F,
562   T_array7& G)
563{
564    applyStencil_imp(stencil, A, B, C, D, E, F, G,
565        _dummyArray, _dummyArray, _dummyArray, _dummyArray);
566}
567
568template<typename T_stencil, typename T_numtype1, int N_rank, typename T_array2,
569    class T_array3, typename T_array4, typename T_array5, typename T_array6,
570    class T_array7, typename T_array8>
571inline void applyStencil(const T_stencil& stencil, Array<T_numtype1,N_rank>& A,
572   T_array2& B, T_array3& C, T_array4& D, T_array5& E, T_array6& F,
573   T_array7& G, T_array8& H)
574{
575    applyStencil_imp(stencil, A, B, C, D, E, F, G, H,
576        _dummyArray, _dummyArray, _dummyArray);
577}
578
579template<typename T_stencil, typename T_numtype1, int N_rank, typename T_array2,
580    class T_array3, typename T_array4, typename T_array5, typename T_array6,
581    class T_array7, typename T_array8, typename T_array9>
582inline void applyStencil(const T_stencil& stencil, Array<T_numtype1,N_rank>& A,
583   T_array2& B, T_array3& C, T_array4& D, T_array5& E, T_array6& F,
584   T_array7& G, T_array8& H, T_array9& I)
585{
586    applyStencil_imp(stencil, A, B, C, D, E, F, G, H, I,
587        _dummyArray, _dummyArray);
588}
589
590template<typename T_stencil, typename T_numtype1, int N_rank, typename T_array2,
591    class T_array3, typename T_array4, typename T_array5, typename T_array6,
592    class T_array7, typename T_array8, typename T_array9, typename T_array10>
593inline void applyStencil(const T_stencil& stencil, Array<T_numtype1,N_rank>& A,
594   T_array2& B, T_array3& C, T_array4& D, T_array5& E, T_array6& F,
595   T_array7& G, T_array8& H, T_array9& I, T_array10& J)
596{
597    applyStencil_imp(stencil, A, B, C, D, E, F, G, H, I, J,
598        _dummyArray);
599}
600
601template<typename T_stencil, typename T_numtype1, int N_rank, typename T_array2,
602    class T_array3, typename T_array4, typename T_array5, typename T_array6,
603    class T_array7, typename T_array8, typename T_array9, typename T_array10,
604    class T_array11>
605inline void applyStencil(const T_stencil& stencil, Array<T_numtype1,N_rank>& A,
606   T_array2& B, T_array3& C, T_array4& D, T_array5& E, T_array6& F,
607   T_array7& G, T_array8& H, T_array9& I, T_array10& J, T_array11& K)
608{
609    applyStencil_imp(stencil, A, B, C, D, E, F, G, H, I, J, K);
610}
611
612BZ_NAMESPACE_END
613
614#endif // BZ_ARRAYSTENCIL_CC
Note: See TracBrowser for help on using the repository browser.