Skip to content
Snippets Groups Projects
Commit 7e843807 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

GIT: corrected incorrect merge artifacts

STYLE: simplified output logic, reduced duplicate code in CompactIOList
parent 9cd9e812
Branches
Tags
No related merge requests found
......@@ -179,48 +179,26 @@ bool Foam::CompactIOList<T, BaseType>::writeObject
const bool valid
) const
{
bool nonCompact = false;
if (fmt == IOstream::ASCII)
{
// Change type to be non-compact format type
const word oldTypeName = typeName;
const_cast<word&>(typeName) = IOList<T>::typeName;
bool good = regIOobject::writeObject(fmt, ver, cmp, valid);
// Change type back
const_cast<word&>(typeName) = oldTypeName;
return good;
nonCompact = true;
}
else if (overflows())
{
WarningInFunction
<< "Overall number of elements of CompactIOList of size "
<< this->size() << " overflows the representation of a label"
<< endl << " Switching to ascii writing" << endl;
// Change type to be non-compact format type
const word oldTypeName = typeName;
const_cast<word&>(typeName) = IOList<T>::typeName;
nonCompact = true;
bool good = regIOobject::writeObject(IOstream::ASCII, ver, cmp, valid);
// Change type back
const_cast<word&>(typeName) = oldTypeName;
return good;
}
else if (overflows())
{
WarningInFunction
<< "Overall number of elements of CompactIOList of size "
<< this->size() << " overflows the representation of a label"
<< endl << " Switching to ascii writing" << endl;
<< nl << " Switching to ascii writing" << endl;
}
// Change type to be non-compact format type
const word oldTypeName = typeName;
if (nonCompact)
{
// Change to non-compact type
const word oldTypeName(typeName);
const_cast<word&>(typeName) = IOList<T>::typeName;
......@@ -231,10 +209,8 @@ bool Foam::CompactIOList<T, BaseType>::writeObject
return good;
}
else
{
return regIOobject::writeObject(fmt, ver, cmp, valid);
}
return regIOobject::writeObject(fmt, ver, cmp, valid);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment