MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ChemCompt.h
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment.
4 ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS
5 ** It is made available under the terms of the
6 ** GNU Lesser General Public License version 2.1
7 ** See the file COPYING.LIB for the full notice.
8 **********************************************************************/
9 
10 #ifndef _CHEM_COMPT_H
11 #define _CHEM_COMPT_H
12 
13 #include "VoxelJunction.h"
14 
23 class ChemCompt
24 {
25  public:
26  ChemCompt();
27  virtual ~ChemCompt();
29  // Field assignment stuff
31 
36  double getEntireVolume( const Eref& e ) const;
37 
38  // Virtual function to get vol of entire compartment.
39  virtual double vGetEntireVolume() const = 0;
40 
47  void setEntireVolume( const Eref& e, double volume);
48 
52  double getOneVoxelVolume( const Eref& e, unsigned int voxel ) const;
53  void setOneVoxelVolume( const Eref& e, unsigned int voxel,
54  double volume );
55 
60  unsigned int getDimensions() const;
61  virtual unsigned int innerGetDimensions() const = 0;
62 
69  void setMethod( string method );
70  string getMethod() const;
71 
72  bool getIsMembraneBound() const;
73  void setIsMembraneBound( bool v );
74 
79  vector< double > getStencilRate( unsigned int row ) const;
80 
82  virtual vector< double > innerGetStencilRate( unsigned int row ) const = 0;
83 
89  vector< unsigned int > getStencilIndex( unsigned int row ) const;
90 
92  vector< double > getVoxelVolume() const;
94  virtual const vector< double >& vGetVoxelVolume() const = 0;
95 
97  vector< double > getVoxelMidpoint() const;
99  virtual const vector< double >& vGetVoxelMidpoint() const = 0;
100 
102  // Dest Finfo
104 
114  void setVolumeNotRates( double volume);
115 
117  virtual bool vSetVolumeNotRates( double volume) = 0;
118 
126  void buildDefaultMesh( const Eref& e,
127  double volume, unsigned int numEntries );
128  virtual void innerBuildDefaultMesh(
129  const Eref& e,
130  double volume, unsigned int numEntries ) = 0;
131 
132  /*
133  void handleRequestMeshStats( const Eref& e );
134  virtual void innerHandleRequestMeshStats(
135  const Eref& e,
136  const SrcFinfo2< unsigned int, vector< double > >*
137  meshStatsFinfo
138  ) = 0;
139  */
140 
141  void handleNodeInfo( const Eref& e,
142  unsigned int numNodes, unsigned int numThreads );
143  virtual void innerHandleNodeInfo(
144  const Eref& e,
145  unsigned int numNodes, unsigned int numThreads ) = 0;
146 
151  void resetStencil();
152  virtual void innerResetStencil() = 0;
153 
155  // FieldElementFinfo stuff for MeshEntry lookup
157 
160  unsigned int getNumEntries() const;
161  virtual unsigned int innerGetNumEntries() const = 0;
162 
167  void setNumEntries( unsigned int num );
168  virtual void innerSetNumEntries( unsigned int n ) = 0;
169 
173  MeshEntry* lookupEntry( unsigned int index );
174 
176  // Generic utility function
178  static double distance( double x, double y, double z );
179 
181  // Utility function for volume rescaling
183 
191  void getChildConcs( const Eref& e, vector< double >& childConcs )
192  const;
193 
202  unsigned int setChildConcs( const Eref& e,
203  const vector< double >& childConcs, unsigned int start ) const;
204 
206  // Lookup funcs for Boundary
208  /*
209  Boundary* lookupBoundary( unsigned int index );
210  void setNumBoundary( unsigned int num );
211  unsigned int getNumBoundary( ) const;
212  */
213 
219  void buildJunction( ChemCompt* other, vector< VoxelJunction >& ret );
220 
235  virtual void matchMeshEntries( const ChemCompt* other,
236  vector< VoxelJunction > & ret ) const = 0;
237 
238 
245  virtual double nearest( double x, double y, double z,
246  unsigned int& index ) const = 0;
247 
252  virtual void indexToSpace( unsigned int index,
253  double& x, double& y, double& z ) const = 0;
254 
256  void flipRet( vector< VoxelJunction >& ret ) const;
257 
259  // FieldElement assignment stuff for MeshEntries
262  virtual unsigned int getMeshType( unsigned int fid )
263  const = 0;
265  virtual unsigned int getMeshDimensions( unsigned int fid )
266  const = 0;
268  virtual double getMeshEntryVolume( unsigned int fid )
269  const = 0;
270  //
273  virtual void setMeshEntryVolume( unsigned int fid, double volume );
274 
276  virtual vector< double > getCoordinates( unsigned int fid )
277  const = 0;
279  virtual vector< unsigned int > getNeighbors( unsigned int fid )
280  const = 0;
282  virtual vector< double > getDiffusionArea( unsigned int fid )
283  const = 0;
285  virtual vector< double > getDiffusionScaling( unsigned int fid )
286  const = 0;
287 
289  virtual double extendedMeshEntryVolume( unsigned int fid )
290  const = 0;
291 
293  virtual void clearExtendedMeshEntryVolume() = 0;
294 
312  virtual unsigned int getStencilRow( unsigned int meshIndex,
313  const double** entry, const unsigned int** colIndex )
314  const = 0;
315 
316 
324  virtual void extendStencil(
325  const ChemCompt* other, const vector< VoxelJunction >& vj ) = 0;
326 
329 
330  static const Cinfo* initCinfo();
331 
332  private:
334 
347  vector< Boundary > boundaries_;
348 
354  string method_;
355 
364 };
365 
366 extern SrcFinfo5<
367  double,
368  vector< double >,
369  vector< unsigned int>,
370  vector< vector< unsigned int > >,
371  vector< vector< unsigned int > >
372  >* meshSplit();
373 
374 #endif // _CHEM_COMPT_H
void resetStencil()
Definition: ChemCompt.cpp:233
static const Cinfo * initCinfo()
Definition: ChemCompt.cpp:25
string getMethod() const
void setIsMembraneBound(bool v)
Definition: ChemCompt.cpp:360
vector< double > getVoxelMidpoint() const
Returns vector of all voxel midpoints in compartment.
Definition: ChemCompt.cpp:318
virtual double nearest(double x, double y, double z, unsigned int &index) const =0
virtual bool vSetVolumeNotRates(double volume)=0
Virtual function for actually doing this.
virtual double extendedMeshEntryVolume(unsigned int fid) const =0
Volume of mesh Entry including abutting diff-coupled voxels.
virtual ~ChemCompt()
Definition: ChemCompt.cpp:206
virtual void innerHandleNodeInfo(const Eref &e, unsigned int numNodes, unsigned int numThreads)=0
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
void buildJunction(ChemCompt *other, vector< VoxelJunction > &ret)
Definition: ChemCompt.cpp:400
const int numEntries
Definition: proc.cpp:60
virtual unsigned int getMeshDimensions(unsigned int fid) const =0
Virtual function to return dimensions of specified entry.
virtual vector< double > getCoordinates(unsigned int fid) const =0
Virtual function to return coords of mesh Entry.
bool isMembraneBound_
Definition: ChemCompt.h:363
virtual void innerResetStencil()=0
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
virtual vector< double > innerGetStencilRate(unsigned int row) const =0
Virtual func for getting stencil rates for the derived classes.
virtual vector< unsigned int > getNeighbors(unsigned int fid) const =0
Virtual function to return info on Entries connected to this one.
virtual unsigned int innerGetDimensions() const =0
virtual double vGetEntireVolume() const =0
static double distance(double x, double y, double z)
Definition: ChemCompt.cpp:422
string method_
Definition: ChemCompt.h:354
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.
virtual unsigned int innerGetNumEntries() const =0
virtual vector< double > getDiffusionScaling(unsigned int fid) const =0
Virtual function to return scale factor for diffusion. 1 here.
virtual vector< double > getDiffusionArea(unsigned int fid) const =0
Virtual function to return diffusion X-section area per neighbor.
virtual void indexToSpace(unsigned int index, double &x, double &y, double &z) const =0
bool getIsMembraneBound() const
Definition: ChemCompt.cpp:355
void buildDefaultMesh(const Eref &e, double volume, unsigned int numEntries)
Definition: ChemCompt.cpp:220
void setMethod(string method)
Definition: Eref.h:26
virtual void extendStencil(const ChemCompt *other, const vector< VoxelJunction > &vj)=0
unsigned int setChildConcs(const Eref &e, const vector< double > &childConcs, unsigned int start) const
Definition: ChemCompt.cpp:288
void setNumEntries(unsigned int num)
Definition: ChemCompt.cpp:384
virtual void clearExtendedMeshEntryVolume()=0
clear out extended mesh entries for rebuilding.
static unsigned int numNodes
virtual void setMeshEntryVolume(unsigned int fid, double volume)
Definition: ChemCompt.cpp:335
virtual unsigned int getStencilRow(unsigned int meshIndex, const double **entry, const unsigned int **colIndex) const =0
SrcFinfo5< double, vector< double >, vector< unsigned int >, vector< vector< unsigned int > >, vector< vector< unsigned int > > > * meshSplit()
virtual const vector< double > & vGetVoxelMidpoint() const =0
Virtual func so that derived classes can return voxel midpoint.
vector< Boundary > boundaries_
Wrapper for self ptr.
Definition: ChemCompt.h:347
virtual void matchMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const =0
MeshEntry entry_
Definition: ChemCompt.h:333
virtual unsigned int getMeshType(unsigned int fid) const =0
Virtual function to return MeshType of specified entry.
void handleNodeInfo(const Eref &e, unsigned int numNodes, unsigned int numThreads)
Definition: ChemCompt.cpp:226
virtual double getMeshEntryVolume(unsigned int fid) const =0
Virtual function to return volume of mesh Entry.
void flipRet(vector< VoxelJunction > &ret) const
Utility function for swapping first and second in VoxelJunctions.
Definition: ChemCompt.cpp:406
virtual void innerSetNumEntries(unsigned int n)=0
Definition: Cinfo.h:18
virtual void innerBuildDefaultMesh(const Eref &e, double volume, unsigned int numEntries)=0