#include <FieldLattice.h>
Inheritance diagram for FieldLattice::

Public Methods | |
| FieldLattice () | |
| FieldLattice (const GridLattice &grid, const char *fieldname) | |
| FieldLattice (const GridLattice &grid, ArrayGen(NUMT) &coefficients, const char *fieldname) | |
| FieldLattice (const GridLattice &grid, ArrayGenSel(NUMT) &coefficients, const char *fieldname) | |
| FieldLattice (const GridLattice &grid, const int fict_boundary, const char *fieldname) | |
| FieldLattice (const GridLattice &grid, GridLattice::Component comp, const char *fieldname, const bool change_staggered_grid=true) | |
| FieldLattice (const GridLattice &grid, GridLattice::Component comp, const int fict_boundary, const char *fieldname, const bool change_staggered_grid=true) | |
| ~FieldLattice () | |
| bool | redim (const GridLattice &grid, const char *fieldname) |
| bool | redim (const GridLattice &grid, const ArrayGen(NUMT) &coefficients, const char *fieldname) |
| bool | redim (const GridLattice &grid, const ArrayGenSel(NUMT) &coeff, const char *fieldname) |
| bool | redim (const GridLattice &grid, const int fict_boundary, const char *fieldname) |
| bool | redim (const GridLattice &grid, GridLattice::Component comp, const char *fieldname, const bool change_staggered_grid=true) |
| bool | redim (const GridLattice &grid, GridLattice::Component comp, const int fict_boundary, const char *fieldname, const bool change_staggered_grid=true) |
| bool | redim (const FieldLattice &f, const char *fieldname) |
| GridLattice& | grid () |
| const GridLattice& | grid () const |
| ArrayGenSel(NUMT)& | values () |
| const ArrayGenSel(NUMT)& | values () const |
| ArrayGen(NUMT)& | values0 () |
| const ArrayGen(NUMT)& | values0 () const |
| bool | ghostBoundary () const |
| void | exchangeValues (FieldLattice &f) |
| bool | empty () const |
| virtual bool | ok () const |
| virtual void | minmax (NUMT &min, NUMT &max, GridWithPts *grid=NULL) const |
| NUMT& | valueIndex (int i) |
| NUMT& | valueIndex (int i, int j) |
| NUMT& | valueIndex (int i, int j, int k) |
| NUMT | valueIndex (int i) const |
| NUMT | valueIndex (int i, int j) const |
| NUMT | valueIndex (int i, int j, int k) const |
| NUMT& | valueIndex (double i) |
| NUMT& | valueIndex (double i, double j) |
| NUMT& | valueIndex (double i, double j, double k) |
| NUMT | valueIndex (double i) const |
| NUMT | valueIndex (double i, double j) const |
| NUMT | valueIndex (double i, double j, double k) const |
| int | fictBoundary () const |
| NUMT& | valueIndex (const Ptv(int) &index) |
| NUMT | valueIndex (const Ptv(int) &index) const |
| void | value (const ArrayGenSel(NUMT) &values) |
| virtual NUMT | valuePt (const Ptv(real) &x, real t=DUMMY) |
| virtual NUMT | valueFEM (const FiniteElement &fe, real t=DUMMY) |
| virtual Ptv(NUMT) | derivativePt (const Ptv(real) &x, real t=DUMMY) |
| virtual void | derivativeFEM (Ptv(NUMT) &d, const FiniteElement &fe, real t=DUMMY) |
| void | operator= (const FieldLattice &field) |
| void | operator= (const FieldFunc &func) |
| void | fill (const FieldFunc &func, real time=DUMMY) |
| void | copyWithoutGhostBoundary (const FieldLattice &f) |
| virtual void | print (Os os) const |
| void | scan (Is is) |
| virtual void | fill (NUMT value) |
| virtual void | add (NUMT value) |
| virtual void | mult (NUMT value) |
| virtual void | apply (Func(NUMT) f) |
| virtual void | add (Field &field, int power, NUMT front_factor) |
| virtual Field& | scale () |
| virtual Field& | unscale () |
| virtual void | unloadData (Os os) const |
| virtual void | loadData (Is is) |
| virtual void | attach (Grid &grid) |
| virtual Grid* | getGridBase () |
| virtual int | getNoPoints () const |
| virtual int | getNoValues () const |
| virtual NUMT& | valuePoint (int point_no) |
| virtual NUMT | valuePoint (int point_no) const |
| virtual Ptv(real) | getPt (int point_no) const |
| virtual GridWithPts& | getGridWithPts () |
| virtual const GridWithPts& | getGridWithPts () const |
| virtual Vec(NUMT)& | valuesVec () |
| virtual const Vec(NUMT)& | valuesVec () const |
| CLASS_INFO | VIRTUAL_CAST (FieldLattice) COPY_CONSTRUCTOR(FieldLattice) |
| void | pack (CharPack &package) |
| void | unpack (CharPack &package, int package_size) |
NAME: FieldLattice - finite difference scalar field
DESCRIPTION:
The class implements a scalar field suited for finite difference methods. The field is defined in terms of a "GridLattice" object and an array containing the point values at the grid points.
The number of space dimensions can be arbitrary (not limited to 1D, 2D or 3D). However, in high dimensions the amount of data is significant and subscripting is performed in terms of "Ptv(int)" objects, which is not very efficient (it is then wise to design a class with particular emphasis on efficient data handling).
This version of the "FieldLattice" class can operate on staggered grids, with or without a ghost boundary.
If you use this "FieldLattice" heavily in finite difference programming, we strongly recommend to study the code in the member functions, and the "ArrayGenSel" object and its base classes, to get a complete knowledge of the tool. This is important for creating efficient code.
|
|
As for the other field objects, ""initialization"" here refers to allocation of internal data structures for the field values and setting a pointer to a valid grid object. Hence, initialization of field 'values' is not implied. There are several types of "redim" functions and corresponding constructors (constructors and "redim" functions call "reallocate" in the same way). (1) The constructor function without arguments performs no actions. "redim" must be called later to allocate data structures and bind the object to a grid. (2) The "redim" function that takes a "GridLattice" object allocates a corresponding field, according to the dimensions and lower and upper values of the various indices in the grid. (3) The "redim" function that takes a "GridLattice" object and an "ArrayGenSel(NUMT)" object binds the "mesh" pointer to the grid object and the "vec" pointer to the supplied array. Hence, there is no allocation of data and the field object relies on external data structures. This functionality is well suited for cases where several fields can share the same fundamental array of field values (transforming one field format to another is an example). Note that when this constructor is used, the field values are shared with the incoming array. That is, if that array is changed outside the "FieldLattice" object, the changes also affect the "FieldLattice" object. Moreover, the constructor performs initialization of field values in addition to the ""initialization" as defined above. (4) As point (3) above, but the array is of "ArrayGen(NUMT)" type. In this case, the "vec" pointer cannot simply be bound to the supplied array. Instead, we allocate an "ArrayGenSel(NUMT)" array (without any ghost boundary of course) and copy the values from the supplied array. Notice that this seems to be a waste of memory, but there is no way to ""extend"" a base class object (here "ArrayGen") to a subclass object (here "ArrayGenSel"). (5) Another "redim" function takes a "GridLattice" object and an integer representing the size of the fictitious (ghost) boundary. The "fict_boundary" does not affect the "GridLattice" object, but the array allocated can in addition to holding the values at the grid points, also hold one or more extra points of points around grid. This is often convenient when programming finite difference methods. If the base value of the grid is "i0", and the field was allocated with "fict_boundary=1", one can access and place values in the fictitious point "i0-1". (6) A "redim" function takes a "GridLattice" object, an enumerator "comp_in_staggered_grid" and a "bool" "change_staggered_grid". The enumerator is defined in class "GridLattice" and must have one of the values "GridLattice p", "GridLattice::u", "GridLattice::v" or "GridLattice w", where "p" is the scalar value in the computations, and "u", "v" and "w" hold the values of the different velocity components. The underlying grid will now not be "GridLattice", but one of its subclasses "GridLatticeB" and "GridLatticeC". See the documentation in these classes for more information on using the staggered grid utilities. The optional last argument "change_staggered_grid" is true by default, but might be set to "false" if the staggered grid has been constructed in its right size 'before' the call to this "redim" or constructor. This functionality is normally only used in parallel programming, where a manager is in charge of dividing global grids into local ones and distributing these to subdomain solvers. (7) A "redim" function takes a "GridLattice" grid, an enumerator "comp_in_staggered_grid", an integer representing the size of the fictitious boundary, and a "bool" variable "change_staggered_grid". The constructor is just a combination of the constructors (5) and (6), see their documentation for more information. |
|
|
See documentation of one of the overloaded constructor. |
|
|
See documentation of one of the overloaded constructor. |
|
|
See documentation of one of the overloaded constructor. |
|
|
See documentation of one of the overloaded constructor. |
|
|
See documentation of one of the overloaded constructor. |
|
|
See documentation of one of the overloaded constructor. |
|
|
|
|
|
|
|
|
See documentation of one of the overloaded functions. Reimplemented from Field. |
|
|
adds a constant field to the field. An overloaded version takes a "Field" "f", an integer power "i" and a factor "c" as arguments. The formula "c*f^i" is added to the object field. Reimplemented from Field. |
|
|
applies a function, like "sin(x)", to the field. Reimplemented from Field. |
|
|
attaches a grid to the field. Used by the "FieldReader" and "SimResFile" classes when reading fields from files. Specific versions of the function are implemented in the subclasses. Reimplemented from Field. |
|
|
only for internal use. Gives a warning if the field has a ghost-boundary, otherwise, it makes a copy of the values. |
|
|
Reimplemented from Field. |
|
|
evaluates the derivative of the field at a point in space and time. Reimplemented from Field. |
|
|
returns true if the field has neither a grid or a value array allocated (or attached) and false if one of these are present in the field. |
|
|
swap values between two fields ("this" and the supplied field). It is left up to the user of the function to ensure that the two fields are compatible. |
|
|
returns the size of the fictitious boundary/ghost boundary. |
|
|
See documentation of one of the overloaded functions. Reimplemented from Field. |
|
|
fill the field with the given value or functor. |
|
|
returns a "Grid" base class pointer to the grid associated with the field. Since many field types do not have an associated grid, the function is not meaningful for all fields. The "getGridBase" function is used by the "SimResFile" and "FileReader" classes. Reimplemented from Field. |
|
|
See documentation of one of the overloaded functions. Reimplemented from FieldWithPtValues. |
|
|
gives access to the grid object associated with the "FieldWithPtValues" object. The corresponding base class for grid with discrete points is "GridWithPts". Reimplemented from FieldWithPtValues. |
|
|
returns the number of points in the grid. Reimplemented from FieldWithPtValues. |
|
|
returns the number of field values (usually equal to the number of points).`\footnote{`In a "GridLattice" grid one can think of a finite difference field defined at the cell centers. Then the number of grid points does not coincide with the number of field values. However, the field is typically characterized as being defined at a finite number of spatial points.`}` Reimplemented from FieldWithPtValues. |
|
|
returns the coordinate of a point. The point is given by its point number in the grid. Reimplemented from FieldWithPtValues. |
|
|
returns true if the field was impleented to have a ghost boundary, and false if not. |
|
|
See documentation of one of the overloaded functions. |
|
|
gives access to the underlying grid. |
|
|
a special scan function used for reading the field from a SimRes file. (See classes "SimResFile" and "FieldReader"). Reimplemented from Field. |
|
|
finds the minimum and maximum values of the field. Most of the subclass fields have an internal grid and will find the extreme values over this grid. The "minmax" function has an optional argument "grid" that can be supplied. This grid is not used if the field has an internal grid. However, some fields, like "FieldFunc", do not have internal grids and in that case the "grid" argument is required in order to compute the extreme values. Reimplemented from Field. |
|
|
multiplies the field values by a number. Reimplemented from Field. |
|
|
returns true if the object is initialized, for the base class "Field" it just writes an error messages such that if a derived class fails to define an "ok" function, an error message will be written. Reimplemented from Field. |
|
|
|
|
|
|
|
|
pack all the values in the field into a "CharPack" object. (Used in communication between processes in parallel computations.) |
|
|
prints the field. Most subclass implementations involve printing the field values and the grid. Reimplemented from Field. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
documented under ""Construction and initialization"". |
|
|
scale the field values and the space(-time) domain. That is, the original values of the field are overwritten by the new, scaled values. To retrieve the original values, call "unscale". Both "scale" and "unscale" tests a variable first to determine if the field is already scaled or unscaled (calling e.g. "scale" twice then results in no action of the second call). Reimplemented from Field. |
|
|
|
|
|
a special print function that is used for dumping the field to a SimRes file. (See classes "SimResFile" and "FieldWriter"). Reimplemented from Field. |
|
|
unpack all the values in the field from a "CharPack" object. (Used in communication between processes in parallel computations.) |
|
|
the inverse action of "scale". Reimplemented from Field. |
|
|
assigns numbers to all the field values based on the array given as argument to the function. The internal data structures in "*this" field must be allocated before the function can be called. A copy of the array given as argument is taken. |
|
|
evaluates the field at a point in space and time, but the argument is a "FiniteElement" object which means that the evaluation process in a finite element context will be very efficient (since "FiniteElement" knows the element number and the local coordinates of the spatial point). The function is virtual and offers a unified interface to the evaluation of all types of fields in a finite element based simulator. Reimplemented from Field. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
gives access to a single field value. For example, "valueIndex(j,k)" is identical to "values( (j,k)",) but the former construction is the ""most protected"" and hence the recommended one. If one creates a loop over the field values, the loop indices are given by the grid object, cf. the example below. |
|
|
See documentation of one of the overloaded functions. Reimplemented from FieldWithPtValues. |
|
|
returns access to the field value at a spatial point. The point is given by its point number. (If the point is known by its coordinates and not the point number, one can use the "valuePt" function, see class "Field"). Reimplemented from FieldWithPtValues. |
|
|
evaluates the field at a point in space and time. The time argument can be omitted, the default value is then "DUMMY". Generally, we suggest to use "DUMMY" to check if fields are stationary. Reimplemented from Field. |
|
|
See documentation of one of the overloaded functions. |
|
|
gives access to the array of field values (at the grid points). |
|
|
See documentation of one of the overloaded functions. |
|
|
gives access to the array of field values (at the grid points) as an "ArrayGen(NUMT)" array. This can have undesired side effects if the underlying "ArrayGenSel(NUMT)" object, used in this field, has a ghost boundary. You can use "ghostBoundary()" to check if there are fictitious pints outside the grid. Notice that the "values0" function is not inline. One should therefore never use it for subscripting line "...values0( (i,j)".) Use "values0" to initialize an "ArrayGen(NUMT)&" reference and perform subscripting based on this reference! |
|
|
Reimplemented from FieldWithPtValues. |
|
|
Reimplemented from FieldWithPtValues. |