Lagrangian Particle Code for The Simulation of 2D/3D Fluid Dynamics
 All Classes Files Functions Variables Typedefs Friends Pages
Public Member Functions | List of all members
HexagonalPacking2D Class Reference

Computes the 2D Cartesian coordinates of a particle based on the hexagonal close packing. More...

#include <hexagonal_packing.h>

Public Member Functions

 HexagonalPacking2D (double xmin_, double xmax_, double ymin_, double ymax_, double h_r_)
 Constructor. More...
 
void getParameters (size_t &m0_, size_t &m1_, size_t &n0_odd_, size_t &n1_odd_, size_t &n0_even_, size_t &n1_even_)
 Getter function to retrieve parameters of the boundaries of this hexagonal close packing. More...
 
double computeX (int tag, size_t k)
 Computes the particle location in the x-coordinate. More...
 
double computeY (size_t j)
 Computes the particle location in the y-coordinate. More...
 

Detailed Description

Computes the 2D Cartesian coordinates of a particle based on the hexagonal close packing.

Author
Chen, Hsin-Chiang (morri.nosp@m.sche.nosp@m.n2008.nosp@m.@gma.nosp@m.il.co.nosp@m.m)
Version
1.0
Date
2014/05/09

Created on: 2014/05/01

Constructor & Destructor Documentation

HexagonalPacking2D::HexagonalPacking2D ( double  xmin_,
double  xmax_,
double  ymin_,
double  ymax_,
double  h_r_ 
)

Constructor.

The constructor initializes parameters needed to compute the 2D Cartesian coordinate of particles based on the hexagonal close packing using the input spatial domain and the input radius of the constructing equal sphere. All particles will be located inside the input spatial domain.

Parameters
[in]xmin_The minimum value of the input spatial domain in x-coordinate
[in]xmax_The maximum value of the input spatial domain in x-coordinate
[in]ymin_The minimum value of the input spatial domain in y-coordinate
[in]ymax_The maximum value of the input spatial domain in y-coordinate
[in]h_r_The radius of the constructing sphere
Note
The parameter h_r_ should be set to be one half of the initial inter-particle distance

Member Function Documentation

double HexagonalPacking2D::computeX ( int  tag,
size_t  k 
)
inline

Computes the particle location in the x-coordinate.

Parameters
[in]tagValue 0 indicates odd-numbered rows; otherwise indicates even-numbered rows
[in]kThe k-th column
Returns
Particle location in the x-coordinate
double HexagonalPacking2D::computeY ( size_t  j)
inline

Computes the particle location in the y-coordinate.

Parameters
[in]jThe j-th row
Returns
Particle location in the y-coordinate
void HexagonalPacking2D::getParameters ( size_t &  m0_,
size_t &  m1_,
size_t &  n0_odd_,
size_t &  n1_odd_,
size_t &  n0_even_,
size_t &  n1_even_ 
)
inline

Getter function to retrieve parameters of the boundaries of this hexagonal close packing.

Parameters
[out]m0_The minimum index of rows
[out]m1_The maximum index of rows
[out]n0_odd_The minimum index of columns in odd-numbered rows
[out]n1_odd_The maximum index of columns in odd-numbered rows
[out]n0_even_The minimum index of columns in even-numbered rows
[out]n1_even_The maximum index of columns in even-numbered rows
Note
The information is retrieved to compute the Cartesian coordinate of particles one-by-one outside this class. This enables the caller to use different criterions to screen each particle to decide if this particle should be included into the computational context or not. This will save a lot of computational time compared to if all particles within the input spatial domain is included in the computational context first, and then screen and delete unnecessary particles.

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