Added control for surface conformation rebuild frequency.

Adding execution time to application.

Adding boolean control for timeChecks, setting to off.

Added determination and reporting of the net number of vertices removed during
an iteration.

Modified and cleaned up all reporting to screen.
This commit is contained in:
graham
2009-08-06 16:39:48 +01:00
parent b29a383ab8
commit 5c28dd80cd
6 changed files with 80 additions and 31 deletions

View File

@ -62,11 +62,19 @@ int main(int argc, char *argv[])
Info<< nl << "Time = " << runTime.timeName() << endl; Info<< nl << "Time = " << runTime.timeName() << endl;
mesh.move(); mesh.move();
Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
} }
mesh.writeMesh(); mesh.writeMesh();
Info<< nl << "End\n" << endl; Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
Info<< nl << "End" << nl << endl;
return 0; return 0;
} }

View File

@ -862,7 +862,7 @@ void Foam::conformalVoronoiMesh::storeSizesAndAlignments
{ {
timeCheck(); timeCheck();
Info << " Initialise stored data" << endl; Info << nl << " Initialise stored size and alignment data" << endl;
sizeAndAlignmentLocations_.setSize(initPts.size()); sizeAndAlignmentLocations_.setSize(initPts.size());
@ -885,13 +885,9 @@ void Foam::conformalVoronoiMesh::storeSizesAndAlignments
timeCheck(); timeCheck();
Info<< " Initialise sizeAndAlignmentTree_" << endl;
buildSizeAndAlignmentTree(); buildSizeAndAlignmentTree();
timeCheck(); timeCheck();
Info<< " Initialised" << endl;
} }
@ -980,10 +976,15 @@ Foam::conformalVoronoiMesh::reconformationControl() const
return FINE; return FINE;
} }
else if(runTime_.timeIndex() % 10 == 0) else if
(
runTime_.timeIndex()
% cvMeshControls().surfaceConformationRebuildFrequency()
== 0
)
{ {
Info<< nl << " Rebuilding surface conformation " Info<< nl << " Rebuilding surface conformation for more iterations"
<< "HARD CODED TO EVERY 10 STEPS" << endl; << endl;
return COARSE; return COARSE;
} }
@ -996,15 +997,13 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
reconformationMode reconfMode reconformationMode reconfMode
) )
{ {
Info<< nl << " Build surface conformation" << endl;
if (reconfMode == COARSE) if (reconfMode == COARSE)
{ {
Info<< " Coarse surface conformation" << endl; Info<< nl << " Build coarse surface conformation" << endl;
} }
else if (reconfMode == FINE) else if (reconfMode == FINE)
{ {
Info<< " Fine surface conformation" << endl; Info<< nl << " Build fine surface conformation" << endl;
} }
else if (reconfMode == NONE) else if (reconfMode == NONE)
{ {
@ -1100,10 +1099,10 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
} }
} }
Info<< nl <<" Initial conformation " << nl Info<< nl <<" Initial conformation" << nl
<< " number_of_vertices " << number_of_vertices() << nl << " Number of vertices " << number_of_vertices() << nl
<< " surfaceHits.size() " << surfaceHits.size() << nl << " Number of surface hits " << surfaceHits.size() << nl
<< " featureEdgeHits.size() " << featureEdgeHits.size() << " Number of edge hits " << featureEdgeHits.size()
<< endl; << endl;
insertSurfacePointPairs insertSurfacePointPairs
@ -1201,10 +1200,10 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
} }
} }
Info<< nl <<" iterationNo " << iterationNo << nl Info<< nl <<" Conformation iteration " << iterationNo << nl
<< " number_of_vertices " << number_of_vertices() << nl << " Number of vertices " << number_of_vertices() << nl
<< " surfaceHits.size() " << surfaceHits.size() << nl << " Number of surface hits " << surfaceHits.size() << nl
<< " featureEdgeHits.size() " << featureEdgeHits.size() << " Number of edge hits " << featureEdgeHits.size()
<< endl; << endl;
totalHits = surfaceHits.size() + featureEdgeHits.size(); totalHits = surfaceHits.size() + featureEdgeHits.size();
@ -2405,7 +2404,7 @@ void Foam::conformalVoronoiMesh::move()
timeCheck(); timeCheck();
Info<< nl << " Looping over all dual faces" << endl; Info<< nl << " Determining vertex displacements" << endl;
vectorField cartesianDirections(3); vectorField cartesianDirections(3);
@ -2645,11 +2644,6 @@ void Foam::conformalVoronoiMesh::move()
vector totalDisp = sum(displacementAccumulator); vector totalDisp = sum(displacementAccumulator);
scalar totalDist = sum(mag(displacementAccumulator)); scalar totalDist = sum(mag(displacementAccumulator));
Info<< " Total displacement = " << totalDisp << nl
<< " Total distance = " << totalDist << nl
<< " Points added = " << pointsAdded
<< endl;
// Relax the calculated displacement // Relax the calculated displacement
displacementAccumulator *= relaxation; displacementAccumulator *= relaxation;
@ -2691,17 +2685,29 @@ void Foam::conformalVoronoiMesh::move()
timeCheck(); timeCheck();
Info<< nl << " Reinserting entire tessellation" << endl; Info<< nl << " Inserting displaced tessellation" << endl;
insertPoints(pointsToInsert); insertPoints(pointsToInsert);
startOfSurfacePointPairs_ = number_of_vertices(); startOfSurfacePointPairs_ = number_of_vertices();
label pointsRemoved =
displacementAccumulator.size()
- number_of_vertices()
+ pointsAdded;
timeCheck(); timeCheck();
conformToSurface(); conformToSurface();
timeCheck(); timeCheck();
Info<< nl
<< " Total displacement = " << totalDisp << nl
<< " Total distance = " << totalDist << nl
<< " Points added = " << pointsAdded << nl
<< " Points removed = " << pointsRemoved
<< endl;
} }

View File

@ -28,8 +28,11 @@ License
inline void Foam::conformalVoronoiMesh::timeCheck() const inline void Foam::conformalVoronoiMesh::timeCheck() const
{ {
if (cvMeshControls().timeChecks())
{
Info<< nl << "--- [ " << runTime_.elapsedCpuTime() << "s, delta " Info<< nl << "--- [ " << runTime_.elapsedCpuTime() << "s, delta "
<< runTime_.cpuTimeIncrement()<< "s ] --- " << endl; << runTime_.cpuTimeIncrement()<< "s ] --- " << endl;
}
} }

View File

@ -49,6 +49,8 @@ Foam::cvControls::cvControls
spanSqr_ = sqr(span_); spanSqr_ = sqr(span_);
timeChecks_ = false;
// Surface conformation controls // Surface conformation controls
const dictionary& surfDict(cvMeshDict_.subDict("surfaceConformation")); const dictionary& surfDict(cvMeshDict_.subDict("surfaceConformation"));
@ -83,7 +85,13 @@ Foam::cvControls::cvControls
surfDict.lookup("maxSurfaceProtrusionCoeff") surfDict.lookup("maxSurfaceProtrusionCoeff")
); );
maxQuadAngle_= readScalar(surfDict.lookup("maxQuadAngle")); maxQuadAngle_ = readScalar(surfDict.lookup("maxQuadAngle"));
surfaceConformationRebuildFrequency_ = max
(
1,
readLabel(surfDict.lookup("surfaceConformationRebuildFrequency"))
);
// Motion control controls // Motion control controls

View File

@ -69,6 +69,9 @@ class cvControls
//- Square of span_ //- Square of span_
scalar spanSqr_; scalar spanSqr_;
//- Activate/deactivate detailed timeChecks during meshing
bool timeChecks_;
// Surface conformation controls // Surface conformation controls
//- Point pair spacing coefficient - fraction of the local target //- Point pair spacing coefficient - fraction of the local target
@ -102,6 +105,9 @@ class cvControls
// additional "mitering" lines are added // additional "mitering" lines are added
scalar maxQuadAngle_; scalar maxQuadAngle_;
//- Now often to rebuild the surface conformation
label surfaceConformationRebuildFrequency_;
// Motion control controls // Motion control controls
@ -175,6 +181,9 @@ public:
//- Return spanSqr //- Return spanSqr
inline scalar spanSqr() const; inline scalar spanSqr() const;
//- Return timeChecks
inline bool timeChecks() const;
//- Return the pointPairDistanceCoeff //- Return the pointPairDistanceCoeff
inline scalar pointPairDistanceCoeff() const; inline scalar pointPairDistanceCoeff() const;
@ -196,6 +205,9 @@ public:
//- Return the maxQuadAngle //- Return the maxQuadAngle
inline scalar maxQuadAngle() const; inline scalar maxQuadAngle() const;
//- Return the surfaceConformationRebuildFrequency
inline label surfaceConformationRebuildFrequency() const;
//- Return the objOutput Switch //- Return the objOutput Switch
inline bool objOutput() const; inline bool objOutput() const;

View File

@ -44,6 +44,12 @@ inline Foam::scalar Foam::cvControls::spanSqr() const
} }
inline bool Foam::cvControls::timeChecks() const
{
return timeChecks_;
}
inline Foam::scalar Foam::cvControls::pointPairDistanceCoeff() const inline Foam::scalar Foam::cvControls::pointPairDistanceCoeff() const
{ {
return pointPairDistanceCoeff_; return pointPairDistanceCoeff_;
@ -86,6 +92,12 @@ inline Foam::scalar Foam::cvControls::maxQuadAngle() const
} }
inline Foam::label Foam::cvControls::surfaceConformationRebuildFrequency() const
{
return surfaceConformationRebuildFrequency_;
}
inline bool Foam::cvControls::objOutput() const inline bool Foam::cvControls::objOutput() const
{ {
return objOutput_; return objOutput_;