OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
oofem::Grid Class Reference

Class that solves certain problems on a regular 2D grid, consisting of n x m nodes. More...

#include <grid.h>

+ Collaboration diagram for oofem::Grid:

Public Member Functions

 Grid (int N, int M)
 Constructor (N = horizontal dimension, M = vertical dimension) More...
 
 ~Grid ()
 Destructor. More...
 
int giveSizeHorizontal ()
 Size information. More...
 
int giveSizeVertical ()
 
int giveSize (int dir)
 
void unFreeze ()
 Set all flags to "unfrozen". More...
 
void setMethod (int o, double i, int c)
 Set the details of the algorithm to be used. More...
 
void setPrescribedFieldValue (int i, int j, double val)
 Method setting the values of the prescribed field (e.g., front velocities) More...
 
FloatMatrixgivePrescribedField ()
 
void setZeroValues (FloatMatrix *gridCoords)
 Methods setting the values of the unknown field at selected points (e.g., zero times) More...
 
void setSolutionValueAt (int i, int j, double value)
 
double giveSolutionValueAt (int i, int j)
 Output methods. More...
 
void printSolutionAsData ()
 

Private Member Functions

void fastMarch (int &eFlag)
 Fast marching method, solving the eikonal equation. More...
 
double calcTime (int i, int j, double Fij, int ord, int &eFlag)
 Auxiliary function that evaluates the tentative value at one grid point, exploited by the fast marching method. More...
 
int ij2ind (int i, int j, int m)
 Utility methods. More...
 
int ind2i (int ind, int m)
 
int ind2j (int ind, int m)
 
bool isInDomain (int i, int j, int m, int n)
 

Private Attributes

int n
 Grid dimensions: number of grid nodes horizontally (n) and vertically (m) More...
 
int m
 
int order
 Algorithmic parameters. More...
 
double initDiag
 
int centDiff
 
bool solutionAvailable
 Flag indicating whether the solution has been computed. More...
 
FloatMatrixT
 Matrix storing the values of the unknown (computed) field (e.g., arrival times) More...
 
FloatMatrixF
 Matrix storing the values of the prescribed field (e.g., front velocities) More...
 
bool * Frozen
 Array storing indicators of frozen points (at which the solution is already known) More...
 
HeapnarrowBand
 Heap used for efficient sorting and detection of smallest candidate. More...
 

Detailed Description

Class that solves certain problems on a regular 2D grid, consisting of n x m nodes.

Currently it implements the fast marching algorithm that solves the eikonal equation. This can be useful for instance for tracing evolving curves. One could also implement finite differences or similar techniques.

The indexing convention is a bit unusual but it follows the original code, which was developed for image analysis. Subscripts "i" and "j" refer to rows and columns of the matrix, but this means that "i" grows in the vertical direction and corresponds to physical coordinate "y". i ... from 1 to m, corresponds to coordinate y j ... from 1 to n, corresponds to coordinate x Actually, for the numerical method it does not matter which direction is horizontal and which one is vertical, but the user should know how to interpret the data. The constructor should get the horizontal dimension first and the vertical one second (n,m). The coordinates of points at which zero value is prescribed should be passed as (x,y). The prescribed field (e.g., propagating front velocity) should be stored by rows, i.e., (1,1), (1,2), (1,3), ... (1,m), (2,1), (2,2,) ... (n,m). If the solution is printed as a matrix, it is arranged on the screen in the natural way. If the solution is printed as data, each output line corresponds to (x,y,value), where x=j and y=i. Conversion to grids with non-unit spacing and shifter corner must be done by the user.

Definition at line 32 of file grid.h.

Constructor & Destructor Documentation

oofem::Grid::Grid ( int  N,
int  M 
)

Constructor (N = horizontal dimension, M = vertical dimension)

Definition at line 46 of file grid.C.

References F, Frozen, m, n, N, narrowBand, solutionAvailable, and T.

oofem::Grid::~Grid ( )

Destructor.

Definition at line 59 of file grid.C.

References F, Frozen, narrowBand, and T.

Member Function Documentation

double oofem::Grid::calcTime ( int  i,
int  j,
double  Fij,
int  ord,
int &  eFlag 
)
private

Auxiliary function that evaluates the tentative value at one grid point, exploited by the fast marching method.

Definition at line 303 of file grid.C.

References oofem::FloatMatrix::at(), centDiff, F, Frozen, ij2ind(), isInDomain(), m, MAX, MIN, n, and T.

Referenced by fastMarch().

void oofem::Grid::fastMarch ( int &  eFlag)
private
FloatMatrix* oofem::Grid::givePrescribedField ( )
inline
int oofem::Grid::giveSize ( int  dir)

Definition at line 70 of file grid.C.

References m, and n.

Referenced by giveSizeVertical().

int oofem::Grid::giveSizeHorizontal ( )
inline

Size information.

Definition at line 41 of file grid.h.

References n.

int oofem::Grid::giveSizeVertical ( )
inline

Definition at line 42 of file grid.h.

References giveSize(), m, and unFreeze().

double oofem::Grid::giveSolutionValueAt ( int  i,
int  j 
)
int oofem::Grid::ij2ind ( int  i,
int  j,
int  m 
)
inlineprivate

Utility methods.

Definition at line 96 of file grid.h.

Referenced by calcTime(), fastMarch(), and setZeroValues().

int oofem::Grid::ind2i ( int  ind,
int  m 
)
inlineprivate

Definition at line 97 of file grid.h.

References m.

Referenced by fastMarch().

int oofem::Grid::ind2j ( int  ind,
int  m 
)
inlineprivate

Definition at line 98 of file grid.h.

Referenced by fastMarch().

bool oofem::Grid::isInDomain ( int  i,
int  j,
int  m,
int  n 
)
inlineprivate

Definition at line 99 of file grid.h.

Referenced by calcTime(), fastMarch(), and setZeroValues().

void oofem::Grid::printSolutionAsData ( )

Definition at line 216 of file grid.C.

References oofem::FloatMatrix::at(), m, n, and T.

Referenced by givePrescribedField().

void oofem::Grid::setMethod ( int  o,
double  i,
int  c 
)
inline

Set the details of the algorithm to be used.

Definition at line 49 of file grid.h.

References centDiff, initDiag, and order.

Referenced by oofem::NonlocalMaterialExtensionInterface::modifyNonlocalWeightFunctionAround().

void oofem::Grid::setPrescribedFieldValue ( int  i,
int  j,
double  val 
)
inline

Method setting the values of the prescribed field (e.g., front velocities)

Definition at line 53 of file grid.h.

References oofem::FloatMatrix::at(), and F.

void oofem::Grid::setSolutionValueAt ( int  i,
int  j,
double  value 
)

Definition at line 196 of file grid.C.

References oofem::FloatMatrix::at(), solutionAvailable, and T.

Referenced by givePrescribedField().

void oofem::Grid::setZeroValues ( FloatMatrix gridCoords)
void oofem::Grid::unFreeze ( )

Member Data Documentation

int oofem::Grid::centDiff
private

Definition at line 72 of file grid.h.

Referenced by calcTime(), setMethod(), and setZeroValues().

FloatMatrix* oofem::Grid::F
private

Matrix storing the values of the prescribed field (e.g., front velocities)

Definition at line 81 of file grid.h.

Referenced by calcTime(), fastMarch(), givePrescribedField(), Grid(), setPrescribedFieldValue(), setZeroValues(), and ~Grid().

bool* oofem::Grid::Frozen
private

Array storing indicators of frozen points (at which the solution is already known)

Definition at line 84 of file grid.h.

Referenced by calcTime(), fastMarch(), Grid(), setZeroValues(), unFreeze(), and ~Grid().

double oofem::Grid::initDiag
private

Definition at line 71 of file grid.h.

Referenced by setMethod(), and setZeroValues().

int oofem::Grid::m
private
int oofem::Grid::n
private

Grid dimensions: number of grid nodes horizontally (n) and vertically (m)

Definition at line 67 of file grid.h.

Referenced by calcTime(), fastMarch(), giveSize(), giveSizeHorizontal(), Grid(), printSolutionAsData(), setZeroValues(), and unFreeze().

Heap* oofem::Grid::narrowBand
private

Heap used for efficient sorting and detection of smallest candidate.

Definition at line 87 of file grid.h.

Referenced by fastMarch(), Grid(), unFreeze(), and ~Grid().

int oofem::Grid::order
private

Algorithmic parameters.

Definition at line 70 of file grid.h.

Referenced by fastMarch(), and setMethod().

bool oofem::Grid::solutionAvailable
private

Flag indicating whether the solution has been computed.

Definition at line 75 of file grid.h.

Referenced by fastMarch(), giveSolutionValueAt(), Grid(), setSolutionValueAt(), setZeroValues(), and unFreeze().

FloatMatrix* oofem::Grid::T
private

Matrix storing the values of the unknown (computed) field (e.g., arrival times)

Definition at line 78 of file grid.h.

Referenced by calcTime(), fastMarch(), giveSolutionValueAt(), Grid(), printSolutionAsData(), setSolutionValueAt(), setZeroValues(), and ~Grid().


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

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:36 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011