OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
oofem::ParticleGrid< Point > Class Template Reference

Particle grid data structure for n-D grids. More...

#include <particlegrid.h>

+ Collaboration diagram for oofem::ParticleGrid< Point >:

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 >
 

Detailed Description

template<class Point>
class oofem::ParticleGrid< Point >

Particle grid data structure for n-D grids.

Supports local refinements through recursively implementing sub grids into points.

Author
Mikael Öhman

Definition at line 57 of file particlegrid.h.

Member Typedef Documentation

template<class Point>
typedef ParticleGridIterator<Point> oofem::ParticleGrid< Point >::iterator

List iterator type.

Definition at line 61 of file particlegrid.h.

Constructor & Destructor Documentation

template<class Point >
oofem::ParticleGrid< Point >::ParticleGrid ( const IntArray res,
const FloatArray bb0,
const FloatArray bb1 
)

Creates a new empty particle grid.

Parameters
resResolution in respective direction.
bb0Lower corner of bounding box.
bb1Upper corner of bounding box.

Definition at line 236 of file particlegrid.h.

template<class Point >
oofem::ParticleGrid< Point >::ParticleGrid ( const ParticleGrid< Point > *  old)

Copies structure of old particle grid, but no content.

Parameters
oldParticleGrid to copy.

Definition at line 242 of file particlegrid.h.

References oofem::ParticleGrid< Point >::bb0, oofem::ParticleGrid< Point >::bb1, and oofem::ParticleGrid< Point >::res.

template<class Point >
oofem::ParticleGrid< Point >::~ParticleGrid ( )

Destructor.

Definition at line 278 of file particlegrid.h.

Member Function Documentation

template<class Point >
void oofem::ParticleGrid< Point >::appendAllPoints ( std::list< Point * > &  answer)
template<class Point >
ParticleGrid< Point >::iterator oofem::ParticleGrid< Point >::begin ( )

Returns an iterator over the entire grid (with subgrids)

Definition at line 383 of file particlegrid.h.

template<class Point >
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().

template<class Point >
void oofem::ParticleGrid< Point >::clearPosition ( const IntArray pos)

Deletes any preexisting data at position.

Parameters
[in]posPosition to clear.

Definition at line 486 of file particlegrid.h.

Referenced by oofem::ParticleTopologyDescription::removePoints().

template<class Point >
void oofem::ParticleGrid< Point >::clearPosition ( int  ind)
template<class Point >
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.

Parameters
[out]subgridNewly created sub-grid.
[in]resResolution of new sub-grid.
[in]posPosition of sub-grid.

Definition at line 532 of file particlegrid.h.

References oofem::FloatArray::add(), and oofem::ParticleGrid< Point >::RefinedParticlePoint::point.

template<class Point>
std :: string oofem::ParticleGrid< Point >::errorInfo ( const char *  func) const
inline

Definition at line 230 of file particlegrid.h.

template<class Point >
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).

Parameters
[in]x0Lower limit of box.
[in]x1Upper limit of box.
[out]ind0Lower index corresponding to x0.
[out]ind1Upper index

Definition at line 361 of file particlegrid.h.

References oofem::max(), oofem::min(), and oofem::IntArray::resize().

template<class Point >
void oofem::ParticleGrid< Point >::getGridCoord ( FloatArray answer,
const IntArray pos 
) const

Gives the real coordinates for the given identifier.

Parameters
[out]answerThe coordinate vector.
[in]posPosition for the grid point.

Definition at line 344 of file particlegrid.h.

References oofem::FloatArray::resize().

Referenced by oofem::ParticleGridIterator< Point >::getGridPoint().

template<class Point >
void oofem::ParticleGrid< Point >::getGridCoord ( FloatArray answer,
int  ind 
) const

Gives the real coordinates for the given identifier.

Parameters
[out]answerThe coordinate vector.
[in]indIdentifier for the grid point.

Definition at line 353 of file particlegrid.h.

template<class Point>
double oofem::ParticleGrid< Point >::getGridStep ( int  i) const
inline

Returns the grid increment.

Parameters
iIndex of dimension.
Returns
Grid step in dimension i.

Definition at line 152 of file particlegrid.h.

template<class Point >
int oofem::ParticleGrid< Point >::getNumberOfPoints ( ) const
template<class Point >
bool oofem::ParticleGrid< Point >::getPoint ( Point *&  answer,
const IntArray pos 
) const

Gives the point at the position.

Parameters
[out]answerThe point as requested position
[in]posThe requested position
Returns
true if point is active, otherwise false

Definition at line 447 of file particlegrid.h.

Referenced by oofem::ParticleTopologyDescription::removePoints().

template<class Point >
bool oofem::ParticleGrid< Point >::getPoint ( Point *&  answer,
int  ind 
) const
template<class Point >
void oofem::ParticleGrid< Point >::getPointsWithin ( std::list< Point * > &  answer,
const FloatArray x0,
const FloatArray x1 
)
template<class Point >
void oofem::ParticleGrid< Point >::getPosition ( const FloatArray x,
IntArray pos 
) const

Finds the position closest to coordinate x.

Parameters
[in]xCoordinate.
[out]posPosition of closest grid point.

Definition at line 372 of file particlegrid.h.

References oofem::max(), oofem::min(), and oofem::IntArray::resize().

template<class Point>
int oofem::ParticleGrid< Point >::getResolution ( int  i)
inline

Returns the resolution in given dimension.

Parameters
iIndex of dimension.
Returns
Resolution in dimension i.

Definition at line 144 of file particlegrid.h.

template<class Point >
bool oofem::ParticleGrid< Point >::getSubGrid ( ParticleGrid< Point > *&  subgrid,
const IntArray pos 
) const

Gives the sub-grid at the position.

Parameters
[out]subgridRequested sub-grid.
[in]posPosition.
Returns
true if sub-grid is active, otherwise false.

Definition at line 526 of file particlegrid.h.

template<class Point >
bool oofem::ParticleGrid< Point >::getSubGrid ( ParticleGrid< Point > *&  subgrid,
int  ind 
) const
template<class Point>
int oofem::ParticleGrid< Point >::getTotal ( ) const
inline

Total number potential points.

Definition at line 127 of file particlegrid.h.

Referenced by oofem::ParticleTopologyDescription::removePoints().

template<class Point>
int oofem::ParticleGrid< Point >::giveDimensions ( )
inline

Returns Number of dimensions of grid.

Definition at line 123 of file particlegrid.h.

template<class Point >
int oofem::ParticleGrid< Point >::giveIndex ( const IntArray pos) const
protected

Translates from n-D position to total position.

Parameters
posn-D position.
Returns
Total position.

Definition at line 325 of file particlegrid.h.

Referenced by oofem::ParticleGridIterator< Point >::operator++(), and oofem::ParticleGridIterator< Point >::ParticleGridIterator().

template<class Point >
void oofem::ParticleGrid< Point >::givePosition ( IntArray pos,
int  index 
) const
protected

Translates from total position to n-D position.

Parameters
posn-D position.
indexTotal position.

Definition at line 335 of file particlegrid.h.

References oofem::IntArray::resize().

template<class Point >
void oofem::ParticleGrid< Point >::init ( const IntArray res,
const FloatArray bb0,
const FloatArray bb1 
)
protected

Initiation of structure, used by constructors.

Parameters
resResolution array.
bb0Lower bounding box.
bb1Upper bounding box.

Definition at line 248 of file particlegrid.h.

References oofem::IntArray::giveSize().

template<class Point >
bool oofem::ParticleGrid< Point >::isEmpty ( ) const
template<class Point >
void oofem::ParticleGrid< Point >::setPoint ( Point *  point,
const IntArray pos 
)

Sets a point in the grid.

Deletes any preexisting data.

Parameters
[in]pointPoint to set at position pos.
[in]posPosition.

Definition at line 453 of file particlegrid.h.

Referenced by oofem::ParticleGridIterator< Point >::setPoint().

template<class Point >
void oofem::ParticleGrid< Point >::setPoint ( Point *  point,
int  ind 
)

Friends And Related Function Documentation

template<class Point>
friend class ParticleGridIterator< Point >
friend

Definition at line 232 of file particlegrid.h.

Member Data Documentation

template<class Point>
FloatArray oofem::ParticleGrid< Point >::bb0
protected

Bounding boxes.

Definition at line 77 of file particlegrid.h.

Referenced by oofem::ParticleGrid< Point >::ParticleGrid().

template<class Point>
FloatArray oofem::ParticleGrid< Point >::bb1
protected

Definition at line 77 of file particlegrid.h.

Referenced by oofem::ParticleGrid< Point >::ParticleGrid().

template<class Point>
FloatArray oofem::ParticleGrid< Point >::dx
protected

Grid increments.

Definition at line 79 of file particlegrid.h.

template<class Point>
int oofem::ParticleGrid< Point >::n
protected

Number of dimensions of the grid.

Definition at line 71 of file particlegrid.h.

template<class Point>
IntArray oofem::ParticleGrid< Point >::res
protected

Resolution in each dimension.

Definition at line 73 of file particlegrid.h.

Referenced by oofem::ParticleGrid< Point >::ParticleGrid().

template<class Point>
IntArray oofem::ParticleGrid< Point >::res_prod
protected

Helper for index <-> position, the cumulative product of res.

Definition at line 83 of file particlegrid.h.

template<class Point>
int oofem::ParticleGrid< Point >::total
protected

Total grid points.

Definition at line 75 of file particlegrid.h.


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

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:39 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011