MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CubeMesh.cpp File Reference
#include "header.h"
#include "SparseMatrix.h"
#include "ElementValueFinfo.h"
#include "Boundary.h"
#include "MeshEntry.h"
#include "VoxelJunction.h"
#include "ChemCompt.h"
#include "MeshCompt.h"
#include "CubeMesh.h"
#include "EndoMesh.h"
+ Include dependency graph for CubeMesh.cpp:

Go to the source code of this file.

Typedefs

typedef pair< unsigned int,
unsigned int > 
PII
 

Functions

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)
 
void setAbut (PII &voxel, unsigned int meshIndex, unsigned int axis)
 
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)
 
void swapIfBackward (double &x0, double &x1)
 

Variables

static const CinfocubeMeshCinfo = CubeMesh::initCinfo()
 

Typedef Documentation

typedef pair< unsigned int, unsigned int > PII

Definition at line 29 of file CubeMesh.cpp.

Function Documentation

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 
)

checkAbut checks the intersect vector for the current position ix, iy, iz, to determine how many diffusion terms to extract. It then puts each of the extracted terms into the ret vector. There is a minor efficiency for one and two diffusion terms as they are encoded within the intersect vector. Higher-order surface alignments require an in-line scan of neighboring voxels. In all casesl the function inserts a flag indicating surface direction into the diffScale field of the VoxelJunction. 0 = x; 1 = y; 2 = z.

Definition at line 1348 of file CubeMesh.cpp.

References CubeMesh::ABUTX, CubeMesh::ABUTY, CubeMesh::ABUTZ, CubeMesh::EMPTY, CubeMesh::MULTI, and CubeMesh::SURFACE.

Referenced by CubeMesh::matchCubeMeshEntries(), and testIntersectVoxel().

1355 {
1356  unsigned int index = ( iz * ny + iy ) * nx + ix;
1357  unsigned int localFlag = intersect[index].second;
1358 
1359  if ( localFlag == CubeMesh::EMPTY || localFlag == CubeMesh::SURFACE )
1360  return; // Nothing to put into the ret vector
1361  if ( localFlag == CubeMesh::ABUTX ) {
1362  ret.push_back(
1363  VoxelJunction( intersect[index].first, meshIndex, 0 ));
1364  } else if ( localFlag == CubeMesh::ABUTY ) {
1365  ret.push_back(
1366  VoxelJunction( intersect[index].first, meshIndex, 1 ));
1367  } else if ( localFlag == CubeMesh::ABUTZ ) {
1368  ret.push_back(
1369  VoxelJunction( intersect[index].first, meshIndex, 2 ));
1370  } else if ( localFlag == CubeMesh::MULTI ) { // go through all 6 cases.
1371  if ( ix > 0 ) {
1372  index = ( iz * ny + iy ) * nx + ix - 1;
1373  if ( intersect[index].second == CubeMesh::SURFACE )
1374  ret.push_back(
1375  VoxelJunction( intersect[index].first, meshIndex, 0 ));
1376  }
1377  if ( ix + 1 < nx ) {
1378  index = ( iz * ny + iy ) * nx + ix + 1;
1379  if ( intersect[index].second == CubeMesh::SURFACE )
1380  ret.push_back(
1381  VoxelJunction( intersect[index].first, meshIndex, 0 ));
1382  }
1383  if ( iy > 0 ) {
1384  index = ( iz * ny + iy -1 ) * nx + ix;
1385  if ( intersect[index].second == CubeMesh::SURFACE )
1386  ret.push_back(
1387  VoxelJunction( intersect[index].first, meshIndex, 1 ));
1388  }
1389  if ( iy + 1 < ny ) {
1390  index = ( iz * ny + iy + 1 ) * nx + ix;
1391  if ( intersect[index].second == CubeMesh::SURFACE )
1392  ret.push_back(
1393  VoxelJunction( intersect[index].first, meshIndex, 1 ));
1394  }
1395  if ( iz > 0 ) {
1396  index = ( (iz-1) * ny + iy ) * nx + ix;
1397  if ( intersect[index].second == CubeMesh::SURFACE )
1398  ret.push_back(
1399  VoxelJunction( intersect[index].first, meshIndex, 2 ));
1400  }
1401  if ( iz + 1 < nz ) {
1402  index = ( (iz+1) * ny + iy ) * nx + ix;
1403  if ( intersect[index].second == CubeMesh::SURFACE )
1404  ret.push_back(
1405  VoxelJunction( intersect[index].first, meshIndex, 2 ));
1406  }
1407  }
1408 }
static const unsigned int ABUTY
Definition: CubeMesh.h:288
static const unsigned int MULTI
Definition: CubeMesh.h:290
static const unsigned int SURFACE
Definition: CubeMesh.h:286
static const unsigned int EMPTY
Definition: CubeMesh.h:285
static const unsigned int ABUTZ
Definition: CubeMesh.h:289
static const unsigned int ABUTX
Definition: CubeMesh.h:287

+ Here is the caller graph for this function:

void setAbut ( PII voxel,
unsigned int  meshIndex,
unsigned int  axis 
)

The intersect pairs are always meshIndex in first, and a flag in the second. The flag can be: EMPTY: empty SURFACE: on the surface ABUT[X,Y,Z]: One place removed from the surface, only one entry MULTI: Multiple surface voxels are only one place removed from here. a number: Special case where 2 surface voxels abut. The number is the meshIndex of the second surface voxel. setAbut assigns the voxel flags based on what was already there

Definition at line 1294 of file CubeMesh.cpp.

References CubeMesh::EMPTY, CubeMesh::MULTI, and CubeMesh::SURFACE.

Referenced by setIntersectVoxel().

1295 {
1296  if ( voxel.second == CubeMesh::SURFACE ) // Don't touch surface voxels.
1297  return;
1298  if ( voxel.second == CubeMesh::EMPTY )
1299  voxel = PII( meshIndex, axis );
1300  else // 1 or more indices are already here.
1301  voxel.second = CubeMesh::MULTI;
1302 }
pair< unsigned int, unsigned int > PII
Definition: CubeMesh.cpp:29
static const unsigned int MULTI
Definition: CubeMesh.h:290
static const unsigned int SURFACE
Definition: CubeMesh.h:286
static const unsigned int EMPTY
Definition: CubeMesh.h:285

+ Here is the caller graph for this function:

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 
)

Definition at line 1304 of file CubeMesh.cpp.

References CubeMesh::ABUTX, CubeMesh::ABUTY, CubeMesh::ABUTZ, setAbut(), and CubeMesh::SURFACE.

Referenced by CubeMesh::assignVoxels(), and testIntersectVoxel().

1309 {
1310  assert( ix < nx && iy < ny && iz < nz );
1311  unsigned int index = ( iz * ny + iy ) * nx + ix;
1312  assert( index < intersect.size() );
1313  intersect[index] = PII( meshIndex, CubeMesh::SURFACE );
1314  if ( ix > 0 )
1315  setAbut( intersect[ (iz*ny + iy) * nx + ix-1 ], meshIndex,
1316  CubeMesh::ABUTX );
1317  if ( ix + 1 < nx )
1318  setAbut( intersect[ (iz*ny + iy) * nx + ix+1 ], meshIndex,
1319  CubeMesh::ABUTX );
1320 
1321  if ( iy > 0 )
1322  setAbut( intersect[ ( iz*ny + iy-1 ) * nx + ix ], meshIndex,
1323  CubeMesh::ABUTY);
1324  if ( iy + 1 < ny )
1325  setAbut( intersect[ ( iz*ny + iy+1 ) * nx + ix ], meshIndex,
1326  CubeMesh::ABUTY);
1327 
1328  if ( iz > 0 )
1329  setAbut( intersect[ ( (iz-1)*ny + iy ) * nx + ix ], meshIndex,
1330  CubeMesh::ABUTZ);
1331  if ( iz + 1 < nz )
1332  setAbut( intersect[ ( (iz+1)*ny + iy ) * nx + ix ], meshIndex,
1333  CubeMesh::ABUTZ);
1334 }
static const unsigned int ABUTY
Definition: CubeMesh.h:288
pair< unsigned int, unsigned int > PII
Definition: CubeMesh.cpp:29
static const unsigned int SURFACE
Definition: CubeMesh.h:286
static const unsigned int ABUTZ
Definition: CubeMesh.h:289
void setAbut(PII &voxel, unsigned int meshIndex, unsigned int axis)
Definition: CubeMesh.cpp:1294
static const unsigned int ABUTX
Definition: CubeMesh.h:287

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void swapIfBackward ( double &  x0,
double &  x1 
)

Definition at line 294 of file CubeMesh.cpp.

Referenced by CubeMesh::defineIntersection(), and CubeMesh::updateCoords().

295 {
296  if ( x0 > x1 ) {
297  double temp = x0;
298  x0 = x1;
299  x1 = temp;
300  }
301 }

+ Here is the caller graph for this function:

Variable Documentation

const Cinfo* cubeMeshCinfo = CubeMesh::initCinfo()
static

Definition at line 256 of file CubeMesh.cpp.

Referenced by CubeMesh::initCinfo().