A cartesian coordinate system and the base class for other coordinate system specifications. More...
#include <meshTools/coordinateSystem.H>
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:
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.
Definition at line 150 of file coordinateSystem.H.
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< coordinateSystem > | clone () 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 word & | name () const |
Return name. | |
string & | note () |
Return non-constant access to the optional note. | |
const string & | note () const |
Return the optional note. | |
const point & | origin () const |
Return origin. | |
const coordinateRotation & | rotation () const |
Return coordinate rotation. | |
const tensor & | R () 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. | |
point & | origin () |
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< pointField > | globalPosition (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< vectorField > | globalVector (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< pointField > | localPosition (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< vectorField > | localVector (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< coordinateSystem > | New (const word &name, const dictionary &) |
Select constructed from dictionary. | |
static autoPtr< coordinateSystem > | New (const word &coordType, const word &name, const point &origin, const coordinateRotation &) |
Select constructed from origin and rotation. | |
static autoPtr< coordinateSystem > | New (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< vectorField > | localToGlobal (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< vectorField > | globalToLocal (const vectorField &, bool translate) const |
Convert from global Cartesian system to the local coordinate system. |
Friends | |
bool | operator!= (const coordinateSystem &, const coordinateSystem &) |
Ostream & | operator<< (Ostream &, const coordinateSystem &) |
coordinateSystem | ( | ) |
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 dictionary (default name)
With the ability to reference global coordinateSystems
Definition at line 129 of file coordinateSystem.C.
References Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorIn, coordinateSystems::find(), Foam::Info, entry::isDict(), dictionary::lookupEntryPtr(), coordinateSystems::New(), Foam::nl, entry::stream(), and coordinateSystems::toc().
coordinateSystem | ( | Istream & | is | ) |
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=().
|
virtual |
Definition at line 197 of file coordinateSystem.C.
|
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().
|
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.
|
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().
|
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.
|
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) | |||
) |
|
static |
Select constructed from dictionary.
Definition at line 32 of file coordinateSystemNew.C.
References Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorIn, name(), Foam::nl, Foam::Pout, and dictionary::readIfPresent().
Referenced by searchableSurfaceCollection::searchableSurfaceCollection().
|
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.
|
static |
Select constructed from Istream.
Definition at line 113 of file coordinateSystemNew.C.
References name().
|
inline |
Return name.
Definition at line 310 of file coordinateSystem.H.
|
inline |
Return non-constant access to the optional note.
Definition at line 316 of file coordinateSystem.H.
|
inline |
Return the optional note.
Definition at line 322 of file coordinateSystem.H.
|
inline |
Return origin.
Definition at line 328 of file coordinateSystem.H.
Referenced by porousZone::origin().
|
inline |
Return coordinate rotation.
Definition at line 334 of file coordinateSystem.H.
|
inline |
Return local-to-global transformation tensor.
Definition at line 340 of file coordinateSystem.H.
|
inline |
Return local Cartesian x-axis.
Definition at line 346 of file coordinateSystem.H.
References Tensor< Cmpt >::x().
|
inline |
Return local Cartesian y-axis.
Definition at line 352 of file coordinateSystem.H.
References Tensor< Cmpt >::y().
|
inline |
Return local Cartesian z-axis.
Definition at line 358 of file coordinateSystem.H.
References Tensor< Cmpt >::z().
|
inline |
Return axis (e3: local Cartesian z-axis)
Definition at line 365 of file coordinateSystem.H.
References Tensor< Cmpt >::z().
Referenced by porousZone::axis().
Return direction (e1: local Cartesian x-axis)
Definition at line 372 of file coordinateSystem.H.
References Tensor< Cmpt >::x().
|
virtual |
Return as dictionary of entries.
[in] | ignoreType | drop 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().
|
inlinevirtual |
Rename.
Definition at line 386 of file coordinateSystem.H.
|
inline |
Edit access to origin.
Definition at line 392 of file coordinateSystem.H.
|
virtual |
Write.
Reimplemented in toroidalCS.
Definition at line 297 of file coordinateSystem.C.
References Foam::type().
Referenced by toroidalCS::write().
|
virtual |
Write dictionary.
Reimplemented in toroidalCS.
Definition at line 304 of file coordinateSystem.C.
References token::BEGIN_BLOCK, Foam::decrIndent(), token::END_BLOCK, token::END_STATEMENT, Foam::endl(), Foam::incrIndent(), Foam::indent(), Foam::nl, Foam::type(), and Ostream::writeKeyword().
Referenced by toroidalCS::writeDict().
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().
|
inline |
Convert from position in local coordinate system to global Cartesian position.
Definition at line 414 of file coordinateSystem.H.
References coordinateSystem::localToGlobal().
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().
|
inline |
Convert from vector components in local coordinate system to global Cartesian vector.
Definition at line 426 of file coordinateSystem.H.
References coordinateSystem::localToGlobal().
Convert from global Cartesian position to position in local coordinate system.
Definition at line 432 of file coordinateSystem.H.
References coordinateSystem::globalToLocal().
|
inline |
Convert from global Cartesian position to position in local coordinate system.
Definition at line 438 of file coordinateSystem.H.
References coordinateSystem::globalToLocal().
Convert from global Cartesian vector to components in local coordinate system.
Definition at line 444 of file coordinateSystem.H.
References coordinateSystem::globalToLocal().
|
inline |
Convert from global Cartesian vector to components in local coordinate system.
Definition at line 450 of file coordinateSystem.H.
References coordinateSystem::globalToLocal().
void operator= | ( | const dictionary & | rhs | ) |
assign from dictionary
Definition at line 336 of file coordinateSystem.C.
References Foam::endl(), dictionary::found(), coordinateRotation::New(), Foam::Pout, dictionary::readIfPresent(), dictionary::subDict(), and Vector< Cmpt >::zero.
Referenced by coordinateSystem::coordinateSystem().
|
friend |
|
friend |