STYLE: adjust packing of members, header comments

This commit is contained in:
Mark Olesen
2020-12-18 09:13:34 +01:00
parent a92cd03a89
commit 6068148c22
4 changed files with 21 additions and 19 deletions

View File

@ -308,10 +308,10 @@ Foam::polyMesh::polyMesh(const IOobject& io, const bool doInit)
globalMeshDataPtr_(nullptr), globalMeshDataPtr_(nullptr),
moving_(false), moving_(false),
topoChanging_(false), topoChanging_(false),
storeOldCellCentres_(false),
curMotionTimeIndex_(time().timeIndex()), curMotionTimeIndex_(time().timeIndex()),
oldPointsPtr_(nullptr), oldPointsPtr_(nullptr),
oldCellCentresPtr_(nullptr), oldCellCentresPtr_(nullptr)
storeOldCellCentres_(false)
{ {
if (!owner_.headerClassName().empty()) if (!owner_.headerClassName().empty())
{ {
@ -514,10 +514,10 @@ Foam::polyMesh::polyMesh
globalMeshDataPtr_(nullptr), globalMeshDataPtr_(nullptr),
moving_(false), moving_(false),
topoChanging_(false), topoChanging_(false),
storeOldCellCentres_(false),
curMotionTimeIndex_(time().timeIndex()), curMotionTimeIndex_(time().timeIndex()),
oldPointsPtr_(nullptr), oldPointsPtr_(nullptr),
oldCellCentresPtr_(nullptr), oldCellCentresPtr_(nullptr)
storeOldCellCentres_(false)
{ {
// Note: changed that the constructors where values can be supplied // Note: changed that the constructors where values can be supplied
// (points, faces, owner/neighbour) use the readOpt. All others // (points, faces, owner/neighbour) use the readOpt. All others
@ -672,10 +672,10 @@ Foam::polyMesh::polyMesh
globalMeshDataPtr_(nullptr), globalMeshDataPtr_(nullptr),
moving_(false), moving_(false),
topoChanging_(false), topoChanging_(false),
storeOldCellCentres_(false),
curMotionTimeIndex_(time().timeIndex()), curMotionTimeIndex_(time().timeIndex()),
oldPointsPtr_(nullptr), oldPointsPtr_(nullptr),
oldCellCentresPtr_(nullptr), oldCellCentresPtr_(nullptr)
storeOldCellCentres_(false)
{ {
// Note: probably needs io.readOpt() for points/faces/cells etc so // Note: probably needs io.readOpt() for points/faces/cells etc so
// we can run with READ_IF_PRESENT. See constructor above. // we can run with READ_IF_PRESENT. See constructor above.

View File

@ -182,6 +182,9 @@ private:
//- Is the mesh topology changing //- Is the mesh topology changing
bool topoChanging_; bool topoChanging_;
//- Store old cell centres?
mutable bool storeOldCellCentres_;
//- Current time index for mesh motion //- Current time index for mesh motion
mutable label curMotionTimeIndex_; mutable label curMotionTimeIndex_;
@ -191,8 +194,6 @@ private:
//- Old cell centres (for the last mesh motion) //- Old cell centres (for the last mesh motion)
mutable autoPtr<pointField> oldCellCentresPtr_; mutable autoPtr<pointField> oldCellCentresPtr_;
//- Whether or not to store the old cell centres
mutable bool storeOldCellCentres_;
// Private Member Functions // Private Member Functions
@ -434,10 +435,10 @@ public:
//- Return face neighbour //- Return face neighbour
virtual const labelList& faceNeighbour() const; virtual const labelList& faceNeighbour() const;
//- Return old points for mesh motion //- Return old points (mesh motion)
virtual const pointField& oldPoints() const; virtual const pointField& oldPoints() const;
//- Return old points for mesh motion //- Return old cellCentres (mesh motion)
virtual const pointField& oldCellCentres() const; virtual const pointField& oldCellCentres() const;
//- Return boundary mesh //- Return boundary mesh

View File

@ -575,10 +575,10 @@ Foam::polyMesh::polyMesh
globalMeshDataPtr_(nullptr), globalMeshDataPtr_(nullptr),
moving_(false), moving_(false),
topoChanging_(false), topoChanging_(false),
storeOldCellCentres_(false),
curMotionTimeIndex_(time().timeIndex()), curMotionTimeIndex_(time().timeIndex()),
oldPointsPtr_(nullptr), oldPointsPtr_(nullptr),
oldCellCentresPtr_(nullptr), oldCellCentresPtr_(nullptr)
storeOldCellCentres_(false)
{ {
DebugInfo DebugInfo
<< "Constructing polyMesh from cell and boundary shapes." << endl; << "Constructing polyMesh from cell and boundary shapes." << endl;
@ -857,10 +857,10 @@ Foam::polyMesh::polyMesh
globalMeshDataPtr_(nullptr), globalMeshDataPtr_(nullptr),
moving_(false), moving_(false),
topoChanging_(false), topoChanging_(false),
storeOldCellCentres_(false),
curMotionTimeIndex_(time().timeIndex()), curMotionTimeIndex_(time().timeIndex()),
oldPointsPtr_(nullptr), oldPointsPtr_(nullptr),
oldCellCentresPtr_(nullptr), oldCellCentresPtr_(nullptr)
storeOldCellCentres_(false)
{ {
DebugInfo DebugInfo
<< "Constructing polyMesh from cell and boundary shapes." << endl; << "Constructing polyMesh from cell and boundary shapes." << endl;

View File

@ -70,12 +70,12 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
if (oldPointsPtr_) if (oldPointsPtr_)
{ {
// Make a copy of the original points // Make a copy of the original points
pointField oldMotionPoints = *oldPointsPtr_; pointField oldMotionPoints(*oldPointsPtr_);
pointField& newMotionPoints = *oldPointsPtr_; pointField& newMotionPoints = *oldPointsPtr_;
// Resize the list to new size // Resize the list to new size
newMotionPoints.setSize(points_.size()); newMotionPoints.resize(points_.size());
// Map the list // Map the list
if (mpm.hasMotionPoints()) if (mpm.hasMotionPoints())
@ -119,15 +119,16 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
} }
} }
// Map the old motion cell-centres if present
if (oldCellCentresPtr_) if (oldCellCentresPtr_)
{ {
// Make a copy of the original cell-centres // Make a copy of the original cell-centres
pointField oldMotionCellCentres = oldCellCentresPtr_(); pointField oldMotionCellCentres(*oldCellCentresPtr_);
pointField& newMotionCellCentres = oldCellCentresPtr_(); pointField& newMotionCellCentres = *oldCellCentresPtr_;
// Resize the list to new size // Resize the list to new size
newMotionCellCentres.setSize(cellCentres().size()); newMotionCellCentres.resize(cellCentres().size());
// Map the list // Map the list
newMotionCellCentres.map(oldMotionCellCentres, mpm.cellMap()); newMotionCellCentres.map(oldMotionCellCentres, mpm.cellMap());