ConstantF.cxx

Go to the documentation of this file.
00001 
00012 #ifdef _MSC_VER
00013 #include "msdevstudio/MSconfig.h"
00014 #endif
00015 
00016 #include "ConstantF.h"
00017 
00018 #include "FunctionHelper.h"
00019 
00020 #include <cassert>
00021 
00022 #ifdef ITERATOR_MEMBER_DEFECT
00023 using namespace std;
00024 #else
00025 using std::vector;
00026 #endif
00027 
00028 namespace hippodraw {
00029 
00030 ConstantF::ConstantF ( )
00031 {
00032   initialize ();
00033 }
00034 
00035 ConstantF::ConstantF ( double value )
00036 {
00037   initialize ();
00038 
00039   m_parms[0] = value;
00040 }
00041 
00042 void ConstantF::initialize ()
00043 {
00044   m_name = "Constant";
00045   m_parm_names.push_back ( "value" );
00046 
00047   resize ();
00048 }
00049 
00050 FunctionBase * ConstantF::clone () const
00051 {
00052   return new ConstantF ( *this );
00053 }
00054 
00055 double ConstantF::operator () ( double ) const
00056 {
00057   return m_parms[0];
00058 }
00059 
00060 void 
00061 ConstantF::
00062 initialParameters ( const FunctionHelper * helper )
00063 {
00064   m_parms[0] = helper->meanValue ();
00065 }
00066 
00067 double ConstantF::derivByParm ( int i, double ) const
00068 {
00069   assert ( i == 0 );
00070 
00071   return 1.0;
00072 }
00073 
00074 } // namespace hippodraw

Generated for HippoDraw Class Library by doxygen