Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
Sacado_MP_Vector_SFS_binary_op_tmpl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Stokhos Package
5 // Copyright (2009) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Eric T. Phipps (etphipp@sandia.gov).
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 namespace Sacado {
43  namespace MP {
44 
45  template <typename O, typename T, int N, typename D>
46  KOKKOS_INLINE_FUNCTION
47  Vector< Stokhos::StaticFixedStorage<O,T,N,D> >
48  OPNAME (const Vector< Stokhos::StaticFixedStorage<O,T,N,D> >& a,
49  const Vector< Stokhos::StaticFixedStorage<O,T,N,D> >& b)
50  {
51  Vector< Stokhos::StaticFixedStorage<O,T,N,D> > c;
52 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
53 #pragma ivdep
54 #endif
55 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
56 #pragma vector aligned
57 #endif
58 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
59 #pragma unroll
60 #endif
61  for (O i=0; i<a.size(); ++i)
62  c.fastAccessCoeff(i) =
63  a.fastAccessCoeff(i) OPER b.fastAccessCoeff(i);
64  return c;
65  }
66 
67  template <typename O, typename T, int N, typename D>
68  KOKKOS_INLINE_FUNCTION
69  Vector< Stokhos::StaticFixedStorage<O,T,N,D> >
70  OPNAME (const volatile Vector< Stokhos::StaticFixedStorage<O,T,N,D> >& a,
71  const volatile Vector< Stokhos::StaticFixedStorage<O,T,N,D> >& b)
72  {
73  Vector< Stokhos::StaticFixedStorage<O,T,N,D> > c;
74 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
75 #pragma ivdep
76 #endif
77 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
78 #pragma vector aligned
79 #endif
80 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
81 #pragma unroll
82 #endif
83  for (O i=0; i<a.size(); ++i)
84  c.fastAccessCoeff(i) =
85  a.fastAccessCoeff(i) OPER b.fastAccessCoeff(i);
86  return c;
87  }
88 
89  template <typename O, typename T, int N, typename D>
90  KOKKOS_INLINE_FUNCTION
91  Vector< Stokhos::StaticFixedStorage<O,T,N,D> >
92  OPNAME (const Vector< Stokhos::StaticFixedStorage<O,T,N,D> >& a,
93  const volatile Vector< Stokhos::StaticFixedStorage<O,T,N,D> >& b)
94  {
95  Vector< Stokhos::StaticFixedStorage<O,T,N,D> > c;
96 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
97 #pragma ivdep
98 #endif
99 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
100 #pragma vector aligned
101 #endif
102 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
103 #pragma unroll
104 #endif
105  for (O i=0; i<a.size(); ++i)
106  c.fastAccessCoeff(i) =
107  a.fastAccessCoeff(i) OPER b.fastAccessCoeff(i);
108  return c;
109  }
110 
111  template <typename O, typename T, int N, typename D>
112  KOKKOS_INLINE_FUNCTION
113  Vector< Stokhos::StaticFixedStorage<O,T,N,D> >
114  OPNAME (const volatile Vector< Stokhos::StaticFixedStorage<O,T,N,D> >& a,
115  const Vector< Stokhos::StaticFixedStorage<O,T,N,D> >& b)
116  {
117  Vector< Stokhos::StaticFixedStorage<O,T,N,D> > c;
118 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
119 #pragma ivdep
120 #endif
121 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
122 #pragma vector aligned
123 #endif
124 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
125 #pragma unroll
126 #endif
127  for (O i=0; i<a.size(); ++i)
128  c.fastAccessCoeff(i) =
129  a.fastAccessCoeff(i) OPER b.fastAccessCoeff(i);
130  return c;
131  }
132 
133  template <typename O, typename T, int N, typename D>
134  KOKKOS_INLINE_FUNCTION
135  Vector< Stokhos::StaticFixedStorage<O,T,N,D> >
136  OPNAME (const typename Vector< Stokhos::StaticFixedStorage<O,T,N,D> >::value_type& a,
137  const Vector< Stokhos::StaticFixedStorage<O,T,N,D> >& b)
138  {
139  Vector< Stokhos::StaticFixedStorage<O,T,N,D> > c;
140 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
141 #pragma ivdep
142 #endif
143 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
144 #pragma vector aligned
145 #endif
146 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
147 #pragma unroll
148 #endif
149  for (O i=0; i<b.size(); ++i)
150  c.fastAccessCoeff(i) =
151  a OPER b.fastAccessCoeff(i);
152  return c;
153  }
154 
155  template <typename O, typename T, int N, typename D>
156  KOKKOS_INLINE_FUNCTION
157  Vector< Stokhos::StaticFixedStorage<O,T,N,D> >
158  OPNAME (const typename Vector< Stokhos::StaticFixedStorage<O,T,N,D> >::value_type& a,
159  const volatile Vector< Stokhos::StaticFixedStorage<O,T,N,D> >& b)
160  {
161  Vector< Stokhos::StaticFixedStorage<O,T,N,D> > c;
162 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
163 #pragma ivdep
164 #endif
165 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
166 #pragma vector aligned
167 #endif
168 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
169 #pragma unroll
170 #endif
171  for (O i=0; i<b.size(); ++i)
172  c.fastAccessCoeff(i) =
173  a OPER b.fastAccessCoeff(i);
174  return c;
175  }
176 
177  template <typename O, typename T, int N, typename D>
178  KOKKOS_INLINE_FUNCTION
179  Vector< Stokhos::StaticFixedStorage<O,T,N,D> >
180  OPNAME (const Vector< Stokhos::StaticFixedStorage<O,T,N,D> >& a,
181  const typename Vector< Stokhos::StaticFixedStorage<O,T,N,D> >::value_type& b)
182  {
183  Vector< Stokhos::StaticFixedStorage<O,T,N,D> > c;
184 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
185 #pragma ivdep
186 #endif
187 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
188 #pragma vector aligned
189 #endif
190 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
191 #pragma unroll
192 #endif
193  for (O i=0; i<a.size(); ++i)
194  c.fastAccessCoeff(i) =
195  a.fastAccessCoeff(i) OPER b;
196  return c;
197  }
198 
199  template <typename O, typename T, int N, typename D>
200  KOKKOS_INLINE_FUNCTION
201  Vector< Stokhos::StaticFixedStorage<O,T,N,D> >
202  OPNAME (const volatile Vector< Stokhos::StaticFixedStorage<O,T,N,D> >& a,
203  const typename Vector< Stokhos::StaticFixedStorage<O,T,N,D> >::value_type& b)
204  {
205  Vector< Stokhos::StaticFixedStorage<O,T,N,D> > c;
206 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
207 #pragma ivdep
208 #endif
209 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
210 #pragma vector aligned
211 #endif
212 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
213 #pragma unroll
214 #endif
215  for (O i=0; i<a.size(); ++i)
216  c.fastAccessCoeff(i) =
217  a.fastAccessCoeff(i) OPER b;
218  return c;
219  }
220  }
221 }
Statically allocated storage class.
#define OPER
KOKKOS_INLINE_FUNCTION Vector< Stokhos::StaticFixedStorage< O, T, N, D > > OPNAME(const Vector< Stokhos::StaticFixedStorage< O, T, N, D > > &a, const Vector< Stokhos::StaticFixedStorage< O, T, N, D > > &b)