29 typedef pair< unsigned int, unsigned int >
PII;
56 "X coord of other end",
62 "Y coord of other end",
68 "Z coord of other end",
94 "Number of subdivisions in mesh in X",
100 "Number of subdivisions in mesh in Y",
106 "Number of subdivisions in mesh in Z",
113 "Flag. True when the mesh should be toroidal, that is,"
114 "when going beyond the right face brings us around to the"
115 "left-most mesh entry, and so on. If we have nx, ny, nz"
116 "entries, this rule means that the coordinate (x, ny, z)"
117 "will map onto (x, 0, z). Similarly,"
118 "(-1, y, z) -> (nx-1, y, z)"
125 "preserveNumEntries",
126 "Flag. When it is true, the numbers nx, ny, nz remain"
127 "unchanged when x0, x1, y0, y1, z0, z1 are altered. Thus"
128 "dx, dy, dz would change instead. When it is false, then"
129 "dx, dy, dz remain the same and nx, ny, nz are altered."
137 "Flag. When it is true, the mesh matches up sequential "
138 "mesh entries for diffusion and chmestry. This is regardless "
139 "of spatial location, and is guaranteed to set up at least "
140 "the home reaction system"
148 "Set all the coords of the cuboid at once. Order is:"
149 "x0 y0 z0 x1 y1 z1 dx dy dz"
150 "When this is done, it recalculates the numEntries since "
151 "dx, dy and dz are given explicitly."
152 "As a special hack, you can leave out dx, dy and dz and use "
153 "a vector of size 6. In this case the operation assumes that "
154 "nx, ny and nz are to be preserved and dx, dy and dz will "
162 "Array in which each mesh entry stores spatial (cubic) index",
169 "Array in which each space index (obtained by linearizing "
170 "the xyz coords) specifies which meshIndex is present."
171 "In many cases the index will store the EMPTY flag if there is"
172 "no mesh entry at that spatial location",
179 "Array specifying surface of arbitrary volume within the "
180 "CubeMesh. All entries must fall within the cuboid. "
181 "Each entry of the array is a spatial index obtained by "
182 "linearizing the ix, iy, iz coordinates within the cuboid. "
183 "So, each entry == ( iz * ny + iy ) * nx + ix"
184 "Note that the voxels listed on the surface are WITHIN the "
185 "volume of the CubeMesh object",
195 "Build cubical mesh for geom surface specified by Id, using"
196 "specified x y z coords as an inside point in mesh",
205 static Finfo* cubeMeshFinfos[] = {
227 static string doc[] =
230 "Author",
"Upi Bhalla",
231 "Description",
"Chemical compartment with cuboid grid. "
232 "Defaults to a cube of size 10 microns, with mesh size "
233 "also 10 microns, so that there is just 1 cubic voxel. "
234 "These defaults are similar to that of a typical cell. "
235 "Can be configured to have different x,y,z dimensions and "
236 "also different dx,dy,dz voxel sizes. ",
243 sizeof( cubeMeshFinfos ) /
sizeof (
Finfo* ),
246 sizeof(doc)/
sizeof(
string)
264 preserveNumEntries_( 1 ),
265 alwaysDiffuse_( false ),
307 for (
unsigned int j = 0; j <
ny_; ++j )
309 for (
unsigned int j = size - ny_; j < size; ++j )
311 for (
unsigned int i = 1; i < nz_ - 1; ++i )
313 for (
unsigned int i = 1; i < nz_ - 1; ++i )
314 surface_.push_back( ny_ - 1 + i * ny_ );
315 }
else if (
ny_ == 1 ) {
316 for (
unsigned int k = 0; k <
nx_; ++k )
318 for (
unsigned int k = size - nx_; k < size; ++k )
320 for (
unsigned int i = 1; i < nz_ - 1; ++i )
322 for (
unsigned int i = 1; i < nz_ - 1; ++i )
323 surface_.push_back( nx_ - 1 + i * nx_ );
324 }
else if ( nz_ == 1 ) {
325 for (
unsigned int k = 0; k <
nx_; ++k )
327 for (
unsigned int k = size - nx_; k < size; ++k )
329 for (
unsigned int j = 1; j <
ny_ - 1; ++j )
331 for (
unsigned int j = 1; j < ny_ - 1; ++j )
332 surface_.push_back( j * nx_ + nx_ - 1 );
344 for (
unsigned int j = 0; j <
ny_; ++j )
345 for (
unsigned int k = 0; k <
nx_; ++k )
348 unsigned int offset = size - nx_ *
ny_;
349 for (
unsigned int j = 0; j <
ny_; ++j )
350 for (
unsigned int k = 0; k <
nx_; ++k )
351 surface_.push_back( offset + j * nx_ + k );
354 for (
unsigned int i = 0; i <
nz_; ++i )
355 for (
unsigned int k = 0; k <
nx_; ++k )
356 surface_.push_back( i * nx_ * ny_ + k );
358 offset = nx_ * ( ny_ - 1 );
359 for (
unsigned int i = 0; i <
nz_; ++i )
360 for (
unsigned int k = 0; k <
nx_; ++k )
361 surface_.push_back( offset + i * nx_ * ny_ + k );
364 for (
unsigned int i = 0; i <
nz_; ++i )
365 for (
unsigned int j = 0; j <
ny_; ++j )
366 surface_.push_back( ( i * ny_ + j ) * nx_ );
369 for (
unsigned int i = 0; i <
nz_; ++i )
370 for (
unsigned int j = 0; j <
ny_; ++j )
371 surface_.push_back( offset + ( i * ny_ + j ) * nx_ );
408 for (
unsigned int i = 0; i < size; ++i ) {
616 if ( v.size() >= 9 ) {
638 vector< double > ret( 9 );
711 approxN = pow( approxN, 1.0 / 3.0 );
712 unsigned int smaller = floor( approxN );
713 unsigned int bigger = ceil( approxN );
714 unsigned int numSide;
715 if ( smaller != bigger ) {
718 unsigned int smallerVol = smaller * smaller * smaller;
719 unsigned int biggerVol = bigger * bigger * bigger;
720 if ( numEntries - smallerVol < biggerVol - numEntries )
725 double side = pow( volume, 1.0 / 3.0 );
726 vector< double > coords( 9, side );
727 coords[0] = coords[1] = coords[2] = 0;
728 coords[6] = coords[7] = coords[8] = side / numSide;
735 const SrcFinfo2<
unsigned int, vector< double > >* meshStatsFinfo )
737 vector< double > meshVolumes( 1,
dx_ *
dy_ *
dz_ );
738 meshStatsFinfo->send( e,
nx_ *
ny_ *
nz_, meshVolumes);
745 unsigned int numNodes,
unsigned int numThreads )
793 if ( fid >=
m2s_.size() ) {
803 assert( fid <
m2s_.size() );
804 unsigned int spaceIndex =
m2s_[fid];
806 unsigned int ix = spaceIndex %
nx_;
807 unsigned int iy = (spaceIndex /
nx_) %
ny_;
808 unsigned int iz = (spaceIndex / (
nx_ *
ny_ )) %
nz_;
810 vector< double > ret( 6 );
815 ret[3] =
x0_ + ix * dx_ +
dx_;
816 ret[4] =
y0_ + iy * dy_ +
dx_;
817 ret[5] =
z0_ + iz * dz_ +
dx_;
823 int dx,
int dy,
int dz )
const
825 int ix = spaceIndex %
nx_;
826 int iy = (spaceIndex /
nx_) %
ny_;
827 int iz = (spaceIndex / (
nx_ *
ny_ )) %
nz_;
833 if ( ix < 0 || ix >= static_cast< int >(
nx_ ) )
835 if ( iy < 0 || iy >= static_cast< int >(
ny_ ) )
837 if ( iz < 0 || iz >= static_cast< int >(
nz_ ) )
840 unsigned int nIndex = ( ( iz *
ny_ ) + iy ) *
nx_ + ix;
848 assert( fid <
m2s_.size() );
850 vector< double > ret;
851 unsigned int spaceIndex =
m2s_[fid];
853 unsigned int nIndex =
neighbor( spaceIndex, 0, 0, 1 );
854 if ( nIndex !=
EMPTY )
855 ret.push_back(
dx_ *
dy_ );
857 nIndex =
neighbor( spaceIndex, 0, 0, -1 );
858 if ( nIndex !=
EMPTY )
859 ret.push_back(
dx_ * dy_ );
861 nIndex =
neighbor( spaceIndex, 0, 1, 0 );
862 if ( nIndex !=
EMPTY )
863 ret.push_back(
dz_ *
dx_ );
865 nIndex =
neighbor( spaceIndex, 0, -1, 0 );
866 if ( nIndex !=
EMPTY )
867 ret.push_back(
dz_ * dx_ );
869 nIndex =
neighbor( spaceIndex, 1, 0, 0 );
870 if ( nIndex !=
EMPTY )
871 ret.push_back( dy_ *
dz_ );
873 nIndex =
neighbor( spaceIndex, -1, 0, 0 );
874 if ( nIndex !=
EMPTY )
875 ret.push_back( dy_ * dz_ );
883 return vector< double >( 6, 1.0 );
901 cout <<
"Warning: CubeMesh::innerSetNumEntries is readonly.\n";
908 vector< unsigned int > ret( numEntries );
909 if ( numEntries > 0 )
910 ret[0] =
static_cast< unsigned int >( -1 );
911 for (
unsigned int i = 1; i <
numEntries; ++i )
919 static vector< double > vol;
927 static vector< double > midpoint;
928 midpoint.resize(
m2s_.size() * 3 );
929 for (
unsigned int i = 0; i <
m2s_.size(); ++i )
931 for (
unsigned int i = 0; i <
m2s_.size(); ++i ) {
932 unsigned int k = i +
m2s_.size();
935 for (
unsigned int i = 0; i <
m2s_.size(); ++i ) {
936 unsigned int k = i +
m2s_.size() * 2;
937 midpoint[k] =
z0_ + ( 0.5 + (
m2s_[i] / ( nx_ *
ny_ ) ) ) *
dz_;
944 static vector< double > area;
947 else if (
nx_ *
nz_ == 1 )
949 else if (
ny_ *
nz_ == 1 )
950 area.resize(
nx_, dy_ * dz_ );
952 area.resize(
nx_, dy_ * dz_ );
953 assert( area.size() ==
nx_ *
ny_ *
nz_ );
959 static vector< double > length;
973 double linscale = pow( vol / oldvol , 1.0 / 3.0 );
988 return ( x >=
x0_ && x < x1_ && y >=
y0_ && y <
y1_ &&
994 double cx = (
x0_ +
x1_ ) / 2.0;
995 double cy = (
y0_ +
y1_ ) / 2.0;
996 double cz = (
z0_ +
z1_ ) / 2.0;
998 double rx = ( x - cx ) / fabs(
x1_ -
x0_ ) / 2.0;
999 double ry = ( y - cy ) / fabs(
y1_ -
y0_ ) / 2.0;
1000 double rz = ( z - cz ) / fabs(
z1_ -
z0_ ) / 2.0;
1002 return ( ( rx * rx + ry * ry + rz * rz ) < 1.0 );
1007 static const unsigned int flag =
EMPTY;
1008 unsigned int num = 0;
1012 for(
unsigned int k = 0; k <
nz_; ++k ) {
1013 double z = k *
dz_ +
z0_;
1014 for(
unsigned int j = 0; j <
ny_; ++j ) {
1015 double y = j *
dy_ +
y0_;
1016 for(
unsigned int i = 0; i <
nx_; ++i ) {
1017 double x = i *
dx_ +
x0_;
1020 m2s_.push_back( q );
1029 assert(
m2s_.size() == num );
1037 for (
unsigned int i = 0; i <
s2m_.size(); ++i ) {
1039 m2s_.push_back( i );
1040 assert(
m2s_.size() ==
s2m_[i] + 1 );
1050 for (
unsigned int i = 0; i <
m2s_.size(); ++i ) {
1062 static const unsigned int flag =
EMPTY;
1066 unsigned int num =
m2s_.size();
1068 for (
unsigned int i = 0; i < num; ++i ) {
1069 unsigned int q =
m2s_[i];
1070 unsigned int ix = q %
nx_;
1071 unsigned int iy = ( q /
nx_ ) %
ny_;
1072 unsigned int iz = ( q / (
nx_ *
ny_ ) ) %
nz_;
1073 vector< double > entry;
1074 vector< unsigned int > colIndex;
1077 if ( ix > 0 &&
s2m_[q-1] != flag ) {
1080 if ( ( ix <
nx_ - 1 ) &&
s2m_[q+1] != flag ) {
1083 if ( iy > 0 &&
s2m_[ q-
nx_ ] != flag ) {
1087 if ( iy <
ny_ - 1 &&
s2m_[ q+
nx_ ] != flag ) {
1088 assert( q+
nx_ <
s2m_.size() );
1091 if ( iz > 0 &&
s2m_[ q -
nx_*
ny_ ] != flag ) {
1092 assert( q >=
nx_ *
ny_ );
1096 assert( q+
nx_ <
s2m_.size() );
1099 sort( e.begin(), e.end() );
1100 for ( vector< Ecol >::iterator j = e.begin(); j != e.end(); ++j ) {
1101 entry.push_back( j->e_ );
1102 colIndex.push_back( j->col_ );
1104 addRow( i, entry, colIndex );
1119 vector< VoxelJunction >& ret )
const
1145 cout <<
"Warning:CubeMesh::matchMeshEntries: cannot yet handle Neuro or Cyl meshes.\n";
1150 return ( (
nx_ > 1 ) + (
ny_ > 1 ) + (
nz_ > 1 ) );
1155 double& x,
double& y,
double& z )
const
1160 unsigned int ix = index %
nx_;
1162 unsigned int iy = index %
ny_;
1164 unsigned int iz = index %
nz_;
1173 if ( x >
x0_ && x < x1_ && y >
y0_ && y < y1_ && z >
z0_ && z <
z1_ )
1175 unsigned int ix = ( x -
x0_ ) /
dx_;
1176 unsigned int iy = ( y -
y0_ ) /
dy_;
1177 unsigned int iz = ( z -
z0_ ) /
dz_;
1178 unsigned int index = ( iz *
ny_ + iy ) *
nx_ + ix;
1179 unsigned int innerIndex =
s2m_[ index ];
1186 unsigned int& index )
const
1188 if ( x >
x0_ && x < x1_ && y >
y0_ && y < y1_ && z >
z0_ && z <
z1_ )
1190 unsigned int ix = ( x -
x0_ ) /
dx_;
1191 unsigned int iy = ( y -
y0_ ) /
dy_;
1192 unsigned int iz = ( z -
z0_ ) /
dz_;
1193 index = ( iz *
ny_ + iy ) *
nx_ + ix;
1194 unsigned int innerIndex =
s2m_[ index ];
1195 if ( innerIndex !=
EMPTY ) {
1200 return distance( x - tx, y - ty, z - tz );
1203 for ( vector< unsigned int >::const_iterator
1208 double r =
distance( tx - x, ty - y, tz - z );
1229 if (
dx_ >= other->
dx_ &&
1234 if ( dx_ <= other->
dx_ &&
1235 dy_ <= other->
dy_ &&
1240 cout <<
"Warning: CubeMesh::compareMeshSpacing: inconsistent spacing\n";
1245 double& xmin,
double &xmax,
1246 double& ymin,
double &ymax,
1247 double& zmin,
double &zmax )
1250 const double meshSlop = 0.2;
1252 xmax = ( x1_ < other->
x1_ ) ? x1_ : other->
x1_;
1254 ymax = ( y1_ < other->
y1_ ) ? y1_ : other->
y1_;
1256 zmax = ( z1_ < other->
z1_ ) ? z1_ : other->
z1_;
1258 double temp = ( xmin -
x0_) /
dx_;
1259 if ( temp - floor( temp ) > meshSlop )
1260 xmin = floor( temp ) *
dx_;
1261 temp = ( ymin -
y0_) /
dy_;
1262 if ( temp - floor( temp ) > meshSlop )
1263 ymin = floor( temp ) *
dy_;
1264 temp = ( zmin -
z0_) /
dz_;
1265 if ( temp - floor( temp ) > meshSlop )
1266 zmin = floor( temp ) *
dz_;
1294 void setAbut(
PII& voxel,
unsigned int meshIndex,
unsigned int axis )
1299 voxel =
PII( meshIndex, axis );
1305 vector< PII >& intersect,
1306 unsigned int ix,
unsigned int iy,
unsigned int iz,
1307 unsigned int nx,
unsigned int ny,
unsigned int nz,
1308 unsigned int meshIndex )
1310 assert( ix < nx && iy < ny && iz < nz );
1311 unsigned int index = ( iz * ny + iy ) * nx + ix;
1312 assert( index < intersect.size() );
1315 setAbut( intersect[ (iz*ny + iy) * nx + ix-1 ], meshIndex,
1318 setAbut( intersect[ (iz*ny + iy) * nx + ix+1 ], meshIndex,
1322 setAbut( intersect[ ( iz*ny + iy-1 ) * nx + ix ], meshIndex,
1325 setAbut( intersect[ ( iz*ny + iy+1 ) * nx + ix ], meshIndex,
1329 setAbut( intersect[ ( (iz-1)*ny + iy ) * nx + ix ], meshIndex,
1332 setAbut( intersect[ ( (iz+1)*ny + iy ) * nx + ix ], meshIndex,
1349 const vector< PII >& intersect,
1350 unsigned int ix,
unsigned int iy,
unsigned int iz,
1351 unsigned int nx,
unsigned int ny,
unsigned int nz,
1352 unsigned int meshIndex,
1353 vector< VoxelJunction >& ret
1356 unsigned int index = ( iz * ny + iy ) * nx + ix;
1357 unsigned int localFlag = intersect[index].second;
1372 index = ( iz * ny + iy ) * nx + ix - 1;
1377 if ( ix + 1 < nx ) {
1378 index = ( iz * ny + iy ) * nx + ix + 1;
1384 index = ( iz * ny + iy -1 ) * nx + ix;
1389 if ( iy + 1 < ny ) {
1390 index = ( iz * ny + iy + 1 ) * nx + ix;
1396 index = ( (iz-1) * ny + iy ) * nx + ix;
1401 if ( iz + 1 < nz ) {
1402 index = ( (iz+1) * ny + iy ) * nx + ix;
1411 double xmin,
double xmax,
1412 double ymin,
double ymax,
1413 double zmin,
double zmax
1416 unsigned int nx = 0.5 + ( xmax - xmin ) /
dx_;
1417 unsigned int ny = 0.5 + ( ymax - ymin ) /
dy_;
1418 unsigned int nz = 0.5 + ( zmax - zmin ) /
dz_;
1422 int ox = round( ( xmin -
x0_ ) /
dx_ );
1423 int oy = round( ( ymin -
y0_ ) /
dy_ );
1424 int oz = round( ( zmin -
z0_ ) /
dz_ );
1427 for ( vector< unsigned int >::const_iterator i =
surface_.begin();
1429 unsigned int index = *i;
1432 if ( x >= xmin && x <= xmax && y >= ymin && y <= ymax &&
1433 z >= zmin && z <= zmax ) {
1434 int ix = index %
nx_ - ox;
1436 unsigned int uix = ix;
1438 int iy = index %
ny_ - oy;
1440 unsigned int uiy = iy;
1442 int iz = index %
nz_ - oz;
1444 unsigned int uiz = iz;
1445 unsigned int meshIndex =
s2m_[ *i ];
1454 vector< VoxelJunction >& ret )
const
1466 double xmin, xmax, ymin, ymax, zmin, zmax;
1470 unsigned int nx = 0.5 + ( xmax - xmin ) /
dx_;
1471 unsigned int ny = 0.5 + ( ymax - ymin ) /
dy_;
1472 unsigned int nz = 0.5 + ( zmax - zmin ) /
dz_;
1473 vector< PII > intersect( nx * ny * nz,
PII(
EMPTY,
EMPTY ) );
1474 assignVoxels( intersect, xmin, xmax, ymin, ymax, zmin, zmax );
1477 for ( vector< unsigned int >::const_iterator i =
1479 i != other->
surface_.end(); ++i ) {
1482 if ( x >= xmin && x <= xmax && y >= ymin && y <= ymax &&
1483 z >= zmin && z <= zmax ) {
1484 unsigned int ix = ( x - xmin ) /
dx_;
1485 unsigned int iy = ( y - ymin ) /
dy_;
1486 unsigned int iz = ( z - zmin ) /
dz_;
1487 unsigned int meshIndex = other->
s2m_[ *i ];
1488 checkAbut( intersect, ix, iy, iz, nx, ny, nz, meshIndex, ret );
1496 sort( ret.begin(), ret.end() );
1504 vector< VoxelJunction >& ret )
const
1507 unsigned int min =
m2s_.size();
1508 if ( min > other->
m2s_.size() )
1509 min = other->
m2s_.size();
1511 for (
unsigned int i = 0; i < min; ++i ) {
1517 vector< VoxelJunction >& ret )
const
1524 vector< VoxelJunction >& ret )
const
1527 for ( vector< VoxelJunction >::iterator i = ret.begin();
1528 i != ret.end(); ++i )
1530 if (
doubleEq( i->diffScale, 0 ) ) {
1531 double selfXA =
dy_ *
dz_;
1532 double otherXA = other->
dy_ * other->
dz_;
1533 if ( selfXA <= otherXA )
1534 i->diffScale = 2 * selfXA / (
dx_ + other->
dx_ );
1536 i->diffScale = 2 * otherXA / (
dx_ + other->
dx_ );
1537 }
else if (
doubleEq( i->diffScale, 1 ) ) {
1538 double selfXA =
dx_ *
dz_;
1539 double otherXA = other->
dx_ * other->
dz_;
1540 if ( selfXA <= otherXA )
1541 i->diffScale = 2 * selfXA / (
dy_ + other->
dy_ );
1543 i->diffScale = 2 * otherXA / (
dy_ + other->
dy_ );
1544 }
else if (
doubleEq( i->diffScale, 2 ) ) {
1545 double selfXA =
dx_ *
dy_;
1546 double otherXA = other->
dx_ * other->
dy_;
1547 if ( selfXA <= otherXA )
1548 i->diffScale = 2 * selfXA / (
dz_ + other->
dz_ );
1550 i->diffScale = 2 * otherXA / (
dz_ + other->
dz_ );
1558 vector< VoxelJunction >& ret )
const
1562 double otherVol = other->
dx_ * other->
dy_ * other->
dz_;
1563 for ( vector< VoxelJunction >::iterator i = ret.begin();
1564 i != ret.end(); ++i )
1566 i->firstVol = myVol;
1567 i->secondVol = otherVol;
static const Cinfo * initCinfo()
vector< unsigned int > surface_
void assignVoxels(vector< pair< unsigned int, unsigned int > > &intersect, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) const
vector< unsigned int > getSurface() const
unsigned int getNx() const
static const Cinfo * initCinfo()
vector< unsigned int > m2s_
of entries in z in surround volume
unsigned int getNz() const
void innerResetStencil()
virtual func implemented here.
static const Cinfo * cubeMeshCinfo
unsigned int spaceToIndex(double x, double y, double z) const
Converts the 3-D coords to an index. EMPTY if out of range.
unsigned int nz_
of entries in y in surround volume
unsigned int neighbor(unsigned int spaceIndex, int dx, int dy, int dz) const
void addRow(unsigned int index, const vector< double > &entry, const vector< unsigned int > &colIndex)
int compareMeshSpacing(const CubeMesh *other) const
Return 0 if spacing same, -1 if self smaller, +1 if self bigger.
void fillThreeDimSurface()
double extendedMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry, including.
void setCoords(const Eref &e, vector< double > v)
vector< double > getCoords(const Eref &e) const
const vector< double > & getVoxelLength() const
void setIntersectVoxel(vector< PII > &intersect, unsigned int ix, unsigned int iy, unsigned int iz, unsigned int nx, unsigned int ny, unsigned int nz, unsigned int meshIndex)
double nearest(double x, double y, double z, unsigned int &index) const
void matchCubeMeshEntries(const CubeMesh *other, vector< VoxelJunction > &ret) const
vector< double > getDiffusionScaling(unsigned int fid) const
Virtual function to return scale factor for diffusion. 1 here.
unsigned int getNy() const
static const unsigned int ABUTY
void innerSetCoords(const vector< double > &v)
pair< unsigned int, unsigned int > PII
double x0_
Flag: should all voxels diffuse to any tgt?
const vector< unsigned int > & surface() const
Utility and test function to read surface.
static const unsigned int MULTI
void setSpaceToMesh(vector< unsigned int > v)
void matchCylMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
bool isInsideSpheroid(double x, double y, double z) const
static SrcFinfo1< vector< double > > * voxelVolOut()
void innerHandleRequestMeshStats(const Eref &e, const SrcFinfo2< unsigned int, vector< double > > *meshStatsFinfo)
More inherited virtual funcs: request comes in for mesh stats.
bool doubleApprox(double x, double y)
void setNx(unsigned int v)
const vector< double > & vGetVoxelVolume() const
Virtual func so that derived classes can pass voxel volume back.
bool isInsideCuboid(double x, double y, double z) const
bool doubleEq(double x, double y)
void matchMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
unsigned int innerGetDimensions() const
static double distance(double x, double y, double z)
vector< unsigned int > getMeshToSpace() const
void setAlwaysDiffuse(bool v)
void setMeshToSpace(vector< unsigned int > v)
vector< unsigned int > getSpaceToMesh() const
unsigned int getMeshType(unsigned int fid) const
Virtual function to return MeshType of specified entry.
void setNz(unsigned int v)
const vector< double > & vGetVoxelMidpoint() const
Virtual func so that derived classes can return voxel midpoint.
static const unsigned int SURFACE
void defineIntersection(const CubeMesh *other, double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax) const
Defines a cuboid volume of intersection between self and other.
vector< double > getDiffusionArea(unsigned int fid) const
Virtual function to return diffusion X-section area.
void fillTwoDimSurface()
Fills surface_ vector with spatial meshIndices for a rectangle.
bool alwaysDiffuse_
Flag: Should dx change or nx, with vol?
vector< unsigned int > s2m_
void fillSpaceToMeshLookup()
void setJunctionVol(const CubeMesh *other, vector< VoxelJunction > &ret) const
Assigns volume info for the voxel junctions.
double vGetEntireVolume() const
Virtual func to get volume of entire compartment.
void setDiffScale(const CubeMesh *other, vector< VoxelJunction > &ret) const
Assigns diffusion scaling info for the voxel junctions.
void innerHandleNodeInfo(const Eref &e, unsigned int numNodes, unsigned int numThreads)
static unsigned int numNodes
unsigned int nx_
Cuboid edge.
void indexToSpace(unsigned int index, double &x, double &y, double &z) const
Converts the integer meshIndex to spatial coords.
void innerSetNumEntries(unsigned int n)
Inherited virtual func.
void checkAbut(const vector< PII > &intersect, unsigned int ix, unsigned int iy, unsigned int iz, unsigned int nx, unsigned int ny, unsigned int nz, unsigned int meshIndex, vector< VoxelJunction > &ret)
bool preserveNumEntries_
Flag: Should the ends loop around mathemagically?
unsigned int ny_
of entries in x in surround volume
void innerBuildDefaultMesh(const Eref &e, double volume, unsigned int numEntries)
Virtual func to make a mesh with specified Volume and numEntries.
static const unsigned int EMPTY
double extendedMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry, including.
vector< double > getCoordinates(unsigned int fid) const
Virtual function to return coords of mesh Entry.
void swapIfBackward(double &x0, double &x1)
static const unsigned int ABUTZ
virtual void matchMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const =0
void matchAllEntries(const CubeMesh *other, vector< VoxelJunction > &ret) const
void setNy(unsigned int v)
vector< unsigned int > getParentVoxel() const
Inherited virtual, do nothing for now.
void setStencilSize(unsigned int numRows, unsigned int numCols)
bool vSetVolumeNotRates(double volume)
Virtual func, assigns volume, usually to single voxel.
void setPreserveNumEntries(bool v)
const vector< double > & getVoxelArea() const
bool getAlwaysDiffuse() const
void setAbut(PII &voxel, unsigned int meshIndex, unsigned int axis)
void flipRet(vector< VoxelJunction > &ret) const
Utility function for swapping first and second in VoxelJunctions.
static const unsigned int ABUTX
unsigned int getMeshDimensions(unsigned int fid) const
Virtual function to return dimensions of specified entry.
void matchMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
unsigned int numDims() const
Utility function for returning # of dimensions in mesh.
void setSurface(vector< unsigned int > v)
void buildMesh(Id geom, double x, double y, double z)
bool getPreserveNumEntries() const
unsigned int innerGetNumEntries() const
double getMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry.