Exemple #1
0
void CubeMesh::matchCubeMeshEntries( const CubeMesh* other,
	   vector< VoxelJunction >& ret ) const
{
		// Flip meshes if the current grid is finer.
		// There are still problems here because a finer grid will end
		// up with 2 levels deep defined as being abutting.
	if ( compareMeshSpacing( other ) == -1 ) {
			other->matchMeshEntries( this, ret );
			flipRet( ret );
			return;
	}
	ret.resize( 0 );
	// Define intersecting cuboid
	double xmin, xmax, ymin, ymax, zmin, zmax;
	defineIntersection( other, xmin, xmax, ymin, ymax, zmin, zmax );

	// Allocate intersecting cuboid
	unsigned int nx = 0.5 + ( xmax - xmin ) / dx_;
	unsigned int ny = 0.5 + ( ymax - ymin ) / dy_;
	unsigned int nz = 0.5 + ( zmax - zmin ) / dz_;
	vector< PII > intersect( nx * ny * nz, PII( EMPTY, EMPTY ) );
	assignVoxels( intersect, xmin, xmax, ymin, ymax, zmin, zmax );
	
	// Scan through finer mesh surface, check for occupied voxels.
	for ( vector< unsigned int >::const_iterator i = 
					other->surface_.begin();
					i != other->surface_.end(); ++i ) {
		double x, y, z;
		other->indexToSpace( *i, x, y, z );
		if ( x >= xmin && x <= xmax && y >= ymin && y <= ymax && 
						z >= zmin && z <= zmax ) {
			unsigned int ix = ( x - xmin ) / dx_;
			unsigned int iy = ( y - ymin ) / dy_;
			unsigned int iz = ( z - zmin ) / dz_;
			unsigned int meshIndex = other->s2m_[ *i ];
			checkAbut( intersect, ix, iy, iz, nx, ny, nz, meshIndex, ret );
		}
	}

	// Scan through the VoxelJunctions and populate their diffScale field
	setDiffScale( other, ret );
	// Scan through the VoxelJunctions and populate their volume field
	setJunctionVol( other, ret );
	sort( ret.begin(), ret.end() );
}
Exemple #2
0
void CubeMesh::matchCylMeshEntries( const ChemCompt* other,
	   vector< VoxelJunction >& ret ) const
{
	other->matchMeshEntries( this, ret );
	flipRet( ret );
}