source: XMLIO_V2/external/include/blitz/meta/vecassign.h @ 80

Last change on this file since 80 was 80, checked in by ymipsl, 14 years ago

ajout lib externe

  • Property svn:eol-style set to native
File size: 3.0 KB
Line 
1// -*- C++ -*-
2/***************************************************************************
3 * blitz/meta/vecassign.h   TinyVector assignment metaprogram
4 *
5 * $Id: vecassign.h,v 1.6 2005/05/07 04:17:57 julianc Exp $
6 *
7 * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * Suggestions:          blitz-dev@oonumerics.org
20 * Bugs:                 blitz-bugs@oonumerics.org
21 *
22 * For more information, please see the Blitz++ Home Page:
23 *    http://oonumerics.org/blitz/
24 *
25 ***************************************************************************/
26
27#ifndef BZ_META_VECASSIGN_H
28#define BZ_META_VECASSIGN_H
29
30BZ_NAMESPACE(blitz)
31
32template<int N, int I> 
33class _bz_meta_vecAssign {
34public:
35    static const int loopFlag = (I < N-1) ? 1 : 0;
36
37    template<typename T_vector, typename T_expr, typename T_updater>
38    static inline void fastAssign(T_vector& vec, T_expr expr, T_updater u)
39    {
40        u.update(vec[I], expr._bz_fastAccess(I));
41        _bz_meta_vecAssign<N * loopFlag, (I+1) * loopFlag>
42           ::fastAssign(vec,expr,u);
43    }
44
45    template<typename T_vector, typename T_expr, typename T_updater>
46    static inline void assign(T_vector& vec, T_expr expr, T_updater u)
47    {
48        u.update(vec[I], expr[I]);
49        _bz_meta_vecAssign<N * loopFlag, (I+1) * loopFlag>
50           ::assign(vec,expr,u);
51    }
52
53    template<typename T_vector, typename T_numtype, typename T_updater>
54    static inline void assignWithArgs(T_vector& vec, T_updater u,
55        T_numtype x0, T_numtype x1=0, T_numtype x2=0, T_numtype x3=0,
56        T_numtype x4=0, T_numtype x5=0, T_numtype x6=0, T_numtype x7=0,
57        T_numtype x8=0, T_numtype x9=0)
58    {
59        u.update(vec[I], x0);
60        _bz_meta_vecAssign<N * loopFlag, (I+1) * loopFlag>
61            ::assignWithArgs(vec, u, x1, x2, x3, x4, x5, x6, x7, x8, x9);
62    }
63       
64};
65
66template<>
67class _bz_meta_vecAssign<0,0> {
68public:
69    template<typename T_vector, typename T_expr, typename T_updater>
70    static inline void fastAssign(T_vector&, T_expr, T_updater)
71    { }
72
73    template<typename T_vector, typename T_expr, typename T_updater>
74    static inline void assign(T_vector&, T_expr, T_updater)
75    { }
76
77    template<typename T_vector, typename T_numtype, typename T_updater>
78    static inline void assignWithArgs(T_vector&, T_updater,
79        T_numtype, T_numtype =0, T_numtype =0, T_numtype =0,
80        T_numtype =0, T_numtype =0, T_numtype =0, T_numtype =0,
81        T_numtype =0, T_numtype =0)
82    {
83    }
84};
85
86BZ_NAMESPACE_END
87
88#endif // BZ_META_ASSIGN_H
Note: See TracBrowser for help on using the repository browser.