INT: Updated dependent code following latest set of integrations

This commit is contained in:
Andrew Heather
2017-09-06 16:05:12 +01:00
parent d8d6030ab6
commit fb20bc107e
31 changed files with 228 additions and 97 deletions

View File

@ -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
}
// ************************************************************************* //

View File

@ -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;

View File

@ -451,6 +451,8 @@ int main(int argc, char *argv[])
fileOperations::collatedFileOperation::maxThreadFileBufferSize;
fileOperations::collatedFileOperation::maxThreadFileBufferSize = 0;
mesh.decomposeMesh();
mesh.writeDecomposition(decomposeSets);
if (writeCellDist)

View File

@ -231,6 +231,7 @@ Foam::parLagrangianRedistributor::redistributeLagrangianPositions
)
{
passiveParticle& newp = newpIter();
newp.relocate();
lagrangianPositions.addParticle(newParticles.remove(&newp));
}

View File

@ -92,7 +92,8 @@ public:
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp
IOstream::compressionType cmp,
const bool valid
) const
{
return true;

View File

@ -58,7 +58,7 @@ public:
explicit zonesEntries(const IOobject& io)
:
regIOobject(io),
PtrList<entry>(readStream("regIOobject"))
PtrList<entry>(readStream(word("regIOobject")))
{
close();
}

View File

@ -199,7 +199,8 @@ void createFieldFiles
(
IOstream::ASCII,
IOstream::currentVersion,
IOstream::UNCOMPRESSED
IOstream::UNCOMPRESSED,
true
);
}
}

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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)
{}

View File

@ -590,7 +590,8 @@ bool Foam::functionObjectList::execute()
(
IOstream::ASCII,
IOstream::currentVersion,
time_.writeCompression()
time_.writeCompression(),
true
);
IOstream::precision_ = oldPrecision;

View File

@ -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.

View File

@ -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 (search && (pathFnd != times_.end()))
{
newInstancePath = findInstancePath
(
*pathFnd(),
instant(io.instance())
);
if (newInstancePath.size())
{
// 1. Try processors equivalent
if (newInstancePath.size())
{
// 1. Try processors equivalent
fileName fName =
processorsPath(io, newInstancePath)
/io.name();
if (isFileOrDir(isFile, fName))
{
searchType = fileOperation::PROCESSORSFINDINSTANCE;
return fName;
}
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();
fName =
io.rootPath()/io.caseName()
/newInstancePath/io.db().dbDir()/io.local()/io.name();
if (isFileOrDir(isFile, fName))
{
searchType = fileOperation::FINDINSTANCE;
return fName;
}
}
}
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

View File

@ -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.

View File

@ -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)

View File

@ -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.

View File

@ -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
);
}

View File

@ -276,7 +276,8 @@ public:
(
IOstream::streamFormat ignoreAlwaysASCII,
IOstream::versionNumber ver,
IOstream::compressionType ignoreAlwaysUncompressed
IOstream::compressionType ignoreAlwaysUncompressed,
const bool valid
) const;
};

View File

@ -234,7 +234,8 @@ void Foam::uniformInterpolationTable<Type>::write() const
(
IOstream::ASCII,
IOstream::currentVersion,
dict.time().writeCompression()
dict.time().writeCompression(),
true
);
}

View File

@ -272,7 +272,7 @@ public:
// either in the case/processor or case otherwise null
virtual fileName filePath() const
{
return globalFilePath();
return globalFilePath(type());
}
//- Read porosity dictionary

View File

@ -475,7 +475,7 @@ void Foam::particle::locate
const vector* direction,
const label celli,
const bool boundaryFail,
const string boundaryMsg
const string& boundaryMsg
)
{
celli_ = celli;
@ -1130,6 +1130,19 @@ void Foam::particle::autoMap
}
void Foam::particle::relocate()
{
locate
(
position(),
nullptr,
celli_,
true,
"Particle mapped to a location outside of the mesh."
);
}
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
bool Foam::operator==(const particle& pA, const particle& pB)

View File

@ -293,7 +293,7 @@ private:
const vector* direction,
const label celli,
const bool boundaryFail,
const string boundaryMsg
const string& boundaryMsg
);
@ -477,6 +477,9 @@ public:
//- Return current cell particle is in
inline label cell() const;
//- Return current cell particle is in for manipulation
inline label& cell();
//- Return current tet face particle is in
inline label tetFace() const;
@ -687,6 +690,10 @@ public:
//- Map after a topology change
void autoMap(const vector& position, const mapPolyMesh& mapper);
//- Set the addressing based on the current position and cell
// Used for e.g. redistributePar
void relocate();
// I-O

View File

@ -60,6 +60,12 @@ inline Foam::label Foam::particle::cell() const
}
inline Foam::label& Foam::particle::cell()
{
return celli_;
}
inline Foam::label Foam::particle::tetFace() const
{
return tetFacei_;

View File

@ -170,7 +170,7 @@ public:
// either in the case/processor or case otherwise null
virtual fileName filePath() const
{
return globalFilePath();
return globalFilePath(type());
}
//- Return const reference to boundBox

View File

@ -286,10 +286,11 @@ bool Foam::dynamicOversetFvMesh::writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp
IOstream::compressionType cmp,
const bool valid
) const
{
bool ok = dynamicMotionSolverFvMesh::writeObject(fmt, ver, cmp);
bool ok = dynamicMotionSolverFvMesh::writeObject(fmt, ver, cmp, valid);
// For postprocessing : write cellTypes and zoneID
{
@ -318,7 +319,7 @@ bool Foam::dynamicOversetFvMesh::writeObject
volTypes[cellI] = cellTypes[cellI];
}
volTypes.correctBoundaryConditions();
volTypes.writeObject(fmt, ver, cmp);
volTypes.writeObject(fmt, ver, cmp, valid);
}
{
volScalarField volZoneID
@ -345,7 +346,7 @@ bool Foam::dynamicOversetFvMesh::writeObject
volZoneID[cellI] = zoneID[cellI];
}
volZoneID.correctBoundaryConditions();
volZoneID.writeObject(fmt, ver, cmp);
volZoneID.writeObject(fmt, ver, cmp, valid);
}
return ok;
}

View File

@ -288,7 +288,8 @@ public:
(
IOstream::streamFormat,
IOstream::versionNumber,
IOstream::compressionType
IOstream::compressionType,
const bool valid
) const;
//- Debug: check halo swap is ok

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -164,14 +164,15 @@ bool Foam::MeshedSurfaceIOAllocator::writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp
IOstream::compressionType cmp,
const bool valid
) const
{
return
(
points_.writeObject(fmt, ver, cmp)
&& faces_.writeObject(fmt, ver, cmp)
&& zones_.writeObject(fmt, ver, cmp)
points_.writeObject(fmt, ver, cmp, valid)
&& faces_.writeObject(fmt, ver, cmp, valid)
&& zones_.writeObject(fmt, ver, cmp, valid)
);
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -199,7 +199,8 @@ public:
(
IOstream::streamFormat,
IOstream::versionNumber,
IOstream::compressionType
IOstream::compressionType,
const bool valid
) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016 OpenCFD-2017 Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -307,7 +307,8 @@ public:
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp
IOstream::compressionType cmp,
const bool valid
) const;
//- Write to file

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -204,10 +204,11 @@ bool Foam::surfMesh::writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp
IOstream::compressionType cmp,
const bool valid
) const
{
return Allocator::writeObject(fmt, ver, cmp);
return Allocator::writeObject(fmt, ver, cmp, valid);
}