MCBooster  1.0.1
Tool to generate MC phase space samples in parallel.
GContainers.h
Go to the documentation of this file.
1 /*
2  * GContainers.h
3  *
4  * Copyright 2016 Antonio Augusto Alves Junior
5  *
6  * Created on : Feb 25, 2016
7  * Author: Antonio Augusto Alves Junior
8  */
9 
10 /*
11  * This file is part of MCBooster.
12  *
13  * MCBooster is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation, either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * MCBooster is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with MCBooster. If not, see <http://www.gnu.org/licenses/>.
25  */
26 
32 #ifndef GCONTAINERS_H_
33 #define GCONTAINERS_H_
34 
35 
36 #include <mcbooster/Config.h>
37 #include <mcbooster/Vector3R.h>
38 #include <mcbooster/Vector4R.h>
39 #include <vector>
40 #include <mcbooster/GTypes.h>
41 #include <thrust/device_vector.h>
42 #include <thrust/host_vector.h>
43 #include <thrust/complex.h>
44 
45 #if !(THRUST_DEVICE_SYSTEM==THRUST_DEVICE_BACKEND_OMP || THRUST_DEVICE_SYSTEM==THRUST_DEVICE_BACKEND_TBB)
46 #include <thrust/system/cuda/experimental/pinned_allocator.h>
47 #endif
48 
49 using namespace std;
50 
51 namespace MCBooster
52 {
53 
54 #if (THRUST_DEVICE_SYSTEM==THRUST_DEVICE_BACKEND_OMP || THRUST_DEVICE_SYSTEM==THRUST_DEVICE_BACKEND_TBB)
55 
59  template <typename T>
60  using mc_device_vector = thrust::host_vector<T>;
67  template <typename T>
68  using mc_host_vector = thrust::host_vector<T>;
69 
70 #else
71 
75  template <typename T>
76  using mc_device_vector = thrust::device_vector<T>;
83  template <typename T>
84  using mc_host_vector = thrust::host_vector<T,
85  thrust::cuda::experimental::pinned_allocator<T>>;
86 
87 #endif
88 
89 
90 //-----------------------------------------------------------------------
91 //complex number container
92 typedef thrust::complex<GReal_t> GComplex_t;
94 //-----------------------------------------------------------------------
95 
99 //-----------------------------------------------------------------------
100 //basic containers on host
101 
106 typedef vector<Particles_h*> ParticlesSet_h;
107 typedef vector<RealVector_h*> VariableSet_h;
110 //-----------------------------------------------------------------------
111 //basic containers on device
116 typedef vector<Particles_d*> ParticlesSet_d;
117 typedef vector<RealVector_d*> VariableSet_d;
121 typedef thrust::detail::tuple_of_iterator_references<Vector4R &,
122  thrust::null_type, thrust::null_type, thrust::null_type,
123  thrust::null_type, thrust::null_type, thrust::null_type,
124  thrust::null_type, thrust::null_type, thrust::null_type> GT1;
125 
127 typedef thrust::detail::tuple_of_iterator_references<Vector4R &, Vector4R &,
128  thrust::null_type, thrust::null_type, thrust::null_type,
129  thrust::null_type, thrust::null_type, thrust::null_type,
130  thrust::null_type, thrust::null_type> GT2;
131 
133 typedef thrust::detail::tuple_of_iterator_references<Vector4R &, Vector4R &,
134  Vector4R &, thrust::null_type, thrust::null_type, thrust::null_type,
135  thrust::null_type, thrust::null_type, thrust::null_type,
136  thrust::null_type> GT3;
137 
139 typedef thrust::detail::tuple_of_iterator_references<Vector4R &, Vector4R &,
140  Vector4R &, Vector4R &, thrust::null_type, thrust::null_type,
141  thrust::null_type, thrust::null_type, thrust::null_type,
142  thrust::null_type> GT4;
143 
145 typedef thrust::detail::tuple_of_iterator_references<Vector4R &, Vector4R &,
146  Vector4R &, Vector4R &, Vector4R &, thrust::null_type,
147  thrust::null_type, thrust::null_type, thrust::null_type,
148  thrust::null_type> GT5;
149 
152 typedef thrust::detail::tuple_of_iterator_references<Vector4R &, Vector4R &,
153  Vector4R &, Vector4R &, Vector4R &, Vector4R &, thrust::null_type,
154  thrust::null_type, thrust::null_type, thrust::null_type> GT6;
155 
157 typedef thrust::detail::tuple_of_iterator_references<Vector4R &, Vector4R &,
158  Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &,
159  thrust::null_type, thrust::null_type, thrust::null_type> GT7;
160 
162 typedef thrust::detail::tuple_of_iterator_references<Vector4R &, Vector4R &,
163  Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &,
164  thrust::null_type, thrust::null_type> GT8;
165 
168 typedef thrust::detail::tuple_of_iterator_references<Vector4R &, Vector4R &,
169  Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &,
170  Vector4R &, thrust::null_type> GT9;
171 
173 typedef thrust::detail::tuple_of_iterator_references<Vector4R &, Vector4R &,
174  Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &,
175  Vector4R &, Vector4R &> GT10;
176 
181 typedef thrust::detail::tuple_of_iterator_references<GReal_t &, Vector4R &,
182  thrust::null_type, thrust::null_type, thrust::null_type,
183  thrust::null_type, thrust::null_type, thrust::null_type,
184  thrust::null_type, thrust::null_type> GTR2;
185 
190 typedef thrust::detail::tuple_of_iterator_references<GReal_t &, Vector4R &,
191  Vector4R &, thrust::null_type, thrust::null_type, thrust::null_type,
192  thrust::null_type, thrust::null_type, thrust::null_type,
193  thrust::null_type> GTR3;
194 
199 typedef thrust::detail::tuple_of_iterator_references<GReal_t &, Vector4R &,
200  Vector4R &, Vector4R &, thrust::null_type, thrust::null_type,
201  thrust::null_type, thrust::null_type, thrust::null_type,
202  thrust::null_type> GTR4;
207 typedef thrust::detail::tuple_of_iterator_references<GReal_t &, Vector4R &,
208  Vector4R &, Vector4R &, Vector4R &, thrust::null_type,
209  thrust::null_type, thrust::null_type, thrust::null_type,
210  thrust::null_type> GTR5;
211 
213 typedef thrust::detail::tuple_of_iterator_references<GReal_t &, Vector4R &,
214  Vector4R &, Vector4R &, Vector4R &, Vector4R &, thrust::null_type,
215  thrust::null_type, thrust::null_type, thrust::null_type> GTR6;
216 
218 typedef thrust::detail::tuple_of_iterator_references<GReal_t &, Vector4R &,
219  Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &,
220  thrust::null_type, thrust::null_type, thrust::null_type> GTR7;
221 
223 typedef thrust::detail::tuple_of_iterator_references<GReal_t &, Vector4R &,
224  Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &,
225  thrust::null_type, thrust::null_type> GTR8;
226 
228 typedef thrust::detail::tuple_of_iterator_references<GReal_t &, Vector4R &,
229  Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &,
230  Vector4R &, thrust::null_type> GTR9;
231 
233 typedef thrust::detail::tuple_of_iterator_references<GReal_t &, Vector4R &,
234  Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &,
235  Vector4R &, Vector4R &> GTR10;
236 
237 }
238 #endif /* GCONTAINERS_H_ */
mc_host_vector< GComplex_t > ComplexVector_h
Typedef for a GReal_t host vector.
Definition: GContainers.h:104
mc_host_vector< Vector3R > ThreeVectors_h
Vector4R host vector.
Definition: GContainers.h:97
thrust::detail::tuple_of_iterator_references< Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type > GT5
GT5 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:148
thrust::host_vector< T > mc_host_vector
Generic template typedef for thrust::host_vector.
Definition: GContainers.h:68
thrust::detail::tuple_of_iterator_references< Vector4R &, Vector4R &, Vector4R &, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type > GT3
GT3 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:136
thrust::detail::tuple_of_iterator_references< Vector4R &, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type > GT1
Typedef for a STL vector of pointers to device RealVector_d vectors.
Definition: GContainers.h:124
thrust::detail::tuple_of_iterator_references< GReal_t &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type > GTR5
GTR5 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:210
thrust::detail::tuple_of_iterator_references< GReal_t &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type > GTR6
GTR6 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:215
thrust::detail::tuple_of_iterator_references< GReal_t &, Vector4R &, Vector4R &, Vector4R &, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type > GTR4
GTR4 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:202
mc_host_vector< GReal_t > RealVector_h
Typedef for a GBool_t host vector.
Definition: GContainers.h:103
mc_device_vector< Vector4R > Particles_d
Typedef for a GComplex_t device vector.
Definition: GContainers.h:115
STL namespace.
vector< Particles_h * > ParticlesSet_h
Typedef for a Vector4R host vector.
Definition: GContainers.h:106
vector< RealVector_d * > VariableSet_d
Typedef for a STL vector of pointers to device Particles_d vectors.
Definition: GContainers.h:117
thrust::detail::tuple_of_iterator_references< Vector4R &, Vector4R &, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type > GT2
GT2 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:130
thrust::complex< GReal_t > GComplex_t
Definition: GContainers.h:92
mc_host_vector< Vector4R > FourVectors_h
Typedef for complex number.
Definition: GContainers.h:96
thrust::detail::tuple_of_iterator_references< Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, thrust::null_type > GT9
GT9 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:170
thrust::detail::tuple_of_iterator_references< GReal_t &, Vector4R &, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type > GTR2
GTR2 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:184
thrust::detail::tuple_of_iterator_references< Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R & > GT10
GT10 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:175
mc_device_vector< GBool_t > BoolVector_d
Typedef for a STL vector of pointers to host RealVector_h vectors.
Definition: GContainers.h:112
mc_host_vector< Vector4R > Particles_h
Typedef for a GComplex_t host vector.
Definition: GContainers.h:105
thrust::detail::tuple_of_iterator_references< Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, thrust::null_type, thrust::null_type, thrust::null_type > GT7
GT7 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:159
mc_device_vector< GComplex_t > ComplexVector_d
Typedef for a GReal_t device vector.
Definition: GContainers.h:114
double GReal_t
Double 8 bytes or float 4 bytes.
Definition: GTypes.h:52
thrust::detail::tuple_of_iterator_references< GReal_t &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, thrust::null_type, thrust::null_type > GTR8
GTR8 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:225
vector< Particles_d * > ParticlesSet_d
Typedef for a Vector4R device vector.
Definition: GContainers.h:116
thrust::detail::tuple_of_iterator_references< Vector4R &, Vector4R &, Vector4R &, Vector4R &, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type > GT4
GT4 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:142
thrust::detail::tuple_of_iterator_references< GReal_t &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R & > GTR10
GTR10 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:235
thrust::detail::tuple_of_iterator_references< GReal_t &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, thrust::null_type, thrust::null_type, thrust::null_type > GTR7
GTR7 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:220
vector< RealVector_h * > VariableSet_h
Typedef for a STL vector of pointers to host Particles_h vectors .
Definition: GContainers.h:107
mc_host_vector< GBool_t > BoolVector_h
Vector3R host vector.
Definition: GContainers.h:102
thrust::host_vector< T > mc_device_vector
Generic template typedef for thrust::host_vector.
Definition: GContainers.h:60
thrust::detail::tuple_of_iterator_references< GReal_t &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, thrust::null_type > GTR9
GTR9 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:230
thrust::detail::tuple_of_iterator_references< GReal_t &, Vector4R &, Vector4R &, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type > GTR3
GTR3 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:193
mc_device_vector< GReal_t > RealVector_d
Typedef for a GBool_t device vector.
Definition: GContainers.h:113
thrust::detail::tuple_of_iterator_references< Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type > GT6
GT6 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:154
thrust::detail::tuple_of_iterator_references< Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, Vector4R &, thrust::null_type, thrust::null_type > GT8
GT8 iterator is a typedef for thrust::detail::tuple_of_iterator_references
Definition: GContainers.h:164