57 readFromLine(nSkip, is, value);
69 auto&
field = tfield.ref();
79 <<
"Cannot read file " << is.
name()
80 <<
" for field " << fieldName
87 is.
read(primitiveType);
95 && primitiveType != pTraits<Type>::typeName
100 <<
"> values for <" << pTraits<Type>::typeName
101 <<
"> but found " << primitiveType <<
nl 102 <<
" This may be okay, but could indicate an error" 116 for (
const faceInfoTuple& facesInfo : faceTypeInfo_)
119 const label endFace = begFace + facesInfo.second();
122 <<
"Reading <" << pTraits<Type>::typeName <<
"> face type " 124 <<
" data:" << facesInfo.second() <<
endl;
126 if (begFace < endFace)
131 if (strValue.contains(
"undef"))
141 for (
direction d = 0; d < pTraits<Type>::nComponents; ++d)
146 for (label facei = begFace; facei < endFace; ++facei)
172 const label fieldIndex
175 if (fieldIndex < 0 || fieldIndex >= fieldNames_.size())
179 <<
" should be in range [0.." << fieldNames_.size() <<
')' <<
nl 180 <<
"Possibly used incorrect field lookup name. Known field names: " 185 const word& fieldName = fieldNames_[fieldIndex];
186 const label fileIndex = timeStartIndex_ +
timeIndex*timeIncrement_;
188 const fileName dataFile
190 baseDir_/replaceMask(fieldFileNames_[fieldIndex], fileIndex)
195 Pout<<
"Read <" << pTraits<Type>::typeName <<
"> field, file=" 199 return readField<Type>(dataFile, fieldName);
A class for handling file names.
virtual const fileName & name() const
The name of the stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static const char * elemNames[nTypes]
The ensight 'Face' element type names.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
tmp< Field< Type > > readField(const fileName &dataFile, const word &fieldName) const
Helper function to return a field.
static void broadcast(Type &value, const label comm=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all processes in communicator.
virtual Istream & read(token &)=0
Return next token from stream.
A class for handling words, derived from Foam::string.
A variant of IFstream with specialised read() for strings, integers and floats. Correctly handles bin...
void skip(const label n, Istream &is) const
Helper function to skip forward n steps in stream.
Similar to IStringStream but using an externally managed buffer for its input. This allows the input ...
#define DebugInfo
Report an information message using Foam::Info.
const char *const typeName
int debug
Static debugging option.
bool good() const noexcept
True if next operation might succeed.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
const Foam::direction componentOrder[]
void readFromLine(const label nSkip, Istream &is, Type &value) const
Helper function to return Type after skipping n tokens.
A class for managing temporary objects.
label & setComponent(label &val, const direction) noexcept
Non-const access to integer-type (has no components)
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
static constexpr const zero Zero
Global zero (0)