ENH: indexedCell and tet output improvements.

This commit is contained in:
graham 2011-06-27 17:48:09 +01:00
parent 0565328638
commit b10c9482d1
3 changed files with 66 additions and 11 deletions

View File

@ -957,7 +957,8 @@ public:
void drawDelaunayCell
(
Ostream& os,
const Delaunay::Finite_cells_iterator& cit
const Delaunay::Finite_cells_iterator& cit,
label offset = 0
) const;
//- Write Delaunay points to .obj file

View File

@ -115,9 +115,19 @@ void Foam::conformalVoronoiMesh::timeCheck
void Foam::conformalVoronoiMesh::drawDelaunayCell
(
Ostream& os,
const Delaunay::Finite_cells_iterator& cit
const Delaunay::Finite_cells_iterator& cit,
label offset
) const
{
// Supply offset as tet number
offset *= 5;
os << "# cell index: " << label(cit->cellIndex()) << endl;
os << "# circumradius "
<< mag(topoint(dual(cit)) - topoint(cit->vertex(0)->point()))
<< endl;
for (int i = 0; i < 4; i++)
{
os << "# index type: "
@ -127,14 +137,16 @@ void Foam::conformalVoronoiMesh::drawDelaunayCell
meshTools::writeOBJ(os, topoint(cit->vertex(i)->point()));
}
os << "f 1 3 2" << nl
<< "f 2 3 4" << nl
<< "f 1 4 3" << nl
<< "f 1 2 4" << endl;
os << "f " << 1 + offset << " " << 3 + offset << " " << 2 + offset << nl
<< "f " << 2 + offset << " " << 3 + offset << " " << 4 + offset << nl
<< "f " << 1 + offset << " " << 4 + offset << " " << 3 + offset << nl
<< "f " << 1 + offset << " " << 2 + offset << " " << 4 + offset << endl;
os << "# cicumcentre " << endl;
meshTools::writeOBJ(os, topoint(dual(cit)));
os << "l 1 5" << endl;
os << "l " << 1 + offset << " " << 5 + offset << endl;
}

View File

@ -36,6 +36,7 @@ Description
#include <CGAL/Triangulation_3.h>
#include <CGAL/Triangulation_cell_base_with_circumcenter_3.h>
#include "indexedVertex.H"
#include "Pstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -157,8 +158,8 @@ public:
}
// Is the Delaunay cell real, i.e. any real vertex
inline int real() const
//- Is the Delaunay cell real, i.e. any real vertex
inline bool real() const
{
return
(
@ -170,9 +171,50 @@ public:
}
//- Does the Dual vertex form part of a processor patch
inline int parallelDualVertex() const
{
return
(
this->vertex(0)->referred()
|| this->vertex(1)->referred()
|| this->vertex(2)->referred()
|| this->vertex(3)->referred()
);
}
//- Does the Dual vertex form part of a processor patch
inline Foam::label dualVertexMasterProc() const
{
if (!parallelDualVertex)
{
return -1;
}
// The master processor is the lowest numbered of the four on this tet.
int masterProc = Foam::Pstream::nProcs() + 1;
for (int i = 0; i < 4; i++)
{
if (this->vertex(i)->referred())
{
masterProc = min(masterProc, this->vertex(i)->procIndex());
}
else
{
masterProc = min(masterProc, Foam::Pstream::myProcNo());
}
}
return masterProc;
}
// Is the Delaunay cell part of the final dual mesj, i.e. any vertex form
// part of the internal or boundary definition
inline int internalOrBoundaryDualVertex() const
inline bool internalOrBoundaryDualVertex() const
{
return
(
@ -186,7 +228,7 @@ public:
// Is the Delaunay cell real or referred (or mixed), i.e. all vertices form
// part of the real or referred internal or boundary definition
inline int anyInternalOrBoundaryDualVertex() const
inline bool anyInternalOrBoundaryDualVertex() const
{
return
(