BUGFIX: Fixed I/O for degrees option in coordinate systems. Author: Hrvoje Jasak. Merge: Dominik Christ.

This commit is contained in:
Dominik Christ 2014-09-30 13:42:45 +01:00
commit 44f746dc6d
14 changed files with 180 additions and 45 deletions

View file

@ -402,31 +402,31 @@ public:
virtual dictionary dict(bool ignoreType = false) const;
// Edit
// Edit
//- Rename
virtual void rename(const word& newName)
{
name_ = newName;
}
//- Rename
virtual void rename(const word& newName)
{
name_ = newName;
}
//- Edit access to origin
point& origin()
{
return origin_;
}
//- Edit access to origin
point& origin()
{
return origin_;
}
// Write
// Write
//- Write
virtual void write(Ostream&) const;
//- Write
virtual void write(Ostream&) const;
//- Write dictionary
virtual void writeDict(Ostream&, bool subDict = true) const;
//- Write dictionary
virtual void writeDict(Ostream&, bool subDict = true) const;
// Transformations
// Transformations
//- Convert from position in local coordinate system to
// global Cartesian position

View file

@ -25,7 +25,6 @@ License
#include "cylindricalCS.H"
#include "Switch.H"
#include "mathematicalConstants.H"
#include "boundBox.H"
#include "addToRunTimeSelectionTable.H"
@ -152,7 +151,7 @@ bool Foam::cylindricalCS::inDegrees() const
}
bool& Foam::cylindricalCS::inDegrees()
Foam::Switch& Foam::cylindricalCS::inDegrees()
{
return inDegrees_;
}
@ -254,4 +253,29 @@ Foam::tmp<Foam::vectorField> Foam::cylindricalCS::globalToLocal
}
void Foam::cylindricalCS::write(Ostream& os) const
{
coordinateSystem::write(os);
os << "inDegrees: " << inDegrees() << endl;
}
void Foam::cylindricalCS::writeDict(Ostream& os, bool subDict) const
{
if (subDict)
{
os << indent << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
}
coordinateSystem::writeDict(os, false);
os.writeKeyword("inDegrees") << inDegrees_ << token::END_STATEMENT << nl;
if (subDict)
{
os << decrIndent << indent << token::END_BLOCK << endl;
}
}
// ************************************************************************* //

View file

@ -36,7 +36,7 @@ SourceFiles
#define cylindricalCS_H
#include "coordinateSystem.H"
#include "typeInfo.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,7 +54,7 @@ class cylindricalCS
// Private data members
//- Are angles in degrees? (default = true)
bool inDegrees_;
Switch inDegrees_;
protected:
@ -156,8 +156,16 @@ public:
bool inDegrees() const;
//- Non-const access to inDegrees
bool& inDegrees();
Switch& inDegrees();
// Write
//- Write
virtual void write(Ostream&) const;
//- Write dictionary
virtual void writeDict(Ostream&, bool subDict = true) const;
};

View file

@ -165,7 +165,7 @@ bool Foam::ellipticCylindricalCS::inDegrees() const
}
bool& Foam::ellipticCylindricalCS::inDegrees()
Foam::Switch& Foam::ellipticCylindricalCS::inDegrees()
{
return inDegrees_;
}
@ -255,4 +255,29 @@ Foam::tmp<Foam::vectorField> Foam::ellipticCylindricalCS::globalToLocal
}
void Foam::ellipticCylindricalCS::write(Ostream& os) const
{
coordinateSystem::write(os);
os << "inDegrees: " << inDegrees() << endl;
}
void Foam::ellipticCylindricalCS::writeDict(Ostream& os, bool subDict) const
{
if (subDict)
{
os << indent << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
}
coordinateSystem::writeDict(os, false);
os.writeKeyword("inDegrees") << inDegrees_ << token::END_STATEMENT << nl;
if (subDict)
{
os << decrIndent << indent << token::END_BLOCK << endl;
}
}
// ************************************************************************* //

View file

@ -44,6 +44,7 @@ Authors
#define ellipticCylindricalCS_H
#include "coordinateSystem.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -64,7 +65,7 @@ class ellipticCylindricalCS
const scalar a_;
//- Are angles in degrees? (default = true)
bool inDegrees_;
Switch inDegrees_;
protected:
@ -171,7 +172,16 @@ public:
bool inDegrees() const;
//- Non-const access to inDegrees
bool& inDegrees();
Switch& inDegrees();
// Write
//- Write
virtual void write(Ostream&) const;
//- Write dictionary
virtual void writeDict(Ostream&, bool subDict = true) const;
};

View file

@ -25,7 +25,6 @@ License
#include "parabolicCylindricalCS.H"
#include "mathematicalConstants.H"
#include "Switch.H"
#include "boundBox.H"
#include "addToRunTimeSelectionTable.H"
@ -119,7 +118,7 @@ bool Foam::parabolicCylindricalCS::inDegrees() const
}
bool& Foam::parabolicCylindricalCS::inDegrees()
Foam::Switch& Foam::parabolicCylindricalCS::inDegrees()
{
return inDegrees_;
}
@ -227,4 +226,29 @@ Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::globalToLocal
}
void Foam::parabolicCylindricalCS::write(Ostream& os) const
{
coordinateSystem::write(os);
os << "inDegrees: " << inDegrees() << endl;
}
void Foam::parabolicCylindricalCS::writeDict(Ostream& os, bool subDict) const
{
if (subDict)
{
os << indent << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
}
coordinateSystem::writeDict(os, false);
os.writeKeyword("inDegrees") << inDegrees_ << token::END_STATEMENT << nl;
if (subDict)
{
os << decrIndent << indent << token::END_BLOCK << endl;
}
}
// ************************************************************************* //

View file

@ -41,6 +41,7 @@ SourceFiles
#define parabolicCylindricalCS_H
#include "coordinateSystem.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,7 +59,7 @@ class parabolicCylindricalCS
// Private data members
//- Are angles in degrees? (default = true)
bool inDegrees_;
Switch inDegrees_;
protected:
@ -134,7 +135,16 @@ public:
bool inDegrees() const;
//- Non-const access to inDegrees
bool& inDegrees();
Switch& inDegrees();
// Write
//- Write
virtual void write(Ostream&) const;
//- Write dictionary
virtual void writeDict(Ostream&, bool subDict = true) const;
};

View file

@ -26,7 +26,6 @@ License
#include "sphericalCS.H"
#include "one.H"
#include "Switch.H"
#include "mathematicalConstants.H"
#include "boundBox.H"
#include "addToRunTimeSelectionTable.H"
@ -150,7 +149,7 @@ bool Foam::sphericalCS::inDegrees() const
}
bool& Foam::sphericalCS::inDegrees()
Foam::Switch& Foam::sphericalCS::inDegrees()
{
return inDegrees_;
}
@ -274,4 +273,29 @@ Foam::tmp<Foam::vectorField> Foam::sphericalCS::globalToLocal
}
void Foam::sphericalCS::write(Ostream& os) const
{
coordinateSystem::write(os);
os << "inDegrees: " << inDegrees() << endl;
}
void Foam::sphericalCS::writeDict(Ostream& os, bool subDict) const
{
if (subDict)
{
os << indent << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
}
coordinateSystem::writeDict(os, false);
os.writeKeyword("inDegrees") << inDegrees_ << token::END_STATEMENT << nl;
if (subDict)
{
os << decrIndent << indent << token::END_BLOCK << endl;
}
}
// ************************************************************************* //

View file

@ -36,6 +36,7 @@ SourceFiles
#define sphericalCS_H
#include "coordinateSystem.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,7 +54,7 @@ class sphericalCS
// Private data members
//- Are angles in degrees? (default = true)
bool inDegrees_;
Switch inDegrees_;
protected:
@ -154,8 +155,16 @@ public:
bool inDegrees() const;
//- Non-const access to inDegrees
bool& inDegrees();
Switch& inDegrees();
// Write
//- Write
virtual void write(Ostream&) const;
//- Write dictionary
virtual void writeDict(Ostream&, bool subDict = true) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -25,7 +25,6 @@ License
#include "toroidalCS.H"
#include "mathematicalConstants.H"
#include "Switch.H"
#include "boundBox.H"
#include "addToRunTimeSelectionTable.H"
@ -106,7 +105,7 @@ bool Foam::toroidalCS::inDegrees() const
}
bool& Foam::toroidalCS::inDegrees()
Foam::Switch& Foam::toroidalCS::inDegrees()
{
return inDegrees_;
}
@ -205,7 +204,7 @@ void Foam::toroidalCS::writeDict(Ostream& os, bool subDict) const
{
if (subDict)
{
os << indent << name() << nl
os << indent << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
}
@ -218,4 +217,5 @@ void Foam::toroidalCS::writeDict(Ostream& os, bool subDict) const
}
}
// ************************************************************************* //

View file

@ -39,6 +39,7 @@ SourceFiles
#define toroidalCS_H
#include "coordinateSystem.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +61,7 @@ class toroidalCS
scalar radius_;
//- Are angles in degrees? (default = true)
bool inDegrees_;
Switch inDegrees_;
// Private Member Functions
@ -133,7 +134,7 @@ public:
bool inDegrees() const;
//- Non-const access to inDegrees
bool& inDegrees();
Switch& inDegrees();
//- Return radius
scalar radius() const
@ -145,7 +146,7 @@ public:
virtual void write(Ostream&) const;
//- Write dictionary
virtual void writeDict(Ostream&, bool subDict=true) const;
virtual void writeDict(Ostream&, bool subDict = true) const;
};

View file

@ -290,7 +290,7 @@ boundary
origin (0 0 0);
axis (0 0 1);
direction (1 0 0);
degrees false; //Use radians
inDegrees false; //Use radians
//Equivalent axis/direction definition:
//e3 (0 0 1);
//e1 (1 0 0);
@ -376,7 +376,7 @@ boundary
origin (0 0 0);
axis (0 0 1);
direction (1 0 0);
degrees false; //Use radians
inDegrees false; //Use radians
//Equivalent axis/direction definition:
//e3 (0 0 1);
//e1 (1 0 0);
@ -405,7 +405,7 @@ boundary
origin (0 0 0);
axis (0 0 1);
direction (1 0 0);
degrees false; //Use radians
inDegrees false; //Use radians
//Equivalent axis/direction definition:
//e3 (0 0 1);
//e1 (1 0 0);
@ -498,7 +498,7 @@ boundary
origin (0 0 0);
axis (0 0 1);
direction (1 0 0);
degrees false; //Use radians
inDegrees false; //Use radians
//Equivalent axis/direction definition:
//e3 (0 0 1);
//e1 (1 0 0);

View file

@ -55,7 +55,7 @@ FoamFile
origin (0 0 0);
e1 (1 0 0);
e3 (0 0 1);
degrees false; //Use radians
inDegrees false; //Use radians
}
ribbonPatch
{

View file

@ -55,7 +55,7 @@ FoamFile
origin (0 0 0);
e1 (1 0 0);
e3 (0 0 1);
degrees false; //Use radians
inDegrees false; //Use radians
}
ribbonPatch
{