An open source method of characteristics neutron transport code.
Cell Class Reference

Represents a Cell inside of a Universe. More...

#include "src/Cell.h"

Public Member Functions

 Cell (int id=0, const char *name="")
 Constructor sets the unique and user-specifed IDs for this Cell. More...
 
virtual ~Cell ()
 Destructor clears vector of Surface pointers bounding the Cell.
 
int getUid () const
 Return the Cell's unique ID. More...
 
int getId () const
 Return the Cell's user-specified ID. More...
 
char * getName () const
 Return the user-defined name of the Cell. More...
 
cellType getType () const
 Return the Cell type (FILL or MATERIAL). More...
 
MaterialgetFillMaterial ()
 Return a pointer to the Material filling this Cell. More...
 
UniversegetFillUniverse ()
 Return a pointer to the Material filling this Cell. More...
 
RegiongetRegion ()
 Return the Cell's Region, its spatial domain. More...
 
double getVolume ()
 Return the aggregate volume/area of all instances of this Cell. More...
 
int getNumInstances ()
 Return the number of instances of this Cell in the Geometry. More...
 
bool isRotated ()
 Return a boolean indicating whether the Cell has been rotated. More...
 
bool isTranslated ()
 Return a boolean indicating whether the Cell has been translated. More...
 
double getPhi (std::string units="degrees")
 Get the rotation angle about the x-axis in degrees. More...
 
double getTheta (std::string units="degrees")
 Get the rotation angle about the y-axis in degrees. More...
 
double getPsi (std::string units="degrees")
 Get the rotation angle about the z-axis in degrees. More...
 
double * getRotationMatrix ()
 Return pointer to array for the rotation matrix. More...
 
double * getTranslation ()
 Return pointer to array for the translations along x, y and z. More...
 
void retrieveRotation (double *rotations, int num_axes, std::string units="degrees")
 Fills an array with the rotation angles for x, y and z. More...
 
void retrieveTranslation (double *translations, int num_axes)
 Fills an array with the translations along x, y and z. More...
 
int getNumRings ()
 Return the number of rings in the Cell. More...
 
int getNumSectors ()
 Return the number of sectors in the Cell. More...
 
double getMinX ()
 Return the minimum reachable x-coordinate in the Cell. More...
 
double getMaxX ()
 Return the maximum reachable x-coordinate in the Cell. More...
 
double getMinY ()
 Return the minimum reachable y-coordinate in the Cell. More...
 
double getMaxY ()
 Return the maximum reachable y-coordinate in the Cell. More...
 
double getMinZ ()
 Return the minimum reachable z-coordinate in the Cell. More...
 
double getMaxZ ()
 Return the maximum reachable z-coordinate in the Cell. More...
 
boundaryType getMinXBoundaryType ()
 Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the minimum reachable x-coordinate in the Cell. More...
 
boundaryType getMaxXBoundaryType ()
 Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the maximum reachable x-coordinate in the Cell. More...
 
boundaryType getMinYBoundaryType ()
 Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the minimum reachable y-coordinate in the Cell. More...
 
boundaryType getMaxYBoundaryType ()
 Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the maximum reachable y-coordinate in the Cell. More...
 
boundaryType getMinZBoundaryType ()
 Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the minimum reachable z-coordinate in the Cell. More...
 
boundaryType getMaxZBoundaryType ()
 Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the maximum reachable z-coordinate in the Cell. More...
 
int getNumSurfaces () const
 Return the number of Surfaces in the Cell. More...
 
std::map< int, Halfspace * > getSurfaces () const
 Return the std::map of Halfspace object pointers for all surfaces within the Region bounding the Cell. More...
 
std::vector< Cell * > getNeighbors () const
 Return the std::vector of neighbor Cells to this Cell. More...
 
bool hasParent ()
 Return true if the Cell has a parent and false otherwise. More...
 
CellgetParent ()
 Return this Cell's parent Cell. More...
 
CellgetOldestAncestor ()
 Get the oldest ancestor Cell for this Cell. More...
 
int getNumZCylinders ()
 Obtain and return the number of ZCylinders in the cell's surfaces. More...
 
std::map< int, Cell * > getAllCells ()
 Returns the std::map of Cell IDs and Cell pointers within any nested Universes filling this Cell. More...
 
std::map< int, Universe * > getAllUniverses ()
 Returns the std::map of all nested Universe IDs and Universe pointers filling this Cell. More...
 
void setName (const char *name)
 Sets the name of the Cell. More...
 
void setFill (Material *fill)
 Sets the Material filling this Cell. More...
 
void setFill (Universe *fill)
 Sets the Universe filling this Cell. More...
 
void setRegion (Region *region)
 Sets the Region this Cell lives in. More...
 
void setVolume (double volume)
 Set the volume/area of the Cell. More...
 
void incrementVolume (double volume)
 Increment the volume/area of the Cell by some amount. More...
 
void setNumInstances (int num_instances)
 Set the number of instances of this Cell. More...
 
void incrementNumInstances ()
 Increment the number of instances of this Cell. More...
 
void setRotation (double *rotation, int num_axes, std::string units="degrees")
 Set the Cell's rotation angles about the x, y and z axes. More...
 
void setTranslation (double *translation, int num_axes)
 Set the Cell's translation along the x, y and z axes. More...
 
void setNumRings (int num_rings)
 Set the Cell's number of rings. More...
 
void setNumSectors (int num_sectors)
 Set the Cell's number of sectors. More...
 
void setParent (Cell *parent)
 Assign a parent Cell to this Cell. More...
 
void addSurface (int halfspace, Surface *surface)
 Insert a Surface into this Cell's bounding Region, assuming that an intersection between the region and the halfspace is desired. More...
 
void addSurfaceInRegion (int halfspace, Surface *surface)
 Insert a Surface into this Cell's bounding Region. More...
 
void addLogicalNode (int region_type)
 Insert a logical node (intersection or union) into the cell region. More...
 
void goUpOneRegionLogical ()
 Climb up the logical tree of regions.
 
void removeSurface (Surface *surface)
 Removes a Surface from this Cell's container of bounding Surfaces. More...
 
void addNeighborCell (Cell *cell)
 Add a neighboring Cell to this Cell's collection of neighbors. More...
 
bool isFissionable ()
 Returns true if this Cell is filled with a fissionable Material. More...
 
bool containsPoint (Point *point)
 Determines whether a Point is contained inside a Cell. More...
 
bool containsCoords (LocalCoords *coords)
 Determines whether a Point is contained inside a Cell. More...
 
double minSurfaceDist (Point *point, double azim, double polar)
 Computes the minimum distance to a Surface from a Point with a given trajectory at a certain angle. More...
 
double minSurfaceDist (LocalCoords *coords)
 Computes the minimum distance to a Surface in the Cell's Region from a point with a given trajectory at a certain angle stored in a LocalCoords object. More...
 
Cellclone (bool clone_region=true)
 Create a duplicate of the Cell. More...
 
void subdivideCell (double max_radius)
 Subdivides a Cell into rings and sectors aligned with the z-axis. More...
 
void buildNeighbors ()
 Build a collection of neighboring Cells for optimized ray tracing.
 
std::string toString ()
 Convert this Cell's attributes to a string format. More...
 
void printString ()
 Prints a string representation of all of the Cell's attributes to the console.
 

Detailed Description

Represents a Cell inside of a Universe.

Constructor & Destructor Documentation

◆ Cell()

Cell::Cell ( int  id = 0,
const char *  name = "" 
)

Constructor sets the unique and user-specifed IDs for this Cell.

Parameters
idthe user-specified optional Cell ID
namethe user-specified optional Cell name

Member Function Documentation

◆ addLogicalNode()

void Cell::addLogicalNode ( int  region_type)

Insert a logical node (intersection or union) into the cell region.

This method creates a node in a tree of regions. The leaves, or the nodes at the very bottom of the tree, are halfspaces. The region is defined by that tree.

Parameters
region_typethe logical operation

◆ addNeighborCell()

void Cell::addNeighborCell ( Cell cell)

Add a neighboring Cell to this Cell's collection of neighbors.

Parameters
cella pointer to the neighboring Cell

◆ addSurface()

void Cell::addSurface ( int  halfspace,
Surface surface 
)

Insert a Surface into this Cell's bounding Region, assuming that an intersection between the region and the halfspace is desired.

Parameters
halfspacethe Surface halfspace (+/-1)
surfacea pointer to the Surface

◆ addSurfaceInRegion()

void Cell::addSurfaceInRegion ( int  halfspace,
Surface surface 
)

Insert a Surface into this Cell's bounding Region.

Parameters
halfspacethe Surface halfspace (+/-1)
surfacea pointer to the Surface

◆ clone()

Cell * Cell::clone ( bool  clone_region = true)

Create a duplicate of the Cell.

Returns
a pointer to the clone

◆ containsCoords()

bool Cell::containsCoords ( LocalCoords coords)

Determines whether a Point is contained inside a Cell.

Queries each Surface inside the Cell to determine if the Point is on the same side of the Surface. This Point is only inside the Cell if it is on the same side of every Surface in the Cell.

Parameters
coordsa pointer to a localcoord
Returns
whether the cell contains the coords or not

◆ containsPoint()

bool Cell::containsPoint ( Point point)

Determines whether a Point is contained inside a Cell.

Queries the Region bounding the Cell to determine if the Point is within the Region. This point is only inside the Cell if it is on the same side of every Surface bounding the Cell.

Parameters
pointa pointer to a Point
Returns
true if the Point is inside the Cell; otherwise false

◆ getAllCells()

std::map< int, Cell * > Cell::getAllCells ( )

Returns the std::map of Cell IDs and Cell pointers within any nested Universes filling this Cell.

Returns
std::map of Cell IDs and pointers

◆ getAllUniverses()

std::map< int, Universe * > Cell::getAllUniverses ( )

Returns the std::map of all nested Universe IDs and Universe pointers filling this Cell.

Returns
std::map of Universe IDs and pointers

◆ getFillMaterial()

Material * Cell::getFillMaterial ( )

Return a pointer to the Material filling this Cell.

Returns
the Material fill pointer

◆ getFillUniverse()

Universe * Cell::getFillUniverse ( )

Return a pointer to the Material filling this Cell.

Returns
the Material fill pointer

◆ getId()

int Cell::getId ( ) const

Return the Cell's user-specified ID.

Returns
the Cell's user-specified ID

◆ getMaxX()

double Cell::getMaxX ( )

Return the maximum reachable x-coordinate in the Cell.

Returns
the maximum x-coordinate

◆ getMaxXBoundaryType()

boundaryType Cell::getMaxXBoundaryType ( )

Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the maximum reachable x-coordinate in the Cell.

Returns
the boundary condition at the maximum x-coordinate

◆ getMaxY()

double Cell::getMaxY ( )

Return the maximum reachable y-coordinate in the Cell.

Returns
the maximum y-coordinate

◆ getMaxYBoundaryType()

boundaryType Cell::getMaxYBoundaryType ( )

Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the maximum reachable y-coordinate in the Cell.

Returns
the boundary condition at the maximum y-coordinate

◆ getMaxZ()

double Cell::getMaxZ ( )

Return the maximum reachable z-coordinate in the Cell.

Returns
the maximum z-coordinate

◆ getMaxZBoundaryType()

boundaryType Cell::getMaxZBoundaryType ( )

Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the maximum reachable z-coordinate in the Cell.

Returns
the boundary condition at the maximum z-coordinate

◆ getMinX()

double Cell::getMinX ( )

Return the minimum reachable x-coordinate in the Cell.

Returns
the minimum x-coordinate

◆ getMinXBoundaryType()

boundaryType Cell::getMinXBoundaryType ( )

Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the minimum reachable x-coordinate in the Cell.

Returns
the boundary condition at the minimum x-coordinate

◆ getMinY()

double Cell::getMinY ( )

Return the minimum reachable y-coordinate in the Cell.

Returns
the minimum y-coordinate

◆ getMinYBoundaryType()

boundaryType Cell::getMinYBoundaryType ( )

Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the minimum reachable y-coordinate in the Cell.

Returns
the boundary condition at the minimum y-coordinate

◆ getMinZ()

double Cell::getMinZ ( )

Return the minimum reachable z-coordinate in the Cell.

Returns
the minimum z-coordinate

◆ getMinZBoundaryType()

boundaryType Cell::getMinZBoundaryType ( )

Return the boundary condition (REFLECTIVE, VACUUM, or INTERFACE) at the minimum reachable z-coordinate in the Cell.

Returns
the boundary condition at the minimum z-coordinate

◆ getName()

char * Cell::getName ( ) const

Return the user-defined name of the Cell.

Returns
the Cell name

◆ getNeighbors()

std::vector< Cell * > Cell::getNeighbors ( ) const

Return the std::vector of neighbor Cells to this Cell.

Returns
std::vector of neighbor Cell pointers

◆ getNumInstances()

int Cell::getNumInstances ( )

Return the number of instances of this Cell in the Geometry.

The number of instances of this Cell in the Geometry is determined during track generation.

Returns
the number of cell instances

◆ getNumRings()

int Cell::getNumRings ( )

Return the number of rings in the Cell.

Returns
the number of rings

◆ getNumSectors()

int Cell::getNumSectors ( )

Return the number of sectors in the Cell.

Returns
the number of sectors

◆ getNumSurfaces()

int Cell::getNumSurfaces ( ) const

Return the number of Surfaces in the Cell.

Returns
the number of Surfaces

◆ getNumZCylinders()

int Cell::getNumZCylinders ( )

Obtain and return the number of ZCylinders in the cell's surfaces.

Returns
the number of ZCylinders used to define this cell's region

◆ getOldestAncestor()

Cell * Cell::getOldestAncestor ( )

Get the oldest ancestor Cell for this Cell.

This method traverses the linked list of parent Cells to find the one at the root node. The oldest ancestor Cell is likely the one created by the user at runtime, while intermediate ancestors were created during radial and angular spatial discretization.

Returns
this Cell's oldest ancestor Cell

◆ getParent()

Cell * Cell::getParent ( )

Return this Cell's parent Cell.

If no parent Cell has been assigned from Cell cloning, then NULL is returned.

Returns
a pointer to the parent Cell

◆ getPhi()

double Cell::getPhi ( std::string  units = "degrees")

Get the rotation angle about the x-axis in degrees.

Parameters
unitsthe angular units in "radians" or "degrees" (default)
Returns
the rotation angle about the x-axis

◆ getPsi()

double Cell::getPsi ( std::string  units = "degrees")

Get the rotation angle about the z-axis in degrees.

Parameters
unitsthe angular units in "radians" or "degrees" (default)
Returns
the rotation angle about the z-axis

◆ getRegion()

Region * Cell::getRegion ( )

Return the Cell's Region, its spatial domain.

Returns
the Cell's Region

◆ getRotationMatrix()

double * Cell::getRotationMatrix ( )

Return pointer to array for the rotation matrix.

Returns
a pointer to an array of rotation angles

◆ getSurfaces()

std::map< int, Halfspace * > Cell::getSurfaces ( ) const

Return the std::map of Halfspace object pointers for all surfaces within the Region bounding the Cell.

Returns
std::map of Halfspace object pointers with surface ID as a key.

◆ getTheta()

double Cell::getTheta ( std::string  units = "degrees")

Get the rotation angle about the y-axis in degrees.

Parameters
unitsthe angular units in "radians" or "degrees" (default)
Returns
the rotation angle about the y-axis

◆ getTranslation()

double * Cell::getTranslation ( )

Return pointer to array for the translations along x, y and z.

Returns
a pointer to an array of translations

◆ getType()

cellType Cell::getType ( ) const

Return the Cell type (FILL or MATERIAL).

Returns
the Cell type

◆ getUid()

int Cell::getUid ( ) const

Return the Cell's unique ID.

Returns
the Cell's unique ID

◆ getVolume()

double Cell::getVolume ( )

Return the aggregate volume/area of all instances of this Cell.

The volume/area of the Cell is computed from track segments which overlap this Cell during track generation.

Returns
the volume/area of the Cell

◆ hasParent()

bool Cell::hasParent ( )

Return true if the Cell has a parent and false otherwise.

Returns
whether the Cell has a parent Cell

◆ incrementNumInstances()

void Cell::incrementNumInstances ( )

Increment the number of instances of this Cell.

This routine is called by the TrackGenerator during track generation and segmentation.

◆ incrementVolume()

void Cell::incrementVolume ( double  volume)

Increment the volume/area of the Cell by some amount.

This routine is called by the TrackGenerator during track generation and segmentation.

Parameters
volumethe amount to increment the current volume by

◆ isFissionable()

bool Cell::isFissionable ( )

Returns true if this Cell is filled with a fissionable Material.

If the Cell is filled by a Material, this method will simply query the filling Material. If the Cell is filled by a Universe, this method will consider any Materials filling those Cells contained by the filling Universe. This method should not be called prior to the calling of the Geometry::computeFissionability() method.

Returns
true if contains a fissionable Material

◆ isRotated()

bool Cell::isRotated ( )

Return a boolean indicating whether the Cell has been rotated.

Returns
whether the Cell has been rotated

◆ isTranslated()

bool Cell::isTranslated ( )

Return a boolean indicating whether the Cell has been translated.

Returns
whether the Cell has been translated

◆ minSurfaceDist() [1/2]

double Cell::minSurfaceDist ( Point point,
double  azim,
double  polar 
)

Computes the minimum distance to a Surface from a Point with a given trajectory at a certain angle.

If the trajectory will not intersect any of the Surfaces in the Cell returns INFINITY.

Parameters
pointthe Point of interest
azimthe azimuthal angle of the trajectory (in radians from $[0,2\pi]$)
polarthe polar angle of the trajectory (in radians from $[0,\pi]$)
Returns
distance to nearest intersection with the cell's region boundaries

◆ minSurfaceDist() [2/2]

double Cell::minSurfaceDist ( LocalCoords coords)

Computes the minimum distance to a Surface in the Cell's Region from a point with a given trajectory at a certain angle stored in a LocalCoords object.

If the trajectory will not intersect any of the Surfaces in the Cell returns INFINITY.

Parameters
coordsa pointer to a localcoords
Returns
distance to nearest intersection with the cell's region boundaries

◆ removeSurface()

void Cell::removeSurface ( Surface surface)

Removes a Surface from this Cell's container of bounding Surfaces.

Parameters
surfacea pointer to the Surface to remove

◆ retrieveRotation()

void Cell::retrieveRotation ( double *  rotations,
int  num_axes,
std::string  units = "degrees" 
)

Fills an array with the rotation angles for x, y and z.

This class method is intended to be called by the OpenMOC Python OpenMC compatiblity module. Although this method appears to require two arguments, in reality it only requires one due to SWIG and would be called from within Python as follows:

rotation = cell.getRotation(3)
Parameters
rotationsan array of rotation angles of length 3 for x, y and z
num_axesthe number of axes (this must always be 3)
unitsthe angular units in "radians" or "degrees" (default)

◆ retrieveTranslation()

void Cell::retrieveTranslation ( double *  translations,
int  num_axes 
)

Fills an array with the translations along x, y and z.

This class method is intended to be called by the OpenMOC Python OpenMC compatiblity module. Although this method appears to require two arguments, in reality it only requires one due to SWIG and would be called from within Python as follows:

translation = cell.retrieveTranslation(3)
Parameters
translationsan array of translations of length 3 for x, y and z
num_axesthe number of axes (this must always be 3)

◆ setFill() [1/2]

void Cell::setFill ( Material fill)

Sets the Material filling this Cell.

Parameters
fillthe Material filling this Cell

◆ setFill() [2/2]

void Cell::setFill ( Universe fill)

Sets the Universe filling this Cell.

Parameters
fillthe Universe filling this Cell

◆ setName()

void Cell::setName ( const char *  name)

Sets the name of the Cell.

Parameters
namethe Cell name string

◆ setNumInstances()

void Cell::setNumInstances ( int  num_instances)

Set the number of instances of this Cell.

Parameters
num_instancesthe number of instances of this Cell in the Geometry

◆ setNumRings()

void Cell::setNumRings ( int  num_rings)

Set the Cell's number of rings.

Parameters
num_ringsthe number of rings in this Cell

◆ setNumSectors()

void Cell::setNumSectors ( int  num_sectors)

Set the Cell's number of sectors.

Parameters
num_sectorsthe number of sectors in this Cell

◆ setParent()

void Cell::setParent ( Cell parent)

Assign a parent Cell to this Cell.

This is used by Cell cloning when applied for radial and angular discretization.

Parameters
parenta pointer to the parent Cell

◆ setRegion()

void Cell::setRegion ( Region region)

Sets the Region this Cell lives in.

NOTE: This method deep copies the Region and stores the copy. Any changes made to the Region will not be reflected in the Region copy stored by the Cell.

Parameters
regionthe Region bounding the Cell

◆ setRotation()

void Cell::setRotation ( double *  rotation,
int  num_axes,
std::string  units = "degrees" 
)

Set the Cell's rotation angles about the x, y and z axes.

This method is a helper function to allow OpenMOC users to assign the Cell's rotation angles in Python. A user must initialize a length 3 NumPy array as input to this function. This function then stores the data values in the NumPy array in the Cell's rotation array. An example of how this function might be called in Python is as follows:

rotation = numpy.array([0., 0., 90.])
cell = openmoc.Cell()
cell.setRotation(rotation)
Parameters
rotationthe array of rotation angles
num_axesthe number of axes (this must always be 3)
unitsthe angular units in "radians" or "degrees" (default)

◆ setTranslation()

void Cell::setTranslation ( double *  translation,
int  num_axes 
)

Set the Cell's translation along the x, y and z axes.

This method is a helper function to allow OpenMOC users to assign the Cell's translations in Python. A user must initialize a length 3 NumPy array as input to this function. This function then stores the data values in the NumPy array in the Cell's translation array. An example of how this function might be called in Python is as follows:

translation = numpy.array([0.25, 0.25, 0.])
cell = openmoc.Cell()
cell.setTranslation(translation)
Parameters
translationthe array of translations
num_axesthe number of axes (this must always be 3)

◆ setVolume()

void Cell::setVolume ( double  volume)

Set the volume/area of the Cell.

Parameters
volumethe volume/area of the Cell

◆ subdivideCell()

void Cell::subdivideCell ( double  max_radius)

Subdivides a Cell into rings and sectors aligned with the z-axis.

This method uses the Cell's clone method to produce a vector of this Cell's subdivided ring and sector Cells.

Parameters
max_radiusthe maximum allowable radius used in the subdivisions
Returns
a vector of Cell pointers to the new subdivided Cells

A container of all Cell clones created for rings and sectors

◆ toString()

std::string Cell::toString ( )

Convert this Cell's attributes to a string format.

Returns
a character array of this Cell's attributes

Add string data for the Surfaces in this Cell


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