Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ConstantF.cxx

Go to the documentation of this file.
00001 /*
00002  * HippoPlot ConstantF class implementation
00003  *
00004  * Copyright (C) 2000, 2001, 2003   The Board of Trustees of The Leland
00005  * Stanford Junior University.  All Rights Reserved.
00006  *
00007  * $Id: ConstantF.cxx,v 1.34 2003/02/23 19:16:44 pfkeb Exp $
00008  *
00009  */
00010 
00011 #ifdef HAVE_CONFIG_H
00012 #include "config.h"
00013 #else
00014 #ifdef _MSC_VER
00015 #include "msdevstudio/MSconfig.h"
00016 #endif
00017 #endif
00018 
00019 #include "ConstantF.h"
00020 
00021 #include "FunctionHelper.h"
00022 
00023 #include <cassert>
00024 
00025 #ifdef ITERATOR_MEMBER_DEFECT
00026 using namespace std;
00027 #else
00028 using std::vector;
00029 #endif
00030 
00031 ConstantF::ConstantF ( )
00032 {
00033   initialize ();
00034 }
00035 
00036 ConstantF::ConstantF ( double value )
00037 {
00038   initialize ();
00039 
00040   m_parms[0] = value;
00041 }
00042 
00043 void ConstantF::initialize ()
00044 {
00045   m_name = "Constant";
00046   m_parm_names.push_back ( "value" );
00047 
00048   resize ();
00049 }
00050 
00051 FunctionBase * ConstantF::clone () const
00052 {
00053   return new ConstantF ( *this );
00054 }
00055 
00056 double ConstantF::operator () ( double x ) const
00057 {
00058   return m_parms[0];
00059 }
00060 
00061 /* virtual */
00062 void 
00063 ConstantF::
00064 initialParameters ( const FunctionHelper * helper )
00065 {
00066   m_parms[0] = helper->meanValue ();
00067 }
00068 
00069 double ConstantF::derivByParm ( int i, double x ) const
00070 {
00071   assert ( i == 0 );
00072 
00073   return 1.0;
00074 }

Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3