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] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/histo/hd2mpi (Version 11.3.0) and /externals/g4tools/include/tools/histo/hd2mpi (Version 10.3.p1)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_histo_hd2mpi                        
  5 #define tools_histo_hd2mpi                        
  6                                                   
  7 // code to MPI_Pack, MPI_Unpack histos without    
  8                                                   
  9 #include "../impi"                                
 10                                                   
 11 #include "histo_data"                             
 12                                                   
 13 #include "../forit"                               
 14                                                   
 15 namespace tools {                                 
 16 namespace histo {                                 
 17                                                   
 18 //////////////////////////////////////////////    
 19 /// hist_data to mpi /////////////////////////    
 20 //////////////////////////////////////////////    
 21                                                   
 22 inline bool axis_dui_pack(impi& a_mpi,const ax    
 23   //typedef double TC;                            
 24   //typedef unsigned int TO;                      
 25   //typedef unsigned int bn_t;                    
 26   if(!a_mpi.pack(a_axis.m_offset)) return fals    
 27   if(!a_mpi.pack(a_axis.m_number_of_bins)) ret    
 28   if(!a_mpi.pack(a_axis.m_minimum_value)) retu    
 29   if(!a_mpi.pack(a_axis.m_maximum_value)) retu    
 30   if(!a_mpi.bpack(a_axis.m_fixed)) return fals    
 31   if(!a_mpi.pack(a_axis.m_bin_width)) return f    
 32   if(!a_mpi.vpack(a_axis.m_edges)) return fals    
 33   return true;                                    
 34 }                                                 
 35                                                   
 36 inline bool histo_data_duiuid_pack(impi& a_mpi    
 37   //typedef double TC;                            
 38   //typedef unsigned int TO;                      
 39   //typedef unsigned int TN;                      
 40   //typedef double TW;                            
 41   //typedef unsigned int dim_t;                   
 42   typedef unsigned int num_t;                     
 43                                                   
 44   if(!a_mpi.spack(a_hd.m_title)) return false;    
 45   if(!a_mpi.pack(a_hd.m_dimension)) return fal    
 46   if(!a_mpi.pack(a_hd.m_bin_number)) return fa    
 47   if(!a_mpi.vpack(a_hd.m_bin_entries)) return     
 48   if(!a_mpi.vpack(a_hd.m_bin_Sw)) return false    
 49   if(!a_mpi.vpack(a_hd.m_bin_Sw2)) return fals    
 50                                                   
 51  {for(unsigned int ibin=0;ibin<a_hd.m_bin_numb    
 52     if(!a_mpi.vpack(a_hd.m_bin_Sxw[ibin])) ret    
 53   }}                                              
 54  {for(unsigned int ibin=0;ibin<a_hd.m_bin_numb    
 55     if(!a_mpi.vpack(a_hd.m_bin_Sx2w[ibin])) re    
 56   }}                                              
 57                                                   
 58   // Axes :                                       
 59  {for(unsigned int iaxis=0;iaxis<a_hd.m_dimens    
 60     if(!axis_dui_pack(a_mpi,a_hd.m_axes[iaxis]    
 61   }}                                              
 62                                                   
 63   // etc :                                        
 64   if(!a_mpi.vpack(a_hd.m_in_range_plane_Sxyw))    
 65                                                   
 66   // Annotations :                                
 67  {if(!a_mpi.pack((num_t)a_hd.m_annotations.siz    
 68   tools_mforcit(std::string,std::string,a_hd.m    
 69     if(!a_mpi.spack((*it).first)) return false    
 70     if(!a_mpi.spack((*it).second)) return fals    
 71   }}                                              
 72                                                   
 73   // fast getters :                               
 74   if(!a_mpi.pack(a_hd.m_all_entries)) return f    
 75   if(!a_mpi.pack(a_hd.m_in_range_entries)) ret    
 76   if(!a_mpi.pack(a_hd.m_in_range_Sw)) return f    
 77   if(!a_mpi.pack(a_hd.m_in_range_Sw2)) return     
 78   if(!a_mpi.vpack(a_hd.m_in_range_Sxw)) return    
 79   if(!a_mpi.vpack(a_hd.m_in_range_Sx2w)) retur    
 80                                                   
 81   return true;                                    
 82 }                                                 
 83                                                   
 84 //////////////////////////////////////////////    
 85 /// mpi to hist_data /////////////////////////    
 86 //////////////////////////////////////////////    
 87                                                   
 88 inline bool axis_dui_unpack(impi& a_mpi,axis<d    
 89   //typedef double TC;                            
 90   //typedef unsigned int TO;                      
 91   //typedef unsigned int bn_t;                    
 92                                                   
 93   if(!a_mpi.unpack(a_axis.m_offset)) return fa    
 94   if(!a_mpi.unpack(a_axis.m_number_of_bins)) r    
 95   if(!a_mpi.unpack(a_axis.m_minimum_value)) re    
 96   if(!a_mpi.unpack(a_axis.m_maximum_value)) re    
 97   if(!a_mpi.bunpack(a_axis.m_fixed)) return fa    
 98   if(!a_mpi.unpack(a_axis.m_bin_width)) return    
 99   if(!a_mpi.vunpack(a_axis.m_edges)) return fa    
100                                                   
101   return true;                                    
102 }                                                 
103                                                   
104 inline bool histo_data_duiuid_unpack(impi& a_m    
105   //typedef double TC;                            
106   //typedef unsigned int TO;                      
107   //typedef unsigned int TN;                      
108   //typedef double TW;                            
109   //typedef unsigned int dim_t;                   
110   typedef unsigned int num_t;                     
111                                                   
112   if(!a_mpi.sunpack(a_hd.m_title)) return fals    
113   if(!a_mpi.unpack(a_hd.m_dimension)) return f    
114   if(!a_mpi.unpack(a_hd.m_bin_number)) return     
115   if(!a_mpi.vunpack(a_hd.m_bin_entries)) retur    
116   if(!a_mpi.vunpack(a_hd.m_bin_Sw)) return fal    
117   if(!a_mpi.vunpack(a_hd.m_bin_Sw2)) return fa    
118                                                   
119  {a_hd.m_bin_Sxw.resize(a_hd.m_bin_number);       
120   for(unsigned int ibin=0;ibin<a_hd.m_bin_numb    
121     if(!a_mpi.vunpack(a_hd.m_bin_Sxw[ibin])) r    
122   }}                                              
123  {a_hd.m_bin_Sx2w.resize(a_hd.m_bin_number);      
124   for(unsigned int ibin=0;ibin<a_hd.m_bin_numb    
125     if(!a_mpi.vunpack(a_hd.m_bin_Sx2w[ibin]))     
126   }}                                              
127                                                   
128   // Axes :                                       
129  {a_hd.m_axes.resize(a_hd.m_dimension);           
130   for(unsigned int iaxis=0;iaxis<a_hd.m_dimens    
131     if(!axis_dui_unpack(a_mpi,a_hd.m_axes[iaxi    
132   }}                                              
133                                                   
134   // etc :                                        
135   if(!a_mpi.vunpack(a_hd.m_in_range_plane_Sxyw    
136                                                   
137   // Annotations :                                
138  {a_hd.m_annotations.clear();                     
139   num_t num;                                      
140   if(!a_mpi.unpack(num)) return false;            
141   for(unsigned int index=0;index<num;index++)     
142     std::string k,v;                              
143     if(!a_mpi.sunpack(k)) return false;           
144     if(!a_mpi.sunpack(v)) return false;           
145     a_hd.m_annotations[k] = v;                    
146   }}                                              
147                                                   
148   // fast getters :                               
149   if(!a_mpi.unpack(a_hd.m_all_entries)) return    
150   if(!a_mpi.unpack(a_hd.m_in_range_entries)) r    
151   if(!a_mpi.unpack(a_hd.m_in_range_Sw)) return    
152   if(!a_mpi.unpack(a_hd.m_in_range_Sw2)) retur    
153   if(!a_mpi.vunpack(a_hd.m_in_range_Sxw)) retu    
154   if(!a_mpi.vunpack(a_hd.m_in_range_Sx2w)) ret    
155                                                   
156   return true;                                    
157 }                                                 
158                                                   
159 }}                                                
160                                                   
161 #include "profile_data"                           
162                                                   
163 namespace tools {                                 
164 namespace histo {                                 
165                                                   
166 //////////////////////////////////////////////    
167 /// profile_data to C struct /////////////////    
168 //////////////////////////////////////////////    
169                                                   
170 inline bool profile_data_duiuidd_pack(impi& a_    
171                                                   
172   if(!histo_data_duiuid_pack(a_mpi,a_pd)) retu    
173                                                   
174   //typedef double TV;                            
175                                                   
176   if(!a_mpi.bpack(a_pd.m_is_profile)) return f    
177   if(!a_mpi.vpack(a_pd.m_bin_Svw)) return fals    
178   if(!a_mpi.vpack(a_pd.m_bin_Sv2w)) return fal    
179   if(!a_mpi.bpack(a_pd.m_cut_v)) return false;    
180   if(!a_mpi.pack(a_pd.m_min_v)) return false;     
181   if(!a_mpi.pack(a_pd.m_max_v)) return false;     
182                                                   
183   return true;                                    
184 }                                                 
185                                                   
186 //////////////////////////////////////////////    
187 /// mpi to profile_data //////////////////////    
188 //////////////////////////////////////////////    
189                                                   
190 inline bool profile_data_duiuidd_unpack(impi&     
191                                                   
192   if(!histo_data_duiuid_unpack(a_mpi,a_pd)) re    
193                                                   
194   //typedef double TV;                            
195                                                   
196   if(!a_mpi.bunpack(a_pd.m_is_profile)) return    
197   if(!a_mpi.vunpack(a_pd.m_bin_Svw)) return fa    
198   if(!a_mpi.vunpack(a_pd.m_bin_Sv2w)) return f    
199   if(!a_mpi.bunpack(a_pd.m_cut_v)) return fals    
200   if(!a_mpi.unpack(a_pd.m_min_v)) return false    
201   if(!a_mpi.unpack(a_pd.m_max_v)) return false    
202                                                   
203   return true;                                    
204 }                                                 
205                                                   
206 }}                                                
207                                                   
208 #endif