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()); 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 for
( (
@ -393,6 +393,30 @@ void Foam::conformalVoronoiMesh::insertPoints
// Info<< returnReduce(pts.size(), sumOp<label>()) // Info<< returnReduce(pts.size(), sumOp<label>())
// << " points in total" << endl; // << " 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 rangeInsertWithInfo
( (
@ -402,6 +426,8 @@ void Foam::conformalVoronoiMesh::insertPoints
indices, indices,
types types
); );
Pout<< pts.size() << " " << indices.size() << " " << types.size() << endl;
} }

View File

@ -970,8 +970,8 @@ private:
labelList& owner, labelList& owner,
labelList& patchSizes, labelList& patchSizes,
labelList& patchStarts, labelList& patchStarts,
List<DynamicList<face> >& patchFaces, const List<DynamicList<face> >& patchFaces,
List<DynamicList<label> >& patchOwners const List<DynamicList<label> >& patchOwners
) const; ) const;
//- Remove points that are no longer used by any faces //- Remove points that are no longer used by any faces
@ -1165,6 +1165,11 @@ public:
// protrude out of the surface beyond a tolerance. // protrude out of the surface beyond a tolerance.
void findRemainingProtrusionSet(const fvMesh& mesh) const; void findRemainingProtrusionSet(const fvMesh& mesh) const;
void writeProcessorInterface
(
const fileName& fName,
const faceList& faces
) const;
//- Function inserting points into a triangulation and setting the //- Function inserting points into a triangulation and setting the
// index and type data of the point in the correct order. This is // 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); c = T.locate(*(p->first), lt, li, lj, hint);
const size_t checkInsertion = T.number_of_vertices();
typename Triangulation::Vertex_handle v typename Triangulation::Vertex_handle v
= T.insert(*(p->first), lt, c, li, lj); = T.insert(*(p->first), lt, c, li, lj);
label oldIndex = p->second; if (checkInsertion != T.number_of_vertices() - 1)
label type = types[oldIndex];
if (type > Vb::vtFar)
{ {
// This is a member of a point pair, don't use the type Pout<< "Failed to insert point "
// directly (note that this routine never gets called << topoint(*(p->first)) << endl;
// for referredPoints so type will never be -procI)
type += T.number_of_vertices() - 1;
} }
else
{
label oldIndex = p->second;
v->index() = indices[oldIndex] + T.number_of_vertices() - 1; label type = types[oldIndex];
v->type() = type;
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) // REMOVED BECAUSE THIS CODE STOPS ALL FACES NEAR ANY BOUNDARY (PROC OR REAL)
// FROM BEING FILTERED. // FROM BEING FILTERED.
// //
// for for
// ( (
// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
// vit != finite_vertices_end(); vit != finite_vertices_end();
// vit++ vit++
// ) )
// { {
// std::list<Cell_handle> cells; std::list<Cell_handle> cells;
// incident_cells(vit, std::back_inserter(cells)); incident_cells(vit, std::back_inserter(cells));
//
// bool hasProcPt = false; bool hasProcPt = false;
//
// for for
// ( (
// std::list<Cell_handle>::iterator cit = cells.begin(); std::list<Cell_handle>::iterator cit = cells.begin();
// cit != cells.end(); cit != cells.end();
// ++cit ++cit
// ) )
// { {
// // Allow filtering if any vertices are far points. Otherwise faces // Allow filtering if any vertices are far points. Otherwise faces
// // with boundary points attached to a cell with a far point will // with boundary points attached to a cell with a far point will
// // not be filtered. // not be filtered.
// if // if
// ( // (
// (!(*cit)->vertex(0)->real() && !(*cit)->vertex(0)->farPoint()) // (!(*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(2)->real() && !(*cit)->vertex(2)->farPoint())
// || (!(*cit)->vertex(3)->real() && !(*cit)->vertex(3)->farPoint()) // || (!(*cit)->vertex(3)->real() && !(*cit)->vertex(3)->farPoint())
// ) // )
// { if
// hasProcPt = true; (
// (!(*cit)->vertex(0)->real())
// break; || (!(*cit)->vertex(1)->real())
// } || (!(*cit)->vertex(2)->real())
// } || (!(*cit)->vertex(3)->real())
// )
// if (hasProcPt) {
// { hasProcPt = true;
// for
// ( break;
// std::list<Cell_handle>::iterator cit = cells.begin(); }
// cit != cells.end(); }
// ++cit
// ) if (hasProcPt)
// { {
// (*cit)->filterCount() = for
// cvMeshControls().filterCountSkipThreshold() + 1; (
// } std::list<Cell_handle>::iterator cit = cells.begin();
// } cit != cells.end();
// } ++cit
)
{
(*cit)->filterCount() =
cvMeshControls().filterCountSkipThreshold() + 1;
}
}
}
PackedBoolList boundaryPts(number_of_cells(), false); PackedBoolList boundaryPts(number_of_cells(), false);
@ -2157,9 +2164,9 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
// Did not find a surface patch between // Did not find a surface patch between
// between Dv pair, finding nearest patch // between Dv pair, finding nearest patch
// Pout<< "Did not find a surface patch between " // Pout<< "Did not find a surface patch between "
// << "for face, finding nearest patch to" // << "for face, finding nearest patch to"
// << 0.5*(ptA + ptB) << endl; // << 0.5*(ptA + ptB) << endl;
patchIndex = geometryToConformTo_.findPatch patchIndex = geometryToConformTo_.findPatch
( (
@ -2240,6 +2247,37 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
{ {
patchPointPairSlaves[patchI].transfer(patchPPSlaves[patchI]); 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& owner,
labelList& patchSizes, labelList& patchSizes,
labelList& patchStarts, labelList& patchStarts,
List<DynamicList<face> >& patchFaces, const List<DynamicList<face> >& patchFaces,
List<DynamicList<label> >& patchOwners const List<DynamicList<label> >& patchOwners
) const ) const
{ {
label nPatches = patchFaces.size(); 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 void Foam::conformalVoronoiMesh::writeInternalDelaunayVertices
( (
const fileName& instance const fileName& instance