IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.

IG::Num::GridGenerator1dBase Class Reference

Base class for 1D grid generators. More...

Inheritance diagram for IG::Num::GridGenerator1dBase:
Collaboration diagram for IG::Num::GridGenerator1dBase:

List of all members.

Public Member Functions

virtual void ClearResults ()
 Clears the results of grid generation (releases internal structures). The Calculated flag is set to false.
abstract void CalculateGrid (ref List< double > nodeList)
 Performs grid generation and stores the generated nodes directly on the provided list. Unless necessary due to nature of generation, results are not stored internally on the current grid generator object. Because of this, the Calculated flag is normally not set after calling this function. WARNING: This method generates a grid even if it has already been generated and is up to date.
virtual void CalculateGrid (ref List< double > nodeList, ref List< double > intervalLengthsList)
 Performs grid generation and stores the generated nodes and intervals between them directly on the provided lists. Unless necessary due to nature of generation, results are not stored internally on the current grid generator object. Because of this, the Calculated flag is normally not set after calling this function. WARNING: This method generates a grid even if it has already been generated and is up to date.
virtual void CalculateGrid ()
 Performs grid generation according to current settings. The generated grid is stored in internal structures of the generator, from where it can be readily copied (e.g. by GetNodeTable() or by GetNodeList()), used in some other way (e.g. by GetIntervalLengthsList) or just referenced (e.g. by GetNodeListReference()). If the grid has already been generated and it is up to date (according to parameters of the generator) then the grid is not re-calculated.
virtual double GetNode (int which)
 Returns the specified node of the generated grid. If necessary, grid is generated first in order to obtain the correct data.
virtual void GetNodeTable (ref double[] result)
 Stores the node positions of the generated 1D grid into the specified table. If necessary, grid is generated first in order to obtain the correct data.
virtual double[] GetNodeTable ()
 Returns a table containing 1D node positions. A copy of list of node positions is always created and returned, therefore it is guaranteed that this table will not be used by some other object related to the grid generator. If necessary, grid is generated first in order to obtain the correct data.
virtual void GetNodeList (ref List< double > result)
 Stores the node positions of the generated 1D grid into the specified list. If necessary, grid is generated first in order to obtain the correct data.
virtual List< double > GetNodeList ()
 Returns a list containing 1D node positions. A copy of list of node positions is always created and returned, therefore it is guaranteed that this table will not be used by some other object related to the grid generator. If necessary, grid is generated first in order to obtain the correct data.
virtual List< double > GetNodeListReference ()
 Returns a list containing generated 1D node positions. This method can return a reference to the internal list containing the generated node coordinated. This means that any future generation or other operation performed by the generator can override list contents. In order to use contents of the list thread safely, enclose this method call and all subsequent operations you will perform on the returned list of generated nodes, within a lock((...).Lock){ ... } block. If necessary, grid is generated first in order to obtain the correct data.
virtual void GetIntervalLengthsTable (ref double[] result)
 Stores a table of interval lengths between the generated nodes into the specified array. If necessary, grid is generated first in order to obtain the correct data.
virtual double[] GetIntervalLengthsTable ()
 Generates and returns a table of interval lengths between the generated nodes. The returned table is a copy that will not be overridden by further operations on the grid generator. If necessary, grid is generated first in order to obtain the correct data.
virtual void GetIntervalLengthsList (ref List< double > result)
 Stores a table of interval lengths between the generated nodes into the specified list. If necessary, grid is generated first in order to obtain the correct data.
virtual List< double > GetIntervalLengthsList ()
 Generates and returns a list of interval lengths between the generated nodes. The returned list is a copy that will not be overridden by further operations on the grid generator. If necessary, grid is generated first in order to obtain the correct data.
virtual double GetIntervalLength (int which)
 Returns the length of the specified interval between generated nodes of the grid. If necessary, grid is generated first in order to obtain the correct data.

Static Public Member Functions

static GridGenerator1d CreateUniform (double from, double to, int numnodes)
 Creates and returns a 1D grid generator for uniform grid (equidistant intervals).
static GridGenerator1d CreateGeometric (double from, double to, int numNodes, double growthFactor)
 Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometrical series from the lower bound of the grid interval.
static GridGenerator1d CreateGeometricCentered (double from, double to, int numNodes, double growthFactor)
 Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometric series from the center of the grid interval towards the bounds.
static GridGenerator1d CreateGeometricScaled (double from, double to, int numNodes, double growthFactor, double scalingFactor)
 Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometric series from the lower bound towards teh upper bound of the grid interval, and the grid can also be scaled.
static GridGenerator1d CreateGeometricCenteredScaled (double from, double to, int numNodes, double growthFactor, double scalingFactor)
 Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometric series from the center of the grid interval, and the grid can also be scaled.
static GridGenerator1dFunc CreateFunctionBased (double from, double to, int numNodes, IRealFunction function, double firstFunctionArgument, double lastFunctionArgument)
 Creates and returns a 1D grid generator where grid point positions are calculated by the specified function.
static void CalculateGridUnitFactors (int numElements, bool centered, double growthFactor, double scalingFactor, ref List< double > factors)
 Calculates factors for a table of values between two points, and stores them to factors.
static void CalculateGridUnitFactors (int numElements, IRealFunction func, double firstFunctionArgument, double lastFunctionArgument, ref List< double > factors)
 Calculates factors for a table of values between two points, and stores them to a list. Factors are calculated according to values of a function of one variable, evaluated in equidistant points on the specified interval, and scaled such that they lie between 0 and 1. It is caller's responsibility to provide a monotonous function, otherwise some factors can lie outside the [0,1] interval and are not ordered.
static void CalculateIntervalLenghts (List< double > nodes, ref List< double > lengths)
 Calculates lengths of subsequent intervals defined by the first list, and stores it to the second list.
static void CalculateIntervalLenghRatios (List< double > nodes, ref List< double > lengthRatios)
 Calculates length ratios between subsequent intervals defined by the first list, ans stores it to the second list.
static void ExampleTableFactors ()
 Examples for calculating table factors.
static void FitGridNode (double minCurrent, double maxCurrent, double minTarget, double maxTarget, ref double node)
 Grid stretching to fit the specified interval bounds. Modifies position of the generated 1d grid node in such a way that it fits the new grid interval.
static void FitGridNodes (double minCurrent, double maxCurrent, double minTarget, double maxTarget, List< double > nodes)
 Grid stretching to fit the specified interval bounds. Modifies positions of the generated 1d grid nodes contained in the specified list in such a way that it fits the new grid interval.

Protected Member Functions

 GridGenerator1dBase ()

Protected Attributes

List< double > _nodes
 Internally stored generated nodes.

Properties

object Lock [get]
 Object used for locking of the current object (ILockable interface).
virtual double CoordinateFirst [get, set]
 Gets or sets coordinate of the first generated node (usually the minimal generated coordinate).
virtual double CoordinateLast [get, set]
 Gets or sets coordinate of the last generated node (usually the maximal generated coordinate).
virtual int NumNodes [get, set]
 Gets or sets teh number of nodes to be generated.
virtual int NumIntervals [get]
 Gets the number of intervals between the nodes. Simply NumNodes-1.
virtual bool Calculated [get, set]
 Flag indicating whether the grid is generated ready to use. If true then node positions are contained in an internal structure, such that they can be obtained simply by copying this structure (i.e. no need for re-calculation). REMARK: If you intend to do something with results on basis of the value of this flag, don't forget to enclose checking of the flag and your operation into the lock(....Lock){ ... } block.

Private Attributes

object _lockObj = new object()
double _first = 0.0
double _last = 1.0
int _numNodes = 2
bool _calculated = false

Detailed Description

Base class for 1D grid generators.

$A Igor Apr10; Dec10;


Constructor & Destructor Documentation

IG::Num::GridGenerator1dBase::GridGenerator1dBase ( ) [inline, protected]

Member Function Documentation

static GridGenerator1d IG::Num::GridGenerator1dBase::CreateUniform ( double  from,
double  to,
int  numnodes 
) [inline, static]

Creates and returns a 1D grid generator for uniform grid (equidistant intervals).

Parameters:
fromLower bound of the generated 1D grid.
toUpper bound of the generated 1D grid.
numNodesNumber of nodes generated.
static GridGenerator1d IG::Num::GridGenerator1dBase::CreateGeometric ( double  from,
double  to,
int  numNodes,
double  growthFactor 
) [inline, static]

Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometrical series from the lower bound of the grid interval.

Parameters:
fromLower bound of the generated 1D grid.
toUpper bound of the generated 1D grid.
numNodesNumber of nodes generated.
growthFactorFactor of interval growth. Factor 1 means a uniform grid with equidistant intervals. If factor is larger than 1 then intervals grow from the lower bound towards the upper bound. If factor is less than 1 then intervals shrink in this direction.
static GridGenerator1d IG::Num::GridGenerator1dBase::CreateGeometricCentered ( double  from,
double  to,
int  numNodes,
double  growthFactor 
) [inline, static]

Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometric series from the center of the grid interval towards the bounds.

Parameters:
fromLower bound of the generated 1D grid.
toUpper bound of the generated 1D grid.
numNodesNumber of nodes generated.
growthFactorFactor of interval growth. Factor 1 means a uniform grid with equidistant intervals. If factor is larger than 1 then intervals grow from the centertowards the bounds. If factor is less than 1 then intervals shrink in this direction.
static GridGenerator1d IG::Num::GridGenerator1dBase::CreateGeometricScaled ( double  from,
double  to,
int  numNodes,
double  growthFactor,
double  scalingFactor 
) [inline, static]

Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometric series from the lower bound towards teh upper bound of the grid interval, and the grid can also be scaled.

Parameters:
fromLower bound of the generated 1D grid (can change when scaling is applied).
toUpper bound of the generated 1D grid (can change when scaling is applied).
numNodesNumber of nodes generated.
growthFactorFactor of interval growth. Factor 1 means a uniform grid with equidistant intervals. If factor is larger than 1 then intervals grow from the lower bound towards the upper bound. If factor is less than 1 then intervals shrink in this direction.
scalingFactorFactor by which the grid is scaled.
static GridGenerator1d IG::Num::GridGenerator1dBase::CreateGeometricCenteredScaled ( double  from,
double  to,
int  numNodes,
double  growthFactor,
double  scalingFactor 
) [inline, static]

Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometric series from the center of the grid interval, and the grid can also be scaled.

Parameters:
fromLower bound of the generated 1D grid (can change when scaling is applied).
toUpper bound of the generated 1D grid (can change when scaling is applied).
numNodesNumber of nodes generated.
growthFactorFactor of interval growth. Factor 1 means a uniform grid with equidistant intervals. If factor is larger than 1 then intervals grow from the center towards the bounds. If factor is less than 1 then intervals shrink in this direction.
scalingFactorFactor by which the grid is scaled.
static GridGenerator1dFunc IG::Num::GridGenerator1dBase::CreateFunctionBased ( double  from,
double  to,
int  numNodes,
IRealFunction  function,
double  firstFunctionArgument,
double  lastFunctionArgument 
) [inline, static]

Creates and returns a 1D grid generator where grid point positions are calculated by the specified function.

Parameters:
fromLower bound of the generated 1D grid.
toUpper bound of the generated 1D grid.
numNodesNumber of nodes generated.
functionFunction used for evaluation of grid points.
firstFunctionArgumentFirst argument (lower bound of the interval) where grid function is evaluated.
lastFunctionArgumentFirst argument (upper bound of the interval) where grid function is evaluated.
static void IG::Num::GridGenerator1dBase::CalculateGridUnitFactors ( int  numElements,
bool  centered,
double  growthFactor,
double  scalingFactor,
ref List< double >  factors 
) [inline, static]

Calculates factors for a table of values between two points, and stores them to factors.

Parameters:
numElementsNumber of sampling points (elements). It should be greater than 1.
centeredif 0 then factors run from 0 to 1 (for a table is from the specified starting till hte end point), otherwise factors run from -1 to 1 (for tables centered in the starting point, ending in the end point and starting in the reflected end point across the start point).
growthFactorFactor by which length of successive intervals is increases to obtain table with intervals growing in geometric order. If the specified factor is 0 then it is set to 1.
scalingfactoradditional factor by which each factor is mutiplied. If centered!=0 and growthfactor>1 then intervals fall from -1 to 0 and grow from 0 to 1.
factorsOuptput - list where factors are stored.

$A Igor Apr10;

static void IG::Num::GridGenerator1dBase::CalculateGridUnitFactors ( int  numElements,
IRealFunction  func,
double  firstFunctionArgument,
double  lastFunctionArgument,
ref List< double >  factors 
) [inline, static]

Calculates factors for a table of values between two points, and stores them to a list. Factors are calculated according to values of a function of one variable, evaluated in equidistant points on the specified interval, and scaled such that they lie between 0 and 1. It is caller's responsibility to provide a monotonous function, otherwise some factors can lie outside the [0,1] interval and are not ordered.

Parameters:
funcA real-valued function of a real variable that defines distribution of factors. The calculated factors are function values
numElementsNumber of sampling points (elements). It should be greater than 1.
firstFunctionArgumentLower bound of function arguments.
lastFunctionArgumentUpper bound for function arguments.
factorsOuptput - list where factors are stored.

$A Igor Apr10;

static void IG::Num::GridGenerator1dBase::CalculateIntervalLenghts ( List< double >  nodes,
ref List< double >  lengths 
) [inline, static]

Calculates lengths of subsequent intervals defined by the first list, and stores it to the second list.

Parameters:
nodesList containing nodes that define intervals.
lengthsList where interval lengths are stored.
static void IG::Num::GridGenerator1dBase::CalculateIntervalLenghRatios ( List< double >  nodes,
ref List< double >  lengthRatios 
) [inline, static]

Calculates length ratios between subsequent intervals defined by the first list, ans stores it to the second list.

Parameters:
nodesList containing nodes that define intervals.
lengthRatiosList where interval length ratios are stored. This list has two elements less than the original list.
static void IG::Num::GridGenerator1dBase::ExampleTableFactors ( ) [inline, static]

Examples for calculating table factors.

static void IG::Num::GridGenerator1dBase::FitGridNode ( double  minCurrent,
double  maxCurrent,
double  minTarget,
double  maxTarget,
ref double  node 
) [inline, static]

Grid stretching to fit the specified interval bounds. Modifies position of the generated 1d grid node in such a way that it fits the new grid interval.

Parameters:
minCurrentLower bound of the interval containing the current grid.
maxCurrentUpper bound of the interval containing the current grid.
minTargetLower bound of the interval containing the fitted (stretched) grid.
maxTargetLower bound of the interval containing the fitted (stretched) grid.
nodePosition of node to be modified according to grid stretching.
static void IG::Num::GridGenerator1dBase::FitGridNodes ( double  minCurrent,
double  maxCurrent,
double  minTarget,
double  maxTarget,
List< double >  nodes 
) [inline, static]

Grid stretching to fit the specified interval bounds. Modifies positions of the generated 1d grid nodes contained in the specified list in such a way that it fits the new grid interval.

Parameters:
minCurrentLower bound of the interval containing the current grid.
maxCurrentUpper bound of the interval containing the current grid.
minTargetLower bound of the interval containing the fitted (stretched) grid.
maxTargetLower bound of the interval containing the fitted (stretched) grid.
nodeList containing positions of node to be modified according to grid stretching.
virtual void IG::Num::GridGenerator1dBase::ClearResults ( ) [inline, virtual]

Clears the results of grid generation (releases internal structures). The Calculated flag is set to false.

Implements IG::Num::IGridGenerator1d.

abstract void IG::Num::GridGenerator1dBase::CalculateGrid ( ref List< double >  nodeList) [pure virtual]

Performs grid generation and stores the generated nodes directly on the provided list. Unless necessary due to nature of generation, results are not stored internally on the current grid generator object. Because of this, the Calculated flag is normally not set after calling this function. WARNING: This method generates a grid even if it has already been generated and is up to date.

Parameters:
nodeListA list where node coordinates are stored. List is allocated or re-allocated if necessary.

Implements IG::Num::IGridGenerator1d.

Implemented in IG::Num::GridGenerator1d, and IG::Num::GridGenerator1dFunc.

virtual void IG::Num::GridGenerator1dBase::CalculateGrid ( ref List< double >  nodeList,
ref List< double >  intervalLengthsList 
) [inline, virtual]

Performs grid generation and stores the generated nodes and intervals between them directly on the provided lists. Unless necessary due to nature of generation, results are not stored internally on the current grid generator object. Because of this, the Calculated flag is normally not set after calling this function. WARNING: This method generates a grid even if it has already been generated and is up to date.

Parameters:
nodeListA list where positions of the generated grid are stored.
intervalLengthsListA list where lengths of intervals between grid nodes are stored.

Implements IG::Num::IGridGenerator1d.

virtual void IG::Num::GridGenerator1dBase::CalculateGrid ( ) [inline, virtual]

Performs grid generation according to current settings. The generated grid is stored in internal structures of the generator, from where it can be readily copied (e.g. by GetNodeTable() or by GetNodeList()), used in some other way (e.g. by GetIntervalLengthsList) or just referenced (e.g. by GetNodeListReference()). If the grid has already been generated and it is up to date (according to parameters of the generator) then the grid is not re-calculated.

Implements IG::Num::IGridGenerator1d.

virtual double IG::Num::GridGenerator1dBase::GetNode ( int  which) [inline, virtual]

Returns the specified node of the generated grid. If necessary, grid is generated first in order to obtain the correct data.

Parameters:
whichSpecifies which node (counted from 0) is to be returned.
Returns:
Position of the specified node of the grid.

Implements IG::Num::IGridGenerator1d.

virtual void IG::Num::GridGenerator1dBase::GetNodeTable ( ref double[]  result) [inline, virtual]

Stores the node positions of the generated 1D grid into the specified table. If necessary, grid is generated first in order to obtain the correct data.

Parameters:
resultTable where node positions of the generated grid are stored. Allocated or relocated if necessary.

Implements IG::Num::IGridGenerator1d.

virtual double [] IG::Num::GridGenerator1dBase::GetNodeTable ( ) [inline, virtual]

Returns a table containing 1D node positions. A copy of list of node positions is always created and returned, therefore it is guaranteed that this table will not be used by some other object related to the grid generator. If necessary, grid is generated first in order to obtain the correct data.

Implements IG::Num::IGridGenerator1d.

virtual void IG::Num::GridGenerator1dBase::GetNodeList ( ref List< double >  result) [inline, virtual]

Stores the node positions of the generated 1D grid into the specified list. If necessary, grid is generated first in order to obtain the correct data.

Parameters:
resultList where node positions of the generated grid are stored. Allocated or relocated if necessary.

Implements IG::Num::IGridGenerator1d.

virtual List<double> IG::Num::GridGenerator1dBase::GetNodeList ( ) [inline, virtual]

Returns a list containing 1D node positions. A copy of list of node positions is always created and returned, therefore it is guaranteed that this table will not be used by some other object related to the grid generator. If necessary, grid is generated first in order to obtain the correct data.

Returns:

Implements IG::Num::IGridGenerator1d.

virtual List<double> IG::Num::GridGenerator1dBase::GetNodeListReference ( ) [inline, virtual]

Returns a list containing generated 1D node positions. This method can return a reference to the internal list containing the generated node coordinated. This means that any future generation or other operation performed by the generator can override list contents. In order to use contents of the list thread safely, enclose this method call and all subsequent operations you will perform on the returned list of generated nodes, within a lock((...).Lock){ ... } block. If necessary, grid is generated first in order to obtain the correct data.

Returns:
A reference to a list of generated nodes. This is usually not a copy of the list but a reference to an internal structure that can be overridden by subsequent operations on the current grid generator.

Implements IG::Num::IGridGenerator1d.

virtual void IG::Num::GridGenerator1dBase::GetIntervalLengthsTable ( ref double[]  result) [inline, virtual]

Stores a table of interval lengths between the generated nodes into the specified array. If necessary, grid is generated first in order to obtain the correct data.

Parameters:
resultArray where interval lengths between nodes of the generated grid are stored. Allocated or relocated if necessary.

Implements IG::Num::IGridGenerator1d.

virtual double [] IG::Num::GridGenerator1dBase::GetIntervalLengthsTable ( ) [inline, virtual]

Generates and returns a table of interval lengths between the generated nodes. The returned table is a copy that will not be overridden by further operations on the grid generator. If necessary, grid is generated first in order to obtain the correct data.

Returns:
A table containing lengths of intervals between the subsequent nodes generated by the current grid generator.

Implements IG::Num::IGridGenerator1d.

virtual void IG::Num::GridGenerator1dBase::GetIntervalLengthsList ( ref List< double >  result) [inline, virtual]

Stores a table of interval lengths between the generated nodes into the specified list. If necessary, grid is generated first in order to obtain the correct data.

Parameters:
resultList where interval lengths between nodes of the generated grid are stored. Allocated or relocated if necessary.

Implements IG::Num::IGridGenerator1d.

virtual List<double> IG::Num::GridGenerator1dBase::GetIntervalLengthsList ( ) [inline, virtual]

Generates and returns a list of interval lengths between the generated nodes. The returned list is a copy that will not be overridden by further operations on the grid generator. If necessary, grid is generated first in order to obtain the correct data.

Returns:
A table containing lengths of intervals between the subsequent nodes generated by the current grid generator.

Implements IG::Num::IGridGenerator1d.

virtual double IG::Num::GridGenerator1dBase::GetIntervalLength ( int  which) [inline, virtual]

Returns the length of the specified interval between generated nodes of the grid. If necessary, grid is generated first in order to obtain the correct data.

Parameters:
whichConsecutive number of the interval between nodes.

Implements IG::Num::IGridGenerator1d.


Member Data Documentation

object IG::Num::GridGenerator1dBase::_lockObj = new object() [private]
double IG::Num::GridGenerator1dBase::_first = 0.0 [private]
double IG::Num::GridGenerator1dBase::_last = 1.0 [private]
List<double> IG::Num::GridGenerator1dBase::_nodes [protected]

Internally stored generated nodes.


Property Documentation

object IG::Num::GridGenerator1dBase::Lock [get]

Object used for locking of the current object (ILockable interface).

Implements IG::Lib::ILockable.

virtual double IG::Num::GridGenerator1dBase::CoordinateFirst [get, set]

Gets or sets coordinate of the first generated node (usually the minimal generated coordinate).

Implements IG::Num::IGridGenerator1d.

virtual double IG::Num::GridGenerator1dBase::CoordinateLast [get, set]

Gets or sets coordinate of the last generated node (usually the maximal generated coordinate).

Implements IG::Num::IGridGenerator1d.

virtual int IG::Num::GridGenerator1dBase::NumNodes [get, set]

Gets or sets teh number of nodes to be generated.

Implements IG::Num::IGridGenerator1d.

virtual int IG::Num::GridGenerator1dBase::NumIntervals [get]

Gets the number of intervals between the nodes. Simply NumNodes-1.

Implements IG::Num::IGridGenerator1d.

virtual bool IG::Num::GridGenerator1dBase::Calculated [get, set]

Flag indicating whether the grid is generated ready to use. If true then node positions are contained in an internal structure, such that they can be obtained simply by copying this structure (i.e. no need for re-calculation). REMARK: If you intend to do something with results on basis of the value of this flag, don't forget to enclose checking of the flag and your operation into the lock(....Lock){ ... } block.

Implements IG::Num::IGridGenerator1d.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties Events