mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Stored size and alignment rebuilds at specified interval.
This commit is contained in:
@ -68,11 +68,11 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
|
||||
startOfSurfacePointPairs_(0),
|
||||
featureVertices_(),
|
||||
featurePointLocations_(),
|
||||
featurePointTree_(),
|
||||
featurePointTreePtr_(),
|
||||
sizeAndAlignmentLocations_(),
|
||||
storedSizes_(),
|
||||
storedAlignments_(),
|
||||
sizeAndAlignmentTree_(),
|
||||
sizeAndAlignmentTreePtr_(),
|
||||
surfaceConformationVertices_(),
|
||||
initialPointsMethod_
|
||||
(
|
||||
@ -800,7 +800,7 @@ void Foam::conformalVoronoiMesh::reinsertFeaturePoints()
|
||||
const Foam::indexedOctree<Foam::treeDataPoint>&
|
||||
Foam::conformalVoronoiMesh::featurePointTree() const
|
||||
{
|
||||
if (featurePointTree_.empty())
|
||||
if (featurePointTreePtr_.empty())
|
||||
{
|
||||
Random rndGen(92561);
|
||||
|
||||
@ -812,7 +812,7 @@ Foam::conformalVoronoiMesh::featurePointTree() const
|
||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
featurePointTree_.reset
|
||||
featurePointTreePtr_.reset
|
||||
(
|
||||
new indexedOctree<treeDataPoint>
|
||||
(
|
||||
@ -825,7 +825,7 @@ Foam::conformalVoronoiMesh::featurePointTree() const
|
||||
);
|
||||
}
|
||||
|
||||
return featurePointTree_();
|
||||
return featurePointTreePtr_();
|
||||
}
|
||||
|
||||
|
||||
@ -862,14 +862,14 @@ void Foam::conformalVoronoiMesh::insertInitialPoints()
|
||||
|
||||
void Foam::conformalVoronoiMesh::storeSizesAndAlignments
|
||||
(
|
||||
const std::vector<Point>& initPts
|
||||
const std::vector<Point>& storePts
|
||||
)
|
||||
{
|
||||
timeCheck();
|
||||
|
||||
Info << nl << "Initialise stored size and alignment data" << endl;
|
||||
Info << nl << "Store size and alignment" << endl;
|
||||
|
||||
sizeAndAlignmentLocations_.setSize(initPts.size());
|
||||
sizeAndAlignmentLocations_.setSize(storePts.size());
|
||||
|
||||
storedSizes_.setSize(sizeAndAlignmentLocations_.size());
|
||||
|
||||
@ -877,7 +877,7 @@ void Foam::conformalVoronoiMesh::storeSizesAndAlignments
|
||||
|
||||
forAll(sizeAndAlignmentLocations_, i)
|
||||
{
|
||||
sizeAndAlignmentLocations_[i] = topoint(initPts[i]);
|
||||
sizeAndAlignmentLocations_[i] = topoint(storePts[i]);
|
||||
|
||||
storedSizes_[i] = cellSizeControl().cellSize
|
||||
(
|
||||
@ -896,17 +896,34 @@ void Foam::conformalVoronoiMesh::storeSizesAndAlignments
|
||||
}
|
||||
|
||||
|
||||
void Foam::conformalVoronoiMesh::updateSizesAndAlignments
|
||||
(
|
||||
const std::vector<Point>& storePts
|
||||
)
|
||||
{
|
||||
if
|
||||
(
|
||||
runTime_.timeIndex()
|
||||
% cvMeshControls().sizeAndAlignmentRebuildFrequency() == 0
|
||||
)
|
||||
{
|
||||
storeSizesAndAlignments(storePts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Foam::indexedOctree<Foam::treeDataPoint>&
|
||||
Foam::conformalVoronoiMesh::sizeAndAlignmentTree() const
|
||||
{
|
||||
if (sizeAndAlignmentTree_.empty())
|
||||
if (sizeAndAlignmentTreePtr_.empty())
|
||||
{
|
||||
buildSizeAndAlignmentTree();
|
||||
}
|
||||
|
||||
return sizeAndAlignmentTree_();
|
||||
return sizeAndAlignmentTreePtr_();
|
||||
}
|
||||
|
||||
|
||||
void Foam::conformalVoronoiMesh::setVertexSizeAndAlignment()
|
||||
{
|
||||
Info<< nl << "Looking up target cell alignment and size" << endl;
|
||||
@ -1515,6 +1532,8 @@ void Foam::conformalVoronoiMesh::move()
|
||||
|
||||
conformToSurface();
|
||||
|
||||
updateSizesAndAlignments(pointsToInsert);
|
||||
|
||||
timeCheck();
|
||||
|
||||
Info<< nl
|
||||
|
||||
@ -134,11 +134,11 @@ private:
|
||||
List<Vb> featureVertices_;
|
||||
|
||||
//- Storing the locations of all of the features to be conformed to.
|
||||
// Single pointField required by the featurePointTree_.
|
||||
// Single pointField required by the featurePointTree.
|
||||
pointField featurePointLocations_;
|
||||
|
||||
//- Search tree for feature point locations
|
||||
mutable autoPtr<indexedOctree<treeDataPoint> > featurePointTree_;
|
||||
mutable autoPtr<indexedOctree<treeDataPoint> > featurePointTreePtr_;
|
||||
|
||||
//- Store locations where the cell size and alignments will be
|
||||
// pre-calculated and looked up
|
||||
@ -151,7 +151,7 @@ private:
|
||||
tensorField storedAlignments_;
|
||||
|
||||
//- Search tree for size and alignment lookup points
|
||||
mutable autoPtr<indexedOctree<treeDataPoint> > sizeAndAlignmentTree_;
|
||||
mutable autoPtr<indexedOctree<treeDataPoint> > sizeAndAlignmentTreePtr_;
|
||||
|
||||
//- Store the surface and feature edge conformation locations to be
|
||||
// reinserted
|
||||
@ -341,8 +341,11 @@ private:
|
||||
void insertInitialPoints();
|
||||
|
||||
//- Store data for sizeAndAlignmentLocations_, storedSizes_ and
|
||||
// storedAlignments_ and initialise the sizeAndAlignmentTree_
|
||||
void storeSizesAndAlignments(const std::vector<Point>& initPts);
|
||||
// storedAlignments_ and initialise the sizeAndAlignmentTreePtr_
|
||||
void storeSizesAndAlignments(const std::vector<Point>& storePts);
|
||||
|
||||
//- Restore the sizes and alignments if required
|
||||
void updateSizesAndAlignments(const std::vector<Point>& storePts);
|
||||
|
||||
//- Demand driven construction of octree for and alignment points
|
||||
const indexedOctree<treeDataPoint>& sizeAndAlignmentTree() const;
|
||||
|
||||
@ -668,7 +668,7 @@ void Foam::conformalVoronoiMesh::buildSizeAndAlignmentTree() const
|
||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
sizeAndAlignmentTree_.reset
|
||||
sizeAndAlignmentTreePtr_.reset
|
||||
(
|
||||
new indexedOctree<treeDataPoint>
|
||||
(
|
||||
|
||||
@ -229,6 +229,12 @@ Foam::cvControls::cvControls
|
||||
degToRad(readScalar(motionDict.lookup("alignmentAcceptanceAngle")))
|
||||
);
|
||||
|
||||
sizeAndAlignmentRebuildFrequency_ = max
|
||||
(
|
||||
1,
|
||||
readLabel(motionDict.lookup("sizeAndAlignmentRebuildFrequency"))
|
||||
);
|
||||
|
||||
// Point removal criteria
|
||||
|
||||
const dictionary& insertionDict
|
||||
|
||||
@ -196,6 +196,9 @@ class cvControls
|
||||
// face will be accepted for rotation
|
||||
scalar cosAlignmentAcceptanceAngle_;
|
||||
|
||||
//- Now often to re-store the size and alignment data
|
||||
label sizeAndAlignmentRebuildFrequency_;
|
||||
|
||||
// Point insertion criteria
|
||||
|
||||
//- Length between Delaunay vertices above which a new Dv should be
|
||||
@ -365,6 +368,9 @@ public:
|
||||
//- Return the cosAlignmentAcceptanceAngle
|
||||
inline scalar cosAlignmentAcceptanceAngle() const;
|
||||
|
||||
//- Return the sizeAndAlignmentRebuildFrequency
|
||||
inline label sizeAndAlignmentRebuildFrequency() const;
|
||||
|
||||
//- Return the insertionDistCoeff
|
||||
inline scalar insertionDistCoeff() const;
|
||||
|
||||
|
||||
@ -115,6 +115,12 @@ inline Foam::scalar Foam::cvControls::cosAlignmentAcceptanceAngle() const
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::cvControls::sizeAndAlignmentRebuildFrequency() const
|
||||
{
|
||||
return sizeAndAlignmentRebuildFrequency_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::cvControls::insertionDistCoeff() const
|
||||
{
|
||||
return insertionDistCoeff_;
|
||||
|
||||
Reference in New Issue
Block a user