Commit 181e4b29 authored by laurence's avatar laurence
Browse files

ENH: Shift printVertexInfo to the DelaunayMesh class

parent 32384443
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -205,6 +205,8 @@ public:
void printInfo(Ostream& os) const;
void printVertexInfo(Ostream& os) const;
//- Create an fvMesh from the triangulation.
// The mesh is not parallel consistent - only used for viewing
autoPtr<fvMesh> createMesh
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -161,6 +161,173 @@ void Foam::DelaunayMesh<Triangulation>::printInfo(Ostream& os) const
}
template<class Triangulation>
void Foam::DelaunayMesh<Triangulation>::printVertexInfo(Ostream& os) const
{
label nInternal = 0;
label nInternalRef = 0;
label nUnassigned = 0;
label nUnassignedRef = 0;
label nInternalNearBoundary = 0;
label nInternalNearBoundaryRef = 0;
label nInternalSurface = 0;
label nInternalSurfaceRef = 0;
label nInternalFeatureEdge = 0;
label nInternalFeatureEdgeRef = 0;
label nInternalFeaturePoint = 0;
label nInternalFeaturePointRef = 0;
label nExternalSurface = 0;
label nExternalSurfaceRef = 0;
label nExternalFeatureEdge = 0;
label nExternalFeatureEdgeRef = 0;
label nExternalFeaturePoint = 0;
label nExternalFeaturePointRef = 0;
label nFar = 0;
label nReferred = 0;
for
(
Finite_vertices_iterator vit = Triangulation::finite_vertices_begin();
vit != Triangulation::finite_vertices_end();
++vit
)
{
if (vit->type() == Vb::vtInternal)
{
if (vit->referred())
{
nReferred++;
nInternalRef++;
}
nInternal++;
}
else if (vit->type() == Vb::vtUnassigned)
{
if (vit->referred())
{
nReferred++;
nUnassignedRef++;
}
nUnassigned++;
}
else if (vit->type() == Vb::vtInternalNearBoundary)
{
if (vit->referred())
{
nReferred++;
nInternalNearBoundaryRef++;
}
nInternalNearBoundary++;
}
else if (vit->type() == Vb::vtInternalSurface)
{
if (vit->referred())
{
nReferred++;
nInternalSurfaceRef++;
}
nInternalSurface++;
}
else if (vit->type() == Vb::vtInternalFeatureEdge)
{
if (vit->referred())
{
nReferred++;
nInternalFeatureEdgeRef++;
}
nInternalFeatureEdge++;
}
else if (vit->type() == Vb::vtInternalFeaturePoint)
{
if (vit->referred())
{
nReferred++;
nInternalFeaturePointRef++;
}
nInternalFeaturePoint++;
}
else if (vit->type() == Vb::vtExternalSurface)
{
if (vit->referred())
{
nReferred++;
nExternalSurfaceRef++;
}
nExternalSurface++;
}
else if (vit->type() == Vb::vtExternalFeatureEdge)
{
if (vit->referred())
{
nReferred++;
nExternalFeatureEdgeRef++;
}
nExternalFeatureEdge++;
}
else if (vit->type() == Vb::vtExternalFeaturePoint)
{
if (vit->referred())
{
nReferred++;
nExternalFeaturePointRef++;
}
nExternalFeaturePoint++;
}
else if (vit->type() == Vb::vtFar)
{
nFar++;
}
}
label nTotalVertices =
nUnassigned
+ nInternal
+ nInternalNearBoundary
+ nInternalSurface
+ nInternalFeatureEdge
+ nInternalFeaturePoint
+ nExternalSurface
+ nExternalFeatureEdge
+ nExternalFeaturePoint
+ nFar;
if (nTotalVertices != label(Triangulation::number_of_vertices()))
{
WarningIn("Foam::conformalVoronoiMesh::printVertexInfo()")
<< nTotalVertices << " does not equal "
<< Triangulation::number_of_vertices()
<< endl;
}
PrintTable<word, label> vertexTable("Vertex Type Information");
vertexTable.add("Total", nTotalVertices);
vertexTable.add("Unassigned", nUnassigned);
vertexTable.add("nInternal", nInternal);
vertexTable.add("nInternalNearBoundary", nInternalNearBoundary);
vertexTable.add("nInternalSurface", nInternalSurface);
vertexTable.add("nInternalFeatureEdge", nInternalFeatureEdge);
vertexTable.add("nInternalFeaturePoint", nInternalFeaturePoint);
vertexTable.add("nExternalSurface", nExternalSurface);
vertexTable.add("nExternalFeatureEdge", nExternalFeatureEdge);
vertexTable.add("nExternalFeaturePoint", nExternalFeaturePoint);
vertexTable.add("nFar", nFar);
vertexTable.add("nReferred", nReferred);
os << endl;
vertexTable.print(os);
}
template<class Triangulation>
Foam::autoPtr<Foam::fvMesh>
Foam::DelaunayMesh<Triangulation>::createMesh
......@@ -185,7 +352,7 @@ Foam::DelaunayMesh<Triangulation>::createMesh
List<DynamicList<face> > patchFaces(1, DynamicList<face>());
List<DynamicList<label> > patchOwners(1, DynamicList<label>());
vertexMap.setSize(Triangulation::number_of_vertices());
vertexMap.setSize(vertexCount());
cellMap.setSize(Triangulation::number_of_finite_cells());
// Calculate pts and a map of point index to location in pts.
......@@ -243,6 +410,16 @@ Foam::DelaunayMesh<Triangulation>::createMesh
const int oppositeVertex = fit->second;
const Cell_handle c2(c1->neighbor(oppositeVertex));
// Do not output if face has neither opposite vertex as an internal
// if
// (
// !c1->vertex(oppositeVertex)->internalPoint()
// || !Triangulation::mirror_vertex(c1, oppositeVertex)->internalPoint()
// )
// {
// continue;
// }
label c1I = Cb::ctFar;
bool c1Real = false;
if (!c1->hasFarPoint() && !Triangulation::is_infinite(c1))
......@@ -331,6 +508,8 @@ Foam::DelaunayMesh<Triangulation>::createMesh
sortFaces(faces, owner, neighbour);
Info<< "Creating patches" << endl;
addPatches
(
faceI,
......@@ -342,6 +521,8 @@ Foam::DelaunayMesh<Triangulation>::createMesh
patchOwners
);
Info<< "Creating mesh" << endl;
autoPtr<fvMesh> meshPtr
(
new fvMesh
......@@ -361,6 +542,8 @@ Foam::DelaunayMesh<Triangulation>::createMesh
)
);
Info<< "Adding patches" << endl;
List<polyPatch*> patches(patchStarts.size());
label nValidPatches = 0;
......@@ -384,6 +567,8 @@ Foam::DelaunayMesh<Triangulation>::createMesh
meshPtr().addFvPatches(patches);
Info<< "Mesh created" << endl;
return meshPtr;
}
......
......@@ -1311,7 +1311,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
cellSizeMeshOverlapsBackground();
printVertexInfo();
printVertexInfo(Info);
if (cvMeshControls().objOutput())
{
......@@ -1878,7 +1878,7 @@ void Foam::conformalVoronoiMesh::move()
timeCheck("After conformToSurface");
printVertexInfo();
printVertexInfo(Info);
// Write the intermediate mesh, do not filter the dual faces.
if (runTime_.outputTime())
......
......@@ -503,13 +503,15 @@ private:
void insertInitialPoints();
//- Calculate the worst load balance
scalar calculateLoadUnbalance() const;
template <class Triangulation>
scalar calculateLoadUnbalance(const Triangulation& mesh) const;
//- In parallel redistribute the backgroundMeshDecomposition and
// vertices to balance the number of vertices on each processor.
// Returns true if the background mesh changes as this removes all
// referred vertices, so the parallel interface may need rebuilt.
bool distributeBackground();
template<class Triangulation>
bool distributeBackground(const Triangulation& mesh);
// Test for full containment
void cellSizeMeshOverlapsBackground() const;
......@@ -1022,8 +1024,6 @@ public:
// surface as required
void move();
void printVertexInfo() const;
//- Check if the point is in the domain handled by this processor
bool positionOnThisProc(const Foam::point& pt) const;
......@@ -1080,6 +1080,13 @@ public:
//- Write the elapsedCpuTime and memory usage, with an optional
// description
static void timeCheck
(
const Time& runTime,
const string& description = string::null,
const bool check = true
);
void timeCheck
(
const string& description = string::null
......@@ -1191,6 +1198,10 @@ public:
#include "conformalVoronoiMeshI.H"
#ifdef NoRepository
# include "conformalVoronoiMeshTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
......
......@@ -41,11 +41,22 @@ void Foam::conformalVoronoiMesh::timeCheck
const string& description
) const
{
if (cvMeshControls().timeChecks())
timeCheck(time(), description, cvMeshControls().timeChecks());
}
void Foam::conformalVoronoiMesh::timeCheck
(
const Time& runTime,
const string& description,
const bool check
)
{
if (check)
{
Info<< nl << "--- [ cpuTime "
<< runTime_.elapsedCpuTime() << " s, "
<< "delta " << runTime_.cpuTimeIncrement()<< " s";
<< runTime.elapsedCpuTime() << " s, "
<< "delta " << runTime.cpuTimeIncrement()<< " s";
if (description != word::null)
{
......@@ -62,185 +73,24 @@ void Foam::conformalVoronoiMesh::timeCheck
if (m.valid())
{
PrintTable<word, label> memoryTable("Memory Usage (kB)");
PrintTable<word, label> memoryTable
(
"Memory Usage (kB): "
+ description
);
memoryTable.add("mSize", m.size());
memoryTable.add("mPeak", m.peak());
memoryTable.add("mRss", m.rss());
Info<< incrIndent;
memoryTable.print(Info);
memoryTable.print(Info, true, true);
Info<< decrIndent;
}
}
}
void Foam::conformalVoronoiMesh::printVertexInfo() const
{
label nInternal = 0;
label nInternalRef = 0;
label nUnassigned = 0;
label nUnassignedRef = 0;
label nInternalNearBoundary = 0;
label nInternalNearBoundaryRef = 0;
label nInternalSurface = 0;
label nInternalSurfaceRef = 0;
label nInternalFeatureEdge = 0;
label nInternalFeatureEdgeRef = 0;
label nInternalFeaturePoint = 0;
label nInternalFeaturePointRef = 0;
label nExternalSurface = 0;
label nExternalSurfaceRef = 0;
label nExternalFeatureEdge = 0;
label nExternalFeatureEdgeRef = 0;
label nExternalFeaturePoint = 0;
label nExternalFeaturePointRef = 0;
label nFar = 0;
label nReferred = 0;
for
(
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();
++vit
)
{
if (vit->type() == Vb::vtInternal)
{
if (vit->referred())
{
nReferred++;
nInternalRef++;
}
nInternal++;
}
else if (vit->type() == Vb::vtUnassigned)
{
if (vit->referred())
{
nReferred++;
nUnassignedRef++;
}
nUnassigned++;
}
else if (vit->type() == Vb::vtInternalNearBoundary)
{
if (vit->referred())
{
nReferred++;
nInternalNearBoundaryRef++;
}
nInternalNearBoundary++;
}
else if (vit->type() == Vb::vtInternalSurface)
{
if (vit->referred())
{
nReferred++;
nInternalSurfaceRef++;
}
nInternalSurface++;
}
else if (vit->type() == Vb::vtInternalFeatureEdge)
{
if (vit->referred())
{
nReferred++;
nInternalFeatureEdgeRef++;
}
nInternalFeatureEdge++;
}
else if (vit->type() == Vb::vtInternalFeaturePoint)
{
if (vit->referred())
{
nReferred++;
nInternalFeaturePointRef++;
}
nInternalFeaturePoint++;
}
else if (vit->type() == Vb::vtExternalSurface)
{
if (vit->referred())
{
nReferred++;
nExternalSurfaceRef++;
}
nExternalSurface++;
}
else if (vit->type() == Vb::vtExternalFeatureEdge)
{
if (vit->referred())
{
nReferred++;
nExternalFeatureEdgeRef++;
}
nExternalFeatureEdge++;
}
else if (vit->type() == Vb::vtExternalFeaturePoint)
{
if (vit->referred())
{
nReferred++;
nExternalFeaturePointRef++;
}
nExternalFeaturePoint++;
}
else if (vit->type() == Vb::vtFar)
{
nFar++;
}
}
label nTotalVertices
= nUnassigned
+ nInternal
+ nInternalNearBoundary
+ nInternalSurface
+ nInternalFeatureEdge
+ nInternalFeaturePoint
+ nExternalSurface
+ nExternalFeatureEdge
+ nExternalFeaturePoint
+ nFar;
if (nTotalVertices != label(number_of_vertices()))
{
WarningIn("Foam::conformalVoronoiMesh::printVertexInfo()")
<< nTotalVertices << " does not equal " << number_of_vertices()
<< endl;
}
PrintTable<word, label> vertexTable("Vertex Type Information");
vertexTable.add("Total", nTotalVertices);
vertexTable.add("Unassigned", nUnassigned);
vertexTable.add("nInternal", nInternal);
vertexTable.add("nInternalNearBoundary", nInternalNearBoundary);
vertexTable.add("nInternalSurface", nInternalSurface);
vertexTable.add("nInternalFeatureEdge", nInternalFeatureEdge);
vertexTable.add("nInternalFeaturePoint", nInternalFeaturePoint);
vertexTable.add("nExternalSurface", nExternalSurface);
vertexTable.add("nExternalFeatureEdge", nExternalFeatureEdge);
vertexTable.add("nExternalFeaturePoint", nExternalFeaturePoint);
vertexTable.add("nFar", nFar);
vertexTable.add("nReferred", nReferred);
Info<< endl;
vertexTable.print(Info);
}
void Foam::conformalVoronoiMesh::drawDelaunayCell
(
Ostream& os,
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -189,10 +189,7 @@ void Foam::autoDensity::recurseAndFill
word newName = recursionName + "_" + Foam::name(i);
if (debug)
{
cvMesh_.timeCheck(newName);
}
conformalVoronoiMesh::timeCheck(cvMesh_.time(), newName, debug);
if (combinedOverlaps(subBB))
{
......
Supports Markdown
0% or .