MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Stoich.cpp File Reference
#include "header.h"
#include "ElementValueFinfo.h"
#include "PoolBase.h"
#include "ReacBase.h"
#include "EnzBase.h"
#include "CplxEnzBase.h"
#include "FuncTerm.h"
#include "RateTerm.h"
#include "FuncRateTerm.h"
#include "SparseMatrix.h"
#include "KinSparseMatrix.h"
#include "VoxelPoolsBase.h"
#include "../mesh/VoxelJunction.h"
#include "XferInfo.h"
#include "ZombiePoolInterface.h"
#include "../builtins/Variable.h"
#include "../builtins/Function.h"
#include "ZombieFunction.h"
#include "Stoich.h"
#include "lookupVolumeFromMesh.h"
#include "../scheduling/Clock.h"
#include "../shell/Shell.h"
#include "../shell/Wildcard.h"
+ Include dependency graph for Stoich.cpp:

Go to the source code of this file.

Functions

void convWildcards (vector< Id > &ret, const vector< ObjId > &elist)
 
pair< Id, IdextractCompts (const vector< Id > &compts)
 
void filterWildcards (vector< Id > &ret, const vector< ObjId > &elist)
 
static Id findFuncMsgSrc (Id pa, const string &msg)
 Returns Function, if any, acting as src of specified msg into pa. More...
 
void installDummy (RateTerm **entry, Id enzId, const string &s)
 
static bool isOffSolverReac (const Element *e, Id myCompt, vector< Id > &poolCompts, map< Id, Id > &poolComptMap)
 
void myUnique (vector< Id > &v)
 

Variables

static const CinfostoichCinfo = Stoich::initCinfo()
 

Function Documentation

void convWildcards ( vector< Id > &  ret,
const vector< ObjId > &  elist 
)

Definition at line 341 of file Stoich.cpp.

342 {
343  ret.resize( elist.size() );
344  for ( unsigned int i = 0; i < elist.size(); ++i )
345  ret[i] = elist[i].id;
346 }
pair< Id, Id > extractCompts ( const vector< Id > &  compts)

Extracts and orders the compartments associated with a given reac.

Definition at line 694 of file Stoich.cpp.

Referenced by Stoich::locateOffSolverReacs().

695 {
696  pair< Id, Id > ret;
697  for ( vector< Id >::const_iterator i = compts.begin();
698  i != compts.end(); ++i )
699  {
700  if ( ret.first == Id() )
701  {
702  ret.first = *i;
703  }
704  else if ( ret.first != *i )
705  {
706  if ( ret.second == Id() )
707  ret.second = *i;
708  else
709  {
710  cout << "Error: Stoich::extractCompts: more than 2 compartments\n";
711  assert( 0 );
712  }
713  }
714  }
715  if ( ( ret.second != Id() ) && ret.second < ret.first )
716  {
717  Id temp = ret.first;
718  ret.first = ret.second;
719  ret.second = ret.first;
720  }
721 
722  return ret;
723 }
Definition: Id.h:17

+ Here is the caller graph for this function:

void filterWildcards ( vector< Id > &  ret,
const vector< ObjId > &  elist 
)

Definition at line 348 of file Stoich.cpp.

Referenced by Stoich::setElist().

349 {
350  ret.clear();
351  ret.reserve( elist.size() );
352  for ( vector< ObjId >::const_iterator
353  i = elist.begin(); i != elist.end(); ++i )
354  {
355  if ( i->element()->cinfo()->isA( "PoolBase" ) ||
356  i->element()->cinfo()->isA( "ReacBase" ) ||
357  i->element()->cinfo()->isA( "EnzBase" ) ||
358  i->element()->cinfo()->isA( "Function" ) )
359  ret.push_back( i->id );
360  }
361 }

+ Here is the caller graph for this function:

static Id findFuncMsgSrc ( Id  pa,
const string &  msg 
)
static

Returns Function, if any, acting as src of specified msg into pa.

Definition at line 1231 of file Stoich.cpp.

References Element::cinfo(), Id::element(), Cinfo::findFinfo(), and Element::getNeighbors().

Referenced by Stoich::zombifyModel(), and Stoich::zombifyPoolFuncWithScaling().

1232 {
1233  const Finfo *finfo = pa.element()->cinfo()->findFinfo( msg );
1234  if ( !finfo ) return Id();
1235  vector< Id > ret;
1236  if ( pa.element()->getNeighbors( ret, finfo ) > 0 )
1237  {
1238  if ( ret[0].element()->cinfo()->isA( "Function" ) )
1239  return ret[0];
1240  }
1241  return Id(); // failure
1242 }
Element * element() const
Synonym for Id::operator()()
Definition: Id.cpp:113
const Cinfo * cinfo() const
Definition: Element.cpp:66
Definition: Id.h:17
unsigned int getNeighbors(vector< Id > &ret, const Finfo *finfo) const
Definition: Element.cpp:949
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void installDummy ( RateTerm **  entry,
Id  enzId,
const string &  s 
)

Definition at line 1625 of file Stoich.cpp.

References Id::path().

Referenced by Stoich::installMMenz().

1626 {
1627  cout << "Warning: Stoich::installMMenz: No " << s << " for: " <<
1628  enzId.path() << endl;
1629  *entry = new ZeroOrder( 0.0 );
1630 }
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool isOffSolverReac ( const Element e,
Id  myCompt,
vector< Id > &  poolCompts,
map< Id, Id > &  poolComptMap 
)
static

Checks if specified reac is off solver. As side-effect it compiles a vector of the pools that are off-solver, and the corresponding compartments for those pools

Definition at line 658 of file Stoich.cpp.

References Element::cinfo(), Id::element(), Cinfo::findFinfo(), getCompt(), Element::getNeighbors(), Cinfo::isA(), and Id::path().

Referenced by Stoich::locateOffSolverReacs().

662 {
663  assert( myCompt != Id() );
664  assert( myCompt.element()->cinfo()->isA( "ChemCompt" ) );
665  bool ret = false;
666  vector< Id > neighbors;
667  e->getNeighbors( neighbors, e->cinfo()->findFinfo( "subOut" ));
668  vector< Id > n2;
669  e->getNeighbors( n2, e->cinfo()->findFinfo( "prdOut" ));
670  neighbors.insert( neighbors.end(), n2.begin(), n2.end() );
671  for ( vector< Id >::const_iterator
672  j = neighbors.begin(); j != neighbors.end(); ++j )
673  {
674  Id otherCompt = getCompt( *j );
675  if ( myCompt != otherCompt )
676  {
677  // offSolverPools.push_back( *j );
678  poolCompts.push_back( otherCompt );
679  poolComptMap[ *j ] = otherCompt; // Avoids duplication of pools
680  ret = true;
681  if ( j->element()->cinfo()->isA( "BufPool" ) )
682  {
683  cout << "Warning: Avoid BufPool: " << j->path() <<
684  "\n as reactant in cross-compartment reactions\n";
685  }
686  }
687  }
688  return ret;
689 }
Element * element() const
Synonym for Id::operator()()
Definition: Id.cpp:113
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
bool isA(const string &ancestor) const
Definition: Cinfo.cpp:280
const Cinfo * cinfo() const
Definition: Element.cpp:66
ObjId getCompt(Id id)
Definition: Id.h:17
unsigned int getNeighbors(vector< Id > &ret, const Finfo *finfo) const
Definition: Element.cpp:949
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void myUnique ( vector< Id > &  v)

Definition at line 924 of file Stoich.cpp.

Referenced by Stoich::resizeArrays().

925 {
926  sort( v.begin(), v.end() );
927  vector< Id >::iterator last = unique( v.begin(), v.end() );
928  v.erase( last, v.end() );
929 }

+ Here is the caller graph for this function:

Variable Documentation

const Cinfo* stoichCinfo = Stoich::initCinfo()
static

Definition at line 251 of file Stoich.cpp.

Referenced by Stoich::initCinfo().