Commit 12adfe13 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

ENH: update empty sampled surfaces storage (#1217)

- also store empty sampled surfaces, otherwise we miss geometry updates.
parent 97be0673
......@@ -490,8 +490,7 @@ bool Foam::sampledSurfaces::read(const dictionary& dict)
bool Foam::sampledSurfaces::performAction(unsigned request)
{
// Update surfaces, writer associations etc.
// Update surfaces and store
bool ok = false;
forAll(*this, surfi)
......@@ -508,12 +507,27 @@ bool Foam::sampledSurfaces::performAction(unsigned request)
nFaces_[surfi] = returnReduce(s.faces().size(), sumOp<label>());
ok = ok || nFaces_[surfi];
// Store surfaces (even empty ones) otherwise we miss geometry
// updates.
// Any associated fields will be removed if the size changes
if ((request & actions_[surfi]) & ACTION_STORE)
{
storeRegistrySurface(s);
}
if ((request & actions_[surfi]) & ACTION_SURF_MESH)
{
s.storeSurfMesh();
}
}
}
if (!ok)
{
// No surface with faces or an applicable action
// No surface with an applicable action or with faces to sample
return true;
}
......@@ -522,36 +536,13 @@ bool Foam::sampledSurfaces::performAction(unsigned request)
// Only seems to be needed for VTK legacy
countFields();
// Update writers
forAll(*this, surfi)
{
const sampledSurface& s = (*this)[surfi];
if (!(request & actions_[surfi]))
{
continue;
}
// TDB: do we store empty surfaces, skip them, or remove them
// from the registry?
// - For now, just skip touching them.
if (!nFaces_[surfi])
{
continue;
}
if ((request & actions_[surfi]) & ACTION_STORE)
{
storeRegistrySurface(s);
}
if ((request & actions_[surfi]) & ACTION_SURF_MESH)
{
s.storeSurfMesh();
}
if ((request & actions_[surfi]) & ACTION_WRITE)
if (((request & actions_[surfi]) & ACTION_WRITE) && nFaces_[surfi])
{
// Output writers
surfaceWriter& outWriter = writers_[surfi];
......@@ -588,6 +579,8 @@ bool Foam::sampledSurfaces::performAction(unsigned request)
}
}
// Sample fields
const IOobjectList objects(obr_, obr_.time().timeName());
performAction<volScalarField>(objects, request);
......
......@@ -140,10 +140,6 @@ protected:
}
//- Update with new contents
void copyContents(const MeshedSurface<face>& surf, bool validate=false);
public:
// Public Typedefs
......
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