From 305bdb59782aa3156d016db0fc0062b15bd36f53 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 11 Jan 2011 13:09:41 +0100 Subject: [PATCH] ENH: add clear() method to coordinateSystem, coordinateRotation --- .../coordinateRotation/coordinateRotation.C | 10 +++++++++- .../coordinateRotation/coordinateRotation.H | 5 ++++- src/meshTools/coordinateSystems/coordinateSystem.C | 11 ++++++++++- src/meshTools/coordinateSystems/coordinateSystem.H | 6 +++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C index 5e4e90837e..cee40302dd 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -167,6 +167,14 @@ Foam::autoPtr Foam::coordinateRotation::New } +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::coordinateRotation::clear() +{ + this->tensor::operator=(sphericalTensor::I); +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // void Foam::coordinateRotation::operator=(const dictionary& rhs) diff --git a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H index 9e5d369cdb..897f0b17d4 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -165,6 +165,9 @@ public: // Member Functions + //- Reset rotation to an identity rotation + virtual void clear(); + //- Return local-to-global transformation tensor const tensor& R() const { diff --git a/src/meshTools/coordinateSystems/coordinateSystem.C b/src/meshTools/coordinateSystems/coordinateSystem.C index e394f89bb2..d4f088d9d4 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.C +++ b/src/meshTools/coordinateSystems/coordinateSystem.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -290,6 +290,15 @@ Foam::tmp Foam::coordinateSystem::globalToLocal } +void Foam::coordinateSystem::clear() +{ + note_.clear(); + origin_ = point::zero; + R_.clear(); + Rtr_ = sphericalTensor::I; +} + + void Foam::coordinateSystem::write(Ostream& os) const { os << type() diff --git a/src/meshTools/coordinateSystems/coordinateSystem.H b/src/meshTools/coordinateSystems/coordinateSystem.H index a5a51944e2..20106002e8 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.H +++ b/src/meshTools/coordinateSystems/coordinateSystem.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -397,6 +397,10 @@ public: return origin_; } + //- Reset origin and rotation to an identity coordinateSystem + // Also resets the note + virtual void clear(); + // Write