OOFEM
2.4
OOFEM.org - Object Oriented Finite Element Solver
|
Particle grid data structure for n-D grids. More...
#include <particlegrid.h>
Classes | |
struct | RefinedParticlePoint |
Recursive data structure for. More... | |
Public Types | |
typedef ParticleGridIterator< Point > | iterator |
List iterator type. More... | |
Public Member Functions | |
ParticleGrid (const IntArray &res, const FloatArray &bb0, const FloatArray &bb1) | |
Creates a new empty particle grid. More... | |
ParticleGrid (const ParticleGrid *old) | |
Copies structure of old particle grid, but no content. More... | |
~ParticleGrid () | |
Destructor. More... | |
int | giveDimensions () |
Returns Number of dimensions of grid. More... | |
int | getTotal () const |
Total number potential points. More... | |
int | getNumberOfPoints () const |
Number of active points. More... | |
bool | isEmpty () const |
Returns true if the entire grid is empty. More... | |
iterator | begin () |
Returns an iterator over the entire grid (with subgrids) More... | |
iterator | beginAt (const FloatArray &x0, const FloatArray &x1) |
Returns an iterator over specified region. More... | |
int | getResolution (int i) |
Returns the resolution in given dimension. More... | |
double | getGridStep (int i) const |
Returns the grid increment. More... | |
void | getGridCoord (FloatArray &answer, const IntArray &pos) const |
Gives the real coordinates for the given identifier. More... | |
void | getGridCoord (FloatArray &answer, int ind) const |
Gives the real coordinates for the given identifier. More... | |
bool | getPoint (Point *&answer, const IntArray &pos) const |
Gives the point at the position. More... | |
bool | getPoint (Point *&answer, int ind) const |
bool | getSubGrid (ParticleGrid< Point > *&subgrid, const IntArray &pos) const |
Gives the sub-grid at the position. More... | |
bool | getSubGrid (ParticleGrid< Point > *&subgrid, int ind) const |
void | createSubGrid (ParticleGrid< Point > *&subgrid, const IntArray &res, const IntArray &pos) |
Creates a 2 by 2 sub-grid at the given position. More... | |
void | setPoint (Point *point, const IntArray &pos) |
Sets a point in the grid. More... | |
void | setPoint (Point *point, int ind) |
void | clearPosition (const IntArray &pos) |
Deletes any preexisting data at position. More... | |
void | clearPosition (int ind) |
void | getPointsWithin (std::list< Point * > &answer, const FloatArray &x0, const FloatArray &x1) |
void | appendAllPoints (std::list< Point * > &answer) |
void | getBoundingBox (const FloatArray &x0, const FloatArray &x1, IntArray &ind0, IntArray &ind1) const |
Finds the indices [ind0, ind1) of the bounding box [x0,x1). More... | |
void | getPosition (const FloatArray &x, IntArray &pos) const |
Finds the position closest to coordinate x. More... | |
std::string | errorInfo (const char *func) const |
Protected Member Functions | |
int | giveIndex (const IntArray &pos) const |
Translates from n-D position to total position. More... | |
void | givePosition (IntArray &pos, int index) const |
Translates from total position to n-D position. More... | |
void | init (const IntArray &res, const FloatArray &bb0, const FloatArray &bb1) |
Initiation of structure, used by constructors. More... | |
Protected Attributes | |
int | n |
Number of dimensions of the grid. More... | |
IntArray | res |
Resolution in each dimension. More... | |
int | total |
Total grid points. More... | |
FloatArray | bb0 |
Bounding boxes. More... | |
FloatArray | bb1 |
FloatArray | dx |
Grid increments. More... | |
RefinedParticlePoint ** | data |
Particle data structure. More... | |
IntArray | res_prod |
Helper for index <-> position, the cumulative product of res. More... | |
Friends | |
class | ParticleGridIterator< Point > |
Particle grid data structure for n-D grids.
Supports local refinements through recursively implementing sub grids into points.
Definition at line 57 of file particlegrid.h.
typedef ParticleGridIterator<Point> oofem::ParticleGrid< Point >::iterator |
List iterator type.
Definition at line 61 of file particlegrid.h.
oofem::ParticleGrid< Point >::ParticleGrid | ( | const IntArray & | res, |
const FloatArray & | bb0, | ||
const FloatArray & | bb1 | ||
) |
Creates a new empty particle grid.
res | Resolution in respective direction. |
bb0 | Lower corner of bounding box. |
bb1 | Upper corner of bounding box. |
Definition at line 236 of file particlegrid.h.
oofem::ParticleGrid< Point >::ParticleGrid | ( | const ParticleGrid< Point > * | old | ) |
Copies structure of old particle grid, but no content.
old | ParticleGrid to copy. |
Definition at line 242 of file particlegrid.h.
References oofem::ParticleGrid< Point >::bb0, oofem::ParticleGrid< Point >::bb1, and oofem::ParticleGrid< Point >::res.
oofem::ParticleGrid< Point >::~ParticleGrid | ( | ) |
Destructor.
Definition at line 278 of file particlegrid.h.
void oofem::ParticleGrid< Point >::appendAllPoints | ( | std::list< Point * > & | answer | ) |
Definition at line 430 of file particlegrid.h.
References OOFEM_ERROR, oofem::ParticleGrid< Point >::RefinedParticlePoint::point, and oofem::ParticleGrid< Point >::RefinedParticlePoint::subgrid.
ParticleGrid< Point >::iterator oofem::ParticleGrid< Point >::begin | ( | ) |
Returns an iterator over the entire grid (with subgrids)
Definition at line 383 of file particlegrid.h.
ParticleGrid< Point >::iterator oofem::ParticleGrid< Point >::beginAt | ( | const FloatArray & | x0, |
const FloatArray & | x1 | ||
) |
Returns an iterator over specified region.
Definition at line 390 of file particlegrid.h.
Referenced by oofem::ParticleTopologyDescription::addCorner().
void oofem::ParticleGrid< Point >::clearPosition | ( | const IntArray & | pos | ) |
Deletes any preexisting data at position.
[in] | pos | Position to clear. |
Definition at line 486 of file particlegrid.h.
Referenced by oofem::ParticleTopologyDescription::removePoints().
void oofem::ParticleGrid< Point >::clearPosition | ( | int | ind | ) |
Definition at line 492 of file particlegrid.h.
References oofem::ParticleGrid< Point >::RefinedParticlePoint::point, and oofem::ParticleGrid< Point >::RefinedParticlePoint::subgrid.
void oofem::ParticleGrid< Point >::createSubGrid | ( | ParticleGrid< Point > *& | subgrid, |
const IntArray & | res, | ||
const IntArray & | pos | ||
) |
Creates a 2 by 2 sub-grid at the given position.
Any existing point or sub-grid is deleted.
[out] | subgrid | Newly created sub-grid. |
[in] | res | Resolution of new sub-grid. |
[in] | pos | Position of sub-grid. |
Definition at line 532 of file particlegrid.h.
References oofem::FloatArray::add(), and oofem::ParticleGrid< Point >::RefinedParticlePoint::point.
|
inline |
Definition at line 230 of file particlegrid.h.
void oofem::ParticleGrid< Point >::getBoundingBox | ( | const FloatArray & | x0, |
const FloatArray & | x1, | ||
IntArray & | ind0, | ||
IntArray & | ind1 | ||
) | const |
Finds the indices [ind0, ind1) of the bounding box [x0,x1).
[in] | x0 | Lower limit of box. |
[in] | x1 | Upper limit of box. |
[out] | ind0 | Lower index corresponding to x0. |
[out] | ind1 | Upper index |
Definition at line 361 of file particlegrid.h.
References oofem::max(), oofem::min(), and oofem::IntArray::resize().
void oofem::ParticleGrid< Point >::getGridCoord | ( | FloatArray & | answer, |
const IntArray & | pos | ||
) | const |
Gives the real coordinates for the given identifier.
[out] | answer | The coordinate vector. |
[in] | pos | Position for the grid point. |
Definition at line 344 of file particlegrid.h.
References oofem::FloatArray::resize().
Referenced by oofem::ParticleGridIterator< Point >::getGridPoint().
void oofem::ParticleGrid< Point >::getGridCoord | ( | FloatArray & | answer, |
int | ind | ||
) | const |
Gives the real coordinates for the given identifier.
[out] | answer | The coordinate vector. |
[in] | ind | Identifier for the grid point. |
Definition at line 353 of file particlegrid.h.
|
inline |
Returns the grid increment.
i | Index of dimension. |
Definition at line 152 of file particlegrid.h.
int oofem::ParticleGrid< Point >::getNumberOfPoints | ( | ) | const |
Number of active points.
Definition at line 288 of file particlegrid.h.
References oofem::ParticleGrid< Point >::RefinedParticlePoint::point, and oofem::ParticleGrid< Point >::RefinedParticlePoint::subgrid.
bool oofem::ParticleGrid< Point >::getPoint | ( | Point *& | answer, |
const IntArray & | pos | ||
) | const |
Gives the point at the position.
[out] | answer | The point as requested position |
[in] | pos | The requested position |
Definition at line 447 of file particlegrid.h.
Referenced by oofem::ParticleTopologyDescription::removePoints().
bool oofem::ParticleGrid< Point >::getPoint | ( | Point *& | answer, |
int | ind | ||
) | const |
Definition at line 459 of file particlegrid.h.
References oofem::ParticleGrid< Point >::RefinedParticlePoint::point.
void oofem::ParticleGrid< Point >::getPointsWithin | ( | std::list< Point * > & | answer, |
const FloatArray & | x0, | ||
const FloatArray & | x1 | ||
) |
Definition at line 399 of file particlegrid.h.
References OOFEM_ERROR, oofem::ParticleGrid< Point >::RefinedParticlePoint::point, and oofem::ParticleGrid< Point >::RefinedParticlePoint::subgrid.
void oofem::ParticleGrid< Point >::getPosition | ( | const FloatArray & | x, |
IntArray & | pos | ||
) | const |
Finds the position closest to coordinate x.
[in] | x | Coordinate. |
[out] | pos | Position of closest grid point. |
Definition at line 372 of file particlegrid.h.
References oofem::max(), oofem::min(), and oofem::IntArray::resize().
|
inline |
Returns the resolution in given dimension.
i | Index of dimension. |
Definition at line 144 of file particlegrid.h.
bool oofem::ParticleGrid< Point >::getSubGrid | ( | ParticleGrid< Point > *& | subgrid, |
const IntArray & | pos | ||
) | const |
Gives the sub-grid at the position.
[out] | subgrid | Requested sub-grid. |
[in] | pos | Position. |
Definition at line 526 of file particlegrid.h.
bool oofem::ParticleGrid< Point >::getSubGrid | ( | ParticleGrid< Point > *& | subgrid, |
int | ind | ||
) | const |
Definition at line 508 of file particlegrid.h.
References oofem::ParticleGrid< Point >::RefinedParticlePoint::subgrid.
|
inline |
Total number potential points.
Definition at line 127 of file particlegrid.h.
Referenced by oofem::ParticleTopologyDescription::removePoints().
|
inline |
Returns Number of dimensions of grid.
Definition at line 123 of file particlegrid.h.
|
protected |
Translates from n-D position to total position.
pos | n-D position. |
Definition at line 325 of file particlegrid.h.
Referenced by oofem::ParticleGridIterator< Point >::operator++(), and oofem::ParticleGridIterator< Point >::ParticleGridIterator().
|
protected |
Translates from total position to n-D position.
pos | n-D position. |
index | Total position. |
Definition at line 335 of file particlegrid.h.
References oofem::IntArray::resize().
|
protected |
Initiation of structure, used by constructors.
res | Resolution array. |
bb0 | Lower bounding box. |
bb1 | Upper bounding box. |
Definition at line 248 of file particlegrid.h.
References oofem::IntArray::giveSize().
bool oofem::ParticleGrid< Point >::isEmpty | ( | ) | const |
Returns true if the entire grid is empty.
Definition at line 306 of file particlegrid.h.
References oofem::ParticleGrid< Point >::RefinedParticlePoint::point, and oofem::ParticleGrid< Point >::RefinedParticlePoint::subgrid.
Referenced by oofem::ParticleTopologyDescription::removePoints().
void oofem::ParticleGrid< Point >::setPoint | ( | Point * | point, |
const IntArray & | pos | ||
) |
Sets a point in the grid.
Deletes any preexisting data.
[in] | point | Point to set at position pos. |
[in] | pos | Position. |
Definition at line 453 of file particlegrid.h.
Referenced by oofem::ParticleGridIterator< Point >::setPoint().
void oofem::ParticleGrid< Point >::setPoint | ( | Point * | point, |
int | ind | ||
) |
Definition at line 477 of file particlegrid.h.
References oofem::ParticleGrid< Point >::RefinedParticlePoint::point.
|
friend |
Definition at line 232 of file particlegrid.h.
|
protected |
Bounding boxes.
Definition at line 77 of file particlegrid.h.
Referenced by oofem::ParticleGrid< Point >::ParticleGrid().
|
protected |
Definition at line 77 of file particlegrid.h.
Referenced by oofem::ParticleGrid< Point >::ParticleGrid().
|
protected |
Particle data structure.
Definition at line 81 of file particlegrid.h.
Referenced by oofem::ParticleGridIterator< Point >::getPoint(), oofem::ParticleGridIterator< Point >::operator++(), and oofem::ParticleGridIterator< Point >::ParticleGridIterator().
|
protected |
Grid increments.
Definition at line 79 of file particlegrid.h.
|
protected |
Number of dimensions of the grid.
Definition at line 71 of file particlegrid.h.
|
protected |
Resolution in each dimension.
Definition at line 73 of file particlegrid.h.
Referenced by oofem::ParticleGrid< Point >::ParticleGrid().
|
protected |
Helper for index <-> position, the cumulative product of res.
Definition at line 83 of file particlegrid.h.
|
protected |
Total grid points.
Definition at line 75 of file particlegrid.h.