peak.cpp

来自「不错的国外的有限元程序代码,附带详细的manual,可以节省很多的底层工作.」· C++ 代码 · 共 33 行

CPP
33
字号
//   file PEAK.CXX
 
#include "peak.hxx"
#include <math.h>


double  PeakFunction :: at (double time)
   // Returns the value of the receiver at time 'time'.
{
   const double precision = 0.000001 ;

   if (! value)
      this -> getCoefficients() ;

   if (fabs(*t - time) < precision)
      return *value ;
   else
      return 0. ;
}


void  PeakFunction :: getCoefficients ()
   // Reads the date anf the time increment of the receiver in the data file.
{
   t     = new double[1] ;
   value = new double[1] ;

   *t     = this -> read("t") ;
   *value = this -> read("f(t)") ;
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?