00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006, 2007, 2008, 2009, Andrew W. Steiner 00005 00006 This file is part of O2scl. 00007 00008 O2scl is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 3 of the License, or 00011 (at your option) any later version. 00012 00013 O2scl is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with O2scl. If not, see <http://www.gnu.org/licenses/>. 00020 00021 ------------------------------------------------------------------- 00022 */ 00023 #ifndef O2SCL_MM_FUNCT_H 00024 #define O2SCL_MM_FUNCT_H 00025 00026 #include <string> 00027 #include <o2scl/collection.h> 00028 #include <o2scl/ovector_tlate.h> 00029 00030 #ifndef DOXYGENP 00031 namespace o2scl { 00032 #endif 00033 00034 /** 00035 \brief Array of multi-dimensional functions [abstract base] 00036 00037 This class generalizes \c nv functions of \c nv variables, i.e. 00038 \f$ y_j(x_0,x_1,...,x_{nv-1}) \f$ for \f$ 0\leq j \leq 00039 nv-1 \f$ . 00040 00041 For functions with C-style arrays, use 00042 the corresponding children of \ref mm_vfunct . 00043 00044 This class is one of a large number of function object classes 00045 in \o2 designed to provide a mechanism for the user to 00046 supply functions to solvers, minimizers, integrators, etc. 00047 See \ref funct_section for a general description. 00048 */ 00049 template<class param_t, class vec_t=ovector_base> 00050 class mm_funct { 00051 public: 00052 00053 mm_funct() {} 00054 00055 virtual ~mm_funct() {} 00056 00057 /** \brief Compute \c nv functions, \c y, of \c nv variables 00058 stored in \c x with parameter \c pa. 00059 */ 00060 virtual int operator()(size_t nv, const vec_t &x, vec_t &y, 00061 param_t &pa)=0; 00062 00063 #ifndef DOXYGENP 00064 00065 private: 00066 00067 mm_funct(const mm_funct &); 00068 mm_funct& operator=(const mm_funct&); 00069 00070 #endif 00071 00072 }; 00073 00074 /** \brief Function pointer to array of multi-dimensional functions 00075 */ 00076 template<class param_t, class vec_t=ovector_base> 00077 class mm_funct_fptr : public mm_funct<param_t,vec_t> { 00078 00079 public: 00080 00081 mm_funct_fptr() {} 00082 00083 virtual ~mm_funct_fptr() {} 00084 00085 /** \brief Specify the function pointer 00086 */ 00087 mm_funct_fptr(int (*fp)(size_t nv, const vec_t &x, vec_t &y, 00088 param_t &pa)) { 00089 fptr=fp; 00090 } 00091 00092 /** \brief Specify the function pointer 00093 */ 00094 int set_function(int (*fp)(size_t nv, const vec_t &x, vec_t &y, 00095 param_t &pa)) { 00096 fptr=fp; 00097 return 0; 00098 } 00099 00100 /** \brief Compute \c nv functions, \c y, of \c nv variables 00101 stored in \c x with parameter \c pa. 00102 */ 00103 virtual int operator()(size_t nv, const vec_t &x, vec_t &y, param_t &pa) { 00104 return fptr(nv,x,y,pa); 00105 } 00106 00107 00108 #ifndef DOXYGEN_INTERNAL 00109 00110 protected: 00111 00112 /// The function pointer to the user-supplied function 00113 int (*fptr)(size_t nv, const vec_t &x, vec_t &y, param_t &pa); 00114 00115 private: 00116 00117 mm_funct_fptr(const mm_funct_fptr &); 00118 mm_funct_fptr& operator=(const mm_funct_fptr&); 00119 00120 #endif 00121 00122 }; 00123 00124 /** \brief Function pointer to array of multi-dimensional functions with 00125 no parameters 00126 */ 00127 template<class param_t, class vec_t=ovector_base> 00128 class mm_funct_fptr_nopar : public mm_funct<param_t,vec_t> { 00129 00130 public: 00131 00132 mm_funct_fptr_nopar() {} 00133 00134 virtual ~mm_funct_fptr_nopar() {} 00135 00136 /** \brief Specify the function pointer 00137 */ 00138 mm_funct_fptr_nopar(int (*fp)(size_t nv, const vec_t &x, vec_t &y)) { 00139 fptr=fp; 00140 } 00141 00142 /** \brief Specify the function pointer 00143 */ 00144 int set_function(int (*fp)(size_t nv, const vec_t &x, vec_t &y)) { 00145 fptr=fp; 00146 return 0; 00147 } 00148 00149 /** \brief Compute \c nv functions, \c y, of \c nv variables 00150 stored in \c x with parameter \c pa. 00151 */ 00152 virtual int operator()(size_t nv, const vec_t &x, vec_t &y, param_t &pa) { 00153 return fptr(nv,x,y); 00154 } 00155 00156 00157 #ifndef DOXYGEN_INTERNAL 00158 00159 protected: 00160 00161 /// The function pointer to the user-supplied function 00162 int (*fptr)(size_t nv, const vec_t &x, vec_t &y); 00163 00164 private: 00165 00166 mm_funct_fptr_nopar(const mm_funct_fptr_nopar &); 00167 mm_funct_fptr_nopar& operator=(const mm_funct_fptr_nopar&); 00168 00169 #endif 00170 00171 }; 00172 00173 /** 00174 \brief Function pointer to a gsl_multiroot_function 00175 00176 This works because with the template parameter \c vec_t as an 00177 \ref ovector_base class because \ref ovector_base is inherited 00178 from \c gsl_vector. 00179 */ 00180 template<class param_t, class vec_t=ovector_base> 00181 class mm_funct_gsl : public mm_funct<param_t,vec_t> { 00182 public: 00183 00184 /** \brief Specify the function pointer 00185 */ 00186 mm_funct_gsl(int (*fp)(const gsl_vector *x, param_t &pa, gsl_vector *f)) { 00187 fptr=fp; 00188 } 00189 00190 /** \brief Compute \c nv functions, \c y, of \c nv variables 00191 stored in \c x with parameter \c pa. 00192 */ 00193 virtual int operator()(size_t nv, const vec_t &x, vec_t &y, param_t &pa) { 00194 const gsl_vector *gx=(const gsl_vector *)(&x); 00195 gsl_vector *gy=(gsl_vector *)(&y); 00196 return fptr(gx,pa,gy); 00197 } 00198 00199 #ifndef DOXYGEN_INTERNAL 00200 00201 protected: 00202 00203 /// The function pointer to the user-supplied function 00204 int (*fptr)(const gsl_vector *x, param_t &pa, gsl_vector *f); 00205 00206 private: 00207 00208 mm_funct_gsl(const mm_funct_gsl &); 00209 mm_funct_gsl& operator=(const mm_funct_gsl&); 00210 00211 #endif 00212 00213 }; 00214 00215 /** \brief Member function pointer to an array of 00216 multi-dimensional functions 00217 */ 00218 template<class tclass, class param_t, class vec_t=ovector_base> 00219 class mm_funct_mfptr : public mm_funct<param_t,vec_t> { 00220 public: 00221 00222 /** \brief Empty constructor 00223 */ 00224 mm_funct_mfptr() { 00225 } 00226 00227 /** \brief Specify the member function pointer 00228 */ 00229 mm_funct_mfptr(tclass *tp, int (tclass::*fp) 00230 (size_t nv, const vec_t &x, vec_t &y, param_t &pa)) { 00231 tptr=tp; 00232 fptr=fp; 00233 } 00234 00235 /** \brief Specify the member function pointer 00236 */ 00237 int set_function(tclass *tp, int (tclass::*fp) 00238 (size_t nv, const vec_t &x, vec_t &y, param_t &pa)) 00239 { 00240 tptr=tp; 00241 fptr=fp; 00242 return 0; 00243 } 00244 00245 virtual ~mm_funct_mfptr() {}; 00246 00247 /** \brief Compute \c nv functions, \c y, of \c nv variables 00248 stored in \c x with parameter \c pa. 00249 */ 00250 virtual int operator()(size_t nv, const vec_t &x, vec_t &y, param_t &pa) { 00251 return (*tptr.*fptr)(nv,x,y,pa); 00252 } 00253 00254 #ifndef DOXYGEN_INTERNAL 00255 00256 protected: 00257 00258 /// The member function pointer 00259 int (tclass::*fptr)(size_t nv, const vec_t &x, vec_t &y, param_t &pa); 00260 00261 /// The class pointer 00262 tclass *tptr; 00263 00264 private: 00265 00266 mm_funct_mfptr(const mm_funct_mfptr &); 00267 mm_funct_mfptr& operator=(const mm_funct_mfptr&); 00268 00269 #endif 00270 00271 }; 00272 00273 /** \brief Member function pointer to an array of 00274 multi-dimensional functions with no parameters 00275 */ 00276 template<class tclass, class param_t, class vec_t=ovector_base> 00277 class mm_funct_mfptr_nopar : public mm_funct<param_t,vec_t> { 00278 public: 00279 00280 /** \brief Empty constructor 00281 */ 00282 mm_funct_mfptr_nopar() { 00283 } 00284 00285 /** \brief Specify the member function pointer 00286 */ 00287 mm_funct_mfptr_nopar(tclass *tp, int (tclass::*fp) 00288 (size_t nv, const vec_t &x, vec_t &y)) { 00289 tptr=tp; 00290 fptr=fp; 00291 } 00292 00293 /** \brief Specify the member function pointer 00294 */ 00295 int set_function(tclass *tp, int (tclass::*fp) 00296 (size_t nv, const vec_t &x, vec_t &y)) 00297 { 00298 tptr=tp; 00299 fptr=fp; 00300 return 0; 00301 } 00302 00303 virtual ~mm_funct_mfptr_nopar() {}; 00304 00305 /** \brief Compute \c nv functions, \c y, of \c nv variables 00306 stored in \c x with parameter \c pa. 00307 */ 00308 virtual int operator()(size_t nv, const vec_t &x, vec_t &y, param_t &pa) { 00309 return (*tptr.*fptr)(nv,x,y); 00310 } 00311 00312 #ifndef DOXYGEN_INTERNAL 00313 00314 protected: 00315 00316 /// The member function pointer 00317 int (tclass::*fptr)(size_t nv, const vec_t &x, vec_t &y); 00318 00319 /// The class pointer 00320 tclass *tptr; 00321 00322 private: 00323 00324 mm_funct_mfptr_nopar(const mm_funct_mfptr_nopar &); 00325 mm_funct_mfptr_nopar& operator=(const mm_funct_mfptr_nopar&); 00326 00327 #endif 00328 00329 }; 00330 00331 /** \brief Const member function pointer to an array of 00332 multi-dimensional functions 00333 */ 00334 template<class tclass, class param_t, class vec_t=ovector_base> 00335 class mm_funct_cmfptr : public mm_funct<param_t,vec_t> { 00336 public: 00337 00338 /** \brief Empty constructor 00339 */ 00340 mm_funct_cmfptr() { 00341 } 00342 00343 /** \brief Specify the member function pointer 00344 */ 00345 mm_funct_cmfptr(tclass *tp, int (tclass::*fp) 00346 (size_t nv, const vec_t &x, vec_t &y, param_t &pa) const) { 00347 tptr=tp; 00348 fptr=fp; 00349 } 00350 00351 /** \brief Specify the member function pointer 00352 */ 00353 int set_function(tclass *tp, int (tclass::*fp) 00354 (size_t nv, const vec_t &x, vec_t &y, param_t &pa) const) 00355 { 00356 tptr=tp; 00357 fptr=fp; 00358 return 0; 00359 } 00360 00361 virtual ~mm_funct_cmfptr() {}; 00362 00363 /** \brief Compute \c nv functions, \c y, of \c nv variables 00364 stored in \c x with parameter \c pa. 00365 */ 00366 virtual int operator()(size_t nv, const vec_t &x, vec_t &y, param_t &pa) { 00367 return (*tptr.*fptr)(nv,x,y,pa); 00368 } 00369 00370 #ifndef DOXYGEN_INTERNAL 00371 00372 protected: 00373 00374 /// The member function pointer 00375 int (tclass::*fptr)(size_t nv, const vec_t &x, vec_t &y, param_t &pa) const; 00376 00377 /// The class pointer 00378 tclass *tptr; 00379 00380 private: 00381 00382 mm_funct_cmfptr(const mm_funct_cmfptr &); 00383 mm_funct_cmfptr& operator=(const mm_funct_cmfptr&); 00384 00385 #endif 00386 00387 }; 00388 00389 /** \brief Const member function pointer to an array of 00390 multi-dimensional functions with no parameters 00391 */ 00392 template<class tclass, class param_t, class vec_t=ovector_base> 00393 class mm_funct_cmfptr_nopar : public mm_funct<param_t,vec_t> { 00394 public: 00395 00396 /** \brief Empty constructor 00397 */ 00398 mm_funct_cmfptr_nopar() { 00399 } 00400 00401 /** \brief Specify the member function pointer 00402 */ 00403 mm_funct_cmfptr_nopar(tclass *tp, int (tclass::*fp) 00404 (size_t nv, const vec_t &x, vec_t &y) const) { 00405 tptr=tp; 00406 fptr=fp; 00407 } 00408 00409 /** \brief Specify the member function pointer 00410 */ 00411 int set_function(tclass *tp, int (tclass::*fp) 00412 (size_t nv, const vec_t &x, vec_t &y)) 00413 { 00414 tptr=tp; 00415 fptr=fp; 00416 return 0; 00417 } 00418 00419 virtual ~mm_funct_cmfptr_nopar() {}; 00420 00421 /** \brief Compute \c nv functions, \c y, of \c nv variables 00422 stored in \c x with parameter \c pa. 00423 */ 00424 virtual int operator()(size_t nv, const vec_t &x, vec_t &y, param_t &pa) { 00425 return (*tptr.*fptr)(nv,x,y); 00426 } 00427 00428 #ifndef DOXYGEN_INTERNAL 00429 00430 protected: 00431 00432 /// The member function pointer 00433 int (tclass::*fptr)(size_t nv, const vec_t &x, vec_t &y) const; 00434 00435 /// The class pointer 00436 tclass *tptr; 00437 00438 private: 00439 00440 mm_funct_cmfptr_nopar(const mm_funct_cmfptr_nopar &); 00441 mm_funct_cmfptr_nopar& operator=(const mm_funct_cmfptr_nopar&); 00442 00443 #endif 00444 00445 }; 00446 00447 /** 00448 \brief Array of multi-dimensional functions with arrays [abstract 00449 base] 00450 00451 This class generalizes \c nv functions of \c nv variables, i.e. 00452 \f$ y_j(x_0,x_1,...,x_{nv-1}) \f$ for \f$ 0\leq j \leq 00453 nv-1 \f$. 00454 00455 To use ovector_base objects instead of C-style arrays, 00456 use \ref mm_funct. 00457 00458 This class is one of a large number of function object classes 00459 in \o2 designed to provide a mechanism for the user to 00460 supply functions to solvers, minimizers, integrators, etc. 00461 See \ref funct_section for a general description. 00462 */ 00463 template<class param_t, size_t nv> 00464 class mm_vfunct { 00465 public: 00466 00467 mm_vfunct() {} 00468 00469 virtual ~mm_vfunct() {} 00470 00471 /** \brief Compute \c nv functions, \c y, of \c nv variables 00472 stored in \c x with parameter \c pa. 00473 */ 00474 virtual int operator()(size_t nvar, const double x[nv], 00475 double y[nv], param_t &pa)=0; 00476 00477 #ifndef DOXYGENP 00478 00479 private: 00480 00481 mm_vfunct(const mm_vfunct &); 00482 mm_vfunct& operator=(const mm_vfunct&); 00483 00484 #endif 00485 00486 }; 00487 00488 /** \brief Function pointer to array of multi-dimensional functions 00489 with arrays 00490 */ 00491 template<class param_t, size_t nv> class mm_vfunct_fptr : 00492 public mm_vfunct<param_t,nv> { 00493 public: 00494 00495 /** \brief Specify the function pointer 00496 */ 00497 mm_vfunct_fptr(int (*fp)(size_t nvar, const double x[nv], double y[nv], 00498 param_t &pa)) { 00499 fptr=fp; 00500 } 00501 00502 00503 virtual ~mm_vfunct_fptr() {}; 00504 00505 /** \brief Compute \c nv functions, \c y, of \c nv variables 00506 stored in \c x with parameter \c pa. 00507 */ 00508 virtual int operator()(size_t nvar, const double x[nv], double y[nv], 00509 param_t &pa) { 00510 return fptr(nv,x,y,pa); 00511 } 00512 00513 00514 #ifndef DOXYGEN_INTERNAL 00515 00516 protected: 00517 00518 mm_vfunct_fptr() {}; 00519 00520 /// The function pointer 00521 int (*fptr)(size_t nvar, const double x[nv], double y[nv], param_t &pa); 00522 00523 private: 00524 00525 mm_vfunct_fptr(const mm_vfunct_fptr &); 00526 mm_vfunct_fptr& operator=(const mm_vfunct_fptr&); 00527 00528 #endif 00529 00530 }; 00531 00532 /** \brief Function pointer to array of multi-dimensional functions 00533 with arrays and no parameters 00534 */ 00535 template<class param_t, size_t nv> class mm_vfunct_fptr_nopar : 00536 public mm_vfunct<param_t,nv> 00537 { 00538 public: 00539 00540 /** \brief Specify the function pointer 00541 */ 00542 mm_vfunct_fptr_nopar(int (*fp)(size_t nvar, const double x[nv], 00543 double y[nv])) { 00544 fptr=fp; 00545 } 00546 00547 00548 virtual ~mm_vfunct_fptr_nopar() {}; 00549 00550 /** \brief Compute \c nv functions, \c y, of \c nv variables 00551 stored in \c x with parameter \c pa. 00552 */ 00553 virtual int operator()(size_t nvar, const double x[nv], double y[nv], 00554 param_t &pa) { 00555 return fptr(nv,x,y); 00556 } 00557 00558 00559 #ifndef DOXYGEN_INTERNAL 00560 00561 protected: 00562 00563 mm_vfunct_fptr_nopar() {}; 00564 00565 /// The function pointer 00566 int (*fptr)(size_t nvar, const double x[nv], double y[nv]); 00567 00568 private: 00569 00570 mm_vfunct_fptr_nopar(const mm_vfunct_fptr_nopar &); 00571 mm_vfunct_fptr_nopar& operator=(const mm_vfunct_fptr_nopar&); 00572 00573 #endif 00574 00575 }; 00576 00577 /** \brief Function pointer to a gsl_multiroot_function with arrays 00578 */ 00579 template<class param_t, size_t nv> 00580 class mm_vfunct_gsl : public mm_vfunct<param_t,nv> { 00581 public: 00582 00583 /** \brief Specify the function pointer 00584 */ 00585 mm_vfunct_gsl(int (*fp)(const gsl_vector *x, param_t &pa, gsl_vector *f)) { 00586 fptr=fp; 00587 } 00588 00589 /** \brief Compute \c nv functions, \c y, of \c nv variables 00590 stored in \c x with parameter \c pa. 00591 */ 00592 virtual int operator()(size_t nvar, const double x[nv], 00593 double y[nv], param_t &pa) { 00594 const gsl_vector *gx=(const gsl_vector *)(&x); 00595 gsl_vector *gy=(gsl_vector *)(&y); 00596 return fptr(gx,pa,gy); 00597 } 00598 00599 #ifndef DOXYGEN_INTERNAL 00600 00601 protected: 00602 00603 /// The function pointer 00604 int (*fptr)(const gsl_vector *x, param_t &pa, gsl_vector *f); 00605 00606 private: 00607 00608 mm_vfunct_gsl(const mm_vfunct_gsl &); 00609 mm_vfunct_gsl& operator=(const mm_vfunct_gsl&); 00610 00611 #endif 00612 00613 }; 00614 00615 /** \brief Member function pointer to an array of 00616 multi-dimensional functions with arrays 00617 */ 00618 template<class tclass, class param_t, size_t nv> 00619 class mm_vfunct_mfptr : public mm_vfunct<param_t,nv> { 00620 public: 00621 00622 /** \brief Specify the member function pointer 00623 */ 00624 mm_vfunct_mfptr(tclass *tp, int (tclass::*fp) 00625 (size_t nvar, const double x[nv], double y[nv], 00626 param_t &pa)) { 00627 tptr=tp; 00628 fptr=fp; 00629 } 00630 00631 virtual ~mm_vfunct_mfptr() {}; 00632 00633 /** \brief Compute \c nv functions, \c y, of \c nv variables 00634 stored in \c x with parameter \c pa. 00635 */ 00636 virtual int operator()(size_t nvar, const double x[nv], double y[nv], 00637 param_t &pa) { 00638 return (*tptr.*fptr)(nv,x,y,pa); 00639 } 00640 00641 #ifndef DOXYGEN_INTERNAL 00642 00643 protected: 00644 00645 /// The member function pointer 00646 int (tclass::*fptr)(size_t nvar, const double x[nv], double y[nv], 00647 param_t &pa); 00648 00649 /// The class pointer 00650 tclass *tptr; 00651 00652 private: 00653 00654 mm_vfunct_mfptr(const mm_vfunct_mfptr &); 00655 mm_vfunct_mfptr& operator=(const mm_vfunct_mfptr&); 00656 00657 #endif 00658 00659 }; 00660 00661 /** \brief Const member function pointer to an array of 00662 multi-dimensional functions with arrays with no parameters 00663 */ 00664 template<class tclass, class param_t, size_t nv> 00665 class mm_vfunct_mfptr_nopar : public mm_vfunct<param_t,nv> { 00666 00667 public: 00668 00669 /** \brief Specify the member function pointer 00670 */ 00671 mm_vfunct_mfptr_nopar(tclass *tp, int (tclass::*fp) 00672 (size_t nvar, const double x[nv], 00673 double y[nv])) { 00674 tptr=tp; 00675 fptr=fp; 00676 } 00677 00678 virtual ~mm_vfunct_mfptr_nopar() {}; 00679 00680 /** \brief Compute \c nv functions, \c y, of \c nv variables 00681 stored in \c x with parameter \c pa. 00682 */ 00683 virtual int operator()(size_t nvar, const double x[nv], double y[nv], 00684 param_t &pa) { 00685 return (*tptr.*fptr)(nv,x,y); 00686 } 00687 00688 #ifndef DOXYGEN_INTERNAL 00689 00690 protected: 00691 00692 /// The member function pointer 00693 int (tclass::*fptr)(size_t nvar, const double x[nv], double y[nv]); 00694 00695 /// The class pointer 00696 tclass *tptr; 00697 00698 private: 00699 00700 mm_vfunct_mfptr_nopar(const mm_vfunct_mfptr_nopar &); 00701 mm_vfunct_mfptr_nopar& operator=(const mm_vfunct_mfptr_nopar&); 00702 00703 #endif 00704 00705 }; 00706 00707 /** \brief Const member function pointer to an array of 00708 multi-dimensional functions with arrays 00709 */ 00710 template<class tclass, class param_t, size_t nv> 00711 class mm_vfunct_cmfptr : public mm_vfunct<param_t,nv> { 00712 public: 00713 00714 /** \brief Specify the member function pointer 00715 */ 00716 mm_vfunct_cmfptr(tclass *tp, int (tclass::*fp) 00717 (size_t nvar, const double x[nv], double y[nv], 00718 param_t &pa) const) { 00719 tptr=tp; 00720 fptr=fp; 00721 } 00722 00723 virtual ~mm_vfunct_cmfptr() {}; 00724 00725 /** \brief Compute \c nv functions, \c y, of \c nv variables 00726 stored in \c x with parameter \c pa. 00727 */ 00728 virtual int operator()(size_t nvar, const double x[nv], double y[nv], 00729 param_t &pa) { 00730 return (*tptr.*fptr)(nv,x,y,pa); 00731 } 00732 00733 #ifndef DOXYGEN_INTERNAL 00734 00735 protected: 00736 00737 /// The member function pointer 00738 int (tclass::*fptr)(size_t nvar, const double x[nv], double y[nv], 00739 param_t &pa) const; 00740 00741 /// The class pointer 00742 tclass *tptr; 00743 00744 private: 00745 00746 mm_vfunct_cmfptr(const mm_vfunct_cmfptr &); 00747 mm_vfunct_cmfptr& operator=(const mm_vfunct_cmfptr&); 00748 00749 #endif 00750 00751 }; 00752 00753 /** \brief Member function pointer to an array of 00754 multi-dimensional functions with arrays with no parameters 00755 */ 00756 template<class tclass, class param_t, size_t nv> 00757 class mm_vfunct_cmfptr_nopar : public mm_vfunct<param_t,nv> { 00758 00759 public: 00760 00761 /** \brief Specify the member function pointer 00762 */ 00763 mm_vfunct_cmfptr_nopar(tclass *tp, int (tclass::*fp) 00764 (size_t nvar, const double x[nv], double y[nv]) 00765 const) { 00766 tptr=tp; 00767 fptr=fp; 00768 } 00769 00770 virtual ~mm_vfunct_cmfptr_nopar() {}; 00771 00772 /** \brief Compute \c nv functions, \c y, of \c nv variables 00773 stored in \c x with parameter \c pa. 00774 */ 00775 virtual int operator()(size_t nvar, const double x[nv], double y[nv], 00776 param_t &pa) { 00777 return (*tptr.*fptr)(nv,x,y); 00778 } 00779 00780 #ifndef DOXYGEN_INTERNAL 00781 00782 protected: 00783 00784 /// The member function pointer 00785 int (tclass::*fptr)(size_t nvar, const double x[nv], double y[nv]) const; 00786 00787 /// The class pointer 00788 tclass *tptr; 00789 00790 private: 00791 00792 mm_vfunct_cmfptr_nopar(const mm_vfunct_cmfptr_nopar &); 00793 mm_vfunct_cmfptr_nopar& operator=(const mm_vfunct_cmfptr_nopar&); 00794 00795 #endif 00796 00797 }; 00798 00799 #ifndef DOXYGENP 00800 } 00801 #endif 00802 00803 #endif
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.
Project hosting provided by
,
O2scl Sourceforge Project Page