FreeFOAM The Cross-Platform CFD Toolkit
coordinateSystem Class Reference

A cartesian coordinate system and the base class for other coordinate system specifications. More...

#include <meshTools/coordinateSystem.H>


Detailed Description

A cartesian coordinate system and the base class for other coordinate system specifications.

All systems are defined by an origin point and a coordinateRotation. For convenience, the dictionary constructor forms allow a few shortcuts:

  • the default origin corresponds to (0 0 0)
  • if the type is not otherwise specified, a Cartesian coordinateSystem is implicit

    flipped
    {
    origin  (0 0 0);
    coordinateRotation
    {
    typeSTARCDRotation;
    rotation(0 0 90);
    }
    }
    
  • if an axes specification (eg, e3/e1) is used, the coordinateRotation sub-dictionary can be dropped.

    flipped // the same, specified as axes
    {
    origin  (0 0 0);
    coordinateRotation
    {
    typeaxes;
    e3  (1 0 0);
    e1  (0 0 -1);
    }
    }
    flipped // the same, using all the shortcuts
    {
    e3  (1 0 0);
    e1  (0 0 -1);
    }
    
  • if a sub-dictionary coordinateSystem is found within the dictionary, it will be used. This provides a convenient means of embedding coordinateSystem information in another dictionary. This is used, for example, in the porousZones:

    1
    (
    cat1
    {
    coordinateSystem
    {
    origin  (0 0 0);
    coordinateRotation
    {
    typeSTARCDRotation;
    rotation(0 0 90);
    }
    }
    porosity0.781;
    Darcy
    {
    d   d [0 -2 0 0 0]  (-1000 -1000 0.50753e+08);
    f   f [0 -1 0 0 0]  (-1000 -1000 12.83);
    }
    }
    )
    
  • additionally, if the coordinateSystem points to a plain entry, it can be used to reference one of the global coordinateSystems

    1
    (
    cat1
    {
    coordinateSystem  system_10;
    porosity0.781;
    Darcy
    {
    d   d [0 -2 0 0 0]  (-1000 -1000 0.50753e+08);
    f   f [0 -1 0 0 0]  (-1000 -1000 12.83);
    }
    }
    )
    

    For this to work correctly, the coordinateSystem constructor must be supplied with both a dictionary and an objectRegistry.

See also:
coordinateSystems and coordinateSystems::New
Source files

Definition at line 150 of file coordinateSystem.H.

+ Inheritance diagram for coordinateSystem:

List of all members.

Public Member Functions

 TypeName ("coordinateSystem")
 Runtime type information.
 coordinateSystem ()
 Construct null. This is equivalent to an identity coordinateSystem.
 coordinateSystem (const word &name, const coordinateSystem &)
 Construct copy with a different name.
 coordinateSystem (const word &name, const point &origin, const coordinateRotation &)
 Construct from origin and rotation.
 coordinateSystem (const word &name, const point &origin, const vector &axis, const vector &dirn)
 Construct from origin and 2 axes.
 coordinateSystem (const word &name, const dictionary &)
 Construct from dictionary with a given name.
 coordinateSystem (const dictionary &)
 Construct from dictionary with default name.
 coordinateSystem (const dictionary &, const objectRegistry &)
 Construct from dictionary (default name)
 coordinateSystem (Istream &)
 Construct from Istream.
autoPtr< coordinateSystemclone () const
 Return clone.
 declareRunTimeSelectionTable (autoPtr, coordinateSystem, dictionary,(const word &name, const dictionary &dict),(name, dict))
 declareRunTimeSelectionTable (autoPtr, coordinateSystem, origRotation,(const word &name, const point &origin, const coordinateRotation &cr),(name, origin, cr))
virtual ~coordinateSystem ()
const wordname () const
 Return name.
stringnote ()
 Return non-constant access to the optional note.
const stringnote () const
 Return the optional note.
const pointorigin () const
 Return origin.
const coordinateRotationrotation () const
 Return coordinate rotation.
const tensorR () const
 Return local-to-global transformation tensor.
const vector e1 () const
 Return local Cartesian x-axis.
const vector e2 () const
 Return local Cartesian y-axis.
const vector e3 () const
 Return local Cartesian z-axis.
const vector axis () const
 Return axis (e3: local Cartesian z-axis)
const vector direction () const
 Return direction (e1: local Cartesian x-axis)
virtual dictionary dict (bool ignoreType=false) const
 Return as dictionary of entries.
virtual void rename (const word &newName)
 Rename.
pointorigin ()
 Edit access to origin.
virtual void write (Ostream &) const
 Write.
virtual void writeDict (Ostream &, bool subDict=true) const
 Write dictionary.
point globalPosition (const point &local) const
 Convert from position in local coordinate system to global Cartesian position.
tmp< pointFieldglobalPosition (const pointField &local) const
 Convert from position in local coordinate system to global Cartesian position.
vector globalVector (const vector &local) const
 Convert from vector components in local coordinate system to global Cartesian vector.
tmp< vectorFieldglobalVector (const vectorField &local) const
 Convert from vector components in local coordinate system to global Cartesian vector.
point localPosition (const point &global) const
 Convert from global Cartesian position to position in local coordinate system.
tmp< pointFieldlocalPosition (const pointField &global) const
 Convert from global Cartesian position to position in local coordinate system.
vector localVector (const vector &global) const
 Convert from global Cartesian vector to components in local coordinate system.
tmp< vectorFieldlocalVector (const vectorField &global) const
 Convert from global Cartesian vector to components in local coordinate system.
void operator= (const dictionary &)
 assign from dictionary

Static Public Member Functions

static autoPtr< coordinateSystemNew (const word &name, const dictionary &)
 Select constructed from dictionary.
static autoPtr< coordinateSystemNew (const word &coordType, const word &name, const point &origin, const coordinateRotation &)
 Select constructed from origin and rotation.
static autoPtr< coordinateSystemNew (Istream &is)
 Select constructed from Istream.

Protected Member Functions

virtual vector localToGlobal (const vector &, bool translate) const
 Convert from local coordinate system to the global Cartesian system.
virtual tmp< vectorFieldlocalToGlobal (const vectorField &, bool translate) const
 Convert from local coordinate system to the global Cartesian system.
virtual vector globalToLocal (const vector &, bool translate) const
 Convert from global Cartesian system to the local coordinate system.
virtual tmp< vectorFieldglobalToLocal (const vectorField &, bool translate) const
 Convert from global Cartesian system to the local coordinate system.

Friends

bool operator!= (const coordinateSystem &, const coordinateSystem &)
Ostreamoperator<< (Ostream &, const coordinateSystem &)

Constructor & Destructor Documentation

Construct null. This is equivalent to an identity coordinateSystem.

Definition at line 42 of file coordinateSystem.C.

Referenced by coordinateSystem::clone().

coordinateSystem ( const word name,
const coordinateSystem cs 
)

Construct copy with a different name.

Definition at line 53 of file coordinateSystem.C.

coordinateSystem ( const word name,
const point origin,
const coordinateRotation cr 
)

Construct from origin and rotation.

Definition at line 67 of file coordinateSystem.C.

coordinateSystem ( const word name,
const point origin,
const vector axis,
const vector dirn 
)

Construct from origin and 2 axes.

Definition at line 82 of file coordinateSystem.C.

coordinateSystem ( const word name,
const dictionary dict 
)

Construct from dictionary with a given name.

Definition at line 98 of file coordinateSystem.C.

coordinateSystem ( const dictionary dict)

Construct from dictionary with default name.

Definition at line 114 of file coordinateSystem.C.

coordinateSystem ( const dictionary dict,
const objectRegistry obr 
)

Construct from Istream.

The Istream contains a word followed by a dictionary

Definition at line 182 of file coordinateSystem.C.

References coordinateSystem::dict(), and coordinateSystem::operator=().

~coordinateSystem ( )
virtual

Definition at line 197 of file coordinateSystem.C.


Member Function Documentation

Foam::vector localToGlobal ( const vector local,
bool  translate 
) const
protectedvirtual

Convert from local coordinate system to the global Cartesian system.

with optional translation for the origin

Reimplemented in cylindricalCS, parabolicCylindricalCS, and sphericalCS.

Definition at line 230 of file coordinateSystem.C.

Referenced by coordinateSystem::globalPosition(), coordinateSystem::globalVector(), parabolicCylindricalCS::localToGlobal(), sphericalCS::localToGlobal(), and cylindricalCS::localToGlobal().

Foam::tmp< Foam::vectorField > localToGlobal ( const vectorField local,
bool  translate 
) const
protectedvirtual

Convert from local coordinate system to the global Cartesian system.

with optional translation for the origin

Reimplemented in cylindricalCS, parabolicCylindricalCS, and sphericalCS.

Definition at line 247 of file coordinateSystem.C.

Foam::vector globalToLocal ( const vector global,
bool  translate 
) const
protectedvirtual

Convert from global Cartesian system to the local coordinate system.

with optional translation for the origin

Reimplemented in cylindricalCS, parabolicCylindricalCS, and sphericalCS.

Definition at line 264 of file coordinateSystem.C.

Referenced by sphericalCS::globalToLocal(), cylindricalCS::globalToLocal(), coordinateSystem::localPosition(), and coordinateSystem::localVector().

Foam::tmp< Foam::vectorField > globalToLocal ( const vectorField global,
bool  translate 
) const
protectedvirtual

Convert from global Cartesian system to the local coordinate system.

with optional translation for the origin

Reimplemented in cylindricalCS, parabolicCylindricalCS, and sphericalCS.

Definition at line 281 of file coordinateSystem.C.

TypeName ( "coordinateSystem"  )

Runtime type information.

autoPtr<coordinateSystem> clone ( ) const
inline

Return clone.

Definition at line 247 of file coordinateSystem.H.

References coordinateSystem::coordinateSystem().

declareRunTimeSelectionTable ( autoPtr  ,
coordinateSystem  ,
dictionary  ,
(const word &name, const dictionary &dict ,
(name, dict  
)
declareRunTimeSelectionTable ( autoPtr  ,
coordinateSystem  ,
origRotation  ,
(const word &name, const point &origin, const coordinateRotation &cr)  ,
(name, origin, cr)   
)
Foam::autoPtr< Foam::coordinateSystem > New ( const word name,
const dictionary dict 
)
static
Foam::autoPtr< Foam::coordinateSystem > New ( const word coordType,
const word name,
const point origin,
const coordinateRotation cr 
)
static

Select constructed from origin and rotation.

Definition at line 77 of file coordinateSystemNew.C.

References Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorIn, name(), Foam::nl, and Foam::Pout.

Foam::autoPtr< Foam::coordinateSystem > New ( Istream is)
static

Select constructed from Istream.

Definition at line 113 of file coordinateSystemNew.C.

References name().

const word& name ( ) const
inline

Return name.

Definition at line 310 of file coordinateSystem.H.

string& note ( )
inline

Return non-constant access to the optional note.

Definition at line 316 of file coordinateSystem.H.

const string& note ( ) const
inline

Return the optional note.

Definition at line 322 of file coordinateSystem.H.

const point& origin ( ) const
inline

Return origin.

Definition at line 328 of file coordinateSystem.H.

Referenced by porousZone::origin().

const coordinateRotation& rotation ( ) const
inline

Return coordinate rotation.

Definition at line 334 of file coordinateSystem.H.

const tensor& R ( ) const
inline

Return local-to-global transformation tensor.

Definition at line 340 of file coordinateSystem.H.

const vector e1 ( ) const
inline

Return local Cartesian x-axis.

Definition at line 346 of file coordinateSystem.H.

References Tensor< Cmpt >::x().

const vector e2 ( ) const
inline

Return local Cartesian y-axis.

Definition at line 352 of file coordinateSystem.H.

References Tensor< Cmpt >::y().

const vector e3 ( ) const
inline

Return local Cartesian z-axis.

Definition at line 358 of file coordinateSystem.H.

References Tensor< Cmpt >::z().

const vector axis ( ) const
inline

Return axis (e3: local Cartesian z-axis)

Deprecated:
method e3 is preferred

Definition at line 365 of file coordinateSystem.H.

References Tensor< Cmpt >::z().

Referenced by porousZone::axis().

const vector direction ( ) const
inline

Return direction (e1: local Cartesian x-axis)

Deprecated:
method e1 is preferred

Definition at line 372 of file coordinateSystem.H.

References Tensor< Cmpt >::x().

Foam::dictionary dict ( bool  ignoreType = false) const
virtual

Return as dictionary of entries.

Parameters:
[in]ignoreTypedrop type (cartesian, cylindrical, etc) when generating the dictionary

Definition at line 203 of file coordinateSystem.C.

References dictionary::add(), and Foam::type().

Referenced by coordinateSystem::coordinateSystem().

virtual void rename ( const word newName)
inlinevirtual

Rename.

Definition at line 386 of file coordinateSystem.H.

point& origin ( )
inline

Edit access to origin.

Definition at line 392 of file coordinateSystem.H.

void write ( Ostream os) const
virtual

Write.

Reimplemented in toroidalCS.

Definition at line 297 of file coordinateSystem.C.

References Foam::type().

Referenced by toroidalCS::write().

void writeDict ( Ostream os,
bool  subDict = true 
) const
virtual
point globalPosition ( const point local) const
inline

Convert from position in local coordinate system to global Cartesian position.

Definition at line 408 of file coordinateSystem.H.

References coordinateSystem::localToGlobal().

Referenced by sampledPlane::sampledPlane().

tmp<pointField> globalPosition ( const pointField local) const
inline

Convert from position in local coordinate system to global Cartesian position.

Definition at line 414 of file coordinateSystem.H.

References coordinateSystem::localToGlobal().

vector globalVector ( const vector local) const
inline

Convert from vector components in local coordinate system to global Cartesian vector.

Definition at line 420 of file coordinateSystem.H.

References coordinateSystem::localToGlobal().

Referenced by sampledPlane::sampledPlane().

tmp<vectorField> globalVector ( const vectorField local) const
inline

Convert from vector components in local coordinate system to global Cartesian vector.

Definition at line 426 of file coordinateSystem.H.

References coordinateSystem::localToGlobal().

point localPosition ( const point global) const
inline

Convert from global Cartesian position to position in local coordinate system.

Definition at line 432 of file coordinateSystem.H.

References coordinateSystem::globalToLocal().

tmp<pointField> localPosition ( const pointField global) const
inline

Convert from global Cartesian position to position in local coordinate system.

Definition at line 438 of file coordinateSystem.H.

References coordinateSystem::globalToLocal().

vector localVector ( const vector global) const
inline

Convert from global Cartesian vector to components in local coordinate system.

Definition at line 444 of file coordinateSystem.H.

References coordinateSystem::globalToLocal().

tmp<vectorField> localVector ( const vectorField global) const
inline

Convert from global Cartesian vector to components in local coordinate system.

Definition at line 450 of file coordinateSystem.H.

References coordinateSystem::globalToLocal().


Friends And Related Function Documentation

bool operator!= ( const coordinateSystem ,
const coordinateSystem  
)
friend
Ostream& operator<< ( Ostream ,
const coordinateSystem  
)
friend

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