mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: support user specification of ensight time format/precision (#2999)
- new format option keywords: timeFormat, timePrecision CONFIG: default ensight output is now consistently BINARY - this removes some uncertainty with the ensightWrite functionObject which was previously dependent on the simulation writeFormat and makes its behaviour consistent with foamToEnsight Note: binary Ensight output is consistent with the defaults for VTP output (inline binary) ENH: minor adjustment of ensight writing methods
This commit is contained in:
committed by
Andrew Heather
parent
8ec35d0b26
commit
dafae668d1
@ -73,7 +73,10 @@ Foam::Time::writeControlNames
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Foam::Time::fmtflags Foam::Time::format_(Foam::Time::fmtflags::general);
|
Foam::IOstreamOption::floatFormat Foam::Time::format_
|
||||||
|
(
|
||||||
|
IOstreamOption::floatFormat::general
|
||||||
|
);
|
||||||
|
|
||||||
int Foam::Time::precision_(6);
|
int Foam::Time::precision_(6);
|
||||||
|
|
||||||
|
|||||||
@ -104,15 +104,6 @@ public:
|
|||||||
saUnknown //!< Dummy no-op. Do not change current value.
|
saUnknown //!< Dummy no-op. Do not change current value.
|
||||||
};
|
};
|
||||||
|
|
||||||
//- Supported time directory name formats
|
|
||||||
enum fmtflags
|
|
||||||
{
|
|
||||||
general = 0, //!< default float notation
|
|
||||||
fixed = ios_base::fixed, //!< fixed-point notation
|
|
||||||
scientific = ios_base::scientific //!< scientific notation
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//- Names for writeControls
|
//- Names for writeControls
|
||||||
static const Enum<writeControls> writeControlNames;
|
static const Enum<writeControls> writeControlNames;
|
||||||
|
|
||||||
@ -179,9 +170,8 @@ protected:
|
|||||||
//- Signal handler for write and clean exit upon signal
|
//- Signal handler for write and clean exit upon signal
|
||||||
sigStopAtWriteNow sigStopAtWriteNow_;
|
sigStopAtWriteNow sigStopAtWriteNow_;
|
||||||
|
|
||||||
|
//- Format for time directory names (general | fixed | scientific)
|
||||||
//- Time directory name format
|
static IOstreamOption::floatFormat format_;
|
||||||
static fmtflags format_;
|
|
||||||
|
|
||||||
//- Time directory name precision
|
//- Time directory name precision
|
||||||
static int precision_;
|
static int precision_;
|
||||||
|
|||||||
@ -329,29 +329,8 @@ void Foam::Time::readDict()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controlDict_.found("timeFormat"))
|
format_ =
|
||||||
{
|
IOstreamOption::floatFormatEnum("timeFormat", controlDict_, format_);
|
||||||
const word formatName(controlDict_.get<word>("timeFormat"));
|
|
||||||
|
|
||||||
if (formatName == "general")
|
|
||||||
{
|
|
||||||
format_ = fmtflags::general;
|
|
||||||
}
|
|
||||||
else if (formatName == "fixed")
|
|
||||||
{
|
|
||||||
format_ = fmtflags::fixed;
|
|
||||||
}
|
|
||||||
else if (formatName == "scientific")
|
|
||||||
{
|
|
||||||
format_ = fmtflags::scientific;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "Unsupported time format " << formatName
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
controlDict_.readIfPresent("timePrecision", precision_);
|
controlDict_.readIfPresent("timePrecision", precision_);
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,6 +35,17 @@ License
|
|||||||
|
|
||||||
const Foam::IOstreamOption::versionNumber Foam::IOstreamOption::currentVersion;
|
const Foam::IOstreamOption::versionNumber Foam::IOstreamOption::currentVersion;
|
||||||
|
|
||||||
|
const Foam::Enum
|
||||||
|
<
|
||||||
|
Foam::IOstreamOption::floatFormat
|
||||||
|
>
|
||||||
|
Foam::IOstreamOption::floatFormatNames
|
||||||
|
({
|
||||||
|
{ floatFormat::general, "general" },
|
||||||
|
{ floatFormat::fixed, "fixed" },
|
||||||
|
{ floatFormat::scientific, "scientific" },
|
||||||
|
});
|
||||||
|
|
||||||
const Foam::Enum
|
const Foam::Enum
|
||||||
<
|
<
|
||||||
Foam::IOstreamOption::streamFormat
|
Foam::IOstreamOption::streamFormat
|
||||||
@ -48,27 +59,72 @@ Foam::IOstreamOption::formatNames
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::IOstreamOption::streamFormat
|
Foam::IOstreamOption::floatFormat
|
||||||
Foam::IOstreamOption::formatEnum
|
Foam::IOstreamOption::floatFormatEnum
|
||||||
(
|
(
|
||||||
const word& formatName,
|
const word& fmtName,
|
||||||
const streamFormat deflt
|
const floatFormat deflt
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Handle bad input graciously. A no-op for an empty string
|
// Handle bad input graciously. A no-op for an empty string
|
||||||
|
|
||||||
if (!formatName.empty())
|
if (!fmtName.empty())
|
||||||
{
|
{
|
||||||
if (formatNames.contains(formatName))
|
const auto iter = floatFormatNames.cfind(fmtName);
|
||||||
|
|
||||||
|
if (iter.good())
|
||||||
{
|
{
|
||||||
return formatNames[formatName];
|
return iter.val();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fall-through to warning
|
// Fall-through to warning
|
||||||
|
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Unknown format specifier '" << formatName
|
<< "Unknown float format specifier '" << fmtName
|
||||||
<< "', using '" << formatNames[deflt] << "'\n";
|
<< "' using '" << floatFormatNames[deflt]
|
||||||
|
<< "' from " << floatFormatNames << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return deflt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::IOstreamOption::floatFormat
|
||||||
|
Foam::IOstreamOption::floatFormatEnum
|
||||||
|
(
|
||||||
|
const word& key,
|
||||||
|
const dictionary& dict,
|
||||||
|
const floatFormat deflt
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return floatFormatNames.getOrDefault(key, dict, deflt, true); // warnOnly
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::IOstreamOption::streamFormat
|
||||||
|
Foam::IOstreamOption::formatEnum
|
||||||
|
(
|
||||||
|
const word& fmtName,
|
||||||
|
const streamFormat deflt
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Handle bad input graciously. A no-op for an empty string
|
||||||
|
|
||||||
|
if (!fmtName.empty())
|
||||||
|
{
|
||||||
|
const auto iter = formatNames.cfind(fmtName);
|
||||||
|
|
||||||
|
if (iter.good())
|
||||||
|
{
|
||||||
|
return iter.val();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fall-through to warning
|
||||||
|
|
||||||
|
WarningInFunction
|
||||||
|
<< "Unknown stream format specifier '" << fmtName
|
||||||
|
<< "' using '" << formatNames[deflt]
|
||||||
|
<< "' from " << formatNames << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return deflt;
|
return deflt;
|
||||||
@ -83,7 +139,7 @@ Foam::IOstreamOption::formatEnum
|
|||||||
const streamFormat deflt
|
const streamFormat deflt
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return formatNames.getOrDefault(key, dict, deflt, true); // failsafe=true
|
return formatNames.getOrDefault(key, dict, deflt, true); // warnOnly
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -114,8 +170,7 @@ Foam::IOstreamOption::compressionEnum
|
|||||||
|
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Unknown compression specifier '" << compName
|
<< "Unknown compression specifier '" << compName
|
||||||
<< "', using compression "
|
<< "' using compression " << (deflt ? "on" : "off") << nl;
|
||||||
<< (deflt ? "on" : "off" ) << nl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return deflt;
|
return deflt;
|
||||||
@ -132,7 +187,7 @@ Foam::IOstreamOption::compressionEnum
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
Switch(key, dict, Switch(bool(deflt)), true) // failsafe=true
|
Switch(key, dict, Switch(bool(deflt)), true) // warnOnly
|
||||||
? compressionType::COMPRESSED
|
? compressionType::COMPRESSED
|
||||||
: compressionType::UNCOMPRESSED
|
: compressionType::UNCOMPRESSED
|
||||||
);
|
);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -48,6 +48,7 @@ SourceFiles
|
|||||||
#define Foam_IOstreamOption_H
|
#define Foam_IOstreamOption_H
|
||||||
|
|
||||||
#include "word.H"
|
#include "word.H"
|
||||||
|
#include <ios>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -97,6 +98,17 @@ public:
|
|||||||
ATOMIC //!< atomic = true
|
ATOMIC //!< atomic = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//- Float formats (eg, time directory name formats)
|
||||||
|
enum class floatFormat : unsigned
|
||||||
|
{
|
||||||
|
//! default float notation
|
||||||
|
general = unsigned(0),
|
||||||
|
//! fixed-point notation
|
||||||
|
fixed = unsigned(std::ios_base::fixed),
|
||||||
|
//! scientific notation
|
||||||
|
scientific = unsigned(std::ios_base::scientific)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//- Representation of a major/minor version number
|
//- Representation of a major/minor version number
|
||||||
class versionNumber
|
class versionNumber
|
||||||
@ -134,7 +146,7 @@ public:
|
|||||||
explicit versionNumber(const token& tok);
|
explicit versionNumber(const token& tok);
|
||||||
|
|
||||||
//- Failsafe construct from dictionary lookup.
|
//- Failsafe construct from dictionary lookup.
|
||||||
versionNumber(const word& keyword, const dictionary& dict);
|
versionNumber(const word& key, const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -168,13 +180,16 @@ public:
|
|||||||
// Positive when 'this' is greater than other.
|
// Positive when 'this' is greater than other.
|
||||||
int compare(const versionNumber& other) const noexcept
|
int compare(const versionNumber& other) const noexcept
|
||||||
{
|
{
|
||||||
return number_ - other.number_;
|
return (number_ - other.number_);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Public Static Data
|
// Public Static Data
|
||||||
|
|
||||||
|
//- Names for float formats (general, fixed, scientific)
|
||||||
|
static const Enum<floatFormat> floatFormatNames;
|
||||||
|
|
||||||
//- Stream format names (ascii, binary)
|
//- Stream format names (ascii, binary)
|
||||||
static const Enum<streamFormat> formatNames;
|
static const Enum<streamFormat> formatNames;
|
||||||
|
|
||||||
@ -182,6 +197,75 @@ public:
|
|||||||
static const versionNumber currentVersion;
|
static const versionNumber currentVersion;
|
||||||
|
|
||||||
|
|
||||||
|
// Static Helpers
|
||||||
|
|
||||||
|
//- Lookup floatFormat enum corresponding to the string
|
||||||
|
//- (general | fixed | scientific).
|
||||||
|
//
|
||||||
|
// If the string is not recognized, emit warning and return default.
|
||||||
|
// Silent if the string itself is empty.
|
||||||
|
//
|
||||||
|
// \note Can be used as constructor substitute for the enumeration
|
||||||
|
static floatFormat floatFormatEnum
|
||||||
|
(
|
||||||
|
const word& fmtName,
|
||||||
|
const floatFormat deflt = floatFormat::general
|
||||||
|
);
|
||||||
|
|
||||||
|
//- getOrDefault floatFormat from dictionary,
|
||||||
|
//- warn only on bad enumeration.
|
||||||
|
static floatFormat floatFormatEnum
|
||||||
|
(
|
||||||
|
const word& key, //!< Lookup key. Uses LITERAL (not REGEX)
|
||||||
|
const dictionary& dict, //!< dictionary
|
||||||
|
const floatFormat deflt = floatFormat::general
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Lookup streamFormat enum corresponding to the string
|
||||||
|
//- (ascii | binary).
|
||||||
|
//
|
||||||
|
// If the string is not recognized, emit warning and return default.
|
||||||
|
// Silent if the string itself is empty.
|
||||||
|
//
|
||||||
|
// \note Can be used as constructor substitute for the enumeration
|
||||||
|
static streamFormat formatEnum
|
||||||
|
(
|
||||||
|
const word& fmtName,
|
||||||
|
const streamFormat deflt = streamFormat::ASCII
|
||||||
|
);
|
||||||
|
|
||||||
|
//- getOrDefault streamFormat from dictionary,
|
||||||
|
//- warn only on bad enumeration.
|
||||||
|
static streamFormat formatEnum
|
||||||
|
(
|
||||||
|
const word& key, //!< Lookup key. Uses LITERAL (not REGEX)
|
||||||
|
const dictionary& dict, //!< dictionary
|
||||||
|
const streamFormat deflt = streamFormat::ASCII
|
||||||
|
);
|
||||||
|
|
||||||
|
//- The compression enum corresponding to the string.
|
||||||
|
// Expects switch values (true/false, on/off, ...)
|
||||||
|
//
|
||||||
|
// If the string is not recognized, emit warning and return default.
|
||||||
|
// Silent if the string itself is empty.
|
||||||
|
//
|
||||||
|
// \note Can be used as constructor substitute for the enumeration
|
||||||
|
static compressionType compressionEnum
|
||||||
|
(
|
||||||
|
const word& compName,
|
||||||
|
const compressionType deflt = compressionType::UNCOMPRESSED
|
||||||
|
);
|
||||||
|
|
||||||
|
//- getOrDefault compressionType from dictionary,
|
||||||
|
//- warn only on bad enumeration.
|
||||||
|
static compressionType compressionEnum
|
||||||
|
(
|
||||||
|
const word& key, //!< Lookup key. Uses LITERAL (not REGEX)
|
||||||
|
const dictionary& dict, //!< dictionary
|
||||||
|
const compressionType deflt = compressionType::UNCOMPRESSED
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private Data
|
// Private Data
|
||||||
@ -252,51 +336,6 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Static Member Functions
|
|
||||||
|
|
||||||
//- The stream format enum corresponding to the string
|
|
||||||
//- (ascii | binary).
|
|
||||||
//
|
|
||||||
// If the string is not recognized, emit warning and return default.
|
|
||||||
// Silent if the string itself is empty.
|
|
||||||
//
|
|
||||||
// \note Can be used as constructor substitute for the enumeration
|
|
||||||
static streamFormat formatEnum
|
|
||||||
(
|
|
||||||
const word& formatName,
|
|
||||||
const streamFormat deflt = streamFormat::ASCII
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Failsafe construct streamFormat from optional dictionary lookup
|
|
||||||
static streamFormat formatEnum
|
|
||||||
(
|
|
||||||
const word& key, //!< Lookup key. Uses LITERAL (not REGEX)
|
|
||||||
const dictionary& dict, //!< dictionary
|
|
||||||
const streamFormat deflt = streamFormat::ASCII
|
|
||||||
);
|
|
||||||
|
|
||||||
//- The compression enum corresponding to the string.
|
|
||||||
// Expects switch values (true/false, on/off, ...)
|
|
||||||
//
|
|
||||||
// If the string is not recognized, emit warning and return default.
|
|
||||||
// Silent if the string itself is empty.
|
|
||||||
//
|
|
||||||
// \note Can be used as constructor substitute for the enumeration
|
|
||||||
static compressionType compressionEnum
|
|
||||||
(
|
|
||||||
const word& compName,
|
|
||||||
const compressionType deflt = compressionType::UNCOMPRESSED
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Failsafe construct compressionType from optional dictionary lookup
|
|
||||||
static compressionType compressionEnum
|
|
||||||
(
|
|
||||||
const word& key, //!< Lookup key. Uses LITERAL (not REGEX)
|
|
||||||
const dictionary& dict, //!< dictionary
|
|
||||||
const compressionType deflt = compressionType::UNCOMPRESSED
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Get the current stream format
|
//- Get the current stream format
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -56,6 +56,44 @@ Foam::word Foam::ensightCase::padded(const int nwidth, const label value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightCase::setTimeFormat
|
||||||
|
(
|
||||||
|
OSstream& os,
|
||||||
|
IOstreamOption::floatFormat timeFmt,
|
||||||
|
const int timePrec
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os.setf(std::ios_base::left);
|
||||||
|
os.setf
|
||||||
|
(
|
||||||
|
std::ios_base::fmtflags(timeFmt),
|
||||||
|
std::ios_base::floatfield
|
||||||
|
);
|
||||||
|
|
||||||
|
if (timePrec > 0)
|
||||||
|
{
|
||||||
|
os.precision(timePrec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightCase::setTimeFormat
|
||||||
|
(
|
||||||
|
OSstream& os,
|
||||||
|
const ensightCase::options& opts
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os.setf(std::ios_base::left);
|
||||||
|
os.setf
|
||||||
|
(
|
||||||
|
std::ios_base::fmtflags(opts.timeFormat()),
|
||||||
|
std::ios_base::floatfield
|
||||||
|
);
|
||||||
|
|
||||||
|
os.precision(opts.timePrecision());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::ensightCase::printTimeset
|
void Foam::ensightCase::printTimeset
|
||||||
(
|
(
|
||||||
OSstream& os,
|
OSstream& os,
|
||||||
@ -184,7 +222,7 @@ Foam::fileName Foam::ensightCase::dataDir() const
|
|||||||
|
|
||||||
void Foam::ensightCase::initialize()
|
void Foam::ensightCase::initialize()
|
||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (UPstream::master())
|
||||||
{
|
{
|
||||||
// EnSight and EnSight/data directories must exist
|
// EnSight and EnSight/data directories must exist
|
||||||
|
|
||||||
@ -211,11 +249,7 @@ void Foam::ensightCase::initialize()
|
|||||||
|
|
||||||
// The case file is always ASCII
|
// The case file is always ASCII
|
||||||
os_.reset(new OFstream(ensightDir_/caseName_, IOstreamOption::ASCII));
|
os_.reset(new OFstream(ensightDir_/caseName_, IOstreamOption::ASCII));
|
||||||
|
ensightCase::setTimeFormat(*os_, *options_); // Format options
|
||||||
// Format options
|
|
||||||
os_->setf(ios_base::left);
|
|
||||||
os_->setf(ios_base::scientific, ios_base::floatfield);
|
|
||||||
os_->precision(5);
|
|
||||||
|
|
||||||
writeHeader();
|
writeHeader();
|
||||||
}
|
}
|
||||||
@ -468,7 +502,7 @@ Foam::ensightCase::createDataFile
|
|||||||
const word& name
|
const word& name
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (UPstream::master())
|
||||||
{
|
{
|
||||||
// The data/ITER subdirectory must exist
|
// The data/ITER subdirectory must exist
|
||||||
// Note that data/ITER is indeed a valid ensight::FileName
|
// Note that data/ITER is indeed a valid ensight::FileName
|
||||||
@ -490,7 +524,7 @@ Foam::ensightCase::createCloudFile
|
|||||||
const word& name
|
const word& name
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (UPstream::master())
|
||||||
{
|
{
|
||||||
// Write
|
// Write
|
||||||
// eg -> "data/********/lagrangian/<cloudName>/positions"
|
// eg -> "data/********/lagrangian/<cloudName>/positions"
|
||||||
@ -584,7 +618,7 @@ void Foam::ensightCase::setTime(const scalar value, const label index)
|
|||||||
timeIndex_ = index;
|
timeIndex_ = index;
|
||||||
timeValue_ = value;
|
timeValue_ = value;
|
||||||
|
|
||||||
if (Pstream::master())
|
if (UPstream::master())
|
||||||
{
|
{
|
||||||
// The data/ITER subdirectory must exist
|
// The data/ITER subdirectory must exist
|
||||||
// Note that data/ITER is indeed a valid ensight::FileName
|
// Note that data/ITER is indeed a valid ensight::FileName
|
||||||
@ -810,7 +844,7 @@ Foam::ensightCase::newGeometry
|
|||||||
{
|
{
|
||||||
autoPtr<Foam::ensightGeoFile> output;
|
autoPtr<Foam::ensightGeoFile> output;
|
||||||
|
|
||||||
if (Pstream::master())
|
if (UPstream::master())
|
||||||
{
|
{
|
||||||
// Set the path of the ensight file
|
// Set the path of the ensight file
|
||||||
fileName path;
|
fileName path;
|
||||||
@ -844,7 +878,7 @@ Foam::ensightCase::newCloud
|
|||||||
{
|
{
|
||||||
autoPtr<Foam::ensightFile> output;
|
autoPtr<Foam::ensightFile> output;
|
||||||
|
|
||||||
if (Pstream::master())
|
if (UPstream::master())
|
||||||
{
|
{
|
||||||
output = createCloudFile(cloudName, "positions");
|
output = createCloudFile(cloudName, "positions");
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -57,6 +57,7 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
class bitSet;
|
class bitSet;
|
||||||
|
class dictionary;
|
||||||
class ensightCase;
|
class ensightCase;
|
||||||
class instant;
|
class instant;
|
||||||
class OSstream;
|
class OSstream;
|
||||||
@ -333,6 +334,21 @@ public:
|
|||||||
|
|
||||||
// Output Helpers
|
// Output Helpers
|
||||||
|
|
||||||
|
//- Set output time format for ensight case file
|
||||||
|
static void setTimeFormat
|
||||||
|
(
|
||||||
|
OSstream& os,
|
||||||
|
IOstreamOption::floatFormat timeFmt,
|
||||||
|
const int timePrec
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Set output time format for ensight case file
|
||||||
|
static void setTimeFormat
|
||||||
|
(
|
||||||
|
OSstream& os,
|
||||||
|
const ensightCase::options& opts
|
||||||
|
);
|
||||||
|
|
||||||
//- Print time-set for ensight case file with a single time
|
//- Print time-set for ensight case file with a single time
|
||||||
static void printTimeset
|
static void printTimeset
|
||||||
(
|
(
|
||||||
@ -388,7 +404,7 @@ class ensightCase::options
|
|||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Ascii/Binary file output
|
//- The output file format (ascii/binary)
|
||||||
IOstreamOption::streamFormat format_;
|
IOstreamOption::streamFormat format_;
|
||||||
|
|
||||||
//- Remove existing directory and sub-directories on creation
|
//- Remove existing directory and sub-directories on creation
|
||||||
@ -400,8 +416,14 @@ class ensightCase::options
|
|||||||
//- Write clouds into their own directory
|
//- Write clouds into their own directory
|
||||||
bool separateCloud_;
|
bool separateCloud_;
|
||||||
|
|
||||||
|
//- Time format for case file (default: scientific)
|
||||||
|
IOstreamOption::floatFormat timeFormat_;
|
||||||
|
|
||||||
|
//- Time precision for case file (default: 5)
|
||||||
|
int timePrecision_;
|
||||||
|
|
||||||
//- Width of mask for subdirectories
|
//- Width of mask for subdirectories
|
||||||
label width_;
|
int width_;
|
||||||
|
|
||||||
//- The '*' mask appropriate for subdirectories
|
//- The '*' mask appropriate for subdirectories
|
||||||
word mask_;
|
word mask_;
|
||||||
@ -415,16 +437,39 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct with the specified format (default is binary)
|
//- Construct with the specified format (default is binary)
|
||||||
options(IOstreamOption::streamFormat fmt = IOstreamOption::BINARY);
|
explicit options
|
||||||
|
(
|
||||||
|
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||||
|
);
|
||||||
|
|
||||||
|
//- If present, construct with the format specified in the dictionary
|
||||||
|
//- or use default (binary)
|
||||||
|
options
|
||||||
|
(
|
||||||
|
//! The lookup name for the format, typically 'format'
|
||||||
|
//! or 'writeFormat' etc.
|
||||||
|
const word& formatKeyword,
|
||||||
|
const dictionary& dict,
|
||||||
|
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Ascii/Binary file output
|
//- The output file format (ascii/binary)
|
||||||
IOstreamOption::streamFormat format() const noexcept { return format_; }
|
IOstreamOption::streamFormat format() const noexcept { return format_; }
|
||||||
|
|
||||||
|
//- Time format for case file (general/fixed/scientific)
|
||||||
|
IOstreamOption::floatFormat timeFormat() const noexcept
|
||||||
|
{
|
||||||
|
return timeFormat_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Time precision for case file
|
||||||
|
int timePrecision() const noexcept { return timePrecision_; }
|
||||||
|
|
||||||
//- The '*' mask appropriate for sub-directories
|
//- The '*' mask appropriate for sub-directories
|
||||||
const word& mask() const noexcept { return mask_; }
|
const word& mask() const noexcept { return mask_; }
|
||||||
|
|
||||||
@ -432,7 +477,7 @@ public:
|
|||||||
word padded(const label i) const;
|
word padded(const label i) const;
|
||||||
|
|
||||||
//- Return current width of mask and padded.
|
//- Return current width of mask and padded.
|
||||||
label width() const noexcept { return width_; }
|
int width() const noexcept { return width_; }
|
||||||
|
|
||||||
//- Remove existing directory and sub-directories on creation
|
//- Remove existing directory and sub-directories on creation
|
||||||
bool overwrite() const noexcept { return overwrite_; }
|
bool overwrite() const noexcept { return overwrite_; }
|
||||||
@ -445,7 +490,22 @@ public:
|
|||||||
|
|
||||||
//- Set width of mask and padded.
|
//- Set width of mask and padded.
|
||||||
// Default width is 8 digits, max width is 31 digits.
|
// Default width is 8 digits, max width is 31 digits.
|
||||||
void width(const label i);
|
void width(const int i);
|
||||||
|
|
||||||
|
//- Set the time format for case file
|
||||||
|
void timeFormat(IOstreamOption::floatFormat fmt) noexcept
|
||||||
|
{
|
||||||
|
timeFormat_ = fmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Set the time precision for case file
|
||||||
|
void timePrecision(int prec) noexcept { timePrecision_ = prec; }
|
||||||
|
|
||||||
|
//- Set the time format for case file
|
||||||
|
void timeFormat(const word& key, const dictionary& dict);
|
||||||
|
|
||||||
|
//- Set the time precision for case file
|
||||||
|
void timePrecision(const word& key, const dictionary& dict);
|
||||||
|
|
||||||
//- Remove existing directory and sub-directories on creation
|
//- Remove existing directory and sub-directories on creation
|
||||||
void overwrite(bool on) noexcept { overwrite_ = on; }
|
void overwrite(bool on) noexcept { overwrite_ = on; }
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,15 +26,24 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "ensightCase.H"
|
#include "ensightCase.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::ensightCase::options::options(IOstreamOption::streamFormat fmt)
|
Foam::ensightCase::options::options(IOstreamOption::streamFormat fmt)
|
||||||
:
|
:
|
||||||
format_(fmt),
|
format_
|
||||||
|
(
|
||||||
|
// Can only be ASCII or BINARY
|
||||||
|
(fmt == IOstreamOption::streamFormat::ASCII)
|
||||||
|
? IOstreamOption::streamFormat::ASCII
|
||||||
|
: IOstreamOption::streamFormat::BINARY
|
||||||
|
),
|
||||||
overwrite_(false),
|
overwrite_(false),
|
||||||
nodeValues_(false),
|
nodeValues_(false),
|
||||||
separateCloud_(false),
|
separateCloud_(false),
|
||||||
|
timeFormat_(IOstreamOption::floatFormat::scientific),
|
||||||
|
timePrecision_(5),
|
||||||
width_(0),
|
width_(0),
|
||||||
mask_(),
|
mask_(),
|
||||||
printf_()
|
printf_()
|
||||||
@ -43,6 +52,17 @@ Foam::ensightCase::options::options(IOstreamOption::streamFormat fmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::ensightCase::options::options
|
||||||
|
(
|
||||||
|
const word& formatKeyword,
|
||||||
|
const dictionary& dict,
|
||||||
|
IOstreamOption::streamFormat fmt
|
||||||
|
)
|
||||||
|
:
|
||||||
|
options(IOstreamOption::formatEnum(formatKeyword, dict, fmt))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::word Foam::ensightCase::options::padded(const label i) const
|
Foam::word Foam::ensightCase::options::padded(const label i) const
|
||||||
@ -58,7 +78,7 @@ Foam::word Foam::ensightCase::options::padded(const label i) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::ensightCase::options::width(const label n)
|
void Foam::ensightCase::options::width(const int n)
|
||||||
{
|
{
|
||||||
// Enforce min/max sanity limits
|
// Enforce min/max sanity limits
|
||||||
if (n < 1 || n > 31)
|
if (n < 1 || n > 31)
|
||||||
@ -74,4 +94,27 @@ void Foam::ensightCase::options::width(const label n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightCase::options::timeFormat
|
||||||
|
(
|
||||||
|
const word& key,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
timeFormat_ = IOstreamOption::floatFormatEnum(key, dict, timeFormat_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightCase::options::timePrecision
|
||||||
|
(
|
||||||
|
const word& key,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (!key.empty())
|
||||||
|
{
|
||||||
|
dict.readIfPresent(key, timePrecision_, keyType::LITERAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,19 +40,16 @@ Foam::ensightCase::newData
|
|||||||
{
|
{
|
||||||
autoPtr<ensightFile> output;
|
autoPtr<ensightFile> output;
|
||||||
|
|
||||||
if (Pstream::master())
|
if (UPstream::master())
|
||||||
{
|
{
|
||||||
const ensight::VarName varName(name);
|
const ensight::VarName varName(name);
|
||||||
output = createDataFile(varName);
|
output = createDataFile(varName);
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
output().write
|
output().writeString
|
||||||
(
|
(
|
||||||
string
|
padded(timeIndex_) / varName
|
||||||
(
|
+ " <" + pTraits<Type>::typeName + ">"
|
||||||
padded(timeIndex_) / varName
|
|
||||||
+ " <" + pTraits<Type>::typeName + ">"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
output().newline();
|
output().newline();
|
||||||
|
|
||||||
@ -91,19 +88,16 @@ Foam::ensightCase::newCloudData
|
|||||||
{
|
{
|
||||||
autoPtr<ensightFile> output;
|
autoPtr<ensightFile> output;
|
||||||
|
|
||||||
if (Pstream::master())
|
if (UPstream::master())
|
||||||
{
|
{
|
||||||
const ensight::VarName varName(name);
|
const ensight::VarName varName(name);
|
||||||
output = createCloudFile(cloudName, varName);
|
output = createCloudFile(cloudName, varName);
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
output().write
|
output().writeString
|
||||||
(
|
(
|
||||||
string
|
padded(timeIndex_) / cloudName / varName
|
||||||
(
|
+ " <" + pTraits<Type>::typeName + ">"
|
||||||
padded(timeIndex_) / cloudName / varName
|
|
||||||
+ " <" + pTraits<Type>::typeName + ">"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
output().newline();
|
output().newline();
|
||||||
|
|
||||||
|
|||||||
@ -147,7 +147,7 @@ float Foam::ensightFile::undefValue(float value) noexcept
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Ostream& Foam::ensightFile::writeString(const char* str, size_t len)
|
void Foam::ensightFile::writeString(const char* str, size_t len)
|
||||||
{
|
{
|
||||||
// Output 79 chars (ASCII) or 80 chars (BINARY)
|
// Output 79 chars (ASCII) or 80 chars (BINARY)
|
||||||
char buf[80];
|
char buf[80];
|
||||||
@ -165,41 +165,47 @@ Foam::Ostream& Foam::ensightFile::writeString(const char* str, size_t len)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
buf[79] = 0; // Max 79 in ASCII
|
buf[79] = 0; // Max 79 in ASCII
|
||||||
|
|
||||||
|
// TBD: Extra safety - trap newline in ASCII?
|
||||||
|
// char* p = ::strchr(buf, '\n');
|
||||||
|
// if (p) *p = 0;
|
||||||
|
|
||||||
stdStream() << buf;
|
stdStream() << buf;
|
||||||
syncState();
|
syncState();
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::ensightFile::writeString(const char* str)
|
void Foam::ensightFile::writeString(const char* str)
|
||||||
{
|
{
|
||||||
return writeString(str, strlen(str));
|
writeString(str, strlen(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::ensightFile::writeString(const std::string& str)
|
void Foam::ensightFile::writeString(const std::string& str)
|
||||||
{
|
{
|
||||||
return writeString(str.data(), str.size());
|
writeString(str.data(), str.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::ensightFile::write(const char* str)
|
Foam::Ostream& Foam::ensightFile::write(const char* str)
|
||||||
{
|
{
|
||||||
return writeString(str, strlen(str));
|
writeString(str, strlen(str));
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::ensightFile::write(const word& str)
|
Foam::Ostream& Foam::ensightFile::write(const word& str)
|
||||||
{
|
{
|
||||||
return writeString(str.data(), str.size());
|
writeString(str.data(), str.size());
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::ensightFile::write(const std::string& str)
|
Foam::Ostream& Foam::ensightFile::write(const std::string& str)
|
||||||
{
|
{
|
||||||
return writeString(str.data(), str.size());
|
writeString(str.data(), str.size());
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -304,10 +310,9 @@ void Foam::ensightFile::newline()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::ensightFile::writeUndef()
|
void Foam::ensightFile::writeUndef()
|
||||||
{
|
{
|
||||||
write(undefValue_);
|
write(undefValue_);
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -330,14 +335,27 @@ Foam::Ostream& Foam::ensightFile::writeKeyword(const keyType& key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::ensightFile::writeBinaryHeader()
|
void Foam::ensightFile::writeBinaryHeader()
|
||||||
{
|
{
|
||||||
if (format() == IOstreamOption::BINARY)
|
if (format() == IOstreamOption::BINARY)
|
||||||
{
|
{
|
||||||
writeString("C Binary");
|
writeString("C Binary");
|
||||||
|
// Is binary: newline() is a no-op
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return *this;
|
|
||||||
|
void Foam::ensightFile::beginTimeStep()
|
||||||
|
{
|
||||||
|
writeString("BEGIN TIME STEP");
|
||||||
|
newline();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightFile::endTimeStep()
|
||||||
|
{
|
||||||
|
writeString("END TIME STEP");
|
||||||
|
newline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -146,19 +146,25 @@ public:
|
|||||||
// Output
|
// Output
|
||||||
|
|
||||||
//- Write "C Binary" string for binary files (eg, geometry/measured)
|
//- Write "C Binary" string for binary files (eg, geometry/measured)
|
||||||
Ostream& writeBinaryHeader();
|
void writeBinaryHeader();
|
||||||
|
|
||||||
|
//- Write "BEGIN TIME STEP" string and newline
|
||||||
|
void beginTimeStep();
|
||||||
|
|
||||||
|
//- Write "END TIME STEP" string and newline
|
||||||
|
void endTimeStep();
|
||||||
|
|
||||||
//- Write character/string content as "%79s" or as binary (max 80 chars)
|
//- Write character/string content as "%79s" or as binary (max 80 chars)
|
||||||
Ostream& writeString(const char* str, size_t len);
|
void writeString(const char* str, size_t len);
|
||||||
|
|
||||||
//- Write C-string as "%79s" or as binary (max 80 chars)
|
//- Write C-string as "%79s" or as binary (max 80 chars)
|
||||||
Ostream& writeString(const char* str);
|
void writeString(const char* str);
|
||||||
|
|
||||||
//- Write string as "%79s" or as binary (max 80 chars)
|
//- Write string as "%79s" or as binary (max 80 chars)
|
||||||
Ostream& writeString(const std::string& str);
|
void writeString(const std::string& str);
|
||||||
|
|
||||||
//- Write undef value
|
//- Write undef value
|
||||||
Ostream& writeUndef();
|
void writeUndef();
|
||||||
|
|
||||||
|
|
||||||
//- Write element keyword with trailing newline,
|
//- Write element keyword with trailing newline,
|
||||||
|
|||||||
@ -34,23 +34,32 @@ License
|
|||||||
void Foam::ensightGeoFile::init()
|
void Foam::ensightGeoFile::init()
|
||||||
{
|
{
|
||||||
writeBinaryHeader();
|
writeBinaryHeader();
|
||||||
|
beginGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightGeoFile::beginGeometry()
|
||||||
|
{
|
||||||
// Description line 1
|
// Description line 1
|
||||||
write("Ensight Geometry File");
|
writeString("Ensight Geometry File");
|
||||||
newline();
|
newline();
|
||||||
|
|
||||||
// Description line 2
|
// Description line 2
|
||||||
write(string("Written by OpenFOAM " + std::to_string(foamVersion::api)));
|
writeString("Written by OpenFOAM " + std::to_string(foamVersion::api));
|
||||||
newline();
|
newline();
|
||||||
|
|
||||||
write("node id assign");
|
writeString("node id assign");
|
||||||
newline();
|
newline();
|
||||||
|
|
||||||
write("element id assign");
|
writeString("element id assign");
|
||||||
newline();
|
newline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightGeoFile::endGeometry()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::ensightGeoFile::ensightGeoFile
|
Foam::ensightGeoFile::ensightGeoFile
|
||||||
@ -96,7 +105,7 @@ Foam::Ostream& Foam::ensightGeoFile::writeKeyword(const keyType& key)
|
|||||||
void Foam::ensightGeoFile::beginPart
|
void Foam::ensightGeoFile::beginPart
|
||||||
(
|
(
|
||||||
const label index,
|
const label index,
|
||||||
const string& description
|
const std::string& description
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
beginPart(index);
|
beginPart(index);
|
||||||
|
|||||||
@ -52,16 +52,21 @@ class ensightGeoFile
|
|||||||
{
|
{
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Initialize outputs the header information
|
//- Initialize outputs the header information and beginGeometry
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
|
//- Start of geometry information
|
||||||
|
void beginGeometry();
|
||||||
|
|
||||||
|
//- End of geometry information
|
||||||
|
void endGeometry();
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
ensightGeoFile(const ensightGeoFile&) = delete;
|
ensightGeoFile(const ensightGeoFile&) = delete;
|
||||||
|
|
||||||
//- No copy assignment
|
//- No copy assignment
|
||||||
void operator=(const ensightGeoFile&) = delete;
|
void operator=(const ensightGeoFile&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Static Functions
|
// Static Functions
|
||||||
@ -111,7 +116,7 @@ public:
|
|||||||
using ensightFile::beginPart;
|
using ensightFile::beginPart;
|
||||||
|
|
||||||
//- Begin a "part" (0-based index), with a description.
|
//- Begin a "part" (0-based index), with a description.
|
||||||
void beginPart(const label index, const string& description);
|
void beginPart(const label index, const std::string& description);
|
||||||
|
|
||||||
//- Begin a "coordinates" block
|
//- Begin a "coordinates" block
|
||||||
void beginCoordinates(const label npoints);
|
void beginCoordinates(const label npoints);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -97,10 +97,7 @@ Foam::functionObjects::ensightWrite::ensightWrite
|
|||||||
:
|
:
|
||||||
fvMeshFunctionObject(name, runTime, dict),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
writeOpts_(),
|
writeOpts_(),
|
||||||
caseOpts_
|
caseOpts_("format", dict, IOstreamOption::BINARY),
|
||||||
(
|
|
||||||
IOstreamOption::formatEnum("format", dict, runTime.writeFormat())
|
|
||||||
),
|
|
||||||
outputDir_(),
|
outputDir_(),
|
||||||
consecutive_(false),
|
consecutive_(false),
|
||||||
meshState_(polyMesh::TOPO_CHANGE),
|
meshState_(polyMesh::TOPO_CHANGE),
|
||||||
@ -180,6 +177,9 @@ bool Foam::functionObjects::ensightWrite::read(const dictionary& dict)
|
|||||||
caseOpts_.width(dict.getOrDefault<label>("width", 8));
|
caseOpts_.width(dict.getOrDefault<label>("width", 8));
|
||||||
caseOpts_.overwrite(dict.getOrDefault("overwrite", false));
|
caseOpts_.overwrite(dict.getOrDefault("overwrite", false));
|
||||||
|
|
||||||
|
caseOpts_.timeFormat("timeFormat", dict);
|
||||||
|
caseOpts_.timePrecision("timePrecision", dict);
|
||||||
|
|
||||||
|
|
||||||
// Output directory
|
// Output directory
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -42,6 +42,9 @@ Description
|
|||||||
writeInterval 1;
|
writeInterval 1;
|
||||||
format binary;
|
format binary;
|
||||||
|
|
||||||
|
timeFormat scientific;
|
||||||
|
timePrecision 5;
|
||||||
|
|
||||||
overwrite true;
|
overwrite true;
|
||||||
width 12;
|
width 12;
|
||||||
|
|
||||||
@ -95,11 +98,13 @@ Description
|
|||||||
\heading Ensight Output Options
|
\heading Ensight Output Options
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default
|
Property | Description | Required | Default
|
||||||
format | ascii or binary format | no | same as simulation
|
format | ascii or binary format | no | binary
|
||||||
width | Mask width for \c data/XXXX | no | 8
|
width | Mask width for \c data/XXXX | no | 8
|
||||||
directory | The output directory name | no | postProcessing/NAME
|
directory | The output directory name | no | postProcessing/NAME
|
||||||
overwrite | Remove existing directory | no | false
|
overwrite | Remove existing directory | no | false
|
||||||
consecutive | Consecutive output numbering | no | false
|
consecutive | Consecutive output numbering | no | false
|
||||||
|
timeFormat | Time format (ensight case) | no | scientific
|
||||||
|
timePrecision | Time precision (ensight case) | no | 5
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
\heading Output Selection
|
\heading Output Selection
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -176,7 +176,7 @@ void Foam::coordSetWriters::ensightWriter::writeGeometry
|
|||||||
Foam::coordSetWriters::ensightWriter::ensightWriter()
|
Foam::coordSetWriters::ensightWriter::ensightWriter()
|
||||||
:
|
:
|
||||||
coordSetWriter(),
|
coordSetWriter(),
|
||||||
writeFormat_(IOstreamOption::ASCII),
|
caseOpts_(IOstreamOption::BINARY),
|
||||||
collateTimes_(true),
|
collateTimes_(true),
|
||||||
caching_("fieldsDict") // Historic name
|
caching_("fieldsDict") // Historic name
|
||||||
{}
|
{}
|
||||||
@ -185,13 +185,13 @@ Foam::coordSetWriters::ensightWriter::ensightWriter()
|
|||||||
Foam::coordSetWriters::ensightWriter::ensightWriter(const dictionary& options)
|
Foam::coordSetWriters::ensightWriter::ensightWriter(const dictionary& options)
|
||||||
:
|
:
|
||||||
coordSetWriter(options),
|
coordSetWriter(options),
|
||||||
writeFormat_
|
caseOpts_("format", options, IOstreamOption::BINARY),
|
||||||
(
|
|
||||||
IOstreamOption::formatEnum("format", options, IOstreamOption::ASCII)
|
|
||||||
),
|
|
||||||
collateTimes_(options.getOrDefault("collateTimes", true)),
|
collateTimes_(options.getOrDefault("collateTimes", true)),
|
||||||
caching_("fieldsDict") // Historic name
|
caching_("fieldsDict") // Historic name
|
||||||
{}
|
{
|
||||||
|
caseOpts_.timeFormat("timeFormat", options);
|
||||||
|
caseOpts_.timePrecision("timePrecision", options);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::coordSetWriters::ensightWriter::ensightWriter
|
Foam::coordSetWriters::ensightWriter::ensightWriter
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -44,8 +44,11 @@ Description
|
|||||||
Format options:
|
Format options:
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default
|
Property | Description | Required | Default
|
||||||
format | ascii/binary | no | ascii
|
format | ascii/binary | no | binary
|
||||||
collateTimes | use common geometry for times | no | true
|
collateTimes | use common geometry for times | no | true
|
||||||
|
timeFormat | Time format (ensight case) | no | scientific
|
||||||
|
timePrecision | Time precision (ensight case) | no | 5
|
||||||
|
\endtable
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
@ -57,6 +60,7 @@ SourceFiles
|
|||||||
#define Foam_coordSetWriters_ensightWriter_H
|
#define Foam_coordSetWriters_ensightWriter_H
|
||||||
|
|
||||||
#include "coordSetWriter.H"
|
#include "coordSetWriter.H"
|
||||||
|
#include "ensightCase.H"
|
||||||
#include "ensightWriterCaching.H"
|
#include "ensightWriterCaching.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -91,8 +95,8 @@ class ensightWriter
|
|||||||
|
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Output format option (default: ASCII)
|
//- Ensight case options
|
||||||
IOstreamOption::streamFormat writeFormat_;
|
ensightCase::options caseOpts_;
|
||||||
|
|
||||||
//- Collate times (default: true)
|
//- Collate times (default: true)
|
||||||
bool collateTimes_;
|
bool collateTimes_;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
Copyright (C) 2022-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -148,7 +148,7 @@ Foam::fileName Foam::coordSetWriters::ensightWriter::writeCollated
|
|||||||
(
|
(
|
||||||
geomFile.path(),
|
geomFile.path(),
|
||||||
geomFile.name(),
|
geomFile.name(),
|
||||||
writeFormat_
|
caseOpts_.format()
|
||||||
);
|
);
|
||||||
|
|
||||||
writeGeometry(osGeom, elemOutput);
|
writeGeometry(osGeom, elemOutput);
|
||||||
@ -160,7 +160,7 @@ Foam::fileName Foam::coordSetWriters::ensightWriter::writeCollated
|
|||||||
(
|
(
|
||||||
dataDir,
|
dataDir,
|
||||||
varName,
|
varName,
|
||||||
writeFormat_
|
caseOpts_.format()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (verbose_)
|
if (verbose_)
|
||||||
@ -177,11 +177,7 @@ Foam::fileName Foam::coordSetWriters::ensightWriter::writeCollated
|
|||||||
if (stateChanged)
|
if (stateChanged)
|
||||||
{
|
{
|
||||||
OFstream osCase(outputFile, IOstreamOption::ASCII);
|
OFstream osCase(outputFile, IOstreamOption::ASCII);
|
||||||
|
ensightCase::setTimeFormat(osCase, caseOpts_); // time-format
|
||||||
// Format options
|
|
||||||
osCase.setf(ios_base::left);
|
|
||||||
osCase.setf(ios_base::scientific, ios_base::floatfield);
|
|
||||||
osCase.precision(5);
|
|
||||||
|
|
||||||
if (verbose_)
|
if (verbose_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
Copyright (C) 2022-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -101,13 +101,13 @@ Foam::fileName Foam::coordSetWriters::ensightWriter::writeUncollated
|
|||||||
(
|
(
|
||||||
baseDir,
|
baseDir,
|
||||||
baseName + ".00000000.mesh",
|
baseName + ".00000000.mesh",
|
||||||
writeFormat_
|
caseOpts_.format()
|
||||||
);
|
);
|
||||||
ensightFile osField
|
ensightFile osField
|
||||||
(
|
(
|
||||||
baseDir,
|
baseDir,
|
||||||
baseName + ".00000000." + varName,
|
baseName + ".00000000." + varName,
|
||||||
writeFormat_
|
caseOpts_.format()
|
||||||
);
|
);
|
||||||
|
|
||||||
writeGeometry(osGeom, elemOutput);
|
writeGeometry(osGeom, elemOutput);
|
||||||
@ -119,11 +119,7 @@ Foam::fileName Foam::coordSetWriters::ensightWriter::writeUncollated
|
|||||||
// Update case file
|
// Update case file
|
||||||
{
|
{
|
||||||
OFstream osCase(outputFile, IOstreamOption::ASCII);
|
OFstream osCase(outputFile, IOstreamOption::ASCII);
|
||||||
|
ensightCase::setTimeFormat(osCase, caseOpts_); // time-format
|
||||||
// Format options
|
|
||||||
osCase.setf(ios_base::left);
|
|
||||||
osCase.setf(ios_base::scientific, ios_base::floatfield);
|
|
||||||
osCase.precision(5);
|
|
||||||
|
|
||||||
osCase
|
osCase
|
||||||
<< "FORMAT" << nl
|
<< "FORMAT" << nl
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2014 OpenFOAM Foundation
|
Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -55,7 +55,7 @@ namespace surfaceWriters
|
|||||||
Foam::surfaceWriters::ensightWriter::ensightWriter()
|
Foam::surfaceWriters::ensightWriter::ensightWriter()
|
||||||
:
|
:
|
||||||
surfaceWriter(),
|
surfaceWriter(),
|
||||||
writeFormat_(IOstreamOption::ASCII),
|
caseOpts_(IOstreamOption::BINARY),
|
||||||
collateTimes_(true),
|
collateTimes_(true),
|
||||||
caching_("fieldsDict") // Historic name
|
caching_("fieldsDict") // Historic name
|
||||||
{}
|
{}
|
||||||
@ -67,13 +67,13 @@ Foam::surfaceWriters::ensightWriter::ensightWriter
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
surfaceWriter(options),
|
surfaceWriter(options),
|
||||||
writeFormat_
|
caseOpts_("format", options, IOstreamOption::BINARY),
|
||||||
(
|
|
||||||
IOstreamOption::formatEnum("format", options, IOstreamOption::ASCII)
|
|
||||||
),
|
|
||||||
collateTimes_(options.getOrDefault("collateTimes", true)),
|
collateTimes_(options.getOrDefault("collateTimes", true)),
|
||||||
caching_("fieldsDict") // Historic name
|
caching_("fieldsDict") // Historic name
|
||||||
{}
|
{
|
||||||
|
caseOpts_.timeFormat("timeFormat", options);
|
||||||
|
caseOpts_.timePrecision("timePrecision", options);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfaceWriters::ensightWriter::ensightWriter
|
Foam::surfaceWriters::ensightWriter::ensightWriter
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -44,12 +44,14 @@ Description
|
|||||||
Format options for ensight:
|
Format options for ensight:
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default
|
Property | Description | Required | Default
|
||||||
format | ascii/binary | no | ascii
|
format | ascii/binary | no | binary
|
||||||
collateTimes | Use common geometry for times | no | true
|
collateTimes | Use common geometry for times | no | true
|
||||||
scale | Output geometry scaling | no | 1
|
scale | Output geometry scaling | no | 1
|
||||||
transform | Output coordinate transform | no |
|
transform | Output coordinate transform | no |
|
||||||
fieldLevel | Subtract field level before scaling | no | empty dict
|
fieldLevel | Subtract field level before scaling | no | empty dict
|
||||||
fieldScale | Output field scaling | no | empty dict
|
fieldScale | Output field scaling | no | empty dict
|
||||||
|
timeFormat | Time format (ensight case) | no | scientific
|
||||||
|
timePrecision | Time precision (ensight case) | no | 5
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
The collated format maintains an internal list of the known times
|
The collated format maintains an internal list of the known times
|
||||||
@ -65,6 +67,7 @@ SourceFiles
|
|||||||
#define Foam_surfaceWriters_ensightWriter_H
|
#define Foam_surfaceWriters_ensightWriter_H
|
||||||
|
|
||||||
#include "surfaceWriter.H"
|
#include "surfaceWriter.H"
|
||||||
|
#include "ensightCase.H"
|
||||||
#include "ensightWriterCaching.H"
|
#include "ensightWriterCaching.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -84,8 +87,8 @@ class ensightWriter
|
|||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Output format option (default: ASCII)
|
//- Ensight case options
|
||||||
IOstreamOption::streamFormat writeFormat_;
|
ensightCase::options caseOpts_;
|
||||||
|
|
||||||
//- Collate times (default: true)
|
//- Collate times (default: true)
|
||||||
bool collateTimes_;
|
bool collateTimes_;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2014 OpenFOAM Foundation
|
Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -163,7 +163,7 @@ Foam::fileName Foam::surfaceWriters::ensightWriter::writeCollated
|
|||||||
(
|
(
|
||||||
geomFile.path(),
|
geomFile.path(),
|
||||||
geomFile.name(),
|
geomFile.name(),
|
||||||
writeFormat_
|
caseOpts_.format()
|
||||||
);
|
);
|
||||||
part.write(osGeom); // serial
|
part.write(osGeom); // serial
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ Foam::fileName Foam::surfaceWriters::ensightWriter::writeCollated
|
|||||||
(
|
(
|
||||||
dataDir,
|
dataDir,
|
||||||
varName,
|
varName,
|
||||||
writeFormat_
|
caseOpts_.format()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (verbose_)
|
if (verbose_)
|
||||||
@ -191,11 +191,7 @@ Foam::fileName Foam::surfaceWriters::ensightWriter::writeCollated
|
|||||||
if (stateChanged)
|
if (stateChanged)
|
||||||
{
|
{
|
||||||
OFstream osCase(outputFile, IOstreamOption::ASCII);
|
OFstream osCase(outputFile, IOstreamOption::ASCII);
|
||||||
|
ensightCase::setTimeFormat(osCase, caseOpts_); // time-format
|
||||||
// Format options
|
|
||||||
osCase.setf(ios_base::left);
|
|
||||||
osCase.setf(ios_base::scientific, ios_base::floatfield);
|
|
||||||
osCase.precision(5);
|
|
||||||
|
|
||||||
if (verbose_)
|
if (verbose_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2014 OpenFOAM Foundation
|
Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -73,7 +73,7 @@ Foam::fileName Foam::surfaceWriters::ensightWriter::writeUncollated()
|
|||||||
(
|
(
|
||||||
outputDir,
|
outputDir,
|
||||||
baseName + ".00000000.mesh",
|
baseName + ".00000000.mesh",
|
||||||
writeFormat_
|
caseOpts_.format()
|
||||||
);
|
);
|
||||||
|
|
||||||
ensightOutputSurface part
|
ensightOutputSurface part
|
||||||
@ -85,7 +85,9 @@ Foam::fileName Foam::surfaceWriters::ensightWriter::writeUncollated()
|
|||||||
part.write(osGeom); // serial
|
part.write(osGeom); // serial
|
||||||
|
|
||||||
// Update case file
|
// Update case file
|
||||||
OFstream osCase(outputFile);
|
OFstream osCase(outputFile, IOstreamOption::ASCII);
|
||||||
|
ensightCase::setTimeFormat(osCase, caseOpts_); // time-format
|
||||||
|
|
||||||
osCase
|
osCase
|
||||||
<< "FORMAT" << nl
|
<< "FORMAT" << nl
|
||||||
<< "type: ensight gold" << nl
|
<< "type: ensight gold" << nl
|
||||||
@ -176,13 +178,13 @@ Foam::fileName Foam::surfaceWriters::ensightWriter::writeUncollated
|
|||||||
(
|
(
|
||||||
baseDir,
|
baseDir,
|
||||||
baseName + ".00000000.mesh",
|
baseName + ".00000000.mesh",
|
||||||
writeFormat_
|
caseOpts_.format()
|
||||||
);
|
);
|
||||||
ensightFile osField
|
ensightFile osField
|
||||||
(
|
(
|
||||||
baseDir,
|
baseDir,
|
||||||
baseName + ".00000000." + varName,
|
baseName + ".00000000." + varName,
|
||||||
writeFormat_
|
caseOpts_.format()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Ensight Geometry
|
// Ensight Geometry
|
||||||
@ -203,11 +205,7 @@ Foam::fileName Foam::surfaceWriters::ensightWriter::writeUncollated
|
|||||||
// Update case file
|
// Update case file
|
||||||
{
|
{
|
||||||
OFstream osCase(outputFile, IOstreamOption::ASCII);
|
OFstream osCase(outputFile, IOstreamOption::ASCII);
|
||||||
|
ensightCase::setTimeFormat(osCase, caseOpts_); // time-format
|
||||||
// Format options
|
|
||||||
osCase.setf(ios_base::left);
|
|
||||||
osCase.setf(ios_base::scientific, ios_base::floatfield);
|
|
||||||
osCase.precision(5);
|
|
||||||
|
|
||||||
osCase
|
osCase
|
||||||
<< "FORMAT" << nl
|
<< "FORMAT" << nl
|
||||||
|
|||||||
Reference in New Issue
Block a user