51 [](
const scalar a,
const scalar
b)
72 dictName_(cacheFileName)
103 bool Foam::ensightOutput::writerCaching::remove(
const word& fieldName)
126 Foam::label Foam::ensightOutput::writerCaching::readPreviousTimes
128 const fileName& dictFile,
129 const scalar timeValue
144 IFstream is(dictFile);
146 if (is.good() && cache_.read(is))
150 cache_.readIfPresent(
"times", times_);
156 if (cache_.readIfPresent(
"geometry", geomIndices))
159 geoms_.
set(geomIndices);
161 else if (cache_.readIfPresent(
"meshes", meshTimes))
165 <<
"Setting geometry timeset information from time values" 166 <<
" (cache from an older OpenFOAM version)." <<
nl 167 <<
"This may not be fully reliable." <<
nl 170 for (
const scalar meshTime : meshTimes)
173 geoms_.set(geomIndex);
180 geoms_.resize(times_.size());
189 return max(0, times_.size()-1);
194 return max(0, geoms_.find_last());
202 if (geoms_.count() <= 1)
207 if (geoms_.size() == times_.size() && geoms_.all())
223 const scalar timeValue,
224 const bool geomChanged,
225 const word& fieldName,
226 const word& fieldType,
230 const fileName dictFile(baseDir/dictName_);
232 bool stateChanged =
false;
237 ? readPreviousTimes(dictFile, timeValue)
268 cache_.set(
"times", times_);
269 cache_.set(
"geometry", geoms_.sortedToc());
279 dictionary&
dict = fieldDict(fieldName);
285 dict.set(
"type", fieldType);
286 if (!varName.empty() && varName != fieldName)
289 dict.set(
"name", varName);
295 OFstream
os(dictFile);
296 os <<
"// State file for writer output" <<
nl <<
nl;
297 cache_.write(
os,
false);
299 os <<
nl <<
"// End" <<
nl;
void clear()
Clear all values.
label findLower(const ListType &input, const T &val, const label start, const ComparePredicate &comp)
Binary search to find the index of the last element in a sorted list that is less than value...
bool update(const fileName &baseDir, const scalar timeValue, const bool geomChanged, const word &fieldName, const word &fieldType, const word &varName=word::null)
Update time/geometry information and file cache. This routine should only be called from the master p...
A class for handling file names.
static const equalOp< scalar > equalTimes(ROOTSMALL)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
constexpr char nl
The newline '\n' character (0x0a)
const dictionary & fieldsDict() const
Get or create the 'fields' information dictionary.
dictionary & subDictOrAdd(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary for manipulation.
Various functions to operate on Lists.
bool remove(const word &keyword)
Remove an entry specified by keyword.
static label findTimeIndex(const UList< scalar > &list, const scalar val)
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
A class for handling words, derived from Foam::string.
List< scalar > scalarList
A List of scalars.
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
OBJstream os(runTime.globalPath()/outputName)
int geometryTimeset() const
Expected timeset for the geometry.
#define WarningInFunction
Report a warning using Foam::Warning.
label latestGeomIndex() const
The most current geometry index.
List< label > labelList
A List of labels.
writerCaching(const word &cacheFileName)
Construct with specified cache name.
label latestTimeIndex() const
The most current time index.
const dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary pointer if present (and a sub-dictionary) otherwise return nullptr...