00001 #include "generalfunctioninterface.h" 00002 #include <iostream> 00003 #include "exception.h" 00004 00005 void GeneralFunctionInterface::plotInLine(VecDouble &p1,VecDouble &p2,unsigned npts,std::ostream &fout,unsigned cmp) 00006 { 00007 assert(p1.size() == getDomainDim()); 00008 assert(p2.size() == getDomainDim()); 00009 00010 VecDouble dp=p2; 00011 VecDouble p=p1; 00012 dp-=p1; 00013 dp*=1.0/(npts-1); 00014 double dx = dp.l2_norm(); 00015 double x=0; 00016 for(unsigned i=0;i<npts;i++) 00017 { 00018 fout << x << " " << (*this)(p,cmp) << std::endl; 00019 x+=dx; 00020 p+=dp; 00021 } 00022 } 00023 00024 00025 00026 bool GeneralFunctionInterface::isInDomain(const VecDouble &p,unsigned component) const 00027 { 00028 00029 throw new Exception("GeneralFunctionInterface::IsInDomain not defined for %s\n",typeid(*this).name()); 00030 return false; 00031 }