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

Last change on this file since 1022 was 1022, checked in by mhnguyen, 7 years ago
File size: 2.5 KB
Line 
1/***************************************************************************
2 * blitz/array/cycle.cc  Cycle arrays for time-stepping of PDEs.
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_ARRAYCYCLE_CC
31#define BZ_ARRAYCYCLE_CC
32
33#ifndef BZ_ARRAY_H
34 #error <blitz/array/cycle.cc> must be included via <blitz/array.h>
35#endif
36
37BZ_NAMESPACE(blitz)
38
39template<typename T_numtype, int N_rank>
40void cycleArrays(Array<T_numtype, N_rank>& a, Array<T_numtype, N_rank>& b)
41{
42    Array<T_numtype, N_rank> tmp(a);
43    a.reference(b);
44    b.reference(tmp);
45}
46
47template<typename T_numtype, int N_rank>
48void cycleArrays(Array<T_numtype, N_rank>& a, Array<T_numtype, N_rank>& b,
49    Array<T_numtype, N_rank>& c)
50{
51    Array<T_numtype, N_rank> tmp(a);
52    a.reference(b);
53    b.reference(c);
54    c.reference(tmp);
55}
56
57template<typename T_numtype, int N_rank>
58void cycleArrays(Array<T_numtype, N_rank>& a, Array<T_numtype, N_rank>& b,
59    Array<T_numtype, N_rank>& c, Array<T_numtype, N_rank>& d)
60{
61    Array<T_numtype, N_rank> tmp(a);
62    a.reference(b);
63    b.reference(c);
64    c.reference(d);
65    d.reference(tmp);
66}
67
68template<typename T_numtype, int N_rank>
69void cycleArrays(Array<T_numtype, N_rank>& a, Array<T_numtype, N_rank>& b,
70    Array<T_numtype, N_rank>& c, Array<T_numtype, N_rank>& d,
71    Array<T_numtype, N_rank>& e)
72{
73    Array<T_numtype, N_rank> tmp(a);
74    a.reference(b);
75    b.reference(c);
76    c.reference(d);
77    d.reference(e);
78    e.reference(tmp);
79}
80
81BZ_NAMESPACE_END
82
83#endif // BZ_ARRAYCYCLE_CC
Note: See TracBrowser for help on using the repository browser.