COMP: access transformedElements by reference, not copy

- better code style and seems to avoid triggering a gcc warning about
  possibly uninitialized values

COMP: JSONformatter writeEntry missing a return value

STYLE: accept 'json' for checkMesh write format

- consistent with caseInfo functionObject
This commit is contained in:
Mark Olesen
2023-12-15 11:44:41 +01:00
parent 79993bba43
commit 0352a224b7
6 changed files with 49 additions and 54 deletions

View File

@ -130,7 +130,7 @@ Foam::Ostream& Foam::JSONformatter::writeDict(const dictionary& dict)
const word& keyword = e.keyword();
os_ << indent;
writeKeyword(keyword) << " : ";
os_.writeQuoted(keyword) << " : ";
if (e.isDict())
{

View File

@ -82,7 +82,7 @@ public:
virtual Ostream& write(const bool val);
virtual Ostream& write(const int32_t val);
virtual Ostream& write(const int64_t val);
virtual Ostream& write(const float val );
virtual Ostream& write(const float val);
virtual Ostream& write(const double val);
virtual Ostream& write(const word& str);
virtual Ostream& write(const std::string& str);
@ -94,11 +94,13 @@ public:
//- Write OpenFOAM dictionary to JSON dictionary
virtual Ostream& writeDict(const dictionary& dict);
//- Write JSON keyword-value pair
//- Write JSON keyword-value pair (for primitive types)
template<class Type>
Ostream& writeEntry(const word& keyword, Type val)
Ostream& writeEntry(const word& keyword, const Type& val)
{
writeKeyword(keyword) << " : " << write(val);
os_.writeQuoted(keyword) << " : ";
write(val);
return os_;
}
};