more sensible variable names

This commit is contained in:
andy
2009-08-19 11:47:52 +01:00
parent 3e0ec9d835
commit 71b7f89329
2 changed files with 22 additions and 23 deletions

View File

@ -55,8 +55,8 @@ Foam::faceZonesIntegration::faceZonesIntegration
obr_(obr), obr_(obr),
active_(true), active_(true),
log_(false), log_(false),
faceZonesSet_(), zoneNames_(),
fItems_(), fieldNames_(),
filePtr_(NULL) filePtr_(NULL)
{ {
// Check if the available mesh is an fvMesh otherise deactivate // Check if the available mesh is an fvMesh otherise deactivate
@ -94,9 +94,9 @@ void Foam::faceZonesIntegration::read(const dictionary& dict)
{ {
log_ = dict.lookupOrDefault<Switch>("log", false); log_ = dict.lookupOrDefault<Switch>("log", false);
dict.lookup("fields") >> fItems_; dict.lookup("fields") >> fieldNames_;
dict.lookup("faceZones") >> faceZonesSet_; dict.lookup("faceZones") >> zoneNames_;
} }
} }
@ -132,11 +132,11 @@ void Foam::faceZonesIntegration::makeFile()
mkDir(faceZonesIntegrationDir); mkDir(faceZonesIntegrationDir);
// Open new file at start up // Open new file at start up
filePtr_.resize(fItems_.size()); filePtr_.resize(fieldNames_.size());
forAll(fItems_, Ifields) forAll(fieldNames_, fieldI)
{ {
const word& fieldName = fItems_[Ifields]; const word& fieldName = fieldNames_[fieldI];
OFstream* sPtr = new OFstream OFstream* sPtr = new OFstream
( (
@ -163,10 +163,9 @@ void Foam::faceZonesIntegration::writeFileHeader()
os << "#Time " << setw(w); os << "#Time " << setw(w);
forAll (faceZonesSet_, zoneI) forAll (zoneNames_, zoneI)
{ {
const word name = faceZonesSet_[zoneI]; os << zoneNames_[zoneI] << setw(w);
os << name << setw(w);
} }
os << nl << endl; os << nl << endl;
@ -192,9 +191,9 @@ void Foam::faceZonesIntegration::write()
{ {
makeFile(); makeFile();
forAll(fItems_, fieldI) forAll(fieldNames_, fieldI)
{ {
const word& fieldName = fItems_[fieldI]; const word& fieldName = fieldNames_[fieldI];
const surfaceScalarField& sField = const surfaceScalarField& sField =
obr_.lookupObject<surfaceScalarField>(fieldName); obr_.lookupObject<surfaceScalarField>(fieldName);
@ -203,17 +202,17 @@ void Foam::faceZonesIntegration::write()
// 1. integrate over all face zones // 1. integrate over all face zones
scalarField integralVals(faceZonesSet_.size()); scalarField integralVals(zoneNames_.size());
forAll(faceZonesSet_, setI) forAll(integralVals, zoneI)
{ {
const word name = faceZonesSet_[setI]; const word& name = zoneNames_[zoneI];
label zoneID = mesh.faceZones().findZoneID(name); label zoneID = mesh.faceZones().findZoneID(name);
const faceZone& fZone = mesh.faceZones()[zoneID]; const faceZone& fZone = mesh.faceZones()[zoneID];
integralVals[setI] = returnReduce integralVals[zoneI] = returnReduce
( (
calcIntegral(sField, fZone), calcIntegral(sField, fZone),
sumOp<scalar>() sumOp<scalar>()
@ -231,15 +230,15 @@ void Foam::faceZonesIntegration::write()
os << obr_.time().value(); os << obr_.time().value();
forAll(integralVals, setI) forAll(integralVals, zoneI)
{ {
os << ' ' << setw(w) << integralVals[setI]; os << ' ' << setw(w) << integralVals[zoneI];
if (log_) if (log_)
{ {
Info<< "faceZonesIntegration output:" << nl Info<< "faceZonesIntegration output:" << nl
<< " Integration[" << setI << "] " << " Integration[" << zoneI << "] "
<< integralVals[setI] << endl; << integralVals[zoneI] << endl;
} }
} }

View File

@ -82,11 +82,11 @@ protected:
//- Switch to send output to Info as well as to file //- Switch to send output to Info as well as to file
Switch log_; Switch log_;
//- faceZones to integrate over //- List of face zone names to integrate over
wordList faceZonesSet_; wordList zoneNames_;
//- Names of the surface fields //- Names of the surface fields
wordList fItems_; wordList fieldNames_;
//- Current open files //- Current open files