Diffpack Documentation


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

FieldPiWisConst Class Reference

piecewise const scalar field over materials or elements. More...

#include <FieldPiWisConst.h>

Inheritance diagram for FieldPiWisConst::

FieldWithPtValues Field HandleId List of all members.

Public Methods

 FieldPiWisConst ()
 FieldPiWisConst (const GridFE &grid, bool elementsRsubdomains, const char *fieldname)
 FieldPiWisConst (const GridFE &grid, const Vec(NUMT) &subdomain_values, const char *fieldname)
 ~FieldPiWisConst ()
bool update ()
bool redim (const GridFE &grid, bool elementsRsubdomains, const char *fieldname)
bool redim (const GridFE &grid, const Vec(NUMT) &subdomain_values, const char *fieldname)
const GridFEgrid () const
GridFEgrid ()
bool piecewiseConstOverElms () const
const Vec(NUMT)& values () const
Vec(NUMT)& values ()
void setValueElm (int e, NUMT value)
void setSubDomainValue (int material, NUMT value)
void setMaterialValue (int material, NUMT value)
void fill (const Vec(NUMT) &values)
void operator= (const FieldPiWisConst &f)
void operator= (const FieldFE &f)
void fill (const FieldsFEatItgPt &f, int component)
virtual bool ok () const
virtual void minmax (NUMT &min, NUMT &max, GridWithPts *grid=NULL) const
void point (Ptv(real) &pt, int element)
void point (Ptv(real) &pt, int element) const
NUMT valueElm (int e) const
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)
void derivativeElm (Ptv(NUMT) &der, int e)
virtual void derivativeFEM (Ptv(NUMT) &d, const FiniteElement &fe, real t=DUMMY)
virtual void hessianPt (Ptv(NUMT) &, const Ptv(real) &, real=DUMMY)
virtual void hessianFEM (Ptv(NUMT) &, const FiniteElement &, real=DUMMY)
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 Fieldscale ()
virtual Fieldunscale ()
virtual void unloadData (Os os) const
virtual void loadData (Is is)
virtual void attach (Grid &grid)
virtual GridgetGridBase ()
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 GridWithPtsgetGridWithPts ()
virtual const GridWithPtsgetGridWithPts () const
virtual Vec(NUMT)& valuesVec ()
virtual const Vec(NUMT)& valuesVec () const
CLASS_INFO VIRTUAL_CAST (FieldPiWisConst)
 COPY_CONSTRUCTOR (FieldPiWisConst)
virtual void print (Os os) const
void scan (Is is)

Detailed Description

piecewise const scalar field over materials or elements.

NAME: FieldPiWisConst - piecewise const scalar field over materials or elements

DESCRIPTION:

The "FieldPiWisConst" class represents a piecewise constant scalar field over non-overlapping subdomains of a finite element grid. The subdomains are defined in terms of the ""material"" concept in class "GridFE". (This is different from the ""subdomain"" concept in class "GridFE"; the latter can represent non-overlapping subdomains for domain decomposition methods and parallel algorithms, whereas the former reflects distinct physical materials of the domain, with possibly different physical (material) properties.) There are two different representations: 1) the field is constant on each subdomain, where the subdomains are defined in a finite element grid, 2) the field is constant on each finite element (ie., the finite elements constitute the subdomains). The choice between these two definitions of ""subdomain"" is given as a parameter to the constructor.

It may seem strange that "FieldPiWisConst" is derived from class "FieldWithPtValues". This derivation is motivated by some field generators (such as stochastic field generators) where one wants to hide the details of a scattered point collection, a complicated finite element field or a piecewise constant field. The ""point"" associated with a field value in "FieldPiWisConst" is meant to be the centroid of the domain over which the field is constant. When the elements are the subdomains, this point is easy to compute since "GridFE" supports a function for calculating the centroid. For subdomain consisting of a set of elements, there is no implementation of the ""point"" concept in the present version of the class. However, in this latter case, there is seldom useful to regard "FieldPiWisConst" as a field with point values.


Constructor & Destructor Documentation

FieldPiWisConst::FieldPiWisConst ( )
 

There is one constructor taking a finite element grid as parameter. In addition, a boolean variable indicates whether the elements are the subdomain or if the subdomain definitions in the grid should be used.

FieldPiWisConst::FieldPiWisConst ( const GridFE & grid,
bool elementsRsubdomains,
const char * fieldname )
 

See documentation of one of the overloaded constructor.

FieldPiWisConst::FieldPiWisConst ( const GridFE & grid,
const Vec(NUMT) & subdomain_values,
const char * fieldname )
 

See documentation of one of the overloaded constructor.

FieldPiWisConst::~FieldPiWisConst ( )
 


Member Function Documentation

FieldPiWisConst::COPY_CONSTRUCTOR ( FieldPiWisConst )
 

CLASS_INFO FieldPiWisConst::VIRTUAL_CAST ( FieldPiWisConst )
 

void FieldPiWisConst::add ( Field & field,
int power,
NUMT front_factor ) [virtual]
 

See documentation of one of the overloaded functions.

Reimplemented from Field.

void FieldPiWisConst::add ( NUMT value ) [virtual]
 

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.

void FieldPiWisConst::apply ( Func(NUMT) f ) [virtual]
 

applies a function, like "sin(x)", to the field.

Reimplemented from Field.

void FieldPiWisConst::attach ( Grid & grid ) [virtual]
 

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.

void FieldPiWisConst::derivativeElm ( Ptv(NUMT) & der,
int e )
 

void FieldPiWisConst::derivativeFEM ( Ptv(NUMT) & d,
const FiniteElement & fe,
real t = DUMMY ) [virtual]
 

Reimplemented from Field.

Ptv(NUMT) FieldPiWisConst::derivativePt ( const Ptv(real) & x,
real t = DUMMY ) [virtual]
 

evaluates the derivative of the field at a point in space and time.

Reimplemented from Field.

void FieldPiWisConst::fill ( NUMT value ) [virtual]
 

See documentation of one of the overloaded functions.

Reimplemented from Field.

void FieldPiWisConst::fill ( const FieldsFEatItgPt & f,
int component )
 

See documentation of one of the overloaded functions.

void FieldPiWisConst::fill ( const Vec(NUMT) & values )
 

The version that takes a "Vec(NUMT)" fill all subdomain values. If the elements are the subdomains and one sends an "ArrayGen(real)" as argument, one can use this function for initializing a "FieldPiWisConst" with values obtained from the cells in a finite difference grid ("GridLattice"). The element and cell numbering will correspond to each other if the numering conventions of "PreproBox" (for example) is followed when constructing the finite element grid. If the grid was initialized by a "scanLattice" function, or set equal to a "GridLattice", the element numering will automatically coincide. Observe that the length and dimension sizes of the "ArrayGen(real)" argument is different from the standard "FieldLattice" point values array (in the latter field class, the point array reflects values at the nodes in the grid rather than in the cells).

The version of the function taking a FieldsFEatItgPt initializes a "FieldPiWisConst" object at each element as the average of the field values of "FieldsFEatItgPt" (in the same element). If "FieldsFEatItgPt" contains only one field value per element (at the centroid), the data in "FieldsFEatItgPt" are just copied into the present "FieldPiWisConst" object.

Grid * FieldPiWisConst::getGridBase ( ) [virtual]
 

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.

const GridWithPts & FieldPiWisConst::getGridWithPts ( ) const [virtual]
 

See documentation of one of the overloaded functions.

Reimplemented from FieldWithPtValues.

GridWithPts & FieldPiWisConst::getGridWithPts ( ) [virtual]
 

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.

int FieldPiWisConst::getNoPoints ( ) const [inline, virtual]
 

returns the number of points in the grid.

Reimplemented from FieldWithPtValues.

int FieldPiWisConst::getNoValues ( ) const [inline, virtual]
 

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.

Ptv(real) FieldPiWisConst::getPt ( int point_no ) const [virtual]
 

returns the coordinate of a point. The point is given by its point number in the grid.

Reimplemented from FieldWithPtValues.

GridFE & FieldPiWisConst::grid ( ) [inline]
 

See documentation of one of the overloaded functions.

const GridFE & FieldPiWisConst::grid ( ) const [inline]
 

returns access to the associated grid.

void FieldPiWisConst::hessianFEM ( Ptv(NUMT) &,
const FiniteElement & fe,
real = DUMMY ) [virtual]
 

Reimplemented from Field.

void FieldPiWisConst::hessianPt ( Ptv(NUMT) &,
const Ptv(real) & x,
real = DUMMY ) [virtual]
 

evaluates the hessian (2nd derivatives) of the field at a point in space and time, i.e. f,xx for nsd=1, {f,xx f,yy f,xy} for nsd=2 and {f,xx f,yy f,zz f,xy f,xz f,yz} for nsd=3.

Reimplemented from Field.

void FieldPiWisConst::loadData ( Is is ) [virtual]
 

a special scan function used for reading the field from a SimRes file. (See classes "SimResFile" and "FieldReader").

Reimplemented from Field.

void FieldPiWisConst::minmax ( NUMT & min,
NUMT & max,
GridWithPts * grid = NULL ) const [virtual]
 

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.

void FieldPiWisConst::mult ( NUMT value ) [virtual]
 

multiplies the field values by a number.

Reimplemented from Field.

bool FieldPiWisConst::ok ( ) const [virtual]
 

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.

void FieldPiWisConst::operator= ( const FieldFE & f )
 

void FieldPiWisConst::operator= ( const FieldPiWisConst & f )
 

bool FieldPiWisConst::piecewiseConstOverElms ( ) const [inline]
 

returns a true value if the elements are the subdomains (otherwise it returns a false value).

void FieldPiWisConst::point ( Ptv(real) & pt,
int element ) const [inline]
 

void FieldPiWisConst::point ( Ptv(real) & pt,
int element )
 

void FieldPiWisConst::print ( Os os ) const [virtual]
 

prints the field. Most subclass implementations involve printing the field values and the grid.

Reimplemented from Field.

bool FieldPiWisConst::redim ( const GridFE & grid,
const Vec(NUMT) & subdomain_values,
const char * fieldname )
 

See documentation of one of the overloaded functions.

bool FieldPiWisConst::redim ( const GridFE & grid,
bool elementsRsubdomains,
const char * fieldname )
 

each constructor is a simple call to the associated "redim" function. In other words, we refer to constructing and initializing the class for more information on the actions of the "redim" functions.

Field & FieldPiWisConst::scale ( ) [virtual]
 

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.

void FieldPiWisConst::scan ( Is is )
 

void FieldPiWisConst::setMaterialValue ( int material,
NUMT value ) [inline]
 

same as "setSubDomainValue", just another function name for making some codes easier to read.

void FieldPiWisConst::setSubDomainValue ( int material,
NUMT value )
 

sets the field value for the given subdomain (to be used when the elements are not the subdomains, and the subdomain reflects a material).

void FieldPiWisConst::setValueElm ( int e,
NUMT value )
 

sets the value of the field in an element. Requires that the elements are the subdomains.

void FieldPiWisConst::unloadData ( Os os ) const [virtual]
 

a special print function that is used for dumping the field to a SimRes file. (See classes "SimResFile" and "FieldWriter").

Reimplemented from Field.

Field & FieldPiWisConst::unscale ( ) [virtual]
 

the inverse action of "scale".

Reimplemented from Field.

bool FieldPiWisConst::update ( )
 

redimensions the internal data structure in accordance with the attached grid. useful in adaptive grid methods where the size of the grid may vary during a simulation. The boolean return value reflects whether new memory was allocated or not.

NUMT FieldPiWisConst::valueElm ( int e ) const
 

NUMT FieldPiWisConst::valueFEM ( const FiniteElement & fe,
real t = DUMMY ) [virtual]
 

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.

NUMT FieldPiWisConst::valuePoint ( int point_no ) const [inline, virtual]
 

See documentation of one of the overloaded functions.

Reimplemented from FieldWithPtValues.

NUMT & FieldPiWisConst::valuePoint ( int point_no ) [inline, virtual]
 

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.

NUMT FieldPiWisConst::valuePt ( const Ptv(real) & x,
real t = DUMMY ) [virtual]
 

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.

Vec(NUMT) & FieldPiWisConst::values ( ) [inline]
 

See documentation of one of the overloaded functions.

const Vec(NUMT) & FieldPiWisConst::values ( ) const [inline]
 

gives access to a vector with all the subdomain field values. The length of the vector depends on the type of field, that is, piecewise constants over each element or over subdomains. You can use "value().size()", or better, "piecewiseConstOverElms" to test for the field type.

const Vec(NUMT) & FieldPiWisConst::valuesVec ( ) const [inline, virtual]
 

Reimplemented from FieldWithPtValues.

Vec(NUMT) & FieldPiWisConst::valuesVec ( ) [inline, virtual]
 

Reimplemented from FieldWithPtValues.


Friends And Related Function Documentation

class FieldsPiWisConst [friend]
 


The documentation for this class was generated from the following file:
Copyright © 2003 inuTech GmbH. All rights reserved.