ENH: regionSizeDistrubtion: optional coordinateSystem for vectorFields

This commit is contained in:
mattijs
2013-09-18 16:01:08 +01:00
parent 670476dd52
commit c969be872c
2 changed files with 31 additions and 1 deletions

View File

@ -368,6 +368,14 @@ void Foam::regionSizeDistribution::read(const dictionary& dict)
word format(dict.lookup("setFormat")); word format(dict.lookup("setFormat"));
formatterPtr_ = writer<scalar>::New(format); formatterPtr_ = writer<scalar>::New(format);
if (dict.found("coordinateSystem"))
{
coordSysPtr_.reset(new coordinateSystem(obr_, dict));
Info<< "Transforming all vectorFields with coordinate system "
<< coordSysPtr_().name() << endl;
}
} }
} }
@ -797,11 +805,21 @@ void Foam::regionSizeDistribution::write()
const word& fldName = vectorNames[selected[i]]; const word& fldName = vectorNames[selected[i]];
Info<< "Vector field " << fldName << endl; Info<< "Vector field " << fldName << endl;
const vectorField& fld = obr_.lookupObject vectorField fld = obr_.lookupObject
< <
volVectorField volVectorField
>(fldName).internalField(); >(fldName).internalField();
if (coordSysPtr_.valid())
{
Info<< "Transforming vector field " << fldName
<< " with coordinate system "
<< coordSysPtr_().name()
<< endl;
fld = coordSysPtr_().localVector(fld);
}
// Components // Components

View File

@ -69,6 +69,13 @@ Description
maxDiameter 0.5e-4; maxDiameter 0.5e-4;
minDiameter 0; minDiameter 0;
setFormat gnuplot; setFormat gnuplot;
coordinateSystem
{
type cartesian;
origin (0 0 0);
e3 (0 1 1);
e1 (1 0 0);
}
} }
\endverbatim \endverbatim
@ -84,6 +91,7 @@ Description
maxDiameter | maximum region equivalent diameter | yes | maxDiameter | maximum region equivalent diameter | yes |
minDiameter | minimum region equivalent diameter | no | 0 minDiameter | minimum region equivalent diameter | no | 0
setFormat | writing format | yes | setFormat | writing format | yes |
coordinateSystem | transformation for vector fields | no |
\endtable \endtable
SeeAlso SeeAlso
@ -104,6 +112,7 @@ SourceFiles
#include "Map.H" #include "Map.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "wordReList.H" #include "wordReList.H"
#include "coordinateSystem.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -159,6 +168,9 @@ class regionSizeDistribution
//- Output formatter to write //- Output formatter to write
autoPtr<writer<scalar> > formatterPtr_; autoPtr<writer<scalar> > formatterPtr_;
//- Optional coordinate system
autoPtr<coordinateSystem> coordSysPtr_;
// Private Member Functions // Private Member Functions