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


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_sg_f2plot                           
  5 #define tools_sg_f2plot                           
  6                                                   
  7 // Connexion tools/func to sg/plotter.            
  8                                                   
  9 #include "plottables"                             
 10                                                   
 11 //#include "../func"                              
 12                                                   
 13 #include "../words"                               
 14 #include "../S_STRING"                            
 15 #include "../forit"                               
 16                                                   
 17 #ifdef TOOLS_MEM                                  
 18 #include "../mem"                                 
 19 #endif                                            
 20                                                   
 21 namespace tools {                                 
 22 namespace sg {                                    
 23                                                   
 24 template <class T>                                
 25 class f1d2plot : public virtual func1D {          
 26 public:                                           
 27   TOOLS_T_SCLASS(T,tools::sg::f1d2plot)           
 28   virtual void* cast(const std::string& a_clas    
 29     if(void* p = cmp_cast<f1d2plot>(this,a_cla    
 30     return func1D::cast(a_class);                 
 31   }                                               
 32 public: //plottable                               
 33   virtual plottable* copy() const {return new     
 34   virtual bool is_valid() const {return true;}    
 35   virtual const std::string& name() const {ret    
 36   virtual void set_name(const std::string& a_s    
 37   virtual const std::string& title() const {re    
 38   virtual const std::string& legend() const {r    
 39   virtual void set_legend(const std::string& a    
 40                                                   
 41   virtual void infos(const std::string& a_opts    
 42     a_sinfos.clear();                             
 43     std::string f_lf("\n");                       
 44     std::vector<std::string> _words;              
 45     words(a_opts," ",false,_words);               
 46     tools_vforcit(std::string,_words,it) {        
 47       if(((*it)=="name") && m_name.size()) {      
 48         if(a_sinfos.size()) a_sinfos += f_lf;     
 49         a_sinfos += "Name\n";                     
 50         a_sinfos += m_name;                       
 51       }                                           
 52     }                                             
 53   }                                               
 54 public: //func1D                                  
 55   virtual bool value(float a_x,float& a_v) con    
 56     if(!m_data.in_domain(a_x)) {a_v = 0;return    
 57     a_v = (float)m_data.value(a_x);               
 58     return true;                                  
 59   }                                               
 60                                                   
 61   virtual unsigned int x_steps() const {return    
 62   virtual float x_min() const {return (float)m    
 63   virtual float x_max() const {return (float)m    
 64                                                   
 65 public:                                           
 66   f1d2plot(const T& a_data):m_data(a_data){       
 67 #ifdef TOOLS_MEM                                  
 68     mem::increment(s_class().c_str());            
 69 #endif                                            
 70   }                                               
 71   virtual ~f1d2plot(){                            
 72 #ifdef TOOLS_MEM                                  
 73     mem::decrement(s_class().c_str());            
 74 #endif                                            
 75   }                                               
 76 public:                                           
 77   f1d2plot(const f1d2plot& a_from)                
 78   :plottable(a_from),func1D(a_from)               
 79   ,m_data(a_from.m_data)                          
 80   ,m_name(a_from.m_name)                          
 81   ,m_legend(a_from.m_legend)                      
 82   ,m_title(a_from.m_title)                        
 83   {                                               
 84 #ifdef TOOLS_MEM                                  
 85     mem::increment(s_class().c_str());            
 86 #endif                                            
 87   }                                               
 88   f1d2plot& operator=(const f1d2plot& a_from){    
 89     m_name = a_from.m_name;                       
 90     m_legend = a_from.m_legend;                   
 91     m_title = a_from.m_title;                     
 92     return *this;                                 
 93   }                                               
 94 public:                                           
 95   void set_title(const std::string& a_s) {m_ti    
 96 protected:                                        
 97   const T& m_data;                                
 98   std::string m_name;                             
 99   std::string m_legend;                           
100   std::string m_title;                            
101 };                                                
102                                                   
103 template <class T>                                
104 class f1d2plot_cp : public f1d2plot<T> {          
105 public:                                           
106   TOOLS_T_SCLASS(T,tools::sg::f1d2plot_cp)        
107   virtual void* cast(const std::string& a_clas    
108     if(void* p = cmp_cast<f1d2plot_cp>(this,a_    
109     return f1d2plot<T>::cast(a_class);            
110   }                                               
111 public:                                           
112   f1d2plot_cp(const T& a_data)                    
113   :f1d2plot<T>(m_cp)                              
114   ,m_cp(a_data)                                   
115   {}                                              
116   virtual ~f1d2plot_cp(){}                        
117 public:                                           
118   f1d2plot_cp(const f1d2plot_cp& a_from)          
119   :plottable(a_from)                              
120   ,func1D(a_from)                                 
121   ,f1d2plot<T>(m_cp)                              
122   ,m_cp(a_from.m_cp)                              
123   {}                                              
124   f1d2plot_cp& operator=(const f1d2plot_cp& a_    
125     f1d2plot<T>::operator=(a_from);               
126     m_cp = a_from.m_cp;                           
127     return *this;                                 
128   }                                               
129 protected:                                        
130   T m_cp;                                         
131 };                                                
132                                                   
133 template <class T>                                
134 class f2d2plot : public virtual func2D {          
135 public:                                           
136   TOOLS_T_SCLASS(T,tools::sg::f2d2plot)           
137   virtual void* cast(const std::string& a_clas    
138     if(void* p = cmp_cast<f2d2plot>(this,a_cla    
139     return func2D::cast(a_class);                 
140   }                                               
141 public: //plottable                               
142   virtual plottable* copy() const {return new     
143   virtual bool is_valid() const {return true;}    
144   virtual const std::string& name() const {ret    
145   virtual void set_name(const std::string& a_s    
146   virtual const std::string& title() const {re    
147   virtual const std::string& legend() const {r    
148   virtual void set_legend(const std::string& a    
149                                                   
150   virtual void infos(const std::string& a_opts    
151     a_sinfos.clear();                             
152     std::string f_lf("\n");                       
153     std::vector<std::string> _words;              
154     words(a_opts," ",false,_words);               
155     tools_vforcit(std::string,_words,it) {        
156       if(((*it)=="name") && m_name.size()) {      
157         if(a_sinfos.size()) a_sinfos += f_lf;     
158         a_sinfos += "Name\n";                     
159         a_sinfos += m_name;                       
160       }                                           
161     }                                             
162   }                                               
163 public: //func2D                                  
164   virtual bool value(float a_x,float a_y,float    
165     if(!m_data.in_domain(a_x,a_y)) {a_v = 0;re    
166     a_v = (float)m_data.value(a_x,a_y);           
167     return true;                                  
168   }                                               
169                                                   
170   virtual unsigned int x_steps() const {return    
171   virtual float x_min() const {return m_data.x    
172   virtual float x_max() const {return m_data.x    
173   virtual unsigned int y_steps() const {return    
174   virtual float y_min() const {return m_data.y    
175   virtual float y_max() const {return m_data.y    
176 public:                                           
177   f2d2plot(const T& a_data):m_data(a_data){       
178 #ifdef TOOLS_MEM                                  
179     mem::increment(s_class().c_str());            
180 #endif                                            
181   }                                               
182   virtual ~f2d2plot(){                            
183 #ifdef TOOLS_MEM                                  
184     mem::decrement(s_class().c_str());            
185 #endif                                            
186   }                                               
187 public:                                           
188   f2d2plot(const f2d2plot& a_from)                
189   :plottable(a_from),func2D(a_from)               
190   ,m_data(a_from.m_data)                          
191   ,m_name(a_from.m_name)                          
192   ,m_legend(a_from.m_legend)                      
193   ,m_title(a_from.m_title)                        
194   {                                               
195 #ifdef TOOLS_MEM                                  
196     mem::increment(s_class().c_str());            
197 #endif                                            
198   }                                               
199   f2d2plot& operator=(const f2d2plot& a_from){    
200     m_name = a_from.m_name;                       
201     m_legend = a_from.m_legend;                   
202     m_title = a_from.m_title;                     
203     return *this;                                 
204   }                                               
205 public:                                           
206   void set_title(const std::string& a_s) {m_ti    
207 protected:                                        
208   const T& m_data;                                
209   std::string m_name;                             
210   std::string m_legend;                           
211   std::string m_title;                            
212 };                                                
213                                                   
214 template <class T>                                
215 class f2d2plot_cp : public f2d2plot<T> {          
216 public:                                           
217   TOOLS_T_SCLASS(T,tools::sg::f2d2plot_cp)        
218   virtual void* cast(const std::string& a_clas    
219     if(void* p = cmp_cast<f2d2plot_cp>(this,a_    
220     return f2d2plot<T>::cast(a_class);            
221   }                                               
222 public:                                           
223   f2d2plot_cp(const T& a_data)                    
224   :f2d2plot<T>(m_cp)                              
225   ,m_cp(a_data)                                   
226   {}                                              
227   virtual ~f2d2plot_cp(){}                        
228 public:                                           
229   f2d2plot_cp(const f2d2plot_cp& a_from)          
230   :plottable(a_from)                              
231   ,func2D(a_from)                                 
232   ,f2d2plot<T>(m_cp)                              
233   ,m_cp(a_from.m_cp)                              
234   {}                                              
235   f2d2plot_cp& operator=(const f2d2plot_cp& a_    
236     f2d2plot<T>::operator=(a_from);               
237     m_cp = a_from.m_cp;                           
238     return *this;                                 
239   }                                               
240 protected:                                        
241   T m_cp;                                         
242 };                                                
243                                                   
244 }}                                                
245                                                   
246 #endif