diff --git a/applications/utilities/mesh/generation/CV3DMesher/CV3D.C b/applications/utilities/mesh/generation/CV3DMesher/CV3D.C index d6968d57bd..aa0c7e3e09 100644 --- a/applications/utilities/mesh/generation/CV3DMesher/CV3D.C +++ b/applications/utilities/mesh/generation/CV3DMesher/CV3D.C @@ -58,7 +58,7 @@ void Foam::CV3D::reinsertPoints(const pointField& points) { const point& p = points[i]; - insert(toPoint(p))->index() = nVert++; + insert(toPoint(p))->index() = nVert++; } Info<< nVert << " vertices reinserted" << endl; @@ -158,7 +158,6 @@ void Foam::CV3D::insertPoints assert(is_valid()); writeTriangles("initial_triangles.obj", true); -// writeFaces("initial_faces.obj", true); } } @@ -183,11 +182,13 @@ void Foam::CV3D::insertPoints(const fileName& pointFileName) void Foam::CV3D::insertGrid() { - Info<< "insertInitialGrid: "; + Info<< nl << "Inserting initial grid." << endl; startOfInternalPoints_ = number_of_vertices(); label nVert = startOfInternalPoints_; + Info<< nl << nVert << " existing vertices." << endl; + scalar x0 = qSurf_.bb().min().x(); scalar xR = qSurf_.bb().max().x() - x0; int ni = int(xR/controls_.minCellSize) + 1; @@ -207,6 +208,38 @@ void Foam::CV3D::insertGrid() Random rndGen(1321); scalar pert = controls_.randomPerturbation*cmptMin(delta); + // for (int i=0; iindex() = nVert++; + // } + // } + // } + // } + + // Info<< nVert - startOfInternalPoints_ << " vertices inserted" << endl; + + std::vector initialPoints; + for (int i=0; iindex() = nVert++; + initialPoints.push_back(Point(p.x(), p.y(), p.z())); } } } } - Info<< nVert << " vertices inserted" << nl << endl; + Info<< nl << initialPoints.size() << " vertices to insert." << endl; - // std::vector initialPoints; + // using the range insert (it is faster than inserting points one by one) + insert(initialPoints.begin(), initialPoints.end()); - // for (int i=0; iuninitialised()) + { + vit->index() = nVert++; + } + } if (controls_.writeInitialTriangulation) { diff --git a/applications/utilities/mesh/generation/CV3DMesher/CV3DIO.C b/applications/utilities/mesh/generation/CV3DMesher/CV3DIO.C index 74ed9e7936..7199b4a424 100644 --- a/applications/utilities/mesh/generation/CV3DMesher/CV3DIO.C +++ b/applications/utilities/mesh/generation/CV3DMesher/CV3DIO.C @@ -136,8 +136,8 @@ void Foam::CV3D::writeTriangles(const fileName& fName, bool internalOnly) const if(writeFacet) { - str << "f " - << vertexMap[c->vertex(facetIndices[0])->index()] + 1 + str << "f " + << vertexMap[c->vertex(facetIndices[0])->index()] + 1 << ' ' << vertexMap[c->vertex(facetIndices[1])->index()] + 1 << ' ' << vertexMap[c->vertex(facetIndices[2])->index()] + 1 << nl; diff --git a/applications/utilities/mesh/generation/CV3DMesher/Make/files b/applications/utilities/mesh/generation/CV3DMesher/Make/files index 653d445ede..fc4326559c 100644 --- a/applications/utilities/mesh/generation/CV3DMesher/Make/files +++ b/applications/utilities/mesh/generation/CV3DMesher/Make/files @@ -1,8 +1,5 @@ - #include CGAL_FILES -plane.C - querySurface.C CV3D.C controls.C diff --git a/applications/utilities/mesh/generation/CV3DMesher/calcDualMesh_backup_14_10_08.C b/applications/utilities/mesh/generation/CV3DMesher/calcDualMesh_backup_14_10_08.C deleted file mode 100644 index 035e6de674..0000000000 --- a/applications/utilities/mesh/generation/CV3DMesher/calcDualMesh_backup_14_10_08.C +++ /dev/null @@ -1,416 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*----------------------------------------------------------------------------*/ - -#include "CV3D.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::CV3D::calcDualMesh -( - pointField& points, - faceList& faces, - labelList& owner, - labelList& neighbour, - wordList& patchNames, - labelList& patchSizes, - labelList& patchStarts -) -{ - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ dual points ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - points.setSize(number_of_cells()); - - label dualVerti = 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() = dualVerti; - points[dualVerti] = topoint(dual(cit)); - dualVerti++; - } - else - { - cit->cellIndex() = -1; - } - } - - points.setSize(dualVerti); - - // ~~~~~~~~~~~~~~~~~~~~~~~~~ dual cell indexing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // resets type and index information for Delaunay vertices - // assigns an index to the vertices which will be the dual cell index used - // for owner neighbour assignment - - label dualCelli = 0; - - for - ( - Triangulation::Finite_vertices_iterator vit = finite_vertices_begin(); - vit != finite_vertices_end(); - ++vit - ) - { - if (vit->internalOrBoundaryPoint()) - { - vit->type() = Vb::INTERNAL_POINT; - vit->index() = dualCelli; - dualCelli++; - } - else - { - vit->type() = Vb::FAR_POINT; - vit->index() = -1; - } - } - - // ~~~~~~~~~~~~ dual face and owner neighbour construction ~~~~~~~~~~~~~~~~~ - - label nPatches = 1; - - patchNames.setSize(nPatches); - - patchNames[0] = "CV3D_default_patch"; - - patchSizes.setSize(nPatches); - - patchStarts.setSize(nPatches); - - List > patchFaces(nPatches, DynamicList(0)); - - List > patchOwners(nPatches, DynamicList