mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: writeFile - add newFile function
ENH: writeFile - renamed createFile functions
to newFileAtTime and newFileAtStartTime
This commit is contained in:
committed by
Mark OLESEN
parent
c59b6db3c4
commit
f87f0040b8
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -135,7 +135,7 @@ bool Foam::functionObjects::Curle::read(const dictionary& dict)
|
||||
rawFilePtrs_.set
|
||||
(
|
||||
filei,
|
||||
createFile("observer" + Foam::name(filei))
|
||||
newFileAtStartTime("observer" + Foam::name(filei))
|
||||
);
|
||||
|
||||
if (rawFilePtrs_.set(filei))
|
||||
|
||||
@ -742,7 +742,7 @@ void Foam::DMDModels::STDMD::writeToFile(const word& fileName) const
|
||||
// Write objects of dynamics
|
||||
{
|
||||
autoPtr<OFstream> osPtr =
|
||||
createFile
|
||||
newFileAtTime
|
||||
(
|
||||
fileName + "_" + fieldName_,
|
||||
mesh_.time().timeOutputValue()
|
||||
|
||||
@ -190,7 +190,7 @@ bool Foam::binModel::read(const dictionary& dict)
|
||||
filePtrs_.setSize(fieldNames_.size());
|
||||
forAll(filePtrs_, i)
|
||||
{
|
||||
filePtrs_.set(i, createFile(fieldNames_[i] + "Bin"));
|
||||
filePtrs_.set(i, newFileAtStartTime(fieldNames_[i] + "Bin"));
|
||||
}
|
||||
|
||||
setCoordinateSystem(dict);
|
||||
|
||||
@ -910,7 +910,7 @@ bool Foam::functionObjects::fluxSummary::update()
|
||||
forAll(filePtrs_, zonei)
|
||||
{
|
||||
const word& zoneName = zoneNames_[zonei];
|
||||
filePtrs_.set(zonei, createFile(zoneName));
|
||||
filePtrs_.set(zonei, newFileAtStartTime(zoneName));
|
||||
writeFileHeader
|
||||
(
|
||||
zoneName,
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,19 +36,19 @@ createFileNames()
|
||||
{
|
||||
if (writeToFile() && !prodFilePtr_)
|
||||
{
|
||||
prodFilePtr_ = createFile("production");
|
||||
prodFilePtr_ = newFileAtStartTime("production");
|
||||
writeHeader(prodFilePtr_(), "production");
|
||||
writeFileHeader(prodFilePtr_());
|
||||
|
||||
consFilePtr_ = createFile("consumption");
|
||||
consFilePtr_ = newFileAtStartTime("consumption");
|
||||
writeHeader(consFilePtr_(), "consumption");
|
||||
writeFileHeader(consFilePtr_());
|
||||
|
||||
prodIntFilePtr_ = createFile("productionInt");
|
||||
prodIntFilePtr_ = newFileAtStartTime("productionInt");
|
||||
writeHeader(prodIntFilePtr_(), "productionInt");
|
||||
writeFileHeader(prodIntFilePtr_());
|
||||
|
||||
consIntFilePtr_ = createFile("consumptionInt");
|
||||
consIntFilePtr_ = newFileAtStartTime("consumptionInt");
|
||||
writeHeader(consIntFilePtr_(), "consumptionInt");
|
||||
writeFileHeader(consIntFilePtr_());
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ void Foam::functionObjects::forceCoeffs::createIntegratedDataFile()
|
||||
{
|
||||
if (!coeffFilePtr_.valid())
|
||||
{
|
||||
coeffFilePtr_ = createFile("coefficient");
|
||||
coeffFilePtr_ = newFileAtStartTime("coefficient");
|
||||
writeIntegratedDataFileHeader("Coefficients", coeffFilePtr_());
|
||||
}
|
||||
}
|
||||
|
||||
@ -386,13 +386,13 @@ void Foam::functionObjects::forces::createIntegratedDataFiles()
|
||||
{
|
||||
if (!forceFilePtr_.valid())
|
||||
{
|
||||
forceFilePtr_ = createFile("force");
|
||||
forceFilePtr_ = newFileAtStartTime("force");
|
||||
writeIntegratedDataFileHeader("Force", forceFilePtr_());
|
||||
}
|
||||
|
||||
if (!momentFilePtr_.valid())
|
||||
{
|
||||
momentFilePtr_ = createFile("moment");
|
||||
momentFilePtr_ = newFileAtStartTime("moment");
|
||||
writeIntegratedDataFileHeader("Moment", momentFilePtr_());
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,7 +181,8 @@ void Foam::functionObjects::propellerInfo::createFiles()
|
||||
|
||||
if (writePropellerPerformance_ && !propellerPerformanceFilePtr_)
|
||||
{
|
||||
propellerPerformanceFilePtr_ = createFile("propellerPerformance");
|
||||
propellerPerformanceFilePtr_ =
|
||||
newFileAtStartTime("propellerPerformance");
|
||||
auto& os = propellerPerformanceFilePtr_();
|
||||
|
||||
writeHeader(os, "Propeller performance");
|
||||
@ -203,8 +204,9 @@ void Foam::functionObjects::propellerInfo::createFiles()
|
||||
|
||||
if (writeWakeFields_)
|
||||
{
|
||||
if (!wakeFilePtr_) wakeFilePtr_ = createFile("wake");
|
||||
if (!axialWakeFilePtr_) axialWakeFilePtr_ = createFile("axialWake");
|
||||
if (!wakeFilePtr_) wakeFilePtr_ = newFileAtStartTime("wake");
|
||||
if (!axialWakeFilePtr_) axialWakeFilePtr_ =
|
||||
newFileAtStartTime("axialWake");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2019 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -378,7 +378,7 @@ Foam::functionObjects::sizeDistribution::sizeDistribution
|
||||
{
|
||||
read(dict);
|
||||
resetFile(name);
|
||||
createFile(name);
|
||||
newFileAtStartTime(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ void Foam::functionObjects::energySpectrum::calcAndWriteSpectrum
|
||||
E /= kappaNorm;
|
||||
|
||||
Log << "Writing spectrum" << endl;
|
||||
autoPtr<OFstream> osPtr = createFile(name(), time_.value());
|
||||
autoPtr<OFstream> osPtr = newFileAtTime(name(), time_.value());
|
||||
OFstream& os = osPtr.ref();
|
||||
writeFileHeader(os);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user