Merge branch 'cvMesh'

This commit is contained in:
laurence
2012-02-08 15:18:36 +00:00
4 changed files with 175 additions and 63 deletions

View File

@ -240,9 +240,9 @@ void Foam::conformalVoronoiMesh::insertPoints
{
label preDistributionSize(points.size());
DynamicList<Foam::point> transferPoints;
DynamicList<Foam::point> transferPoints(points.size()/2);
List<Point> pointsOnProcessor;
DynamicList<Point> pointsOnProcessor(points.size()/2);
for
(
@ -393,6 +393,30 @@ void Foam::conformalVoronoiMesh::insertPoints
// Info<< returnReduce(pts.size(), sumOp<label>())
// << " points in total" << endl;
}
//
// forAll(pts, pI)
// {
// // creation of points and indices is done assuming that it will be
// // relative to the instantaneous number_of_vertices() at insertion.
//
// label type = types[pI];
//
// if (type > Vb::vtFar)
// {
// // This is a member of a point pair, don't use the type directly
// // (note that this routine never gets called for referredPoints
// // so type will never be -procI)
// type += number_of_vertices();
// }
//
// insertPoint
// (
// pts[pI],
// indices[pI] + number_of_vertices(),
// type
// );
// }
rangeInsertWithInfo
(
@ -402,6 +426,8 @@ void Foam::conformalVoronoiMesh::insertPoints
indices,
types
);
Pout<< pts.size() << " " << indices.size() << " " << types.size() << endl;
}

View File

@ -970,8 +970,8 @@ private:
labelList& owner,
labelList& patchSizes,
labelList& patchStarts,
List<DynamicList<face> >& patchFaces,
List<DynamicList<label> >& patchOwners
const List<DynamicList<face> >& patchFaces,
const List<DynamicList<label> >& patchOwners
) const;
//- Remove points that are no longer used by any faces
@ -1165,6 +1165,11 @@ public:
// protrude out of the surface beyond a tolerance.
void findRemainingProtrusionSet(const fvMesh& mesh) const;
void writeProcessorInterface
(
const fileName& fName,
const faceList& faces
) const;
//- Function inserting points into a triangulation and setting the
// index and type data of the point in the correct order. This is
@ -1226,23 +1231,35 @@ public:
c = T.locate(*(p->first), lt, li, lj, hint);
const size_t checkInsertion = T.number_of_vertices();
typename Triangulation::Vertex_handle v
= T.insert(*(p->first), lt, c, li, lj);
label oldIndex = p->second;
label type = types[oldIndex];
if (type > Vb::vtFar)
if (checkInsertion != T.number_of_vertices() - 1)
{
// This is a member of a point pair, don't use the type
// directly (note that this routine never gets called
// for referredPoints so type will never be -procI)
type += T.number_of_vertices() - 1;
Pout<< "Failed to insert point "
<< topoint(*(p->first)) << endl;
}
else
{
label oldIndex = p->second;
v->index() = indices[oldIndex] + T.number_of_vertices() - 1;
v->type() = type;
label type = types[oldIndex];
if (type > Vb::vtFar)
{
// This is a member of a point pair, don't use the
// type directly (note that this routine never gets
// called for referredPoints so type will never be
// -procI
type += T.number_of_vertices() - 1;
}
v->index() = indices[oldIndex]
+ T.number_of_vertices() - 1;
v->type() = type;
}
}
}
};

View File

@ -82,28 +82,28 @@ void Foam::conformalVoronoiMesh::calcDualMesh
// REMOVED BECAUSE THIS CODE STOPS ALL FACES NEAR ANY BOUNDARY (PROC OR REAL)
// FROM BEING FILTERED.
//
// for
// (
// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
// vit != finite_vertices_end();
// vit++
// )
// {
// std::list<Cell_handle> cells;
// incident_cells(vit, std::back_inserter(cells));
//
// bool hasProcPt = false;
//
// for
// (
// std::list<Cell_handle>::iterator cit = cells.begin();
// cit != cells.end();
// ++cit
// )
// {
// // Allow filtering if any vertices are far points. Otherwise faces
// // with boundary points attached to a cell with a far point will
// // not be filtered.
for
(
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();
vit++
)
{
std::list<Cell_handle> cells;
incident_cells(vit, std::back_inserter(cells));
bool hasProcPt = false;
for
(
std::list<Cell_handle>::iterator cit = cells.begin();
cit != cells.end();
++cit
)
{
// Allow filtering if any vertices are far points. Otherwise faces
// with boundary points attached to a cell with a far point will
// not be filtered.
// if
// (
// (!(*cit)->vertex(0)->real() && !(*cit)->vertex(0)->farPoint())
@ -111,27 +111,34 @@ void Foam::conformalVoronoiMesh::calcDualMesh
// || (!(*cit)->vertex(2)->real() && !(*cit)->vertex(2)->farPoint())
// || (!(*cit)->vertex(3)->real() && !(*cit)->vertex(3)->farPoint())
// )
// {
// hasProcPt = true;
//
// break;
// }
// }
//
// if (hasProcPt)
// {
// for
// (
// std::list<Cell_handle>::iterator cit = cells.begin();
// cit != cells.end();
// ++cit
// )
// {
// (*cit)->filterCount() =
// cvMeshControls().filterCountSkipThreshold() + 1;
// }
// }
// }
if
(
(!(*cit)->vertex(0)->real())
|| (!(*cit)->vertex(1)->real())
|| (!(*cit)->vertex(2)->real())
|| (!(*cit)->vertex(3)->real())
)
{
hasProcPt = true;
break;
}
}
if (hasProcPt)
{
for
(
std::list<Cell_handle>::iterator cit = cells.begin();
cit != cells.end();
++cit
)
{
(*cit)->filterCount() =
cvMeshControls().filterCountSkipThreshold() + 1;
}
}
}
PackedBoolList boundaryPts(number_of_cells(), false);
@ -2157,9 +2164,9 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
// Did not find a surface patch between
// between Dv pair, finding nearest patch
// Pout<< "Did not find a surface patch between "
// << "for face, finding nearest patch to"
// << 0.5*(ptA + ptB) << endl;
// Pout<< "Did not find a surface patch between "
// << "for face, finding nearest patch to"
// << 0.5*(ptA + ptB) << endl;
patchIndex = geometryToConformTo_.findPatch
(
@ -2240,6 +2247,37 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
{
patchPointPairSlaves[patchI].transfer(patchPPSlaves[patchI]);
}
if (cvMeshControls().objOutput())
{
forAll(procNeighbours, nbI)
{
if (patchFaces[nbI].size() > 0)
{
const label neighbour = procNeighbours[nbI];
if (neighbour != -1)
{
word fName =
"processor_"
+ name(Pstream::myProcNo())
+ "_to_"
+ name(neighbour)
+ "_interface.obj";
writeProcessorInterface
(
fName,
patchFaces[nbI]
);
}
}
}
Pout<< "Patch Names: " << patchNames << endl;
Pout<< "Patch Sizes: " << patchSizes << endl;
Pout<< "Proc Neighbours: " << procNeighbours << endl;
}
}
@ -2527,8 +2565,8 @@ void Foam::conformalVoronoiMesh::addPatches
labelList& owner,
labelList& patchSizes,
labelList& patchStarts,
List<DynamicList<face> >& patchFaces,
List<DynamicList<label> >& patchOwners
const List<DynamicList<face> >& patchFaces,
const List<DynamicList<label> >& patchOwners
) const
{
label nPatches = patchFaces.size();

View File

@ -220,6 +220,37 @@ void Foam::conformalVoronoiMesh::writePoints
}
void Foam::conformalVoronoiMesh::writeProcessorInterface
(
const fileName& fName,
const faceList& faces
) const
{
OFstream str(runTime_.path()/fName);
Pout<< "Writing processor interface" << endl;
pointField points(number_of_cells(), point::max);
for
(
Delaunay::Finite_cells_iterator cit = finite_cells_begin();
cit != finite_cells_end();
++cit
)
{
if (!cit->farCell())
{
points[cit->cellIndex()] = topoint(dual(cit));
}
}
meshTools::writeOBJ(str, faces, points);
Pout<< "Written processor interface" << endl;
}
void Foam::conformalVoronoiMesh::writeInternalDelaunayVertices
(
const fileName& instance