1 | /*************************************************************************** |
---|
2 | * blitz/array/cycle.cc Cycle arrays for time-stepping of PDEs. |
---|
3 | * |
---|
4 | * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> |
---|
5 | * |
---|
6 | * This program is free software; you can redistribute it and/or |
---|
7 | * modify it under the terms of the GNU General Public License |
---|
8 | * as published by the Free Software Foundation; either version 2 |
---|
9 | * of the License, or (at your option) any later version. |
---|
10 | * |
---|
11 | * This program is distributed in the hope that it will be useful, |
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | * GNU General Public License for more details. |
---|
15 | * |
---|
16 | * Suggestions: blitz-dev@oonumerics.org |
---|
17 | * Bugs: blitz-bugs@oonumerics.org |
---|
18 | * |
---|
19 | * For more information, please see the Blitz++ Home Page: |
---|
20 | * http://oonumerics.org/blitz/ |
---|
21 | * |
---|
22 | ****************************************************************************/ |
---|
23 | #ifndef BZ_ARRAYCYCLE_CC |
---|
24 | #define BZ_ARRAYCYCLE_CC |
---|
25 | |
---|
26 | #ifndef BZ_ARRAY_H |
---|
27 | #error <blitz/array/cycle.cc> must be included via <blitz/array.h> |
---|
28 | #endif |
---|
29 | |
---|
30 | BZ_NAMESPACE(blitz) |
---|
31 | |
---|
32 | template<typename T_numtype, int N_rank> |
---|
33 | void cycleArrays(Array<T_numtype, N_rank>& a, Array<T_numtype, N_rank>& b) |
---|
34 | { |
---|
35 | Array<T_numtype, N_rank> tmp(a); |
---|
36 | a.reference(b); |
---|
37 | b.reference(tmp); |
---|
38 | } |
---|
39 | |
---|
40 | template<typename T_numtype, int N_rank> |
---|
41 | void cycleArrays(Array<T_numtype, N_rank>& a, Array<T_numtype, N_rank>& b, |
---|
42 | Array<T_numtype, N_rank>& c) |
---|
43 | { |
---|
44 | Array<T_numtype, N_rank> tmp(a); |
---|
45 | a.reference(b); |
---|
46 | b.reference(c); |
---|
47 | c.reference(tmp); |
---|
48 | } |
---|
49 | |
---|
50 | template<typename T_numtype, int N_rank> |
---|
51 | void cycleArrays(Array<T_numtype, N_rank>& a, Array<T_numtype, N_rank>& b, |
---|
52 | Array<T_numtype, N_rank>& c, Array<T_numtype, N_rank>& d) |
---|
53 | { |
---|
54 | Array<T_numtype, N_rank> tmp(a); |
---|
55 | a.reference(b); |
---|
56 | b.reference(c); |
---|
57 | c.reference(d); |
---|
58 | d.reference(tmp); |
---|
59 | } |
---|
60 | |
---|
61 | template<typename T_numtype, int N_rank> |
---|
62 | void cycleArrays(Array<T_numtype, N_rank>& a, Array<T_numtype, N_rank>& b, |
---|
63 | Array<T_numtype, N_rank>& c, Array<T_numtype, N_rank>& d, |
---|
64 | Array<T_numtype, N_rank>& e) |
---|
65 | { |
---|
66 | Array<T_numtype, N_rank> tmp(a); |
---|
67 | a.reference(b); |
---|
68 | b.reference(c); |
---|
69 | c.reference(d); |
---|
70 | d.reference(e); |
---|
71 | e.reference(tmp); |
---|
72 | } |
---|
73 | |
---|
74 | BZ_NAMESPACE_END |
---|
75 | |
---|
76 | #endif // BZ_ARRAYCYCLE_CC |
---|