Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
Sacado_MP_Vector_SFS_binary_func_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> >
50  {
51  using std::OPNAME;
53 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
54 #pragma ivdep
55 #endif
56 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
57 #pragma vector aligned
58 #endif
59 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
60 #pragma unroll
61 #endif
62  for (O i=0; i<a.size(); ++i)
63  c.fastAccessCoeff(i) =
64  OPNAME( a.fastAccessCoeff(i) , b.fastAccessCoeff(i) );
65  return c;
66  }
67 
68  template <typename O, typename T, int N, typename D>
69  KOKKOS_INLINE_FUNCTION
70  Vector< Stokhos::StaticFixedStorage<O,T,N,D> >
72  const volatile Vector< Stokhos::StaticFixedStorage<O,T,N,D> >& b)
73  {
74  using std::OPNAME;
76 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
77 #pragma ivdep
78 #endif
79 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
80 #pragma vector aligned
81 #endif
82 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
83 #pragma unroll
84 #endif
85  for (O i=0; i<a.size(); ++i)
86  c.fastAccessCoeff(i) =
87  OPNAME( a.fastAccessCoeff(i) , b.fastAccessCoeff(i) );
88  return c;
89  }
90 
91  template <typename O, typename T, int N, typename D>
92  KOKKOS_INLINE_FUNCTION
93  Vector< Stokhos::StaticFixedStorage<O,T,N,D> >
95  const volatile Vector< Stokhos::StaticFixedStorage<O,T,N,D> >& b)
96  {
97  using std::OPNAME;
99 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
100 #pragma ivdep
101 #endif
102 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
103 #pragma vector aligned
104 #endif
105 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
106 #pragma unroll
107 #endif
108  for (O i=0; i<a.size(); ++i)
109  c.fastAccessCoeff(i) =
110  OPNAME( a.fastAccessCoeff(i) , b.fastAccessCoeff(i) );
111  return c;
112  }
113 
114  template <typename O, typename T, int N, typename D>
115  KOKKOS_INLINE_FUNCTION
116  Vector< Stokhos::StaticFixedStorage<O,T,N,D> >
119  {
120  using std::OPNAME;
122 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
123 #pragma ivdep
124 #endif
125 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
126 #pragma vector aligned
127 #endif
128 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
129 #pragma unroll
130 #endif
131  for (O i=0; i<a.size(); ++i)
132  c.fastAccessCoeff(i) =
133  OPNAME( a.fastAccessCoeff(i) , b.fastAccessCoeff(i) );
134  return c;
135  }
136 
137  template <typename O, typename T, int N, typename D>
138  KOKKOS_INLINE_FUNCTION
139  Vector< Stokhos::StaticFixedStorage<O,T,N,D> >
142  {
143  using std::OPNAME;
145 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
146 #pragma ivdep
147 #endif
148 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
149 #pragma vector aligned
150 #endif
151 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
152 #pragma unroll
153 #endif
154  for (O i=0; i<b.size(); ++i)
155  c.fastAccessCoeff(i) =
156  OPNAME( a , b.fastAccessCoeff(i) );
157  return c;
158  }
159 
160  template <typename O, typename T, int N, typename D>
161  KOKKOS_INLINE_FUNCTION
162  Vector< Stokhos::StaticFixedStorage<O,T,N,D> >
164  const volatile Vector< Stokhos::StaticFixedStorage<O,T,N,D> >& b)
165  {
166  using std::OPNAME;
168 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
169 #pragma ivdep
170 #endif
171 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
172 #pragma vector aligned
173 #endif
174 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
175 #pragma unroll
176 #endif
177  for (O i=0; i<b.size(); ++i)
178  c.fastAccessCoeff(i) =
179  OPNAME( a , b.fastAccessCoeff(i) );
180  return c;
181  }
182 
183  template <typename O, typename T, int N, typename D>
184  KOKKOS_INLINE_FUNCTION
185  Vector< Stokhos::StaticFixedStorage<O,T,N,D> >
188  {
189  using std::OPNAME;
191 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
192 #pragma ivdep
193 #endif
194 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
195 #pragma vector aligned
196 #endif
197 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
198 #pragma unroll
199 #endif
200  for (O i=0; i<a.size(); ++i)
201  c.fastAccessCoeff(i) =
202  OPNAME( a.fastAccessCoeff(i) , b );
203  return c;
204  }
205 
206  template <typename O, typename T, int N, typename D>
207  KOKKOS_INLINE_FUNCTION
208  Vector< Stokhos::StaticFixedStorage<O,T,N,D> >
211  {
212  using std::OPNAME;
214 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
215 #pragma ivdep
216 #endif
217 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
218 #pragma vector aligned
219 #endif
220 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
221 #pragma unroll
222 #endif
223  for (O i=0; i<a.size(); ++i)
224  c.fastAccessCoeff(i) =
225  OPNAME( a.fastAccessCoeff(i) , b );
226  return c;
227  }
228  }
229 }
Statically allocated storage class.
KOKKOS_INLINE_FUNCTION Vector< Stokhos::StaticFixedStorage< O, T, N, D > > OPNAME(const volatile Vector< Stokhos::StaticFixedStorage< O, T, N, D > > &a, const typename Vector< Stokhos::StaticFixedStorage< O, T, N, D > >::value_type &b)
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)