Commit 94ae8c01 authored by mark's avatar mark

STYLE: simplify mesh change detection

parent ea50dbcf
......@@ -65,7 +65,7 @@ bool Foam::adiosWrite::cloudRead
if (src.nParcels())
{
size_t nread = reader.getBuffered(src.fullName(), transferBuffer());
IBufStream is(transfer_, nread, IOstream::BINARY);
IBufStream is(transferBuffer(), nread, IOstream::BINARY);
newParcels = IDLList<pType>(is, typename pType::iNew(mesh));
}
......@@ -174,13 +174,10 @@ Foam::label Foam::adiosWrite::writeCloud
// stream contents
int64_t varid = defineStreamVariable(varName, totalLen);
// use transfer_ to avoid too many reallocations
// Needs rework?
transfer_.reserve(adios_expected_var_size(varid));
transferBuffer().reserve(adios_expected_var_size(varid));
// stream the cloud contents - always binary content
CloudOutputStream os(transfer_, IOstream::BINARY);
CloudOutputStream os(transferBuffer(), IOstream::BINARY);
os << '('; // opening '('
forAllConstIter(typename CloudType, cld, pIter)
......@@ -205,7 +202,7 @@ Foam::label Foam::adiosWrite::writeCloud
Pout<< "cloud-stream: " << dbg.str() << endl;
}
writeVariable(varName, transfer_);
writeVariable(varName, transferBuffer());
}
......
......@@ -41,7 +41,7 @@ Foam::adiosTime Foam::adiosWrite::readData(const fileName& bpFile)
adiosTime timeInfo(reader);
transfer_.reserve(reader.sizeOf()); // this is per process
transferBuffer().reserve(reader.sizeOf()); // this is per process
// direct lookup via time_.lookupClass<fvMesh>() would be nice,
// but have to trick the compiler not to get the const-version.
......
......@@ -129,19 +129,11 @@ Foam::adiosWrite::regionInfo::regionInfo
ignoredFields_(),
topoTime_(0),
pointTime_(0),
topoTime0_(0),
pointTime0_(0),
requestedClouds_(),
ignoredClouds_()
{
read(mesh, dict);
// mark points/faces as out-of-date (since last write)
// to ensure mesh will also be emitted at the first write()
const double now = mesh.time().timeOutputValue();
pointTime_ = topoTime_ = now;
pointTime0_ = topoTime0_ = now - mesh.time().deltaTValue();
pointTime_ = topoTime_ = mesh.time().timeOutputValue();
}
......@@ -218,9 +210,6 @@ Foam::adiosWrite::regionInfo::updateTimes(const fvMesh& mesh) const
const word pointsInstance = mesh.pointsInstance().name();
const word facesInstance = mesh.facesInstance().name();
Info<<" points: " << pointsInstance << " was " << pointsName_ << endl;
Info<<" faces : " << facesInstance << " was " << facesName_ << endl;
polyMesh::readUpdateState state = polyMesh::UNCHANGED;
if (pointsName_ != pointsInstance)
......@@ -228,7 +217,7 @@ Foam::adiosWrite::regionInfo::updateTimes(const fvMesh& mesh) const
state = polyMesh::POINTS_MOVED;
pointsName_ = pointsInstance;
pointTime_ = pointTime0_ = now;
pointTime_ = now;
}
if (facesName_ != facesInstance)
......@@ -236,10 +225,9 @@ Foam::adiosWrite::regionInfo::updateTimes(const fvMesh& mesh) const
state = polyMesh::TOPO_CHANGE;
facesName_ = facesInstance;
topoTime_ = topoTime0_ = now;
topoTime_ = now;
}
Info << "state: " << state << endl;
return state;
}
......
......@@ -142,7 +142,7 @@ bool Foam::adiosWrite::restart()
// TODO: handle deltaT0 too
t.setDeltaT(bpTime.deltaT(), false);
// pointTime0_ = xxx
// pointTime_ = xxx, faceTime_ = xxx
}
else
{
......
......@@ -269,12 +269,6 @@ class adiosWrite::regionInfo
//- Time of the point status at the last mesh change
mutable scalar pointTime_;
//- Time of the topology status at the last write
mutable scalar topoTime0_;
//- Time of the point status at the last write
mutable scalar pointTime0_;
//- Name of the most recent faces instance
mutable word facesName_;
......@@ -349,11 +343,11 @@ public:
//- Accept cloud io-object based on its name
bool acceptCloudObject(const regIOobject& obj) const;
bool acceptCloudObject(const regIOobject&) const;
//- Accept field io-object based on its name
bool acceptFieldObject(const regIOobject& obj) const;
bool acceptFieldObject(const regIOobject&) const;
//- Update topology changing information (as required)
......@@ -361,27 +355,6 @@ public:
enum polyMesh::readUpdateState updateTimes(const fvMesh&) const;
//- Is mesh moving
bool moving() const
{
return (pointTime_ > pointTime0_);
}
//- Is mesh topology changing
bool topoChanging() const
{
return (topoTime_ > topoTime0_);
}
//- Is mesh changing (topology changing and/or moving)
bool changing() const
{
return moving() || topoChanging();
}
//- Path name for regions
inline string regionPath() const
{
......
Markdown is supported
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