Commit 10042d2a authored by laurence's avatar laurence
Browse files

ENH: cvMesh: Add option to print vertex info

parent ec313f85
......@@ -168,8 +168,8 @@ Foam::pointHit Foam::controlMeshRefinement::findDiscontinuities
{
pointHit p(point::max);
const scalar tolSqr = sqr(1e-3);
const scalar secondDerivTolSqr = sqr(1e-3);
const scalar tolSqr = sqr(1e-1);
const scalar secondDerivTolSqr = sqr(1e-1);
detectEdge
(
......@@ -373,6 +373,54 @@ void Foam::controlMeshRefinement::initialMeshPopulation
<< "/" << returnReduce(vertices.size(), sumOp<label>())
<< endl;
}
// Change cell size function of bounding points to be consistent
// with their nearest neighbours
// for
// (
// CellSizeDelaunay::Finite_vertices_iterator vit =
// mesh_.finite_vertices_begin();
// vit != mesh_.finite_vertices_end();
// ++vit
// )
// {
// if (vit->uninitialised())
// {
// // Get its adjacent vertices
// std::list<CellSizeDelaunay::Vertex_handle> adjacentVertices;
//
// mesh_.adjacent_vertices
// (
// vit,
// std::back_inserter(adjacentVertices)
// );
//
// scalar totalCellSize = 0;
// label nVerts = 0;
//
// for
// (
// std::list<CellSizeDelaunay::Vertex_handle>::iterator avit =
// adjacentVertices.begin();
// avit != adjacentVertices.end();
// ++avit
// )
// {
// if (!(*avit)->uninitialised())
// {
// totalCellSize += (*avit)->targetCellSize();
// nVerts++;
// }
// }
//
// Pout<< "Changing " << vit->info();
//
// vit->targetCellSize() = totalCellSize/nVerts;
// vit->type() = Vb::vtInternalNearBoundary;
//
// Pout<< "to " << vit->info() << endl;
// }
// }
}
......@@ -381,7 +429,9 @@ Foam::label Foam::controlMeshRefinement::refineMesh
const autoPtr<backgroundMeshDecomposition>& decomposition
)
{
Info<< "Iterate over cell size mesh edges" << endl;
Info<< "Iterate over "
<< returnReduce(label(mesh_.number_of_finite_edges()), sumOp<label>())
<< " cell size mesh edges" << endl;
DynamicList<Vb> verts(mesh_.number_of_vertices());
......
......@@ -52,11 +52,11 @@ linearDistance::linearDistance
distanceCellSize_
(
readScalar(coeffsDict().lookup("distanceCellSizeCoeff"))
*defaultCellSize_
*defaultCellSize
),
distance_
(
readScalar(coeffsDict().lookup("distanceCoeff"))*defaultCellSize_
readScalar(coeffsDict().lookup("distanceCoeff"))*defaultCellSize
),
distanceSqr_(sqr(distance_))
{}
......
......@@ -51,7 +51,7 @@ linearSpatial::linearSpatial
referenceCellSize_
(
readScalar(coeffsDict().lookup("referenceCellSizeCoeff"))
*defaultCellSize_
*defaultCellSize
),
direction_(coeffsDict().lookup("direction")),
cellSizeGradient_(readScalar(coeffsDict().lookup("cellSizeGradient")))
......
......@@ -54,11 +54,11 @@ surfaceOffsetLinearDistance::surfaceOffsetLinearDistance
distanceCellSize_
(
readScalar(coeffsDict().lookup("distanceCellSizeCoeff"))
*defaultCellSize_
*defaultCellSize
),
surfaceOffset_
(
readScalar(coeffsDict().lookup("surfaceOffsetCoeff"))*defaultCellSize_
readScalar(coeffsDict().lookup("surfaceOffsetCoeff"))*defaultCellSize
),
totalDistance_(),
totalDistanceSqr_()
......@@ -93,13 +93,13 @@ surfaceOffsetLinearDistance::surfaceOffsetLinearDistance
{
totalDistance_ =
readScalar(coeffsDict().lookup("totalDistanceCoeff"))
*defaultCellSize_;
*defaultCellSize;
}
else
{
totalDistance_ =
readScalar(coeffsDict().lookup("linearDistanceCoeff"))
*defaultCellSize_
*defaultCellSize
+ surfaceOffset_;
}
}
......
......@@ -49,7 +49,7 @@ uniformDistance::uniformDistance
cellSizeFunction(typeName, initialPointsDict, surface, defaultCellSize),
distance_
(
readScalar(coeffsDict().lookup("distanceCoeff"))*defaultCellSize_
readScalar(coeffsDict().lookup("distanceCoeff"))*defaultCellSize
),
distanceSqr_(sqr(distance_))
{}
......
......@@ -121,7 +121,7 @@ Foam::automatic::automatic
),
maximumCellSize_
(
readScalar(coeffsDict_.lookup("maximumCellSizeCoeff"))*defaultCellSize_
readScalar(coeffsDict_.lookup("maximumCellSizeCoeff"))*defaultCellSize
)
{}
......
......@@ -81,7 +81,7 @@ Foam::nonUniformField::nonUniformField
(
coeffsDict(),
surfaceTriMesh_,
defaultCellSize_
defaultCellSize
)
),
pointCellSize_(),
......
......@@ -58,7 +58,7 @@ Foam::uniformValue::uniformValue
),
surfaceCellSize_
(
readScalar(coeffsDict().lookup("surfaceCellSizeCoeff"))*defaultCellSize_
readScalar(coeffsDict().lookup("surfaceCellSizeCoeff"))*defaultCellSize
)
{}
......
......@@ -734,7 +734,6 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh()
if (Pstream::parRun())
{
distributeBackground(cellSizeMesh);
// cellSizeMesh.distribute(decomposition_);
}
label nMaxIter = readLabel
......@@ -790,7 +789,10 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh()
cellSizeMesh.write();
}
cellSizeMesh.printVertexInfo(Info);
if (cvMeshControls().printVertexInfo())
{
cellSizeMesh.printVertexInfo(Info);
}
}
......@@ -1311,7 +1313,10 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
cellSizeMeshOverlapsBackground();
printVertexInfo(Info);
if (cvMeshControls().printVertexInfo())
{
printVertexInfo(Info);
}
if (cvMeshControls().objOutput())
{
......@@ -1878,7 +1883,10 @@ void Foam::conformalVoronoiMesh::move()
timeCheck("After conformToSurface");
printVertexInfo(Info);
if (cvMeshControls().printVertexInfo())
{
printVertexInfo(Info);
}
// Write the intermediate mesh, do not filter the dual faces.
if (runTime_.outputTime())
......
......@@ -328,7 +328,7 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
labelList cellToDelaunayVertex;
// Per patch, per face the Delaunay vertex
labelListList patchToDelaunayVertex;
// Per patch the start of the dual faces
labelList dualPatchStarts;
{
......@@ -771,9 +771,6 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
const wordList& patchTypes,
const wordList& patchNames,
const PtrList<dictionary>& patchDicts
// const labelList& patchSizes,
// const labelList& patchStarts,
// const labelList& procNeighbours
) const
{
Info<< incrIndent << indent << "Reordering processor patches" << endl;
......
......@@ -137,6 +137,11 @@ Foam::cvControls::cvControls
motionDict.lookupOrDefault<Switch>("timeChecks", false)
);
printVertexInfo_ = Switch
(
motionDict.lookupOrDefault<Switch>("printVertexInfo", false)
);
if (Pstream::parRun())
{
maxLoadUnbalance_ = readScalar(motionDict.lookup("maxLoadUnbalance"));
......
......@@ -142,6 +142,9 @@ class cvControls
//- Switch to control the reporting of detailed timeChecks
Switch timeChecks_;
//- Switch to control the reporting of detailed vertex information
Switch printVertexInfo_;
//- Allowed relative load unbalance
scalar maxLoadUnbalance_;
......@@ -277,6 +280,9 @@ public:
//- Return the timeChecks Switch
inline Switch timeChecks() const;
//- Return the printVertexInfo Switch
inline Switch printVertexInfo() const;
//- Return the maxLoadUnbalance
inline scalar maxLoadUnbalance() const;
......
......@@ -136,6 +136,12 @@ inline Foam::Switch Foam::cvControls::timeChecks() const
}
inline Foam::Switch Foam::cvControls::printVertexInfo() const
{
return printVertexInfo_;
}
inline Foam::scalar Foam::cvControls::maxLoadUnbalance() const
{
return maxLoadUnbalance_;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment