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 friend class io_tlate<mm_funct_fptr>; 00113 00114 /// The function pointer to the user-supplied function 00115 int (*fptr)(size_t nv, const vec_t &x, vec_t &y, param_t &pa); 00116 00117 private: 00118 00119 mm_funct_fptr(const mm_funct_fptr &); 00120 mm_funct_fptr& operator=(const mm_funct_fptr&); 00121 00122 #endif 00123 00124 }; 00125 00126 /** \brief Function pointer to array of multi-dimensional functions with 00127 no parameters 00128 */ 00129 template<class param_t, class vec_t=ovector_base> 00130 class mm_funct_fptr_nopar : public mm_funct<param_t,vec_t> { 00131 00132 public: 00133 00134 mm_funct_fptr_nopar() {} 00135 00136 virtual ~mm_funct_fptr_nopar() {} 00137 00138 /** \brief Specify the function pointer 00139 */ 00140 mm_funct_fptr_nopar(int (*fp)(size_t nv, const vec_t &x, vec_t &y)) { 00141 fptr=fp; 00142 } 00143 00144 /** \brief Specify the function pointer 00145 */ 00146 int set_function(int (*fp)(size_t nv, const vec_t &x, vec_t &y)) { 00147 fptr=fp; 00148 return 0; 00149 } 00150 00151 /** \brief Compute \c nv functions, \c y, of \c nv variables 00152 stored in \c x with parameter \c pa. 00153 */ 00154 virtual int operator()(size_t nv, const vec_t &x, vec_t &y, param_t &pa) { 00155 return fptr(nv,x,y); 00156 } 00157 00158 00159 #ifndef DOXYGEN_INTERNAL 00160 00161 protected: 00162 00163 friend class io_tlate<mm_funct_fptr_nopar>; 00164 00165 /// The function pointer to the user-supplied function 00166 int (*fptr)(size_t nv, const vec_t &x, vec_t &y); 00167 00168 private: 00169 00170 mm_funct_fptr_nopar(const mm_funct_fptr_nopar &); 00171 mm_funct_fptr_nopar& operator=(const mm_funct_fptr_nopar&); 00172 00173 #endif 00174 00175 }; 00176 00177 /** 00178 \brief Function pointer to a gsl_multiroot_function 00179 00180 This works because with the template parameter \c vec_t as an 00181 \ref ovector_base class because \ref ovector_base is inherited 00182 from \c gsl_vector. 00183 */ 00184 template<class param_t, class vec_t=ovector_base> 00185 class mm_funct_gsl : public mm_funct<param_t,vec_t> { 00186 public: 00187 00188 /** \brief Specify the function pointer 00189 */ 00190 mm_funct_gsl(int (*fp)(const gsl_vector *x, param_t &pa, gsl_vector *f)) { 00191 fptr=fp; 00192 } 00193 00194 /** \brief Compute \c nv functions, \c y, of \c nv variables 00195 stored in \c x with parameter \c pa. 00196 */ 00197 virtual int operator()(size_t nv, const vec_t &x, vec_t &y, param_t &pa) { 00198 const gsl_vector *gx=(const gsl_vector *)(&x); 00199 gsl_vector *gy=(gsl_vector *)(&y); 00200 return fptr(gx,pa,gy); 00201 } 00202 00203 #ifndef DOXYGEN_INTERNAL 00204 00205 protected: 00206 00207 friend class io_tlate<mm_funct_gsl>; 00208 00209 /// The function pointer to the user-supplied function 00210 int (*fptr)(const gsl_vector *x, param_t &pa, gsl_vector *f); 00211 00212 private: 00213 00214 mm_funct_gsl(const mm_funct_gsl &); 00215 mm_funct_gsl& operator=(const mm_funct_gsl&); 00216 00217 #endif 00218 00219 }; 00220 00221 /** \brief Member function pointer to an array of 00222 multi-dimensional functions 00223 */ 00224 template<class tclass, class param_t, class vec_t=ovector_base> 00225 class mm_funct_mfptr : public mm_funct<param_t,vec_t> { 00226 public: 00227 00228 /** \brief Empty constructor 00229 */ 00230 mm_funct_mfptr() { 00231 } 00232 00233 /** \brief Specify the member function pointer 00234 */ 00235 mm_funct_mfptr(tclass *tp, int (tclass::*fp) 00236 (size_t nv, const vec_t &x, vec_t &y, param_t &pa)) { 00237 tptr=tp; 00238 fptr=fp; 00239 } 00240 00241 /** \brief Specify the member function pointer 00242 */ 00243 int set_function(tclass *tp, int (tclass::*fp) 00244 (size_t nv, const vec_t &x, vec_t &y, param_t &pa)) 00245 { 00246 tptr=tp; 00247 fptr=fp; 00248 return 0; 00249 } 00250 00251 virtual ~mm_funct_mfptr() {}; 00252 00253 /** \brief Compute \c nv functions, \c y, of \c nv variables 00254 stored in \c x with parameter \c pa. 00255 */ 00256 virtual int operator()(size_t nv, const vec_t &x, vec_t &y, param_t &pa) { 00257 return (*tptr.*fptr)(nv,x,y,pa); 00258 } 00259 00260 #ifndef DOXYGEN_INTERNAL 00261 00262 protected: 00263 00264 /// The member function pointer 00265 int (tclass::*fptr)(size_t nv, const vec_t &x, vec_t &y, param_t &pa); 00266 00267 /// The class pointer 00268 tclass *tptr; 00269 00270 private: 00271 00272 mm_funct_mfptr(const mm_funct_mfptr &); 00273 mm_funct_mfptr& operator=(const mm_funct_mfptr&); 00274 00275 #endif 00276 00277 }; 00278 00279 /** \brief Member function pointer to an array of 00280 multi-dimensional functions with no parameters 00281 */ 00282 template<class tclass, class param_t, class vec_t=ovector_base> 00283 class mm_funct_mfptr_nopar : public mm_funct<param_t,vec_t> { 00284 public: 00285 00286 /** \brief Empty constructor 00287 */ 00288 mm_funct_mfptr_nopar() { 00289 } 00290 00291 /** \brief Specify the member function pointer 00292 */ 00293 mm_funct_mfptr_nopar(tclass *tp, int (tclass::*fp) 00294 (size_t nv, const vec_t &x, vec_t &y)) { 00295 tptr=tp; 00296 fptr=fp; 00297 } 00298 00299 /** \brief Specify the member function pointer 00300 */ 00301 int set_function(tclass *tp, int (tclass::*fp) 00302 (size_t nv, const vec_t &x, vec_t &y)) 00303 { 00304 tptr=tp; 00305 fptr=fp; 00306 return 0; 00307 } 00308 00309 virtual ~mm_funct_mfptr_nopar() {}; 00310 00311 /** \brief Compute \c nv functions, \c y, of \c nv variables 00312 stored in \c x with parameter \c pa. 00313 */ 00314 virtual int operator()(size_t nv, const vec_t &x, vec_t &y, param_t &pa) { 00315 return (*tptr.*fptr)(nv,x,y); 00316 } 00317 00318 #ifndef DOXYGEN_INTERNAL 00319 00320 protected: 00321 00322 /// The member function pointer 00323 int (tclass::*fptr)(size_t nv, const vec_t &x, vec_t &y); 00324 00325 /// The class pointer 00326 tclass *tptr; 00327 00328 private: 00329 00330 mm_funct_mfptr_nopar(const mm_funct_mfptr_nopar &); 00331 mm_funct_mfptr_nopar& operator=(const mm_funct_mfptr_nopar&); 00332 00333 #endif 00334 00335 }; 00336 00337 /** \brief Const member function pointer to an array of 00338 multi-dimensional functions 00339 */ 00340 template<class tclass, class param_t, class vec_t=ovector_base> 00341 class mm_funct_cmfptr : public mm_funct<param_t,vec_t> { 00342 public: 00343 00344 /** \brief Empty constructor 00345 */ 00346 mm_funct_cmfptr() { 00347 } 00348 00349 /** \brief Specify the member function pointer 00350 */ 00351 mm_funct_cmfptr(tclass *tp, int (tclass::*fp) 00352 (size_t nv, const vec_t &x, vec_t &y, param_t &pa) const) { 00353 tptr=tp; 00354 fptr=fp; 00355 } 00356 00357 /** \brief Specify the member function pointer 00358 */ 00359 int set_function(tclass *tp, int (tclass::*fp) 00360 (size_t nv, const vec_t &x, vec_t &y, param_t &pa) const) 00361 { 00362 tptr=tp; 00363 fptr=fp; 00364 return 0; 00365 } 00366 00367 virtual ~mm_funct_cmfptr() {}; 00368 00369 /** \brief Compute \c nv functions, \c y, of \c nv variables 00370 stored in \c x with parameter \c pa. 00371 */ 00372 virtual int operator()(size_t nv, const vec_t &x, vec_t &y, param_t &pa) { 00373 return (*tptr.*fptr)(nv,x,y,pa); 00374 } 00375 00376 #ifndef DOXYGEN_INTERNAL 00377 00378 protected: 00379 00380 /// The member function pointer 00381 int (tclass::*fptr)(size_t nv, const vec_t &x, vec_t &y, param_t &pa) const; 00382 00383 /// The class pointer 00384 tclass *tptr; 00385 00386 private: 00387 00388 mm_funct_cmfptr(const mm_funct_cmfptr &); 00389 mm_funct_cmfptr& operator=(const mm_funct_cmfptr&); 00390 00391 #endif 00392 00393 }; 00394 00395 /** \brief Const member function pointer to an array of 00396 multi-dimensional functions with no parameters 00397 */ 00398 template<class tclass, class param_t, class vec_t=ovector_base> 00399 class mm_funct_cmfptr_nopar : public mm_funct<param_t,vec_t> { 00400 public: 00401 00402 /** \brief Empty constructor 00403 */ 00404 mm_funct_cmfptr_nopar() { 00405 } 00406 00407 /** \brief Specify the member function pointer 00408 */ 00409 mm_funct_cmfptr_nopar(tclass *tp, int (tclass::*fp) 00410 (size_t nv, const vec_t &x, vec_t &y) const) { 00411 tptr=tp; 00412 fptr=fp; 00413 } 00414 00415 /** \brief Specify the member function pointer 00416 */ 00417 int set_function(tclass *tp, int (tclass::*fp) 00418 (size_t nv, const vec_t &x, vec_t &y)) 00419 { 00420 tptr=tp; 00421 fptr=fp; 00422 return 0; 00423 } 00424 00425 virtual ~mm_funct_cmfptr_nopar() {}; 00426 00427 /** \brief Compute \c nv functions, \c y, of \c nv variables 00428 stored in \c x with parameter \c pa. 00429 */ 00430 virtual int operator()(size_t nv, const vec_t &x, vec_t &y, param_t &pa) { 00431 return (*tptr.*fptr)(nv,x,y); 00432 } 00433 00434 #ifndef DOXYGEN_INTERNAL 00435 00436 protected: 00437 00438 /// The member function pointer 00439 int (tclass::*fptr)(size_t nv, const vec_t &x, vec_t &y) const; 00440 00441 /// The class pointer 00442 tclass *tptr; 00443 00444 private: 00445 00446 mm_funct_cmfptr_nopar(const mm_funct_cmfptr_nopar &); 00447 mm_funct_cmfptr_nopar& operator=(const mm_funct_cmfptr_nopar&); 00448 00449 #endif 00450 00451 }; 00452 00453 /** 00454 \brief Array of multi-dimensional functions with arrays [abstract 00455 base] 00456 00457 This class generalizes \c nv functions of \c nv variables, i.e. 00458 \f$ y_j(x_0,x_1,...,x_{nv-1}) \f$ for \f$ 0\leq j \leq 00459 nv-1 \f$. 00460 00461 To use ovector_base objects instead of C-style arrays, 00462 use \ref mm_funct. 00463 00464 This class is one of a large number of function object classes 00465 in \o2 designed to provide a mechanism for the user to 00466 supply functions to solvers, minimizers, integrators, etc. 00467 See \ref funct_section for a general description. 00468 */ 00469 template<class param_t, size_t nv> 00470 class mm_vfunct { 00471 public: 00472 00473 mm_vfunct() {} 00474 00475 virtual ~mm_vfunct() {} 00476 00477 /** \brief Compute \c nv functions, \c y, of \c nv variables 00478 stored in \c x with parameter \c pa. 00479 */ 00480 virtual int operator()(size_t nvar, const double x[nv], 00481 double y[nv], param_t &pa)=0; 00482 00483 #ifndef DOXYGENP 00484 00485 private: 00486 00487 mm_vfunct(const mm_vfunct &); 00488 mm_vfunct& operator=(const mm_vfunct&); 00489 00490 #endif 00491 00492 }; 00493 00494 /** \brief Function pointer to array of multi-dimensional functions 00495 with arrays 00496 */ 00497 template<class param_t, size_t nv> class mm_vfunct_fptr : 00498 public mm_vfunct<param_t,nv> { 00499 public: 00500 00501 /** \brief Specify the function pointer 00502 */ 00503 mm_vfunct_fptr(int (*fp)(size_t nvar, const double x[nv], double y[nv], 00504 param_t &pa)) { 00505 fptr=fp; 00506 } 00507 00508 00509 virtual ~mm_vfunct_fptr() {}; 00510 00511 /** \brief Compute \c nv functions, \c y, of \c nv variables 00512 stored in \c x with parameter \c pa. 00513 */ 00514 virtual int operator()(size_t nvar, const double x[nv], double y[nv], 00515 param_t &pa) { 00516 return fptr(nv,x,y,pa); 00517 } 00518 00519 00520 #ifndef DOXYGEN_INTERNAL 00521 00522 protected: 00523 00524 friend class io_tlate<mm_vfunct_fptr>; 00525 00526 mm_vfunct_fptr() {}; 00527 00528 /// The function pointer 00529 int (*fptr)(size_t nvar, const double x[nv], double y[nv], param_t &pa); 00530 00531 private: 00532 00533 mm_vfunct_fptr(const mm_vfunct_fptr &); 00534 mm_vfunct_fptr& operator=(const mm_vfunct_fptr&); 00535 00536 #endif 00537 00538 }; 00539 00540 /** \brief Function pointer to array of multi-dimensional functions 00541 with arrays and no parameters 00542 */ 00543 template<class param_t, size_t nv> class mm_vfunct_fptr_nopar : 00544 public mm_vfunct<param_t,nv> 00545 { 00546 public: 00547 00548 /** \brief Specify the function pointer 00549 */ 00550 mm_vfunct_fptr_nopar(int (*fp)(size_t nvar, const double x[nv], 00551 double y[nv])) { 00552 fptr=fp; 00553 } 00554 00555 00556 virtual ~mm_vfunct_fptr_nopar() {}; 00557 00558 /** \brief Compute \c nv functions, \c y, of \c nv variables 00559 stored in \c x with parameter \c pa. 00560 */ 00561 virtual int operator()(size_t nvar, const double x[nv], double y[nv], 00562 param_t &pa) { 00563 return fptr(nv,x,y); 00564 } 00565 00566 00567 #ifndef DOXYGEN_INTERNAL 00568 00569 protected: 00570 00571 friend class io_tlate<mm_vfunct_fptr_nopar>; 00572 00573 mm_vfunct_fptr_nopar() {}; 00574 00575 /// The function pointer 00576 int (*fptr)(size_t nvar, const double x[nv], double y[nv]); 00577 00578 private: 00579 00580 mm_vfunct_fptr_nopar(const mm_vfunct_fptr_nopar &); 00581 mm_vfunct_fptr_nopar& operator=(const mm_vfunct_fptr_nopar&); 00582 00583 #endif 00584 00585 }; 00586 00587 /** \brief Function pointer to a gsl_multiroot_function with arrays 00588 */ 00589 template<class param_t, size_t nv> 00590 class mm_vfunct_gsl : public mm_vfunct<param_t,nv> { 00591 public: 00592 00593 /** \brief Specify the function pointer 00594 */ 00595 mm_vfunct_gsl(int (*fp)(const gsl_vector *x, param_t &pa, gsl_vector *f)) { 00596 fptr=fp; 00597 } 00598 00599 /** \brief Compute \c nv functions, \c y, of \c nv variables 00600 stored in \c x with parameter \c pa. 00601 */ 00602 virtual int operator()(size_t nvar, const double x[nv], 00603 double y[nv], param_t &pa) { 00604 const gsl_vector *gx=(const gsl_vector *)(&x); 00605 gsl_vector *gy=(gsl_vector *)(&y); 00606 return fptr(gx,pa,gy); 00607 } 00608 00609 #ifndef DOXYGEN_INTERNAL 00610 00611 protected: 00612 00613 friend class io_tlate<mm_vfunct_gsl>; 00614 00615 /// The function pointer 00616 int (*fptr)(const gsl_vector *x, param_t &pa, gsl_vector *f); 00617 00618 private: 00619 00620 mm_vfunct_gsl(const mm_vfunct_gsl &); 00621 mm_vfunct_gsl& operator=(const mm_vfunct_gsl&); 00622 00623 #endif 00624 00625 }; 00626 00627 /** \brief Member function pointer to an array of 00628 multi-dimensional functions with arrays 00629 */ 00630 template<class tclass, class param_t, size_t nv> 00631 class mm_vfunct_mfptr : public mm_vfunct<param_t,nv> { 00632 public: 00633 00634 /** \brief Specify the member function pointer 00635 */ 00636 mm_vfunct_mfptr(tclass *tp, int (tclass::*fp) 00637 (size_t nvar, const double x[nv], double y[nv], 00638 param_t &pa)) { 00639 tptr=tp; 00640 fptr=fp; 00641 } 00642 00643 virtual ~mm_vfunct_mfptr() {}; 00644 00645 /** \brief Compute \c nv functions, \c y, of \c nv variables 00646 stored in \c x with parameter \c pa. 00647 */ 00648 virtual int operator()(size_t nvar, const double x[nv], double y[nv], 00649 param_t &pa) { 00650 return (*tptr.*fptr)(nv,x,y,pa); 00651 } 00652 00653 #ifndef DOXYGEN_INTERNAL 00654 00655 protected: 00656 00657 /// The member function pointer 00658 int (tclass::*fptr)(size_t nvar, const double x[nv], double y[nv], 00659 param_t &pa); 00660 00661 /// The class pointer 00662 tclass *tptr; 00663 00664 private: 00665 00666 mm_vfunct_mfptr(const mm_vfunct_mfptr &); 00667 mm_vfunct_mfptr& operator=(const mm_vfunct_mfptr&); 00668 00669 #endif 00670 00671 }; 00672 00673 /** \brief Const member function pointer to an array of 00674 multi-dimensional functions with arrays with no parameters 00675 */ 00676 template<class tclass, class param_t, size_t nv> 00677 class mm_vfunct_mfptr_nopar : public mm_vfunct<param_t,nv> { 00678 00679 public: 00680 00681 /** \brief Specify the member function pointer 00682 */ 00683 mm_vfunct_mfptr_nopar(tclass *tp, int (tclass::*fp) 00684 (size_t nvar, const double x[nv], 00685 double y[nv])) { 00686 tptr=tp; 00687 fptr=fp; 00688 } 00689 00690 virtual ~mm_vfunct_mfptr_nopar() {}; 00691 00692 /** \brief Compute \c nv functions, \c y, of \c nv variables 00693 stored in \c x with parameter \c pa. 00694 */ 00695 virtual int operator()(size_t nvar, const double x[nv], double y[nv], 00696 param_t &pa) { 00697 return (*tptr.*fptr)(nv,x,y); 00698 } 00699 00700 #ifndef DOXYGEN_INTERNAL 00701 00702 protected: 00703 00704 /// The member function pointer 00705 int (tclass::*fptr)(size_t nvar, const double x[nv], double y[nv]); 00706 00707 /// The class pointer 00708 tclass *tptr; 00709 00710 private: 00711 00712 mm_vfunct_mfptr_nopar(const mm_vfunct_mfptr_nopar &); 00713 mm_vfunct_mfptr_nopar& operator=(const mm_vfunct_mfptr_nopar&); 00714 00715 #endif 00716 00717 }; 00718 00719 /** \brief Const member function pointer to an array of 00720 multi-dimensional functions with arrays 00721 */ 00722 template<class tclass, class param_t, size_t nv> 00723 class mm_vfunct_cmfptr : public mm_vfunct<param_t,nv> { 00724 public: 00725 00726 /** \brief Specify the member function pointer 00727 */ 00728 mm_vfunct_cmfptr(tclass *tp, int (tclass::*fp) 00729 (size_t nvar, const double x[nv], double y[nv], 00730 param_t &pa) const) { 00731 tptr=tp; 00732 fptr=fp; 00733 } 00734 00735 virtual ~mm_vfunct_cmfptr() {}; 00736 00737 /** \brief Compute \c nv functions, \c y, of \c nv variables 00738 stored in \c x with parameter \c pa. 00739 */ 00740 virtual int operator()(size_t nvar, const double x[nv], double y[nv], 00741 param_t &pa) { 00742 return (*tptr.*fptr)(nv,x,y,pa); 00743 } 00744 00745 #ifndef DOXYGEN_INTERNAL 00746 00747 protected: 00748 00749 /// The member function pointer 00750 int (tclass::*fptr)(size_t nvar, const double x[nv], double y[nv], 00751 param_t &pa) const; 00752 00753 /// The class pointer 00754 tclass *tptr; 00755 00756 private: 00757 00758 mm_vfunct_cmfptr(const mm_vfunct_cmfptr &); 00759 mm_vfunct_cmfptr& operator=(const mm_vfunct_cmfptr&); 00760 00761 #endif 00762 00763 }; 00764 00765 /** \brief Member function pointer to an array of 00766 multi-dimensional functions with arrays with no parameters 00767 */ 00768 template<class tclass, class param_t, size_t nv> 00769 class mm_vfunct_cmfptr_nopar : public mm_vfunct<param_t,nv> { 00770 00771 public: 00772 00773 /** \brief Specify the member function pointer 00774 */ 00775 mm_vfunct_cmfptr_nopar(tclass *tp, int (tclass::*fp) 00776 (size_t nvar, const double x[nv], double y[nv]) 00777 const) { 00778 tptr=tp; 00779 fptr=fp; 00780 } 00781 00782 virtual ~mm_vfunct_cmfptr_nopar() {}; 00783 00784 /** \brief Compute \c nv functions, \c y, of \c nv variables 00785 stored in \c x with parameter \c pa. 00786 */ 00787 virtual int operator()(size_t nvar, const double x[nv], double y[nv], 00788 param_t &pa) { 00789 return (*tptr.*fptr)(nv,x,y); 00790 } 00791 00792 #ifndef DOXYGEN_INTERNAL 00793 00794 protected: 00795 00796 /// The member function pointer 00797 int (tclass::*fptr)(size_t nvar, const double x[nv], double y[nv]) const; 00798 00799 /// The class pointer 00800 tclass *tptr; 00801 00802 private: 00803 00804 mm_vfunct_cmfptr_nopar(const mm_vfunct_cmfptr_nopar &); 00805 mm_vfunct_cmfptr_nopar& operator=(const mm_vfunct_cmfptr_nopar&); 00806 00807 #endif 00808 00809 }; 00810 00811 #ifndef DOXYGENP 00812 } 00813 #endif 00814 00815 #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