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

#include <MeshCompt.h>

+ Inheritance diagram for MeshCompt:
+ Collaboration diagram for MeshCompt:

Public Member Functions

void addRow (unsigned int index, const vector< double > &entry, const vector< unsigned int > &colIndex)
 
void clearExtendedMeshEntryVolume ()
 Inherited virtual function to clear the vector of MeshEntryVolume. More...
 
double extendedMeshEntryVolume (unsigned int fid) const
 Virtual function to return volume of mesh Entry, including. More...
 
void extendStencil (const ChemCompt *other, const vector< VoxelJunction > &vj)
 Add boundary voxels to stencil for cross-solver junctions. More...
 
vector< unsigned int > getNeighbors (unsigned int fid) const
 Looks up stencil to return vector of indices of coupled voxels. More...
 
virtual vector< unsigned int > getParentVoxel () const =0
 
const SparseMatrix< double > & getStencil () const
 Returns entire sparse matrix of mesh. Used by diffusion solver. More...
 
unsigned int getStencilRow (unsigned int meshIndex, const double **entry, const unsigned int **colIndex) const
 
virtual const vector< double > & getVoxelArea () const =0
 
virtual const vector< double > & getVoxelLength () const =0
 
vector< double > innerGetStencilRate (unsigned int row) const
 
void innerResetStencil ()
 virtual func implemented here. More...
 
 MeshCompt ()
 
void setStencilSize (unsigned int numRows, unsigned int numCols)
 
 ~MeshCompt ()
 
- Public Member Functions inherited from ChemCompt
void buildDefaultMesh (const Eref &e, double volume, unsigned int numEntries)
 
void buildJunction (ChemCompt *other, vector< VoxelJunction > &ret)
 
 ChemCompt ()
 
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
 
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
 
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 void innerHandleNodeInfo (const Eref &e, unsigned int numNodes, unsigned int numThreads)=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 ()
 

Private Attributes

SparseMatrix< double > coreStencil_
 Handles the core stencil for own vol. More...
 
vector< double > extendedMeshEntryVolume_
 
SparseMatrix< double > m_
 Handles stencil for core + abutting voxels. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ChemCompt
static double distance (double x, double y, double z)
 
static const CinfoinitCinfo ()
 
static SrcFinfo1< vector
< double > > * 
voxelVolOut ()
 

Detailed Description

The MeshCompt represents the base class for all compartments which are set up as a meshes. These include CubeMesh, CylMesh and NeuroMesh. The MeshCompt handles the stencil that is the core of all the meshes. The stencil specifies which compartments diffuse into each other, and by how much.

Definition at line 20 of file MeshCompt.h.

Constructor & Destructor Documentation

MeshCompt::MeshCompt ( )

Definition at line 24 of file MeshCompt.cpp.

25 {
26  ;
27 }
MeshCompt::~MeshCompt ( )

Definition at line 29 of file MeshCompt.cpp.

30 {
31  ;
32 }

Member Function Documentation

void MeshCompt::addRow ( unsigned int  index,
const vector< double > &  entry,
const vector< unsigned int > &  colIndex 
)

Definition at line 98 of file MeshCompt.cpp.

References SparseMatrix< T >::addRow(), and coreStencil_.

Referenced by CylMesh::buildStencil(), NeuroMesh::buildStencil(), and CubeMesh::buildStencil().

102 {
103  coreStencil_.addRow( index, entry, colIndex );
104 }
void addRow(unsigned int rowNum, const vector< T > &row)
Definition: SparseMatrix.h:387
SparseMatrix< double > coreStencil_
Handles the core stencil for own vol.
Definition: MeshCompt.h:74

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MeshCompt::clearExtendedMeshEntryVolume ( )
virtual

Inherited virtual function to clear the vector of MeshEntryVolume.

Implements ChemCompt.

Definition at line 43 of file MeshCompt.cpp.

References extendedMeshEntryVolume_.

44 {
46 }
vector< double > extendedMeshEntryVolume_
Definition: MeshCompt.h:85
double MeshCompt::extendedMeshEntryVolume ( unsigned int  fid) const
virtual

Virtual function to return volume of mesh Entry, including.

Utility function to return volume of any voxel including those diffusively coupled and aubtting the present volume.

Implements ChemCompt.

Reimplemented in NeuroMesh, SpineMesh, and PsdMesh.

Definition at line 36 of file MeshCompt.cpp.

References extendedMeshEntryVolume_.

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

37 {
38  assert( index < extendedMeshEntryVolume_.size() );
39  return extendedMeshEntryVolume_[ index ];
40 }
vector< double > extendedMeshEntryVolume_
Definition: MeshCompt.h:85

+ Here is the caller graph for this function:

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

Add boundary voxels to stencil for cross-solver junctions.

extendStencil adds voxels to the current stencil m_, to build up a monolithic stencil that also handles the entries just past all the boundaries. This function may be called many times to deal with the addition of multiple junctions. Before the first of these calls, the m_ matrix should be set to the coreStencil_.

Organizes vj by voxel, that is, by row.

Implements ChemCompt.

Definition at line 121 of file MeshCompt.cpp.

References SparseMatrix< T >::addRow(), SparseMatrix< T >::clear(), coreStencil_, EMPTY, extendedMeshEntryVolume_, ChemCompt::getMeshEntryVolume(), SparseMatrix< T >::getRow(), m_, SparseMatrix< T >::nRows(), and SparseMatrix< T >::setSize().

Referenced by testCubeMeshExtendStencil().

123 {
124  // Maps from remote meshIndex (in vj) to local index of proxy voxel.
125  map< unsigned int, unsigned int > meshMap;
126  map< unsigned int, unsigned int >::iterator mmi;
127 
128  // Maps from local index of proxy voxel back to remote meshIndex.
129  vector< unsigned int > meshBackMap;
130 
131 
132  unsigned int coreSize = coreStencil_.nRows();
133  unsigned int oldSize = m_.nRows();
134  unsigned int newSize = oldSize;
135 
137  vector< vector< VoxelJunction > > vvj( coreSize );
138 
139  for ( vector< VoxelJunction >::const_iterator
140  i = vj.begin(); i != vj.end(); ++i ) {
141  mmi = meshMap.find( i->second );
142  if ( mmi == meshMap.end() ) {
143  assert( i->first < coreSize );
144  meshBackMap.push_back( i->second );
145  meshMap[i->second] = newSize++;
146  vvj[i->first].push_back( *i );
147  }
148  }
149  vector< vector< VoxelJunction > > vvjCol( newSize );
150  SparseMatrix< double > oldM = m_;
151  m_.clear();
152  m_.setSize( newSize, newSize );
153  for ( unsigned int i = 0; i < newSize; ++i ) {
154  vector< VoxelJunction > temp;
155  if ( i < oldSize ) { // Copy over old matrix.
156  const double* entry;
157  const unsigned int* colIndex;
158  unsigned int num = oldM.getRow( i, &entry, &colIndex );
159  temp.resize( num );
160  for ( unsigned int j = 0; j < num; ++j ) {
161  temp[j].first = colIndex[j];
162  temp[j].diffScale = entry[j];
163  }
164  }
165  if ( i < coreSize ) { // Set up diffusion into proxy voxels.
166  for ( vector< VoxelJunction >::const_iterator
167  j = vvj[i].begin(); j != vvj[i].end(); ++j )
168  {
169  unsigned int row = j->first;
170  assert( row == i );
171  unsigned int col = meshMap[j->second];
172  assert( col >= oldSize );
173  temp.push_back(
174  VoxelJunction( col, EMPTY, j->diffScale ) );
175  vvjCol[col].push_back(
176  VoxelJunction( row, EMPTY, j->diffScale ) );
177  }
178  }
179  if ( i >= oldSize ) { // Set up diffusion from proxy to old voxels
180  for ( vector< VoxelJunction >::const_iterator
181  j = vvjCol[i].begin(); j != vvjCol[i].end(); ++j )
182  {
183  temp.push_back( *j );
184  }
185  }
186  // Now we've filled in all the VoxelJunctions for the new row.
187  sort( temp.begin(), temp.end() );
188  vector< double > e( temp.size() );
189  vector< unsigned int > c( temp.size() );
190  for ( unsigned int j = 0; j < temp.size(); ++j ) {
191  e[j] = temp[j].diffScale;
192  c[j] = temp[j].first;
193  }
194  m_.addRow( i, e, c );
195  }
196 
197  // Fill in the volumes of the external mesh entries
198  for ( vector< unsigned int>::const_iterator
199  i = meshBackMap.begin(); i != meshBackMap.end(); ++i ) {
200  extendedMeshEntryVolume_.push_back( other->getMeshEntryVolume( *i ) );
201  }
202 }
SparseMatrix< double > m_
Handles stencil for core + abutting voxels.
Definition: MeshCompt.h:77
vector< double > extendedMeshEntryVolume_
Definition: MeshCompt.h:85
unsigned int getRow(unsigned int row, const T **entry, const unsigned int **colIndex) const
Definition: SparseMatrix.h:288
unsigned int nRows() const
Definition: SparseMatrix.h:87
void addRow(unsigned int rowNum, const vector< T > &row)
Definition: SparseMatrix.h:387
void setSize(unsigned int nrows, unsigned int ncolumns)
Definition: SparseMatrix.h:126
static const unsigned int EMPTY
Definition: MeshCompt.cpp:19
virtual double getMeshEntryVolume(unsigned int fid) const =0
Virtual function to return volume of mesh Entry.
SparseMatrix< double > coreStencil_
Handles the core stencil for own vol.
Definition: MeshCompt.h:74

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< unsigned int > MeshCompt::getNeighbors ( unsigned int  fid) const
virtual

Looks up stencil to return vector of indices of coupled voxels.

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

Implements ChemCompt.

Definition at line 69 of file MeshCompt.cpp.

References SparseMatrix< T >::getRow(), and m_.

Referenced by NeuroMesh::getDiffusionArea(), and testCubeMesh().

70 {
71  const double* entry;
72  const unsigned int *colIndex;
73 
74  unsigned int n = m_.getRow( row, &entry, &colIndex );
75 
76  vector< unsigned int > ret;
77  ret.insert( ret.end(), colIndex, colIndex + n );
78 
79  return ret;
80 }
SparseMatrix< double > m_
Handles stencil for core + abutting voxels.
Definition: MeshCompt.h:77
unsigned int getRow(unsigned int row, const T **entry, const unsigned int **colIndex) const
Definition: SparseMatrix.h:288

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual vector< unsigned int > MeshCompt::getParentVoxel ( ) const
pure virtual

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

Referenced by Dsolve::build(), and EndoMesh::getParentVoxel().

+ Here is the caller graph for this function:

const SparseMatrix< double > & MeshCompt::getStencil ( ) const

Returns entire sparse matrix of mesh. Used by diffusion solver.

Definition at line 60 of file MeshCompt.cpp.

References coreStencil_.

61 {
62  return coreStencil_;
63 }
SparseMatrix< double > coreStencil_
Handles the core stencil for own vol.
Definition: MeshCompt.h:74
unsigned int MeshCompt::getStencilRow ( unsigned int  meshIndex,
const double **  entry,
const unsigned int **  colIndex 
) const
virtual

Derived function to return SparseMatrix-style row info for specified mesh entry.

Implements ChemCompt.

Definition at line 54 of file MeshCompt.cpp.

References SparseMatrix< T >::getRow(), and m_.

Referenced by testCubeMeshExtendStencil().

56 {
57  return m_.getRow( meshIndex, entry, colIndex );
58 }
SparseMatrix< double > m_
Handles stencil for core + abutting voxels.
Definition: MeshCompt.h:77
unsigned int getRow(unsigned int row, const T **entry, const unsigned int **colIndex) const
Definition: SparseMatrix.h:288

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual const vector< double >& MeshCompt::getVoxelArea ( ) const
pure virtual

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

Referenced by Dsolve::build().

+ Here is the caller graph for this function:

virtual const vector< double >& MeshCompt::getVoxelLength ( ) const
pure virtual

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

Referenced by Dsolve::build(), and EndoMesh::matchMeshEntries().

+ Here is the caller graph for this function:

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

Looks up stencil to return vector of diffusion coupling to neighbor voxels.

Implements ChemCompt.

Definition at line 85 of file MeshCompt.cpp.

References SparseMatrix< T >::getRow(), and m_.

86 {
87  const double* entry;
88  const unsigned int *colIndex;
89 
90  unsigned int n = m_.getRow( row, &entry, &colIndex );
91 
92  vector< double > ret;
93  ret.insert( ret.end(), entry, entry + n );
94 
95  return ret;
96 }
SparseMatrix< double > m_
Handles stencil for core + abutting voxels.
Definition: MeshCompt.h:77
unsigned int getRow(unsigned int row, const T **entry, const unsigned int **colIndex) const
Definition: SparseMatrix.h:288

+ Here is the call graph for this function:

void MeshCompt::innerResetStencil ( )
virtual

virtual func implemented here.

Implements ChemCompt.

Definition at line 49 of file MeshCompt.cpp.

References coreStencil_, and m_.

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

50 {
51  m_ = coreStencil_;
52 }
SparseMatrix< double > m_
Handles stencil for core + abutting voxels.
Definition: MeshCompt.h:77
SparseMatrix< double > coreStencil_
Handles the core stencil for own vol.
Definition: MeshCompt.h:74

+ Here is the caller graph for this function:

void MeshCompt::setStencilSize ( unsigned int  numRows,
unsigned int  numCols 
)

Definition at line 106 of file MeshCompt.cpp.

References SparseMatrix< T >::clear(), coreStencil_, and SparseMatrix< T >::setSize().

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

107 {
109  coreStencil_.setSize( numRows, numCols );
110 }
void setSize(unsigned int nrows, unsigned int ncolumns)
Definition: SparseMatrix.h:126
SparseMatrix< double > coreStencil_
Handles the core stencil for own vol.
Definition: MeshCompt.h:74

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

SparseMatrix< double > MeshCompt::coreStencil_
private

Handles the core stencil for own vol.

Definition at line 74 of file MeshCompt.h.

Referenced by addRow(), extendStencil(), getStencil(), innerResetStencil(), and setStencilSize().

vector< double > MeshCompt::extendedMeshEntryVolume_
private

vector of meshEntryVolumes for abutting surfaces, needed to compute diffusion rates across junctions. Indexed from zero.

Definition at line 85 of file MeshCompt.h.

Referenced by clearExtendedMeshEntryVolume(), extendedMeshEntryVolume(), and extendStencil().

SparseMatrix< double > MeshCompt::m_
private

Handles stencil for core + abutting voxels.

Definition at line 77 of file MeshCompt.h.

Referenced by extendStencil(), getNeighbors(), getStencilRow(), innerGetStencilRate(), and innerResetStencil().


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