Go to the documentation of this file.
25 if( std::is_trivially_copyable_v<T> && os.
isBinary() )
34 if(!os.
write(chBuffer.data(), chBuffer.size()))
37 "error in writing binary data to "<<os.
name()<<
endl;
47 "error in writing ASCII data to "<<os.
name()<<
endl;
60 os << token::BEGIN_LIST;
65 os << data[i]<<token::NL;
67 os << data[data.
size()-1] << token::END_LIST;
86 if(std::is_trivially_copyable_v<T> && is.
isBinary())
101 "expected length of vector in the stream "<<is.
name()<<
102 "but found this "<< firstToken<<
endl;
106 is.
read(
reinterpret_cast<char*
>(data.data()), len*
sizeof(T));
130 token firstToken(is);
133 bool lenFound =
false;
139 firstToken =
token(is);
146 if(firstToken != token::BEGIN_LIST)
149 <<
"expected token "<< token::BEGIN_LIST
150 <<
" but found "<< firstToken ;
160 && lastToken == token::END_LIST ))
176 <<
"expected token "<< token::BEGIN_LIST
177 <<
" but found "<< firstToken<<
endl; ;
181 if(lenFound && len>0 && len != vec.size())
184 " is different from number of elements "<< vec.size()<<
endl;
196 if(!gatherData( data ) )
199 "Error in gathering data for out stream "<< os.
name()<<
endl;
203 if( ioPattern_.thisProcWriteData())
218 if( ioPattern_.isParallel() && ioPattern_.isMasterProcessorDistribute())
221 "data transfer for type word is not supported in parallel mode!"<<
endl;
226 if(!gatherData( data ) )
229 "Error in gathering data for out stream "<< os.
name()<<
endl;
233 if( ioPattern_.thisProcWriteData())
251 if(ioPattern_.thisProcReadData())
271 if(IOPatternvCtorSelector_.search(dataIOType))
273 return IOPatternvCtorSelector_[dataIOType](iop);
279 fatalError <<
"Ctor Selector "<< dataIOType <<
" does not exist. \n"
280 <<
"Avaiable ones are: \n\n"
282 IOPatternvCtorSelector_
#define notImplementedFunction
Report that a function is yet not implemented.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
virtual iIstream & read(token &)=0
Return next token from stream.
#define fatalExit
Fatal exit.
Token class based on OpenFOAM stream, with some modifications/simplifications to be tailored to our n...
bool writeDataAsciiBinary(iOstream &os, span< T > data)
bool writeData(iOstream &os, span< T > data)
Write data to the end of file from all processors.
static uniquePtr< dataIO > create(const IOPattern &iop)
#define warningInFunction
Report a warning.
bool isPunctuation() const
Token is PUNCTUATION.
INLINE_FUNCTION_HD uint32 size() const
Returns the number of elements in the span.
iOstream & printKeys(iOstream &os, const wordHashMap< T > &m)
int64 int64Token() const
Return int64 value.
iOstream & endl(iOstream &os)
Add newline and flush stream.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
bool writeDataASCII(iOstream &os, span< T > data)
word angleBracketsNames2(const word &base, const word &w1, const word &w2)
Output base<w1,w2>
Interface class for any input stream
bool readDataAsciiBinary(iIstream &is, std::vector< T > &data)
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
void putBack(const token &tok)
Put back token Only a single put back is permitted.
bool fatalCheck(const char *operation) const
Check IOstream status for given operation.
bool readDataAscii(iIstream &is, std::vector< T > &vec)
bool isInt64() const
Token is int64.
#define fatalError
Report a fatal error and exit the applicaiton.
virtual const word & name() const
Return the name of the stream.
span< char > charSpan(span< T > s)
bool isBinary() const
Return true if stream format is binray.
localProcessors & pFlowProcessors()
unsigned long long int uint64
Interface class for any output stream.
bool readData(iIstream &is, std::vector< T > &data)