proj home

Files   Classes   Functions   Hierarchy  

linepathD1.h

Go to the documentation of this file.
00001 #ifndef LINEPATHD1_H
00002 #define LINEPATHD1_H
00003 
00004 //#include <cassert>
00005 //#include <iostream>
00006 
00007 //using namespace std;
00008 
00009 //#include <typeop.h>
00010 
00016 template< typename FN, typename T > 
00017 class linepathD1
00018 {
00019 public:
00020 
00022   uintc dim;
00023 
00025   FN fn;
00027   T * xi;
00029   T * x0;
00031   T * di;
00032 
00034   linepathD1
00035   (
00036     uintc dim_, 
00037     FN fn_
00038   )
00039     : dim(dim_), fn(fn_), xi(0), x0(0), di(0)
00040     {}
00041 
00042   linepathD1
00043   (
00044     uintc dim_, 
00045     FN fn_, 
00046     X xi_, 
00047     X x0_, 
00048     X di_ 
00049   )
00050     : dim(dim_), fn(fn_), xi(xi_), x0(x0_), di(di_) 
00051     {}
00052 
00054   linepathD1
00055   (
00056     uintc dim_, 
00057     X xi_, 
00058     X x0_, 
00059     X di_ 
00060   )
00061     : dim(dim_), xi(xi_), x0(x0_), di(di_) 
00062     {}
00063 
00065   void eval(T const t)
00066   {
00067     for (uint i=0; i<dim; ++i)
00068       xi[i] = x0[i]+di[i]*t;
00069 //cout << "***";
00070 //cout << printvecfunc(xi,dim) << endl;
00071   }
00073   void eval(T& fval, T const t)
00074     { eval(t); fn(fval); }
00075 
00077   ostream & print(ostream & os) const;
00078 
00079 };
00080 
00081 
00082 //-----------------------------------------------
00083 //  Implementation
00084 
00085 
00086 template< typename FN, typename T > 
00087 ostream & linepathD1<FN,T>::print(ostream & os) const
00088 {
00089   os << "dim=" << dim << endl;
00090   //os << "xi[]=" << printvecfunc(xi,dim) << endl;
00091   os << "xi[]=" << print(xi,xi+dim) << endl;
00092   //os << "x0[]=" << printvecfunc(x0,dim) << endl;
00093   os << "x0[]=" << print(x0,x0+dim) << endl;
00094   //os << "di[]=" << printvecfunc(di,dim) << endl;
00095   os << "di[]=" << print(di,di+dim) << endl;
00096 
00097   return os;
00098 }
00099 
00100 
00101 
00102 
00103 
00104 
00105 #endif
00106 
00107 

Generated on Fri Mar 4 00:49:30 2011 for Chelton Evans Source by  doxygen 1.5.8