Commit fdf73628 authored by Andrew Heather's avatar Andrew Heather
Browse files

INT: Updated dependent code following latest set of integrations

parent 85f12ff5
......@@ -68,7 +68,6 @@ Foam::direction Foam::edgeStats::getNormalDir
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from mesh
Foam::edgeStats::edgeStats(const polyMesh& mesh)
:
mesh_(mesh),
......@@ -144,7 +143,7 @@ Foam::scalar Foam::edgeStats::minLen(Ostream& os) const
const edgeList& edges = mesh_.edges();
forAll(const edge& e : edges)
for (const edge& e : edges)
{
vector eVec(e.vec(mesh_.points()));
......@@ -208,5 +207,4 @@ Foam::scalar Foam::edgeStats::minLen(Ostream& os) const
}
// ************************************************************************* //
......@@ -61,7 +61,7 @@ inline bool writeMeshObject
bool writeOk = false;
if (io.typeHeaderOk<T>(true, true, false))
if (io.typeHeaderOk<CheckType>(true, true, false))
{
Info<< " Reading " << io.headerClassName()
<< " : " << name << endl;
......
......@@ -451,6 +451,8 @@ int main(int argc, char *argv[])
fileOperations::collatedFileOperation::maxThreadFileBufferSize;
fileOperations::collatedFileOperation::maxThreadFileBufferSize = 0;
mesh.decomposeMesh();
mesh.writeDecomposition(decomposeSets);
if (writeCellDist)
......
......@@ -231,6 +231,7 @@ Foam::parLagrangianRedistributor::redistributeLagrangianPositions
)
{
passiveParticle& newp = newpIter();
newp.relocate();
lagrangianPositions.addParticle(newParticles.remove(&newp));
}
......
......@@ -92,7 +92,8 @@ public:
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp
IOstream::compressionType cmp,
const bool valid
) const
{
return true;
......
......@@ -58,7 +58,7 @@ public:
explicit zonesEntries(const IOobject& io)
:
regIOobject(io),
PtrList<entry>(readStream("regIOobject"))
PtrList<entry>(readStream(word("regIOobject")))
{
close();
}
......
......@@ -199,7 +199,8 @@ void createFieldFiles
(
IOstream::ASCII,
IOstream::currentVersion,
IOstream::UNCOMPRESSED
IOstream::UNCOMPRESSED,
true
);
}
}
......
......@@ -224,7 +224,7 @@ bool Foam::CompactIOList<T, BaseType>::writeObject
const_cast<word&>(typeName) = IOList<T>::typeName;
bool good = regIOobject::writeObject(IOstream::ASCII, ver, cmp);
bool good = regIOobject::writeObject(IOstream::ASCII, ver, cmp, valid);
// Change type back
const_cast<word&>(typeName) = oldTypeName;
......
......@@ -39,9 +39,13 @@ namespace Foam
//- Template specialisation for obtaining filePath
template<>
fileName typeFilePath<IOMap<dictionary>>(const IOobject& io)
fileName typeFilePath<IOMap<dictionary>>
(
const IOobject& io,
const bool search
)
{
return io.globalFilePath(IOMap<dictionary>::typeName);
return io.globalFilePath(IOMap<dictionary>::typeName, search);
}
}
......
......@@ -177,7 +177,13 @@ bool Foam::decomposedBlockData::readMasterHeader(IOobject& io, Istream& is)
List<char> data(is);
is.fatalCheck("read(Istream&) : reading entry");
string buf(data.begin(), data.size());
IStringStream str(is.name(), buf);
IStringStream str
(
buf,
IOstream::ASCII,
IOstream::currentVersion,
is.name()
);
return io.readHeader(str);
}
......@@ -241,7 +247,13 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlock
is.fatalCheck("read(Istream&) : reading entry");
string buf(data.begin(), data.size());
realIsPtr = new IStringStream(is.name(), buf);
realIsPtr = new IStringStream
(
buf,
IOstream::ASCII,
IOstream::currentVersion,
is.name()
);
// Read header
if (!headerIO.readHeader(realIsPtr()))
......@@ -261,7 +273,13 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlock
IOstream::streamFormat fmt;
{
string buf(data.begin(), data.size());
IStringStream headerStream(is.name(), buf);
IStringStream headerStream
(
buf,
IOstream::ASCII,
IOstream::currentVersion,
is.name()
);
// Read header
if (!headerIO.readHeader(headerStream))
......@@ -281,7 +299,13 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlock
is.fatalCheck("read(Istream&) : reading entry");
}
string buf(data.begin(), data.size());
realIsPtr = new IStringStream(is.name(), buf);
realIsPtr = new IStringStream
(
buf,
IOstream::ASCII,
IOstream::currentVersion,
is.name()
);
// Apply master stream settings to realIsPtr
realIsPtr().format(fmt);
......@@ -445,7 +469,13 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
is.fatalCheck("read(Istream&) : reading entry");
string buf(data.begin(), data.size());
realIsPtr = new IStringStream(fName, buf);
realIsPtr = new IStringStream
(
buf,
IOstream::ASCII,
IOstream::currentVersion,
fName
);
// Read header
if (!headerIO.readHeader(realIsPtr()))
......@@ -493,7 +523,13 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
is >> data;
string buf(data.begin(), data.size());
realIsPtr = new IStringStream(fName, buf);
realIsPtr = new IStringStream
(
buf,
IOstream::ASCII,
IOstream::currentVersion,
fName
);
}
}
else
......@@ -516,7 +552,13 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
is.fatalCheck("read(Istream&) : reading entry");
string buf(data.begin(), data.size());
realIsPtr = new IStringStream(fName, buf);
realIsPtr = new IStringStream
(
buf,
IOstream::ASCII,
IOstream::currentVersion,
fName
);
// Read header
if (!headerIO.readHeader(realIsPtr()))
......@@ -554,7 +596,13 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
is >> data;
string buf(data.begin(), data.size());
realIsPtr = new IStringStream(fName, buf);
realIsPtr = new IStringStream
(
buf,
IOstream::ASCII,
IOstream::currentVersion,
fName
);
}
}
......@@ -797,7 +845,13 @@ bool Foam::decomposedBlockData::writeData(Ostream& os) const
IOobject io(*this);
if (Pstream::master())
{
IStringStream is(name(), str);
IStringStream is
(
str,
IOstream::ASCII,
IOstream::currentVersion,
name()
);
io.readHeader(is);
}
......
......@@ -138,11 +138,12 @@ public:
(
const Foam::string& buffer,
streamFormat format=ASCII,
versionNumber version=currentVersion
versionNumber version=currentVersion,
const Foam::string& name="input"
)
:
StringStreamAllocator<std::istringstream>(buffer),
ISstream(*allocatedPtr_, "input", format, version)
ISstream(*allocatedPtr_, name, format, version)
{}
......@@ -151,11 +152,12 @@ public:
(
const char* buffer,
streamFormat format=ASCII,
versionNumber version=currentVersion
versionNumber version=currentVersion,
const Foam::string& name="input"
)
:
StringStreamAllocator<std::istringstream>(buffer),
ISstream(*allocatedPtr_, "input", format, version)
ISstream(*allocatedPtr_, name, format, version)
{}
......
......@@ -590,7 +590,8 @@ bool Foam::functionObjectList::execute()
(
IOstream::ASCII,
IOstream::currentVersion,
time_.writeCompression()
time_.writeCompression(),
true
);
IOstream::precision_ = oldPrecision;
......
......@@ -274,7 +274,8 @@ public:
(
const bool checkGlobal,
const IOobject&,
const word& typeName
const word& typeName,
const bool search = true
) const = 0;
//- Search for a directory. checkGlobal : also check undecomposed
......@@ -282,7 +283,8 @@ public:
virtual fileName dirPath
(
const bool checkGlobal,
const IOobject&
const IOobject& io,
const bool search = true
) const = 0;
//- Search directory for objects. Used in IOobjectList.
......
......@@ -95,6 +95,7 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::filePathInfo
const bool checkGlobal,
const bool isFile,
const IOobject& io,
const bool search,
pathType& searchType,
word& newInstancePath
) const
......@@ -163,47 +164,47 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::filePathInfo
}
}
// Check for approximately same time. E.g. if time = 1e-2 and
// directory is 0.01 (due to different time formats)
HashPtrTable<instantList>::const_iterator pathFnd
// Check for approximately same time. E.g. if time = 1e-2 and
// directory is 0.01 (due to different time formats)
HashPtrTable<instantList>::const_iterator pathFnd
(
times_.find
(
io.time().path()
)
);
if (pathFnd != times_.end())
{
newInstancePath = findInstancePath
(
*pathFnd(),
instant(io.instance())
);
if (newInstancePath.size())
{
// 1. Try processors equivalent
fileName fName =
processorsPath(io, newInstancePath)
/io.name();
if (isFileOrDir(isFile, fName))
{
searchType = fileOperation::PROCESSORSFINDINSTANCE;
return fName;
}
fName =
io.rootPath()/io.caseName()
/newInstancePath/io.db().dbDir()/io.local()/io.name();
if (isFileOrDir(isFile, fName))
{
searchType = fileOperation::FINDINSTANCE;
return fName;
}
}
}
if (search && (pathFnd != times_.end()))
{
newInstancePath = findInstancePath
(
*pathFnd(),
instant(io.instance())
);
if (newInstancePath.size())
{
// 1. Try processors equivalent
fileName fName =
processorsPath(io, newInstancePath)
/io.name();
if (isFileOrDir(isFile, fName))
{
searchType = fileOperation::PROCESSORSFINDINSTANCE;
return fName;
}
fName =
io.rootPath()/io.caseName()
/newInstancePath/io.db().dbDir()/io.local()/io.name();
if (isFileOrDir(isFile, fName))
{
searchType = fileOperation::FINDINSTANCE;
return fName;
}
}
}
searchType = fileOperation::NOTFOUND;
return fileName::null;
......@@ -688,7 +689,8 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::filePath
(
const bool checkGlobal,
const IOobject& io,
const word& typeName
const word& typeName,
const bool search
) const
{
if (debug)
......@@ -773,7 +775,8 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::filePath
Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::dirPath
(
const bool checkGlobal,
const IOobject& io
const IOobject& io,
const bool search
) const
{
if (debug)
......@@ -1252,7 +1255,16 @@ Foam::fileOperations::masterUncollatedFileOperation::readStream
Pout<< "masterUncollatedFileOperation::readStream:"
<< " Done reading " << buf.size() << " bytes" << endl;
}
isPtr.reset(new IStringStream(fName, buf));
isPtr.reset
(
new IStringStream
(
buf,
IOstream::ASCII,
IOstream::currentVersion,
fName
)
);
if (!io.readHeader(isPtr()))
{
......@@ -1617,7 +1629,16 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
// Note: IPstream is not an IStream so use a IStringStream to
// convert the buffer. Note that we construct with a string
// so it holds a copy of the buffer.
return autoPtr<ISstream>(new IStringStream(filePath, buf));
return autoPtr<ISstream>
(
new IStringStream
(
buf,
IOstream::ASCII,
IOstream::currentVersion,
filePath
)
);
}
}
else
......
......@@ -550,8 +550,9 @@ public:
virtual fileName filePath
(
const bool checkGlobal,
const IOobject&,
const word& typeName
const IOobject& io,
const word& typeName,
const bool search
) const;
//- Search for a directory. checkGlobal : also check undecomposed
......@@ -559,7 +560,8 @@ public:
virtual fileName dirPath
(
const bool checkGlobal,
const IOobject&
const IOobject& io,
const bool search
) const;
//- Search directory for objects. Used in IOobjectList.
......
......@@ -50,7 +50,8 @@ Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePathInfo
(
const bool checkGlobal,
const bool isFile,
const IOobject& io
const IOobject& io,
const bool search
) const
{
if (io.instance().isAbsolute())
......@@ -119,7 +120,7 @@ Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePathInfo
// Check for approximately same time. E.g. if time = 1e-2 and
// directory is 0.01 (due to different time formats)
if (!Foam::isDir(path))
if (search && !Foam::isDir(path))
{
word newInstancePath = io.time().findInstancePath
(
......@@ -347,7 +348,8 @@ Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePath
(
const bool checkGlobal,
const IOobject& io,
const word& typeName
const word& typeName,
const bool search
) const
{
if (debug)
......@@ -373,7 +375,8 @@ Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePath
Foam::fileName Foam::fileOperations::uncollatedFileOperation::dirPath
(
const bool checkGlobal,
const IOobject& io
const IOobject& io,
const bool search
) const
{
if (debug)
......
......@@ -59,7 +59,8 @@ class uncollatedFileOperation
(
const bool checkGlobal,
const bool isFile,
const IOobject&
const IOobject& io,
const bool search
) const;
......@@ -208,8 +209,9 @@ public:
virtual fileName filePath
(
const bool checkGlobal,
const IOobject&,
const word& typeName
const IOobject& io,
const word& typeName,
const bool search
) const;
//- Search for a directory. checkGlobal : also check undecomposed
......@@ -217,7 +219,8 @@ public:
virtual fileName dirPath
(
const bool checkGlobal,
const IOobject&
const IOobject& io,
const bool search
) const;
//- Search directory for objects. Used in IOobjectList.
......
......@@ -409,14 +409,16 @@ bool Foam::profiling::writeObject
(
IOstream::streamFormat,
IOstream::versionNumber ver,
IOstream::compressionType
IOstream::compressionType,
const bool valid
) const
{
return regIOobject::writeObject
(
IOstream::ASCII,
ver,
IOstream::UNCOMPRESSED
IOstream::UNCOMPRESSED,
true
);
}
......
......@@ -276,7 +276,8 @@ public:
(
IOstream::streamFormat ignoreAlwaysASCII,
IOstream::versionNumber ver,
IOstream::compressionType ignoreAlwaysUncompressed
IOstream::compressionType ignoreAlwaysUncompressed,
const bool valid
) const;
};
......
......@@ -234,7 +234,8 @@ void Foam::uniformInterpolationTable<Type>::write() const
(
IOstream::ASCII,
IOstream::currentVersion,
dict.time().writeCompression()
dict.time().writeCompression(),
true
);
}
......