Acoustic FDTD Solver
Public Member Functions | Public Attributes | Private Member Functions | List of all members
Grid Class Reference

Specify the grid setting over the effective domain. More...

#include <Grid.hpp>

Public Member Functions

 Grid ()
 Grid (const CartPosition &lower, const CartPosition &upper, const double dy, const double dz)
 Create a uniform rectilinear grid.
std::vector< double > getY (const int flag=-1) const
std::vector< double > getZ (const int flag=-1) const
std::vector< double > getDeltaY (const int flag=-1) const
std::vector< double > getDeltaZ (const int flag=-1) const
double getMinimumElementEdgeLength () const
 Compare the spatial discretization across all three dimension and return the small discretization.
std::vector< unsigned > getIntegerCoordinate (const CartPosition &p, const int flag=-1) const
 Convert the position in cartesian coordinate to the grid integer coordinate with respect to the grid denoted by the flag.
std::vector< std::vector
< unsigned > > 
getNeighbourIndices (const double y, const double z, const int flag=-1) const
 Return the indices of the four neighbouring points based on the grid specified by flag.
unsigned getIndex (const CartPosition &p) const
 Convert the position in cartesian coordinate to the grid index as stored in a vector.

Public Attributes

std::vector< double > delt_y
 spatial increment along the y axis for the primary grid
std::vector< double > prim_y
 primary grid point along the y axis
std::vector< double > delt_z
 spatial increment along the z axis for the primary grid
std::vector< double > prim_z
 primary grid point along the z axis

Private Member Functions

std::vector< double > getAxis (const std::vector< double > &axis, const std::vector< double > &delta, const int flag=-1) const

Detailed Description

Specify the grid setting over the effective domain.

Constructor & Destructor Documentation

Grid::Grid ( )
Grid::Grid ( const CartPosition lower,
const CartPosition upper,
const double  dy,
const double  dz 
)

Create a uniform rectilinear grid.

If the edge cannot be broken down to an even number of cells, we impose the number of cells to be even. Thus, the actual $delta$ is smaller than the specified delta.

Member Function Documentation

std::vector< double > Grid::getAxis ( const std::vector< double > &  axis,
const std::vector< double > &  delta,
const int  flag = -1 
) const
private
std::vector<double> Grid::getDeltaY ( const int  flag = -1) const
std::vector<double> Grid::getDeltaZ ( const int  flag = -1) const
unsigned Grid::getIndex ( const CartPosition p) const

Convert the position in cartesian coordinate to the grid index as stored in a vector.

It relies on Grid::getIntegerCoordinate()

std::vector< unsigned > Grid::getIntegerCoordinate ( const CartPosition p,
const int  flag = -1 
) const

Convert the position in cartesian coordinate to the grid integer coordinate with respect to the grid denoted by the flag.

Returns
index in the grid.
double Grid::getMinimumElementEdgeLength ( ) const

Compare the spatial discretization across all three dimension and return the small discretization.

Returns
the minimum cell size
std::vector< std::vector< unsigned > > Grid::getNeighbourIndices ( const double  y,
const double  z,
const int  flag = -1 
) const

Return the indices of the four neighbouring points based on the grid specified by flag.

If the coordinate of the point happens to be the same as an element of the coordinate vector, the index of the element is return.

               |
               v
 
    |          |          |         | 
  y[0]       y[1]       y[2]      y[3]

The linear search method can be replaced by the binary search method.

Parameters
ycoordinate in the y direction
zcoordinate in the z direction
flag"-1" means the primary grid points
Returns
4x2 vector containing the indices in the format of
                   -+--> z
                    |
                    v   1 ---- 2
                   y      |  |
                        4 ---- 3
std::vector< double > Grid::getY ( const int  flag = -1) const
Parameters
flag"-1" means the primary grid points. "0" means the grid point at the center of the voxel. "+1" means the grid point on the right of the voxel.
std::vector< double > Grid::getZ ( const int  flag = -1) const
Parameters
flag"-1" means the primary grid points. "0" means the grid point at the center of the voxel. "+1" means the grid point on the right of the voxel.

Member Data Documentation

std::vector<double> Grid::delt_y

spatial increment along the y axis for the primary grid

std::vector<double> Grid::delt_z

spatial increment along the z axis for the primary grid

std::vector<double> Grid::prim_y

primary grid point along the y axis

std::vector<double> Grid::prim_z

primary grid point along the z axis


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