MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ChemCompt Class Referenceabstract

#include <ChemCompt.h>

+ Inheritance diagram for ChemCompt:
+ Collaboration diagram for ChemCompt:

Public Member Functions

void buildDefaultMesh (const Eref &e, double volume, unsigned int numEntries)
 
void buildJunction (ChemCompt *other, vector< VoxelJunction > &ret)
 
 ChemCompt ()
 
virtual void clearExtendedMeshEntryVolume ()=0
 clear out extended mesh entries for rebuilding. More...
 
virtual double extendedMeshEntryVolume (unsigned int fid) const =0
 Volume of mesh Entry including abutting diff-coupled voxels. More...
 
virtual void extendStencil (const ChemCompt *other, const vector< VoxelJunction > &vj)=0
 
void flipRet (vector< VoxelJunction > &ret) const
 Utility function for swapping first and second in VoxelJunctions. More...
 
void getChildConcs (const Eref &e, vector< double > &childConcs) const
 
virtual vector< double > getCoordinates (unsigned int fid) const =0
 Virtual function to return coords of mesh Entry. More...
 
virtual vector< double > getDiffusionArea (unsigned int fid) const =0
 Virtual function to return diffusion X-section area per neighbor. More...
 
virtual vector< double > getDiffusionScaling (unsigned int fid) const =0
 Virtual function to return scale factor for diffusion. 1 here. More...
 
unsigned int getDimensions () const
 
double getEntireVolume (const Eref &e) const
 
bool getIsMembraneBound () const
 
virtual unsigned int getMeshDimensions (unsigned int fid) const =0
 Virtual function to return dimensions of specified entry. More...
 
virtual double getMeshEntryVolume (unsigned int fid) const =0
 Virtual function to return volume of mesh Entry. More...
 
virtual unsigned int getMeshType (unsigned int fid) const =0
 Virtual function to return MeshType of specified entry. More...
 
string getMethod () const
 
virtual vector< unsigned int > getNeighbors (unsigned int fid) const =0
 Virtual function to return info on Entries connected to this one. More...
 
unsigned int getNumEntries () const
 
double getOneVoxelVolume (const Eref &e, unsigned int voxel) const
 
vector< unsigned int > getStencilIndex (unsigned int row) const
 
vector< double > getStencilRate (unsigned int row) const
 
virtual unsigned int getStencilRow (unsigned int meshIndex, const double **entry, const unsigned int **colIndex) const =0
 
vector< double > getVoxelMidpoint () const
 Returns vector of all voxel midpoints in compartment. More...
 
vector< double > getVoxelVolume () const
 Returns vector of all voxel volumes in compartment. More...
 
void handleNodeInfo (const Eref &e, unsigned int numNodes, unsigned int numThreads)
 
virtual void indexToSpace (unsigned int index, double &x, double &y, double &z) const =0
 
virtual void innerBuildDefaultMesh (const Eref &e, double volume, unsigned int numEntries)=0
 
virtual unsigned int innerGetDimensions () const =0
 
virtual unsigned int innerGetNumEntries () const =0
 
virtual vector< double > innerGetStencilRate (unsigned int row) const =0
 Virtual func for getting stencil rates for the derived classes. More...
 
virtual void innerHandleNodeInfo (const Eref &e, unsigned int numNodes, unsigned int numThreads)=0
 
virtual void innerResetStencil ()=0
 
virtual void innerSetNumEntries (unsigned int n)=0
 
MeshEntrylookupEntry (unsigned int index)
 
virtual void matchMeshEntries (const ChemCompt *other, vector< VoxelJunction > &ret) const =0
 
virtual double nearest (double x, double y, double z, unsigned int &index) const =0
 
void resetStencil ()
 
unsigned int setChildConcs (const Eref &e, const vector< double > &childConcs, unsigned int start) const
 
void setEntireVolume (const Eref &e, double volume)
 
void setIsMembraneBound (bool v)
 
virtual void setMeshEntryVolume (unsigned int fid, double volume)
 
void setMethod (string method)
 
void setNumEntries (unsigned int num)
 
void setOneVoxelVolume (const Eref &e, unsigned int voxel, double volume)
 
void setVolumeNotRates (double volume)
 
virtual double vGetEntireVolume () const =0
 
virtual const vector< double > & vGetVoxelMidpoint () const =0
 Virtual func so that derived classes can return voxel midpoint. More...
 
virtual const vector< double > & vGetVoxelVolume () const =0
 Virtual func so that derived classes can pass voxel volume back. More...
 
virtual bool vSetVolumeNotRates (double volume)=0
 Virtual function for actually doing this. More...
 
virtual ~ChemCompt ()
 

Static Public Member Functions

static double distance (double x, double y, double z)
 
static const CinfoinitCinfo ()
 
static SrcFinfo1< vector
< double > > * 
voxelVolOut ()
 

Private Attributes

vector< Boundaryboundaries_
 Wrapper for self ptr. More...
 
MeshEntry entry_
 
bool isMembraneBound_
 
string method_
 

Detailed Description

The ChemCompt represents a chemically identified compartment. This may be spatially extended, and may even be discontinuous. The same set of reactions and molecules populates any given compartment. Examples of compartments might be: nucleus, cell membrane, early endosomes, spine heads. Connects to one or more 'Geometry' elements to define its boundaries.

Definition at line 23 of file ChemCompt.h.

Constructor & Destructor Documentation

ChemCompt::ChemCompt ( )

Definition at line 198 of file ChemCompt.cpp.

Referenced by initCinfo().

199  :
200  entry_( this ),
201  isMembraneBound_( false )
202 {
203  ;
204 }
bool isMembraneBound_
Definition: ChemCompt.h:363
MeshEntry entry_
Definition: ChemCompt.h:333

+ Here is the caller graph for this function:

ChemCompt::~ChemCompt ( )
virtual

Definition at line 206 of file ChemCompt.cpp.

207 {
208  /*
209  for ( unsigned int i = 0; i < stencil_.size(); ++i ) {
210  if ( stencil_[i] )
211  delete stencil_[i];
212  }
213  */
214 }

Member Function Documentation

void ChemCompt::buildDefaultMesh ( const Eref e,
double  volume,
unsigned int  numEntries 
)

buildDefaultMesh tells the ChemCompt to make a standard mesh partitioning with the specified total volume and the specified number of subdivisions. For example, a CubeMesh of volume 8 and subdivisions 8 would make a 2x2x2 mesh. This function is specialized in each derived class.

Definition at line 220 of file ChemCompt.cpp.

References innerBuildDefaultMesh().

Referenced by initCinfo().

222 {
223  this->innerBuildDefaultMesh( e, volume, numEntries );
224 }
const int numEntries
Definition: proc.cpp:60
virtual void innerBuildDefaultMesh(const Eref &e, double volume, unsigned int numEntries)=0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ChemCompt::buildJunction ( ChemCompt other,
vector< VoxelJunction > &  ret 
)

Wrapper function to buld junction between two meshes, and to extend the meshes so that their stencils also handle update to the voxels abutting the boundary on the neighbor mesh.

Definition at line 400 of file ChemCompt.cpp.

References extendStencil(), and matchMeshEntries().

401 {
402  matchMeshEntries( other, ret );
403  extendStencil( other, ret );
404 }
virtual void extendStencil(const ChemCompt *other, const vector< VoxelJunction > &vj)=0
virtual void matchMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const =0

+ Here is the call graph for this function:

virtual void ChemCompt::clearExtendedMeshEntryVolume ( )
pure virtual

clear out extended mesh entries for rebuilding.

Implemented in MeshCompt.

double ChemCompt::distance ( double  x,
double  y,
double  z 
)
static

Definition at line 422 of file ChemCompt.cpp.

Referenced by CylMesh::matchCylMeshEntries(), CylMesh::nearest(), and CubeMesh::nearest().

423 {
424  return sqrt( x * x + y * y + z * z );
425 }

+ Here is the caller graph for this function:

virtual double ChemCompt::extendedMeshEntryVolume ( unsigned int  fid) const
pure virtual

Volume of mesh Entry including abutting diff-coupled voxels.

Implemented in NeuroMesh, CubeMesh, SpineMesh, PsdMesh, CylMesh, EndoMesh, and MeshCompt.

virtual void ChemCompt::extendStencil ( const ChemCompt other,
const vector< VoxelJunction > &  vj 
)
pure virtual

Function to add voxels for boundaries. This is done so that the solver can do reaction-diffusion computations on the entire mesh including voxels of neighboring solvers abutting the boundary. It uses these to stitch together the computations that span multiple solvers and compartments.

Implemented in MeshCompt.

Referenced by buildJunction().

+ Here is the caller graph for this function:

void ChemCompt::flipRet ( vector< VoxelJunction > &  ret) const

Utility function for swapping first and second in VoxelJunctions.

Definition at line 406 of file ChemCompt.cpp.

Referenced by CubeMesh::matchCubeMeshEntries(), CubeMesh::matchCylMeshEntries(), CylMesh::matchMeshEntries(), SpineMesh::matchMeshEntries(), CubeMesh::matchMeshEntries(), and NeuroMesh::matchMeshEntries().

407 {
408  vector< VoxelJunction >::iterator i;
409  for ( i = ret.begin(); i != ret.end(); ++i ) {
410  unsigned int temp = i->first;
411  i->first = i->second;
412  i->second = temp;
413  double vol = i->firstVol;
414  i->firstVol = i->secondVol;
415  i->secondVol = vol;
416  }
417 }

+ Here is the caller graph for this function:

void ChemCompt::getChildConcs ( const Eref e,
vector< double > &  childConcs 
) const

Recursively traverses all children, depth_first, scooping up concentration terms: conc and concInit for pools, Kf and Kb for Reacs, and Km for enzymes. These are inserted in order into the vector of childConcs. Does not traverse into children of other ChemCompts

Definition at line 264 of file ChemCompt.cpp.

References Neutral::children().

Referenced by CylMesh::innerSetCoords(), CylMesh::setDiffLength(), setEntireVolume(), CylMesh::setR0(), CylMesh::setR1(), CylMesh::setX0(), CylMesh::setX1(), CylMesh::setY0(), CylMesh::setY1(), CylMesh::setZ0(), and CylMesh::setZ1().

266 {
267  vector< Id > kids;
268  Neutral::children( e, kids );
269  for ( vector < Id >::iterator i = kids.begin(); i != kids.end(); ++i )
270  {
271  if ( i->element()->cinfo()->isA( "PoolBase" ) ) {
272  childConcs.push_back( Field< double >::get( *i, "conc" ) );
273  childConcs.push_back( Field< double >::get( *i, "concInit" ) );
274  } else if ( i->element()->cinfo()->isA( "ReacBase" ) ) {
275  childConcs.push_back( Field< double >::get( *i, "Kf" ) );
276  childConcs.push_back( Field< double >::get( *i, "Kb" ) );
277  } else if ( i->element()->cinfo()->isA( "EnzBase" ) ) {
278  childConcs.push_back( Field< double >::get( *i, "Km" ) );
279  } else if ( i->element()->cinfo()->isA( "ChemCompt" ) ) {
280  // Do NOT traverse into child ChemCompts, they look after their
281  // own volumes.
282  continue;
283  }
284  getChildConcs( i->eref(), childConcs );
285  }
286 }
Definition: SetGet.h:236
static void children(const Eref &e, vector< Id > &ret)
Definition: Neutral.cpp:342
void getChildConcs(const Eref &e, vector< double > &childConcs) const
Definition: ChemCompt.cpp:264

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual vector< double > ChemCompt::getCoordinates ( unsigned int  fid) const
pure virtual

Virtual function to return coords of mesh Entry.

Implemented in NeuroMesh, CubeMesh, SpineMesh, PsdMesh, CylMesh, and EndoMesh.

Referenced by EndoMesh::getCoordinates(), and MeshEntry::getCoordinates().

+ Here is the caller graph for this function:

virtual vector< double > ChemCompt::getDiffusionArea ( unsigned int  fid) const
pure virtual

Virtual function to return diffusion X-section area per neighbor.

Implemented in NeuroMesh, CubeMesh, SpineMesh, PsdMesh, CylMesh, and EndoMesh.

Referenced by MeshEntry::getDiffusionArea().

+ Here is the caller graph for this function:

virtual vector< double > ChemCompt::getDiffusionScaling ( unsigned int  fid) const
pure virtual

Virtual function to return scale factor for diffusion. 1 here.

Implemented in NeuroMesh, CubeMesh, SpineMesh, PsdMesh, CylMesh, and EndoMesh.

Referenced by MeshEntry::getDiffusionScaling().

+ Here is the caller graph for this function:

unsigned int ChemCompt::getDimensions ( ) const

Returns # of dimensions of mesh. This is 3 for cube, and 1 for cylinder or neurons.

Definition at line 340 of file ChemCompt.cpp.

References innerGetDimensions().

Referenced by initCinfo(), testCubeMesh(), and testCubeMeshExtendStencil().

341 {
342  return this->innerGetDimensions();
343 }
virtual unsigned int innerGetDimensions() const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double ChemCompt::getEntireVolume ( const Eref e) const

Returns volume, area, or length of compartment, depending on dimensionality.

Definition at line 259 of file ChemCompt.cpp.

References vGetEntireVolume().

Referenced by initCinfo().

260 {
261  return vGetEntireVolume();
262 }
virtual double vGetEntireVolume() const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ChemCompt::getIsMembraneBound ( ) const

Definition at line 355 of file ChemCompt.cpp.

References isMembraneBound_.

Referenced by initCinfo().

356 {
357  return isMembraneBound_;
358 }
bool isMembraneBound_
Definition: ChemCompt.h:363

+ Here is the caller graph for this function:

virtual unsigned int ChemCompt::getMeshDimensions ( unsigned int  fid) const
pure virtual

Virtual function to return dimensions of specified entry.

Implemented in NeuroMesh, CubeMesh, SpineMesh, CylMesh, PsdMesh, and EndoMesh.

Referenced by MeshEntry::getDimensions().

+ Here is the caller graph for this function:

virtual double ChemCompt::getMeshEntryVolume ( unsigned int  fid) const
pure virtual

Virtual function to return volume of mesh Entry.

Implemented in NeuroMesh, CubeMesh, SpineMesh, CylMesh, PsdMesh, and EndoMesh.

Referenced by MeshCompt::extendStencil(), EndoMesh::getMeshEntryVolume(), getOneVoxelVolume(), and MeshEntry::getVolume().

+ Here is the caller graph for this function:

virtual unsigned int ChemCompt::getMeshType ( unsigned int  fid) const
pure virtual

Virtual function to return MeshType of specified entry.

Implemented in NeuroMesh, CubeMesh, SpineMesh, CylMesh, PsdMesh, and EndoMesh.

Referenced by MeshEntry::getMeshType().

+ Here is the caller graph for this function:

string ChemCompt::getMethod ( ) const
virtual vector< unsigned int > ChemCompt::getNeighbors ( unsigned int  fid) const
pure virtual

Virtual function to return info on Entries connected to this one.

Implemented in MeshCompt.

Referenced by MeshEntry::getNeighbors(), and getStencilIndex().

+ Here is the caller graph for this function:

unsigned int ChemCompt::getNumEntries ( ) const

Returns the number of MeshEntries on this ChemCompt

Definition at line 390 of file ChemCompt.cpp.

References innerGetNumEntries().

Referenced by Dsolve::build(), EndoMesh::getDiffusionArea(), EndoMesh::getDiffusionScaling(), initCinfo(), EndoMesh::innerHandleRequestMeshStats(), CylBase::matchCubeMeshEntries(), CylMesh::matchCubeMeshEntries(), and MeshEntry::triggerRemesh().

391 {
392  return this->innerGetNumEntries();
393 }
virtual unsigned int innerGetNumEntries() const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double ChemCompt::getOneVoxelVolume ( const Eref e,
unsigned int  voxel 
) const

Returns volume of specified voxel

Definition at line 323 of file ChemCompt.cpp.

References getMeshEntryVolume().

Referenced by initCinfo().

324 {
325  return this->getMeshEntryVolume( dataIndex );
326 }
static char dataIndex[]
Definition: mfield.cpp:406
virtual double getMeshEntryVolume(unsigned int fid) const =0
Virtual function to return volume of mesh Entry.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< unsigned int > ChemCompt::getStencilIndex ( unsigned int  row) const

Function to return the stencil indices used in the diffusion calculations for voxelized compartments. Refers to the getNeighbors virtual function.

Definition at line 350 of file ChemCompt.cpp.

References getNeighbors().

Referenced by initCinfo().

351 {
352  return this->getNeighbors( row );
353 }
virtual vector< unsigned int > getNeighbors(unsigned int fid) const =0
Virtual function to return info on Entries connected to this one.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< double > ChemCompt::getStencilRate ( unsigned int  row) const

Function to return the stencil values used in the diffusion calculations for voxelized compartments.

Definition at line 345 of file ChemCompt.cpp.

References innerGetStencilRate().

Referenced by initCinfo().

346 {
347  return this->innerGetStencilRate( row );
348 }
virtual vector< double > innerGetStencilRate(unsigned int row) const =0
Virtual func for getting stencil rates for the derived classes.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual unsigned int ChemCompt::getStencilRow ( unsigned int  meshIndex,
const double **  entry,
const unsigned int **  colIndex 
) const
pure virtual

Function to look up scale factor derived from area and length of compartment junction, for all the mesh entries connected to the specified one. Modeled on equivalent function in SparseMatrix. meshIndex: index of reference mesh entry entry: array of values of scale factor colIndex: array of relative indices for each entry. The values returned here are the offset from the meshIndex. Returns number of entries and colIndexes. For a 1-D mesh, there will be 2 except at boundaries For a 2-D mesh, there will be 4 except at boundaries For a 3-D mesh, there will be 6 except at boundaries For a neuromesh, there will be a variable number depending on branching. For a CylMesh there are 2 except at boundaries.

Implemented in MeshCompt.

vector< double > ChemCompt::getVoxelMidpoint ( ) const

Returns vector of all voxel midpoints in compartment.

Definition at line 318 of file ChemCompt.cpp.

References vGetVoxelMidpoint().

Referenced by initCinfo().

319 {
320  return this->vGetVoxelMidpoint();
321 }
virtual const vector< double > & vGetVoxelMidpoint() const =0
Virtual func so that derived classes can return voxel midpoint.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< double > ChemCompt::getVoxelVolume ( ) const

Returns vector of all voxel volumes in compartment.

Definition at line 313 of file ChemCompt.cpp.

References vGetVoxelVolume().

Referenced by Dsolve::build(), initCinfo(), and mapVoxelsBetweenMeshes().

314 {
315  return this->vGetVoxelVolume();
316 }
virtual const vector< double > & vGetVoxelVolume() const =0
Virtual func so that derived classes can pass voxel volume back.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ChemCompt::handleNodeInfo ( const Eref e,
unsigned int  numNodes,
unsigned int  numThreads 
)

Definition at line 226 of file ChemCompt.cpp.

References innerHandleNodeInfo().

Referenced by initCinfo().

228 {
229  // Pass it down to derived classes along with the SrcFinfo
230  innerHandleNodeInfo( e, numNodes, numThreads );
231 }
virtual void innerHandleNodeInfo(const Eref &e, unsigned int numNodes, unsigned int numThreads)=0
static unsigned int numNodes

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void ChemCompt::indexToSpace ( unsigned int  index,
double &  x,
double &  y,
double &  z 
) const
pure virtual

Converts specified index to xyz coords of middle of voxel Values out of range return original xyz

Implemented in NeuroMesh, CubeMesh, SpineMesh, PsdMesh, CylMesh, and EndoMesh.

Referenced by EndoMesh::indexToSpace().

+ Here is the caller graph for this function:

const Cinfo * ChemCompt::initCinfo ( )
static

Definition at line 25 of file ChemCompt.cpp.

References buildDefaultMesh(), ChemCompt(), chemMeshCinfo, getDimensions(), getEntireVolume(), getIsMembraneBound(), getNumEntries(), getOneVoxelVolume(), getStencilIndex(), getStencilRate(), getVoxelMidpoint(), getVoxelVolume(), handleNodeInfo(), MeshEntry::initCinfo(), Neutral::initCinfo(), lookupEntry(), resetStencil(), setEntireVolume(), setIsMembraneBound(), setNumEntries(), setOneVoxelVolume(), setVolumeNotRates(), and voxelVolOut().

Referenced by EndoMesh::initCinfo(), CylMesh::initCinfo(), PsdMesh::initCinfo(), SpineMesh::initCinfo(), NeuroMesh::initCinfo(), and CubeMesh::initCinfo().

26 {
28  // Field Definitions
31  "volume",
32  "Volume of entire chemical domain."
33  "Assigning this only works if the chemical compartment has"
34  "only a single voxel. Otherwise ignored."
35  "This function goes through all objects below this on the"
36  "tree, and rescales their molecule #s and rates as per the"
37  "volume change. This keeps concentration the same, and also"
38  "maintains rates as expressed in volume units.",
41  );
42 
44  voxelVolume(
45  "voxelVolume",
46  "Vector of volumes of each of the voxels.",
48  );
49 
51  voxelMidpoint(
52  "voxelMidpoint",
53  "Vector of midpoint coordinates of each of the voxels. The "
54  "size of this vector is 3N, where N is the number of voxels. "
55  "The first N entries are for x, next N for y, last N are z. ",
57  );
58 
60  ChemCompt, unsigned int, double >
61  oneVoxelVolume(
62  "oneVoxelVolume",
63  "Volume of specified voxel.",
66  );
67 
69  "numDimensions",
70  "Number of spatial dimensions of this compartment. Usually 3 or 2",
72  );
73 
75  "stencilRate",
76  "vector of diffusion rates in the stencil for specified voxel."
77  "The identity of the coupled voxels is given by the partner "
78  "field 'stencilIndex'."
79  "Returns an empty vector for non-voxelized compartments.",
81  );
82 
84  "stencilIndex",
85  "vector of voxels diffusively coupled to the specified voxel."
86  "The diffusion rates into the coupled voxels is given by the "
87  "partner field 'stencilRate'."
88  "Returns an empty vector for non-voxelized compartments.",
90  );
91 
92  static ValueFinfo< ChemCompt, bool > isMembraneBound(
93  "isMembraneBound",
94  "Flag, set to True for meshes where each voxel is membrane "
95  "bound. \n"
96  "NeuroMesh and SpineMesh are false. \n"
97  "CubeMesh, CylMesh, and EndoMesh can be either. If they are "
98  "membrane bound they can still interact via channels and "
99  "cross-compartment reactions. ",
102  );
103 
105  // MsgDest Definitions
107 
108  static DestFinfo buildDefaultMesh( "buildDefaultMesh",
109  "Tells ChemCompt derived class to build a default mesh with the"
110  "specified volume and number of meshEntries.",
113  );
114 
115  static DestFinfo setVolumeNotRates( "setVolumeNotRates",
116  "Changes volume but does not notify any child objects."
117  "Only works if the ChemCompt has just one voxel."
118  "This function will invalidate any concentration term in"
119  "the model. If you don't know why you would want to do this,"
120  "then you shouldn't use this function.",
123  );
124 
125  static DestFinfo handleNodeInfo( "handleNodeInfo",
126  "Tells ChemCompt how many nodes and threads per node it is "
127  "allowed to use. Triggers a return meshSplitOut message.",
130  );
131 
132  static DestFinfo resetStencil( "resetStencil",
133  "Resets the diffusion stencil to the core stencil that only "
134  "includes the within-mesh diffusion. This is needed prior to "
135  "building up the cross-mesh diffusion through junctions.",
138  );
139 
140 
142  // Field Elements
144 
146  "mesh",
147  "Field Element for mesh entries",
152  false
153  );
154 
155  static Finfo* chemMeshFinfos[] = {
156  &volume, // Value
157  &voxelVolume, // ReadOnlyLookupValue
158  &voxelMidpoint, // ReadOnlyLookupValue
159  &oneVoxelVolume, // ReadOnlyLookupValue
160  &numDimensions, // ReadOnlyValue
161  &stencilRate, // ReadOnlyLookupValue
162  &stencilIndex, // ReadOnlyLookupValue
163  &isMembraneBound, // Value
164  voxelVolOut(), // SrcFinfo
165  &buildDefaultMesh, // DestFinfo
166  &setVolumeNotRates, // DestFinfo
167  &resetStencil, // DestFinfo
168  &entryFinfo, // FieldElementFinfo
169  };
170 
171  static string doc[] = {
172  "Name", "ChemCompt",
173  "Author", "Upi Bhalla",
174  "Description", "Pure virtual base class for chemical compartments"
175 
176  };
177  static Dinfo< short > dinfo;
178  static Cinfo chemMeshCinfo (
179  "ChemCompt",
181  chemMeshFinfos,
182  sizeof( chemMeshFinfos ) / sizeof ( Finfo* ),
183  &dinfo,
184  doc,
185  sizeof(doc)/sizeof( string ),
186  true // This is a base class, not be be created directly.
187  );
188 
189  return &chemMeshCinfo;
190 }
void resetStencil()
Definition: ChemCompt.cpp:233
void setIsMembraneBound(bool v)
Definition: ChemCompt.cpp:360
vector< double > getVoxelMidpoint() const
Returns vector of all voxel midpoints in compartment.
Definition: ChemCompt.cpp:318
Definition: Dinfo.h:60
void setVolumeNotRates(double volume)
Definition: ChemCompt.cpp:370
MeshEntry * lookupEntry(unsigned int index)
Definition: ChemCompt.cpp:379
vector< double > getVoxelVolume() const
Returns vector of all voxel volumes in compartment.
Definition: ChemCompt.cpp:313
vector< double > getStencilRate(unsigned int row) const
Definition: ChemCompt.cpp:345
vector< unsigned int > getStencilIndex(unsigned int row) const
Definition: ChemCompt.cpp:350
void setEntireVolume(const Eref &e, double volume)
Definition: ChemCompt.cpp:242
void setOneVoxelVolume(const Eref &e, unsigned int voxel, double volume)
Definition: ChemCompt.cpp:328
double getEntireVolume(const Eref &e) const
Definition: ChemCompt.cpp:259
double getOneVoxelVolume(const Eref &e, unsigned int voxel) const
Definition: ChemCompt.cpp:323
static SrcFinfo1< vector< double > > * voxelVolOut()
Definition: ChemCompt.cpp:17
unsigned int getNumEntries() const
Definition: ChemCompt.cpp:390
unsigned int getDimensions() const
Definition: ChemCompt.cpp:340
bool getIsMembraneBound() const
Definition: ChemCompt.cpp:355
void buildDefaultMesh(const Eref &e, double volume, unsigned int numEntries)
Definition: ChemCompt.cpp:220
Definition: OpFunc.h:27
void setNumEntries(unsigned int num)
Definition: ChemCompt.cpp:384
Definition: OpFunc.h:13
static const Cinfo * initCinfo()
Definition: Neutral.cpp:16
void handleNodeInfo(const Eref &e, unsigned int numNodes, unsigned int numThreads)
Definition: ChemCompt.cpp:226
static const Cinfo * initCinfo()
Definition: MeshEntry.cpp:47
static const Cinfo * chemMeshCinfo
Definition: ChemCompt.cpp:196
Definition: Cinfo.h:18
Definition: EpFunc.h:79
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void ChemCompt::innerBuildDefaultMesh ( const Eref e,
double  volume,
unsigned int  numEntries 
)
pure virtual

Implemented in NeuroMesh, CubeMesh, PsdMesh, SpineMesh, CylMesh, and EndoMesh.

Referenced by buildDefaultMesh().

+ Here is the caller graph for this function:

virtual unsigned int ChemCompt::innerGetDimensions ( ) const
pure virtual

Implemented in SpineMesh, NeuroMesh, PsdMesh, CubeMesh, CylMesh, and EndoMesh.

Referenced by getDimensions().

+ Here is the caller graph for this function:

virtual unsigned int ChemCompt::innerGetNumEntries ( ) const
pure virtual

Implemented in NeuroMesh, CubeMesh, SpineMesh, PsdMesh, CylMesh, and EndoMesh.

Referenced by getNumEntries(), EndoMesh::getParentVoxel(), and EndoMesh::innerGetNumEntries().

+ Here is the caller graph for this function:

virtual vector< double > ChemCompt::innerGetStencilRate ( unsigned int  row) const
pure virtual

Virtual func for getting stencil rates for the derived classes.

Implemented in MeshCompt.

Referenced by getStencilRate().

+ Here is the caller graph for this function:

virtual void ChemCompt::innerHandleNodeInfo ( const Eref e,
unsigned int  numNodes,
unsigned int  numThreads 
)
pure virtual

Implemented in NeuroMesh, SpineMesh, PsdMesh, CylMesh, CubeMesh, and EndoMesh.

Referenced by handleNodeInfo().

+ Here is the caller graph for this function:

virtual void ChemCompt::innerResetStencil ( )
pure virtual

Implemented in MeshCompt.

Referenced by resetStencil().

+ Here is the caller graph for this function:

virtual void ChemCompt::innerSetNumEntries ( unsigned int  n)
pure virtual

Implemented in NeuroMesh, CubeMesh, SpineMesh, PsdMesh, CylMesh, and EndoMesh.

Referenced by setNumEntries().

+ Here is the caller graph for this function:

MeshEntry * ChemCompt::lookupEntry ( unsigned int  index)

Returns the matched lookupEntry

Definition at line 379 of file ChemCompt.cpp.

References entry_.

Referenced by PsdMesh::handlePsdList(), SpineMesh::handleSpineList(), and initCinfo().

380 {
381  return &entry_;
382 }
MeshEntry entry_
Definition: ChemCompt.h:333

+ Here is the caller graph for this function:

virtual void ChemCompt::matchMeshEntries ( const ChemCompt other,
vector< VoxelJunction > &  ret 
) const
pure virtual

Returns the meshIndices (NOT spatial indices) of all adjacent mesh entry pairs on ether side of the (self, other) junction. meshIndices are the indices that look up entries in the vector of pools. spatialIndices are (iz * ny + iy) * nx + ix, that is, a linear conversion of cartesian spatial indices. So, for two touching cubes, the return vector is the paired meshIndices on either side of the plane of contact. If one mesh has a finer mesh than the other, or if there are more than one contact points from self to other (for example, at a corner), then we just have multiple pairs using the same meshIndex of the repeated voxel.

Implemented in NeuroMesh, CubeMesh, SpineMesh, PsdMesh, CylMesh, and EndoMesh.

Referenced by buildJunction(), mapVoxelsBetweenMeshes(), and CubeMesh::matchCylMeshEntries().

+ Here is the caller graph for this function:

virtual double ChemCompt::nearest ( double  x,
double  y,
double  z,
unsigned int &  index 
) const
pure virtual

Returns distance and index of nearest mesh entry. Computes each mesh entry position as its geometric centre. If the current location is not inside a valid mesh entry, distance returned is negative.

Implemented in NeuroMesh, CubeMesh, SpineMesh, PsdMesh, CylMesh, and EndoMesh.

Referenced by EndoMesh::nearest().

+ Here is the caller graph for this function:

void ChemCompt::resetStencil ( )

Reset stencil m_ to coreStencil_. This is needed as a prelude to rebuilding the junctions using extendStencil.

Definition at line 233 of file ChemCompt.cpp.

References innerResetStencil().

Referenced by initCinfo().

234 {
235  this->innerResetStencil();
236 }
virtual void innerResetStencil()=0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int ChemCompt::setChildConcs ( const Eref e,
const vector< double > &  childConcs,
unsigned int  start 
) const

Recursively traverses all children, depth_first, restoring concentration terms as scooped up by getChildConcs. Does conc and concInit for pools, Kf and Kb for Reacs, and Km for enzymes. These are restored in order into the vector of childConcs. Does not traverse into children of other ChemCompts.

Definition at line 288 of file ChemCompt.cpp.

References Neutral::children(), and Field< A >::set().

Referenced by setEntireVolume(), and CylMesh::updateCoords().

290 {
291  vector< Id > kids;
292  Neutral::children( e, kids );
293  for ( vector < Id >::iterator i = kids.begin(); i != kids.end(); ++i )
294  {
295  if ( i->element()->cinfo()->isA( "PoolBase" ) ) {
296  Field< double >::set( *i, "conc", conc[ start++ ] );
297  Field< double >::set( *i, "concInit", conc[start++] );
298  } else if ( i->element()->cinfo()->isA( "ReacBase" ) ) {
299  Field< double >::set( *i, "Kf", conc[ start++ ] );
300  Field< double >::set( *i, "Kb", conc[ start++ ] );
301  } else if ( i->element()->cinfo()->isA( "EnzBase" ) ) {
302  Field< double >::set( *i, "Km", conc[ start++ ] );
303  } else if ( i->element()->cinfo()->isA( "ChemCompt" ) ) {
304  // Do NOT traverse into child ChemCompts, they look after their
305  // own volumes.
306  continue;
307  }
308  start = setChildConcs( i->eref(), conc, start );
309  }
310  return start;
311 }
static void children(const Eref &e, vector< Id > &ret)
Definition: Neutral.cpp:342
static bool set(const ObjId &dest, const string &field, A arg)
Definition: SetGet.h:245
unsigned int setChildConcs(const Eref &e, const vector< double > &childConcs, unsigned int start) const
Definition: ChemCompt.cpp:288

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ChemCompt::setEntireVolume ( const Eref e,
double  volume 
)

This is a little nasty. It calls buildDefaultMesh with the current numEntries. Should not be used if the mesh has been changed to something more interesting. Perhaps I need to do something like changeVolOfExistingMesh.

Definition at line 242 of file ChemCompt.cpp.

References Eref::dataIndex(), Eref::element(), getChildConcs(), Element::getMsgTargets(), setChildConcs(), vGetVoxelVolume(), voxelVolOut(), and vSetVolumeNotRates().

Referenced by initCinfo().

243 {
244  // If the reac system is not solved, then explicitly do scaling
245  vector< ObjId > tgtVec =
247  if ( tgtVec.size() == 0 ) {
248  vector< double > childConcs;
249  getChildConcs( e, childConcs );
250  if ( vSetVolumeNotRates( volume ) ) {
251  setChildConcs( e, childConcs, 0 );
252  }
253  } else {
254  vSetVolumeNotRates( volume );
255  voxelVolOut()->send( e, this->vGetVoxelVolume() );
256  }
257 }
vector< ObjId > getMsgTargets(DataId srcDataId, const SrcFinfo *finfo) const
Definition: Element.cpp:856
virtual bool vSetVolumeNotRates(double volume)=0
Virtual function for actually doing this.
unsigned int dataIndex() const
Definition: Eref.h:50
Element * element() const
Definition: Eref.h:42
static SrcFinfo1< vector< double > > * voxelVolOut()
Definition: ChemCompt.cpp:17
void getChildConcs(const Eref &e, vector< double > &childConcs) const
Definition: ChemCompt.cpp:264
virtual const vector< double > & vGetVoxelVolume() const =0
Virtual func so that derived classes can pass voxel volume back.
unsigned int setChildConcs(const Eref &e, const vector< double > &childConcs, unsigned int start) const
Definition: ChemCompt.cpp:288

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ChemCompt::setIsMembraneBound ( bool  v)

Definition at line 360 of file ChemCompt.cpp.

References isMembraneBound_.

Referenced by initCinfo().

361 {
362  isMembraneBound_ = v;
363 }
bool isMembraneBound_
Definition: ChemCompt.h:363

+ Here is the caller graph for this function:

void ChemCompt::setMeshEntryVolume ( unsigned int  fid,
double  volume 
)
virtual

Virtual function to assign volume of mesh Entry. Does nothing in most cases, but is operational in SpineMesh and PsdMesh.

Reimplemented in SpineMesh, and PsdMesh.

Definition at line 335 of file ChemCompt.cpp.

Referenced by setOneVoxelVolume().

336 {
337  cout << "Warning: ChemCompt::setMeshEntryVolume: Undefined except for PSD and spine mesh.\n";
338 }

+ Here is the caller graph for this function:

void ChemCompt::setMethod ( string  method)

Hint to system indicating method to be used on this compartment. Defaults to blank, which then leaves the decision to the calling function. Doesn't do anything unless the ChemCompt is parsed by the SimManager.

void ChemCompt::setNumEntries ( unsigned int  num)

Dummy function. The numEntries is only set by other functions that define compartment decomposition.

Definition at line 384 of file ChemCompt.cpp.

References innerSetNumEntries().

Referenced by initCinfo().

385 {
386  this->innerSetNumEntries( num );
387  // cout << "Warning: ChemCompt::setNumEntries: No effect. Use subclass-specific functions\nto build or resize mesh.\n";
388 }
virtual void innerSetNumEntries(unsigned int n)=0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ChemCompt::setOneVoxelVolume ( const Eref e,
unsigned int  voxel,
double  volume 
)

Definition at line 328 of file ChemCompt.cpp.

References setMeshEntryVolume().

Referenced by initCinfo().

330 {
331  this->setMeshEntryVolume( dataIndex, volume );
332 }
static char dataIndex[]
Definition: mfield.cpp:406
virtual void setMeshEntryVolume(unsigned int fid, double volume)
Definition: ChemCompt.cpp:335

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ChemCompt::setVolumeNotRates ( double  volume)

Returns true on success. Changes volume but does not notify any child objects. For some classes, this only works if the ChemCompt has just one voxel. It will return false if it can't handle it. This function will invalidate any concentration term in the model. If you don't know why you would want to do this, then you shouldn't use this function.",

Definition at line 370 of file ChemCompt.cpp.

References vSetVolumeNotRates().

Referenced by initCinfo().

371 {
372  vSetVolumeNotRates( volume ); // Pass on to derived classes.
373 }
virtual bool vSetVolumeNotRates(double volume)=0
Virtual function for actually doing this.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual double ChemCompt::vGetEntireVolume ( ) const
pure virtual

Implemented in NeuroMesh, CubeMesh, PsdMesh, SpineMesh, CylMesh, and EndoMesh.

Referenced by getEntireVolume().

+ Here is the caller graph for this function:

virtual const vector< double >& ChemCompt::vGetVoxelMidpoint ( ) const
pure virtual

Virtual func so that derived classes can return voxel midpoint.

Implemented in CubeMesh, SpineMesh, NeuroMesh, PsdMesh, CylMesh, and EndoMesh.

Referenced by getVoxelMidpoint(), and EndoMesh::vGetVoxelMidpoint().

+ Here is the caller graph for this function:

virtual const vector< double >& ChemCompt::vGetVoxelVolume ( ) const
pure virtual

Virtual func so that derived classes can pass voxel volume back.

Implemented in CubeMesh, SpineMesh, NeuroMesh, PsdMesh, CylMesh, and EndoMesh.

Referenced by EndoMesh::getVoxelArea(), EndoMesh::getVoxelLength(), getVoxelVolume(), EndoMesh::matchMeshEntries(), setEntireVolume(), and EndoMesh::vGetVoxelVolume().

+ Here is the caller graph for this function:

SrcFinfo1< vector< double > > * ChemCompt::voxelVolOut ( )
static

Definition at line 17 of file ChemCompt.cpp.

Referenced by initCinfo(), CubeMesh::setCoords(), and setEntireVolume().

17  {
18  static SrcFinfo1< vector< double > > voxelVolOut( "voxelVolOut",
19  "Sends updated voxel volume out to Ksolve, Gsolve, and Dsolve."
20  "Used to request a recalculation of rates and of initial numbers."
21  );
22  return &voxelVolOut;
23 }
static SrcFinfo1< vector< double > > * voxelVolOut()
Definition: ChemCompt.cpp:17

+ Here is the caller graph for this function:

virtual bool ChemCompt::vSetVolumeNotRates ( double  volume)
pure virtual

Virtual function for actually doing this.

Implemented in NeuroMesh, CubeMesh, PsdMesh, SpineMesh, CylMesh, and EndoMesh.

Referenced by setEntireVolume(), and setVolumeNotRates().

+ Here is the caller graph for this function:

Member Data Documentation

vector< Boundary > ChemCompt::boundaries_
private

Wrapper for self ptr.

The Boundaries are Element Fields. They appear as distinct Elements, though they are controlled by the ChemCompt. These are the interfaces between compartments, or just the boundaries of the current one. Each Boundary can be diffusive, reflective, or an interface where molecules in different compartments can talk to each other. All boundaries have a message to a Geometry. The Geometries may be shared, which is why the boundary isn't a Geometry itself. If it is an interface (diffusive or other) then the boundary also contains a message to the adjacent compartment.

Definition at line 347 of file ChemCompt.h.

MeshEntry ChemCompt::entry_
private

Definition at line 333 of file ChemCompt.h.

Referenced by lookupEntry().

bool ChemCompt::isMembraneBound_
private

Flag, set to True for meshes where each voxel is membrane bound. NeuroMesh and SpineMesh are false CubeMesh, CylMesh, and EndoMesh can be either. If they are membrane bound they can still interact via channels and cross-compartment reactions.

Definition at line 363 of file ChemCompt.h.

Referenced by getIsMembraneBound(), and setIsMembraneBound().

string ChemCompt::method_
private

Hint to system indicating method to be used on this compartment. Defaults to blank, which then leaves the decision to the calling function.

Definition at line 354 of file ChemCompt.h.


The documentation for this class was generated from the following files: