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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/sg/cloud2plot (Version 11.3.0) and /externals/g4tools/include/tools/sg/cloud2plot (Version 8.2.p1)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_sg_cloud2plot                       
  5 #define tools_sg_cloud2plot                       
  6                                                   
  7 #include "plottables"                             
  8                                                   
  9 #include "../words"                               
 10 #include "../num2s"                               
 11                                                   
 12 #include "../histo/c2d"                           
 13                                                   
 14 #ifdef TOOLS_MEM                                  
 15 #include "../mem"                                 
 16 #endif                                            
 17                                                   
 18 namespace tools {                                 
 19 namespace sg {                                    
 20                                                   
 21 class c2d2plot : public virtual points2D {        
 22   TOOLS_SCLASS(tools::sg::c2d2plot)               
 23 public: //plottable                               
 24   virtual plottable* copy() const {return new     
 25   virtual bool is_valid() const {return true;}    
 26   virtual const std::string& name() const {ret    
 27   virtual void set_name(const std::string& a_s    
 28   virtual const std::string& title() const {re    
 29   virtual const std::string& legend() const {r    
 30   virtual void set_legend(const std::string& a    
 31                                                   
 32   virtual void infos(const std::string& a_opts    
 33     a_sinfos.clear();                             
 34     std::string f_lf("\n");                       
 35     std::vector<std::string> ws;                  
 36     words(a_opts," ",false,ws);                   
 37     std::vector<std::string>::const_iterator i    
 38                                                   
 39     for(it=ws.begin();it!=ws.end();++it) {        
 40       if(((*it)=="name") && m_name.size()) {      
 41         if(a_sinfos.size()) a_sinfos += f_lf;     
 42         a_sinfos += "Name\n";                     
 43         a_sinfos += m_name;                       
 44                                                   
 45       } else if((*it)=="entries") {               
 46         if(a_sinfos.size()) a_sinfos += f_lf;     
 47         a_sinfos += "Entries\n";                  
 48         if(!numas<unsigned int>(m_data.entries    
 49                                                   
 50       } else if((*it)=="mean") {                  
 51         if(a_sinfos.size()) a_sinfos += f_lf;     
 52         a_sinfos += "MeanX\n";                    
 53         if(!numas<double>(m_data.mean_x(),a_si    
 54         a_sinfos += f_lf;                         
 55         a_sinfos += "MeanY\n";                    
 56         if(!numas<double>(m_data.mean_y(),a_si    
 57                                                   
 58       } else if((*it)=="rms") {                   
 59         if(a_sinfos.size()) a_sinfos += f_lf;     
 60         a_sinfos += "RMS X\n";                    
 61         if(!numas<double>(m_data.rms_x(),a_sin    
 62         a_sinfos += f_lf;                         
 63         a_sinfos += "RMS Y\n";                    
 64         if(!numas<double>(m_data.rms_y(),a_sin    
 65                                                   
 66       }                                           
 67     }                                             
 68   }                                               
 69 public: //points2D                                
 70   virtual float x_axis_min() const {return (fl    
 71   virtual float x_axis_max() const {return (fl    
 72   virtual float y_axis_min() const {return (fl    
 73   virtual float y_axis_max() const {return (fl    
 74                                                   
 75   virtual unsigned int points() const {return     
 76   virtual bool ith_point(unsigned int a_index,    
 77     if(a_index>=m_data.entries()) {a_x = 0;a_y    
 78     if(a_index>=m_data.entries()) {a_x = 0;a_y    
 79     a_x = (float)m_data.value_x(a_index);         
 80     a_y = (float)m_data.value_y(a_index);         
 81     return true;                                  
 82   }                                               
 83 public:                                           
 84   c2d2plot(const histo::c2d& a_data)              
 85   :m_data(a_data)                                 
 86   {                                               
 87 #ifdef TOOLS_MEM                                  
 88     mem::increment(s_class().c_str());            
 89 #endif                                            
 90   }                                               
 91   virtual ~c2d2plot(){                            
 92 #ifdef TOOLS_MEM                                  
 93     mem::decrement(s_class().c_str());            
 94 #endif                                            
 95   }                                               
 96 public:                                           
 97   c2d2plot(const c2d2plot& a_from)                
 98   :plottable(a_from)                              
 99   ,points2D(a_from)                               
100   ,m_data(a_from.m_data)                          
101   ,m_name(a_from.m_name)                          
102   ,m_legend(a_from.m_legend)                      
103   {                                               
104 #ifdef TOOLS_MEM                                  
105     mem::increment(s_class().c_str());            
106 #endif                                            
107   }                                               
108   c2d2plot& operator=(const c2d2plot& a_from){    
109     m_name = a_from.m_name;                       
110     m_legend = a_from.m_legend;                   
111     return *this;                                 
112   }                                               
113 protected:                                        
114   const histo::c2d& m_data;                       
115   std::string m_name;                             
116   std::string m_legend;                           
117 };                                                
118                                                   
119 }}                                                
120                                                   
121 #include "../histo/c3d"                           
122                                                   
123 namespace tools {                                 
124 namespace sg {                                    
125                                                   
126 class c3d2plot : public virtual points3D {        
127   TOOLS_SCLASS(tools::sg::c3d2plot)               
128 public: //plottable                               
129   virtual plottable* copy() const {return new     
130   virtual bool is_valid() const {return true;}    
131   virtual const std::string& name() const {ret    
132   virtual void set_name(const std::string& a_s    
133   virtual const std::string& title() const {re    
134   virtual const std::string& legend() const {r    
135   virtual void set_legend(const std::string& a    
136                                                   
137   virtual void infos(const std::string& a_opts    
138     a_sinfos.clear();                             
139     std::string f_lf("\n");                       
140     std::vector<std::string> ws;                  
141     words(a_opts," ",false,ws);                   
142     std::vector<std::string>::const_iterator i    
143                                                   
144     for(it=ws.begin();it!=ws.end();++it) {        
145       if(((*it)=="name") && m_name.size()) {      
146         if(a_sinfos.size()) a_sinfos += f_lf;     
147         a_sinfos += "Name\n";                     
148         a_sinfos += m_name;                       
149                                                   
150       } else if((*it)=="entries") {               
151         if(a_sinfos.size()) a_sinfos += f_lf;     
152         a_sinfos += "Entries\n";                  
153         if(!numas<unsigned int>(m_data.entries    
154                                                   
155       } else if((*it)=="mean") {                  
156         if(a_sinfos.size()) a_sinfos += f_lf;     
157         a_sinfos += "MeanX\n";                    
158         if(!numas<double>(m_data.mean_x(),a_si    
159         a_sinfos += f_lf;                         
160         a_sinfos += "MeanY\n";                    
161         if(!numas<double>(m_data.mean_y(),a_si    
162         a_sinfos += f_lf;                         
163         a_sinfos += "MeanZ\n";                    
164         if(!numas<double>(m_data.mean_z(),a_si    
165                                                   
166       } else if((*it)=="rms") {                   
167         if(a_sinfos.size()) a_sinfos += f_lf;     
168         a_sinfos += "RMS X\n";                    
169         if(!numas<double>(m_data.rms_x(),a_sin    
170         a_sinfos += f_lf;                         
171         a_sinfos += "RMS Y\n";                    
172         if(!numas<double>(m_data.rms_y(),a_sin    
173         a_sinfos += f_lf;                         
174         a_sinfos += "RMS Z\n";                    
175         if(!numas<double>(m_data.rms_z(),a_sin    
176                                                   
177       }                                           
178     }                                             
179   }                                               
180 public: //points2D                                
181   virtual float x_axis_min() const {return (fl    
182   virtual float x_axis_max() const {return (fl    
183   virtual float y_axis_min() const {return (fl    
184   virtual float y_axis_max() const {return (fl    
185   virtual float z_axis_min() const {return (fl    
186   virtual float z_axis_max() const {return (fl    
187                                                   
188   virtual unsigned int points() const {return     
189   virtual bool ith_point(unsigned int a_index,    
190     if(a_index>=m_data.entries()) {a_x = 0;a_y    
191     if(a_index>=m_data.entries()) {a_x = 0;a_y    
192     a_x = (float)m_data.value_x(a_index);         
193     a_y = (float)m_data.value_y(a_index);         
194     a_z = (float)m_data.value_z(a_index);         
195     return true;                                  
196   }                                               
197 public:                                           
198   c3d2plot(const histo::c3d& a_data)              
199   :m_data(a_data)                                 
200   {                                               
201 #ifdef TOOLS_MEM                                  
202     mem::increment(s_class().c_str());            
203 #endif                                            
204   }                                               
205   virtual ~c3d2plot(){                            
206 #ifdef TOOLS_MEM                                  
207     mem::decrement(s_class().c_str());            
208 #endif                                            
209   }                                               
210 public:                                           
211   c3d2plot(const c3d2plot& a_from)                
212   :plottable(a_from)                              
213   ,points3D(a_from)                               
214   ,m_data(a_from.m_data)                          
215   ,m_name(a_from.m_name)                          
216   ,m_legend(a_from.m_legend)                      
217   {                                               
218 #ifdef TOOLS_MEM                                  
219     mem::increment(s_class().c_str());            
220 #endif                                            
221   }                                               
222   c3d2plot& operator=(const c3d2plot& a_from){    
223     m_name = a_from.m_name;                       
224     m_legend = a_from.m_legend;                   
225     return *this;                                 
226   }                                               
227 protected:                                        
228   const histo::c3d& m_data;                       
229   std::string m_name;                             
230   std::string m_legend;                           
231 };                                                
232                                                   
233 }}                                                
234                                                   
235 #endif