mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: polyMesh: update pointMesh.
This commit is contained in:
@ -265,7 +265,7 @@ Foam::polyMesh::polyMesh(const IOobject& io)
|
||||
),
|
||||
globalMeshDataPtr_(NULL),
|
||||
moving_(false),
|
||||
changing_(false),
|
||||
topoChanging_(false),
|
||||
curMotionTimeIndex_(time().timeIndex()),
|
||||
oldPointsPtr_(NULL)
|
||||
{
|
||||
@ -447,7 +447,7 @@ Foam::polyMesh::polyMesh
|
||||
),
|
||||
globalMeshDataPtr_(NULL),
|
||||
moving_(false),
|
||||
changing_(false),
|
||||
topoChanging_(false),
|
||||
curMotionTimeIndex_(time().timeIndex()),
|
||||
oldPointsPtr_(NULL)
|
||||
{
|
||||
@ -606,7 +606,7 @@ Foam::polyMesh::polyMesh
|
||||
),
|
||||
globalMeshDataPtr_(NULL),
|
||||
moving_(false),
|
||||
changing_(false),
|
||||
topoChanging_(false),
|
||||
curMotionTimeIndex_(time().timeIndex()),
|
||||
oldPointsPtr_(NULL)
|
||||
{
|
||||
@ -673,8 +673,8 @@ void Foam::polyMesh::resetPrimitives
|
||||
const bool validBoundary
|
||||
)
|
||||
{
|
||||
// Clear addressing. Keep geometric props for mapping.
|
||||
clearAddressing();
|
||||
// Clear addressing. Keep geometric props and updateable props for mapping.
|
||||
clearAddressing(true);
|
||||
|
||||
// Take over new primitive data.
|
||||
// Optimized to avoid overwriting data at all
|
||||
|
||||
@ -172,8 +172,8 @@ private:
|
||||
//- Is the mesh moving
|
||||
bool moving_;
|
||||
|
||||
//- Is the mesh changing (moving and/or topology changing)
|
||||
bool changing_;
|
||||
//- Is the mesh topology changing
|
||||
bool topoChanging_;
|
||||
|
||||
//- Current time index for mesh motion
|
||||
mutable label curMotionTimeIndex_;
|
||||
@ -489,22 +489,27 @@ public:
|
||||
{
|
||||
bool m0 = moving_;
|
||||
moving_ = m;
|
||||
changing_ = changing_ || moving_;
|
||||
return m0;
|
||||
}
|
||||
|
||||
//- Is mesh topology changing
|
||||
bool topoChanging() const
|
||||
{
|
||||
return topoChanging_;
|
||||
}
|
||||
|
||||
//- Set the mesh topology to be changing
|
||||
bool topoChanging(const bool c)
|
||||
{
|
||||
bool c0 = topoChanging_;
|
||||
topoChanging_ = c;
|
||||
return c0;
|
||||
}
|
||||
|
||||
//- Is mesh changing (topology changing and/or moving)
|
||||
bool changing() const
|
||||
{
|
||||
return changing_;
|
||||
}
|
||||
|
||||
//- Set the mesh to be changing
|
||||
bool changing(const bool c)
|
||||
{
|
||||
bool c0 = changing_;
|
||||
changing_ = c;
|
||||
return c0;
|
||||
return moving()||topoChanging();
|
||||
}
|
||||
|
||||
//- Move points, returns volumes swept by faces in motion
|
||||
@ -580,7 +585,7 @@ public:
|
||||
void clearGeom();
|
||||
|
||||
//- Clear addressing
|
||||
void clearAddressing();
|
||||
void clearAddressing(const bool isMeshUpdate = false);
|
||||
|
||||
//- Clear all geometry and addressing unnecessary for CFD
|
||||
void clearOut();
|
||||
|
||||
@ -60,6 +60,7 @@ void Foam::polyMesh::clearGeom()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Clear all geometric mesh objects
|
||||
meshObject::clear<polyMesh, GeometricMeshObject>(*this);
|
||||
|
||||
primitiveMesh::clearGeom();
|
||||
@ -93,16 +94,33 @@ void Foam::polyMesh::clearAdditionalGeom()
|
||||
}
|
||||
|
||||
|
||||
void Foam::polyMesh::clearAddressing()
|
||||
void Foam::polyMesh::clearAddressing(const bool isMeshUpdate)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "void polyMesh::clearAddressing() : "
|
||||
<< "clearing topology"
|
||||
<< "clearing topology isMeshUpdate:" << isMeshUpdate
|
||||
<< endl;
|
||||
}
|
||||
|
||||
meshObject::clear<polyMesh, TopologicalMeshObject>(*this);
|
||||
if (isMeshUpdate)
|
||||
{
|
||||
// Part of a mesh update. Keep meshObjects that have an updateMesh
|
||||
// callback
|
||||
meshObject::clearUpto
|
||||
<
|
||||
polyMesh,
|
||||
TopologicalMeshObject,
|
||||
UpdateableMeshObject
|
||||
>
|
||||
(
|
||||
*this
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
meshObject::clear<polyMesh, TopologicalMeshObject>(*this);
|
||||
}
|
||||
|
||||
primitiveMesh::clearAddressing();
|
||||
|
||||
|
||||
@ -553,7 +553,7 @@ Foam::polyMesh::polyMesh
|
||||
),
|
||||
globalMeshDataPtr_(NULL),
|
||||
moving_(false),
|
||||
changing_(false),
|
||||
topoChanging_(false),
|
||||
curMotionTimeIndex_(time().timeIndex()),
|
||||
oldPointsPtr_(NULL)
|
||||
{
|
||||
@ -837,7 +837,7 @@ Foam::polyMesh::polyMesh
|
||||
),
|
||||
globalMeshDataPtr_(NULL),
|
||||
moving_(false),
|
||||
changing_(false),
|
||||
topoChanging_(false),
|
||||
curMotionTimeIndex_(time().timeIndex()),
|
||||
oldPointsPtr_(NULL)
|
||||
{
|
||||
|
||||
@ -32,6 +32,7 @@ License
|
||||
#include "syncTools.H"
|
||||
#include "pointFields.H"
|
||||
#include "sigFpe.H"
|
||||
#include "cellSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -1072,6 +1073,26 @@ Foam::dynamicRefineFvMesh::dynamicRefineFvMesh(const IOobject& io)
|
||||
{
|
||||
protectedCell_.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
cellSet protectedCells(*this, "protectedCells", nProtected);
|
||||
forAll(protectedCell_, cellI)
|
||||
{
|
||||
if (protectedCell_[cellI])
|
||||
{
|
||||
protectedCells.insert(cellI);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Detected " << returnReduce(nProtected, sumOp<label>())
|
||||
<< " cells that are projected from refinement."
|
||||
<< " Writing these to cellSet "
|
||||
<< protectedCells.name()
|
||||
<< "." << endl;
|
||||
|
||||
protectedCells.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1110,7 +1131,7 @@ bool Foam::dynamicRefineFvMesh::update()
|
||||
|
||||
if (refineInterval == 0)
|
||||
{
|
||||
changing(hasChanged);
|
||||
topoChanging(hasChanged);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -1279,7 +1300,13 @@ bool Foam::dynamicRefineFvMesh::update()
|
||||
nRefinementIterations_++;
|
||||
}
|
||||
|
||||
changing(hasChanged);
|
||||
topoChanging(hasChanged);
|
||||
if (hasChanged)
|
||||
{
|
||||
// Reset moving flag (if any). If not using inflation we'll not move,
|
||||
// if are using inflation any follow on movePoints will set it.
|
||||
moving(false);
|
||||
}
|
||||
|
||||
return hasChanged;
|
||||
}
|
||||
|
||||
@ -3184,7 +3184,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::changeMesh
|
||||
syncParallel
|
||||
);
|
||||
|
||||
mesh.changing(true);
|
||||
mesh.topoChanging(true);
|
||||
// Note: could already set moving flag as well
|
||||
// mesh.moving(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3199,7 +3201,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::changeMesh
|
||||
patchStarts,
|
||||
syncParallel
|
||||
);
|
||||
mesh.changing(true);
|
||||
mesh.topoChanging(true);
|
||||
}
|
||||
|
||||
// Clear out primitives
|
||||
|
||||
@ -110,10 +110,42 @@ void Foam::fvMesh::clearGeom()
|
||||
}
|
||||
|
||||
|
||||
void Foam::fvMesh::clearAddressing()
|
||||
void Foam::fvMesh::clearAddressing(const bool isMeshUpdate)
|
||||
{
|
||||
meshObject::clear<fvMesh, TopologicalMeshObject>(*this);
|
||||
meshObject::clear<lduMesh, TopologicalMeshObject>(*this);
|
||||
if (debug)
|
||||
{
|
||||
Info<< "fvMesh::clearAddressing(const bool) :"
|
||||
<< " isMeshUpdate:" << isMeshUpdate << endl;
|
||||
}
|
||||
|
||||
if (isMeshUpdate)
|
||||
{
|
||||
// Part of a mesh update. Keep meshObjects that have an updateMesh
|
||||
// callback
|
||||
meshObject::clearUpto
|
||||
<
|
||||
fvMesh,
|
||||
TopologicalMeshObject,
|
||||
UpdateableMeshObject
|
||||
>
|
||||
(
|
||||
*this
|
||||
);
|
||||
meshObject::clearUpto
|
||||
<
|
||||
lduMesh,
|
||||
TopologicalMeshObject,
|
||||
UpdateableMeshObject
|
||||
>
|
||||
(
|
||||
*this
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
meshObject::clear<fvMesh, TopologicalMeshObject>(*this);
|
||||
meshObject::clear<lduMesh, TopologicalMeshObject>(*this);
|
||||
}
|
||||
deleteDemandDrivenData(lduPtr_);
|
||||
}
|
||||
|
||||
@ -806,7 +838,8 @@ void Foam::fvMesh::updateMesh(const mapPolyMesh& mpm)
|
||||
// Clear the current volume and other geometry factors
|
||||
surfaceInterpolation::clearOut();
|
||||
|
||||
clearAddressing();
|
||||
// Clear any non-updateable addressing
|
||||
clearAddressing(true);
|
||||
|
||||
meshObject::updateMesh<fvMesh>(*this, mpm);
|
||||
meshObject::updateMesh<lduMesh>(*this, mpm);
|
||||
|
||||
@ -141,7 +141,7 @@ class fvMesh
|
||||
void clearGeom();
|
||||
|
||||
//- Clear addressing
|
||||
void clearAddressing();
|
||||
void clearAddressing(const bool isMeshUpdate = false);
|
||||
|
||||
//- Preserve old volume(s)
|
||||
void storeOldVol(const scalarField&);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -65,6 +65,12 @@ bool Foam::rawTopoChangerFvMesh::update()
|
||||
// Do mesh changes (use inflation - put new points in topoChangeMap)
|
||||
Info<< "rawTopoChangerFvMesh : Checking for topology changes..."
|
||||
<< endl;
|
||||
|
||||
// Mesh not moved/changed yet
|
||||
moving(false);
|
||||
topoChanging(false);
|
||||
|
||||
// Do any topology changes. Sets topoChanging (through polyTopoChange)
|
||||
autoPtr<mapPolyMesh> topoChangeMap = topoChanger_.changeMesh(true);
|
||||
|
||||
bool hasChanged = topoChangeMap.valid();
|
||||
@ -170,8 +176,6 @@ bool Foam::rawTopoChangerFvMesh::update()
|
||||
// << " no topology changes..." << endl;
|
||||
}
|
||||
|
||||
changing(hasChanged);
|
||||
|
||||
return hasChanged;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user