diff --git a/applications/utilities/mesh/generation/CV2DMesher/CV2DIO.C b/applications/utilities/mesh/generation/CV2DMesher/CV2DIO.C index 70fb8aa083..4ded03e842 100644 --- a/applications/utilities/mesh/generation/CV2DMesher/CV2DIO.C +++ b/applications/utilities/mesh/generation/CV2DMesher/CV2DIO.C @@ -80,7 +80,7 @@ void Foam::CV2D::writeTriangles(const fileName& fName, bool internalOnly) const { if ( - !internalOnly + !internalOnly || ( fit->vertex(0)->internalOrBoundaryPoint() || fit->vertex(1)->internalOrBoundaryPoint() diff --git a/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index e3445e68e9..2b3dd78c30 100644 --- a/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -1782,7 +1782,7 @@ void Foam::conformalVoronoiMesh::calcDualMesh // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - label dualVerti = 0; + label dualVertI = 0; // Scanning by number of short (dual) edges (nSE) attached to the // circumcentre of each Delaunay tet. A Delaunay tet may only have four @@ -1824,11 +1824,11 @@ void Foam::conformalVoronoiMesh::calcDualMesh if ( cit->vertex(vertex_triple_index(f, 0))-> - internalOrBoundaryPoint() - || cit->vertex(vertex_triple_index(f, 1))-> - internalOrBoundaryPoint() - || cit->vertex(vertex_triple_index(f, 2))-> - internalOrBoundaryPoint() + internalOrBoundaryPoint() + || cit->vertex(vertex_triple_index(f, 1))-> + internalOrBoundaryPoint() + || cit->vertex(vertex_triple_index(f, 2))-> + internalOrBoundaryPoint() ) { point neighDualVertex; @@ -1874,9 +1874,9 @@ void Foam::conformalVoronoiMesh::calcDualMesh || cit->vertex(3)->internalOrBoundaryPoint() ) { - cit->cellIndex() = dualVerti; - points[dualVerti] = dualVertex; - dualVerti++; + cit->cellIndex() = dualVertI; + points[dualVertI] = dualVertex; + dualVertI++; } } else if @@ -1958,22 +1958,22 @@ void Foam::conformalVoronoiMesh::calcDualMesh { if (edgeIsShort[f] && !neighbourAlreadyIndexed[f]) { - cit->neighbor(f)->cellIndex() = dualVerti; + cit->neighbor(f)->cellIndex() = dualVertI; } } - cit->cellIndex() = dualVerti; + cit->cellIndex() = dualVertI; - points[dualVerti] = dualVertex; + points[dualVertI] = dualVertex; - dualVerti++; + dualVertI++; } } } } } - points.setSize(dualVerti); + points.setSize(dualVertI); // ~~~~~~~~~~~~~~~~~~~~~~~~~ dual cell indexing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // assigns an index to the Delaunay vertices which will be the dual cell @@ -2028,7 +2028,7 @@ void Foam::conformalVoronoiMesh::calcDualMesh neighbour.setSize(number_of_edges()); - label dualFacei = 0; + label dualFaceI = 0; for ( @@ -2174,13 +2174,13 @@ void Foam::conformalVoronoiMesh::calcDualMesh reverse(newDualFace); } - faces[dualFacei] = newDualFace; + faces[dualFaceI] = newDualFace; - owner[dualFacei] = dcOwn; + owner[dualFaceI] = dcOwn; - neighbour[dualFacei] = dcNei; + neighbour[dualFaceI] = dcNei; - dualFacei++; + dualFaceI++; } } // else @@ -2191,7 +2191,7 @@ void Foam::conformalVoronoiMesh::calcDualMesh } } - label nInternalFaces = dualFacei; + label nInternalFaces = dualFaceI; faces.setSize(nInternalFaces); @@ -2345,11 +2345,355 @@ void Foam::conformalVoronoiMesh::calcDualMesh { forAll(patchFaces[p], f) { - faces[dualFacei] = patchFaces[p][f]; + faces[dualFaceI] = patchFaces[p][f]; - owner[dualFacei] = patchOwners[p][f]; + owner[dualFaceI] = patchOwners[p][f]; - dualFacei++; + dualFaceI++; + } + } +} + + +void Foam::conformalVoronoiMesh::calcTetMesh +( + pointField& points, + faceList& faces, + labelList& owner, + labelList& neighbour, + wordList& patchNames, + labelList& patchSizes, + labelList& patchStarts +) +{ + labelList vertexMap(number_of_vertices()); + + label vertI = 0; + + points.setSize(number_of_vertices()); + + for + ( + Triangulation::Finite_vertices_iterator vit = finite_vertices_begin(); + vit != finite_vertices_end(); + ++vit + ) + { + if (vit->internalPoint() || vit->pairPoint()) + { + vertexMap[vit->index()] = vertI; + points[vertI] = topoint(vit->point()); + vertI++; + } + } + + points.setSize(vertI); + + label cellI = 0; + + for + ( + Triangulation::Finite_cells_iterator cit = finite_cells_begin(); + cit != finite_cells_end(); + ++cit + ) + { + if + ( + cit->vertex(0)->internalOrBoundaryPoint() + || cit->vertex(1)->internalOrBoundaryPoint() + || cit->vertex(2)->internalOrBoundaryPoint() + || cit->vertex(3)->internalOrBoundaryPoint() + ) + { + cit->cellIndex() = cellI++; + } + else + { + cit->cellIndex() = -1; + } + } + + patchNames = geometryToConformTo_.patchNames(); + + patchNames.setSize(patchNames.size() + 1); + + patchNames[patchNames.size() - 1] = "cvMesh_defaultPatch"; + + label nPatches = patchNames.size(); + + patchSizes.setSize(nPatches); + + patchStarts.setSize(nPatches); + + List > patchFaces(nPatches, DynamicList(0)); + + List > patchOwners(nPatches, DynamicList