diff --git a/moose-core/biophysics/MMPump.cpp b/moose-core/biophysics/MMPump.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c7f093c6923c9f05a6d962e148890f6e1200d66d --- /dev/null +++ b/moose-core/biophysics/MMPump.cpp @@ -0,0 +1,142 @@ +#include "header.h" +#include "MMPump.h" +#include "ElementValueFinfo.h" +#include "../utility/numutil.h" +#include <cmath> + +SrcFinfo2< double,double >* MMPump::PumpOut() +{ + static SrcFinfo2< double,double > pumpOut( "PumpOut", + "Sends out MMPump parameters."); + return &pumpOut; +} + +const Cinfo * MMPump::initCinfo() +{ + static DestFinfo process( "process", + "Handles process call", + new ProcOpFunc< MMPump>(&MMPump::process ) ); + static DestFinfo reinit( "reinit", + "Reinit happens only in stage 0", + new ProcOpFunc< MMPump>( &MMPump::reinit )); + + static Finfo* processShared[] = { + &process, &reinit + }; + + static SharedFinfo proc( + "proc", + "Shared message to receive Process message from scheduler", + processShared, sizeof( processShared ) / sizeof( Finfo* )); + + + //////////////////////////// + // Field defs + //////////////////////////// + + + + static ElementValueFinfo<MMPump, double> Vmax("Vmax", + "maximum pump velocity, scaled by mebrane" + "surface area. i.e., max ion flux in moles/sec", + &MMPump::setVmax, + &MMPump::getVmax); + + static ElementValueFinfo<MMPump, double> Kd("Kd", + "half-maximal activating concentration in mM", + &MMPump::setKd, + &MMPump::getKd); + + //// + // DestFinfo + //// + static Finfo * difBufferFinfos[] = { + ////////////////////////////////////////////////////////////////// + // Field definitions + ////////////////////////////////////////////////////////////////// + + + &Vmax, + &Kd, + ////////////////////////////////////////////////////////////////// + // SharedFinfo definitions + ///////////////////////////////////////////////////////////////// + + &proc, + PumpOut(), + ////////////////////////////////////////////////////////////////// + // DestFinfo definitions + ////////////////////////////////////////////////////////////////// + + }; + + static string doc[] = { + "Name", "MMPump", + "Author", "Subhasis Ray (ported from GENESIS2)", + "Description", "Models diffusible buffer where total concentration is constant. It is" + " coupled with a DifShell.", + }; + static ZeroSizeDinfo<int> dinfo; + static Cinfo MMPumpCinfo( + "MMPump", + Neutral::initCinfo(), + difBufferFinfos, + sizeof(difBufferFinfos)/sizeof(Finfo*), + &dinfo, + doc, + sizeof(doc)/sizeof(string)); + + return &MMPumpCinfo; +} + +static const Cinfo * MMpumpCinfo = MMPump::initCinfo(); + + +//////////////////////////////////////////////////////////////////////////////// +// Class functions +//////////////////////////////////////////////////////////////////////////////// + +MMPump::MMPump() +{ ; } + + + + +double MMPump::getVmax(const Eref& e) const +{ + + return Vmax_; +} +void MMPump::setVmax(const Eref& e,double value) +{ +if ( value < 0.0 ) { + cerr << "Error: MMPump: Vmax cannot be negative!\n"; + return; + } + Vmax_ = value; +} + + +double MMPump::getKd(const Eref& e) const +{ + return Kd_; +} +void MMPump::setKd(const Eref& e,double value) +{ +if ( value < 0.0 ) { + cerr << "Error: MMPump: Kd cannot be negative!\n"; + return; + } + Kd_ = value; +} + + +void MMPump::process(const Eref& e, ProcPtr p) +{ + PumpOut()->send(e,Vmax_,Kd_); +} + +void MMPump::reinit(const Eref& e, ProcPtr p) +{ + return; +} diff --git a/moose-core/biophysics/MMPump.h b/moose-core/biophysics/MMPump.h new file mode 100644 index 0000000000000000000000000000000000000000..911fb1d4b118cb49e4b1b1a3ab5d3fe06ada55c7 --- /dev/null +++ b/moose-core/biophysics/MMPump.h @@ -0,0 +1,45 @@ +/********************************************************************** + ** This program is part of 'MOOSE', the + ** Multiscale Object Oriented Simulation Environment. + ** copyright (C) 2003-2008 + ** Upinder S. Bhalla, Niraj Dudani and NCBS + ** It is made available under the terms of the + ** GNU Lesser General Public License version 2.1 + ** See the file COPYING.LIB for the full notice. + **********************************************************************/ + +#ifndef _MMPUMP_H +#define _MMPUMP_H +/*This is base class for MMPump*/ +class MMPump +{ +public: + MMPump(); + void process( const Eref & e, ProcPtr p); + void reinit(const Eref &e, ProcPtr p); + + double getVmax(const Eref& e) const; //Vmax of the pump + void setVmax(const Eref& e,double value); + + int getVal(const Eref& e) const; //Valence + void setVal(const Eref& e,int value); + + double getKd(const Eref& e) const; // Pump's Kd + void setKd(const Eref& e,double value); + + + + static SrcFinfo2< double,double >* PumpOut(); //Pump parameters; + + static const Cinfo * initCinfo(); + +private: + + double Vmax_; + double Kd_; +}; + + + + +#endif //_MMPUMP_BASE_H