O P A R - Open Architecture Particle in Cell Simulation - Version 3.0
Plasma simulations with dust particles
 All Classes Files Functions Variables Friends Macros Groups Pages
Public Member Functions | Protected Attributes
grid< T > Class Template Reference

A n-dimensional grid of arbitrary type to hold, densities, fields, boundary values etc. Unlike C-arrays the grid size specifies the maximum index of the elements. This means that the grid contains one element more in each direction than the equivalent C-array. Elements are from (0,0,...,0) to (size[0], size[1], ... , size[n]). The implementation is mostly independent on the dimension of the system because it makes use of the dimensionality dependent Position and GridPosition classes. More...

#include <numeric.h>

List of all members.

Public Member Functions

 grid ()
 Default constructor.
 grid (GridPosition size_)
 Construct with size.
 grid (const grid &agrid)
const GridPositionSize () const
 The n-dimensional size of the grid.
void Resize (const GridPosition &asize)
 Resizes the grid. Makes use of the resize method of valarray to free/reallocate the memory.
const gridoperator= (const std::valarray< T > arr)
 assignment operator. Copies the elements of one array into the other. This operator only works when the two grids are of equal size.
const gridoperator= (const T val)
const gridoperator+= (const std::valarray< T > arr)
 operators for addition, subtraction, multiplication and division. Only the += -= *= and /= operators are defined for efficiency reasons. Uses the according operators of the valarray. Work element-wise. These operators only work when the two grids are of equal size.
const gridoperator+= (const grid &arr)
const gridoperator-= (const std::valarray< T > arr)
const gridoperator-= (const grid &arr)
const gridoperator*= (const T val)
const gridoperator/= (const T val)
T & operator[] (const GridPosition &i)
operator[] (const GridPosition &i) const
operator() (const Position &X) const
grid< Positionderive (Position ddx)
void apply (T fkt())

Protected Attributes

T * G
 Holds the values in a one dimensional valarray.
GridPosition size
 The n-dimensional size of the grid.
int gsize

Detailed Description

template<class T>
class grid< T >

A n-dimensional grid of arbitrary type to hold, densities, fields, boundary values etc. Unlike C-arrays the grid size specifies the maximum index of the elements. This means that the grid contains one element more in each direction than the equivalent C-array. Elements are from (0,0,...,0) to (size[0], size[1], ... , size[n]). The implementation is mostly independent on the dimension of the system because it makes use of the dimensionality dependent Position and GridPosition classes.

Todo:
Write iterators for n–dimensional grid, getting rid of macros in the loops. This results in unreadable code.

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