cgma
Fill Class Reference

#include <geometry.hpp>

List of all members.

Public Member Functions

 Fill ()
 Fill (const FillNode &origin_p)
 Fill (irange x, irange y, irange z, std::vector< FillNode > nodes_p)
const FillNodegetOriginNode () const
const FillNodegetNode (int x, int y, int z) const

Protected Member Functions

size_t indicesToSerialIndex (int x, int y, int z) const

Protected Attributes

std::vector< FillNodenodes
bool has_grid
irange xrange
irange yrange
irange zrange

Friends

class Lattice

Detailed Description

A fill is a 3-dimensional grid of fill nodes

Definition at line 193 of file geometry.hpp.


Constructor & Destructor Documentation

Fill::Fill ( ) [inline]

Definition at line 204 of file geometry.hpp.

        :
    nodes(1,FillNode()),has_grid(false)
  {}
Fill::Fill ( const FillNode origin_p) [inline]

Definition at line 208 of file geometry.hpp.

                                  :
    nodes(1,origin_p), has_grid(false)
  {}
Fill::Fill ( irange  x,
irange  y,
irange  z,
std::vector< FillNode nodes_p 
) [inline]

Definition at line 212 of file geometry.hpp.

                                                                   :
    nodes(nodes_p), has_grid(true), xrange(x), yrange(y), zrange(z)
  {}

Member Function Documentation

const FillNode & Fill::getNode ( int  x,
int  y,
int  z 
) const

Definition at line 246 of file geometry.cpp.

                                                         {
  assert( has_grid );
  return nodes.at( indicesToSerialIndex(x, y, z) );
}
const FillNode & Fill::getOriginNode ( ) const

Definition at line 239 of file geometry.cpp.

                                          { 
  if( !has_grid ){
    return nodes.at(0); 
  }
  else return nodes.at(indicesToSerialIndex( 0, 0, 0));
}
size_t Fill::indicesToSerialIndex ( int  x,
int  y,
int  z 
) const [protected]

Definition at line 224 of file geometry.cpp.

                                                             {
  int grid_x = x - xrange.first;
  int grid_y = y - yrange.first;
  int grid_z = z - zrange.first;

  int dx = xrange.second - xrange.first + 1;
  int dy = yrange.second - yrange.first + 1;
  //  int dz = zrange.second - zrange.first;
  
  int index = grid_z * (dy*dx) + grid_y * dx + grid_x;

  assert( index >= 0 && (unsigned)(index) <= nodes.size() );
  return static_cast<size_t>( index );
}

Friends And Related Function Documentation

friend class Lattice [friend]

Definition at line 219 of file geometry.hpp.


Member Data Documentation

bool Fill::has_grid [protected]

Definition at line 197 of file geometry.hpp.

std::vector<FillNode> Fill::nodes [protected]

Definition at line 196 of file geometry.hpp.

irange Fill::xrange [protected]

Definition at line 198 of file geometry.hpp.

irange Fill::yrange [protected]

Definition at line 198 of file geometry.hpp.

irange Fill::zrange [protected]

Definition at line 198 of file geometry.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines