Bugfix in samplesCuttingPlane

Need to trigger the re-calculation of cutting plane on topo changes
This commit is contained in:
Vuko Vukcevic 2018-04-24 16:03:09 +02:00
parent d7a357b646
commit 8a14f3ce8e
4 changed files with 38 additions and 21 deletions

View file

@ -105,6 +105,7 @@ class isoSurface
//- Reference to mesh
const fvMesh& mesh_;
//- Point values
const scalarField& pVals_;
//- Input volScalarField with separated coupled patches rewritten
@ -119,7 +120,6 @@ class isoSurface
//- When to merge points
const scalar mergeDistance_;
//- Whether face might be cut
List<cellCutType> faceCutType_;
@ -446,7 +446,6 @@ public:
const GeometricField<Type, fvPatchField, volMesh>& cCoords,
const Field<Type>& pCoords
) const;
};

View file

@ -572,13 +572,13 @@ bool Foam::sampledIsoSurface::expire()
facesPtr_.clear();
subMeshPtr_.clear();
// already marked as expired
// Already marked as expired
if (prevTimeIndex_ == -1)
{
return false;
}
// force update
// Force update
prevTimeIndex_ = -1;
return true;
}

View file

@ -61,6 +61,8 @@ void Foam::sampledCuttingPlane::createGeometry()
pointDistance_.clear();
cellDistancePtr_.clear();
// Clear derived data
clearGeom();
// Get any subMesh
if (zoneID_.index() != -1 && !subMeshPtr_.valid())
@ -311,6 +313,12 @@ Foam::sampledCuttingPlane::~sampledCuttingPlane()
bool Foam::sampledCuttingPlane::needsUpdate() const
{
// Update for changing mesh
if (mesh().changing())
{
needsUpdate_ = true;
}
return needsUpdate_;
}
@ -327,6 +335,9 @@ bool Foam::sampledCuttingPlane::expire()
// Clear any stored topologies
facesPtr_.clear();
// Clear derived data
clearGeom();
// already marked as expired
if (needsUpdate_)
{

View file

@ -68,10 +68,10 @@ class sampledCuttingPlane
//- Whether to recalculate cell values as average of point values
const Switch average_;
//- zone name/index (if restricted to zones)
//- Zone name/index (if restricted to zones)
mutable cellZoneID zoneID_;
//- for zones: patch to put exposed faces into
//- For zones: patch to put exposed faces into
mutable word exposedPatchName_;
//- Track if the surface needs an update
@ -90,7 +90,7 @@ class sampledCuttingPlane
//- Constructed iso surface
autoPtr<isoSurface> isoSurfPtr_;
//- triangles converted to faceList
//- Triangles converted to faceList
mutable autoPtr<faceList> facesPtr_;
@ -99,7 +99,7 @@ class sampledCuttingPlane
//- Create iso surface
void createGeometry();
//- sample field on faces
//- Sample field on faces
template <class Type>
tmp<Field<Type> > sampleField
(
@ -129,9 +129,8 @@ public:
);
// Destructor
virtual ~sampledCuttingPlane();
//- Destructor
virtual ~sampledCuttingPlane();
// Member Functions
@ -177,67 +176,75 @@ public:
return isoSurfPtr_();
}
//- sample field on surface
// Sample
//- Sample field on surface
virtual tmp<scalarField> sample
(
const volScalarField&
) const;
//- sample field on surface
//- Sample field on surface
virtual tmp<vectorField> sample
(
const volVectorField&
) const;
//- sample field on surface
//- Sample field on surface
virtual tmp<sphericalTensorField> sample
(
const volSphericalTensorField&
) const;
//- sample field on surface
//- Sample field on surface
virtual tmp<symmTensorField> sample
(
const volSymmTensorField&
) const;
//- sample field on surface
//- Sample field on surface
virtual tmp<tensorField> sample
(
const volTensorField&
) const;
//- interpolate field on surface
// Interpolate
//- Interpolate field on surface
virtual tmp<scalarField> interpolate
(
const interpolation<scalar>&
) const;
//- interpolate field on surface
//- Interpolate field on surface
virtual tmp<vectorField> interpolate
(
const interpolation<vector>&
) const;
//- interpolate field on surface
//- Interpolate field on surface
virtual tmp<sphericalTensorField> interpolate
(
const interpolation<sphericalTensor>&
) const;
//- interpolate field on surface
//- Interpolate field on surface
virtual tmp<symmTensorField> interpolate
(
const interpolation<symmTensor>&
) const;
//- interpolate field on surface
//- Interpolate field on surface
virtual tmp<tensorField> interpolate
(
const interpolation<tensor>&
) const;
// Output
//- Write
virtual void print(Ostream&) const;
};