diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/Make/options b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/Make/options index 61661dcca2..7c0b735815 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/Make/options +++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/Make/options @@ -11,6 +11,7 @@ EXE_INC = \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/mesh/snappyHexMesh/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ + -I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ @@ -23,6 +24,7 @@ EXE_LIBS = \ -lconformalVoronoiMesh \ -ldecompositionMethods /* -L$(FOAM_LIBBIN)/dummy -lscotchDecomp */ \ -ltriSurface \ + -lsurfMesh \ -lmeshTools \ -lfileFormats \ -lsampling \ diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C index a360396873..f4ec7e269d 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C @@ -602,20 +602,20 @@ int main(int argc, char *argv[]) { // Apply a distanceSurface to it. - const fvMesh& fvm = backgroundMesh.mesh(); + const fvMesh& mesh = backgroundMesh.mesh(); volScalarField cellDistance ( IOobject ( "cellDistance", - fvm.time().timeName(), - fvm.time(), + mesh.time().timeName(), + mesh.time(), IOobject::NO_READ, IOobject::NO_WRITE, false ), - fvm, + mesh, dimensionedScalar("zero", dimLength, 0) ); @@ -639,14 +639,14 @@ int main(int argc, char *argv[]) cellDistance.primitiveFieldRef() = signedDistance ( distSqr, - fvm.C(), + mesh.C(), geometry, surfaces ); // Patch fields - forAll(fvm.C().boundaryField(), patchi) + forAll(mesh.C().boundaryField(), patchi) { - const pointField& cc = fvm.C().boundaryField()[patchi]; + const pointField& cc = mesh.C().boundaryField()[patchi]; fvPatchScalarField& fld = cellDistance.boundaryFieldRef()[patchi]; scalarField patchDistSqr @@ -656,7 +656,7 @@ int main(int argc, char *argv[]) fld = signedDistance(patchDistSqr, cc, geometry, surfaces); } - // On processor patches the fvm.C() will already be the cell centre + // On processor patches the mesh.C() will already be the cell centre // on the opposite side so no need to swap cellDistance. if (writeMesh) @@ -672,23 +672,23 @@ int main(int argc, char *argv[]) IOobject ( "pointDistance", - fvm.time().timeName(), - fvm.time(), + mesh.time().timeName(), + mesh.time(), IOobject::NO_READ, IOobject::NO_WRITE, false ), - pointMesh::New(fvm), + pointMesh::New(mesh), dimensionedScalar("zero", dimLength, 0) ); { - scalarField pointDistSqr(fvm.nPoints(), -sqr(great)); - for (label facei = 0; facei < fvm.nInternalFaces(); facei++) + scalarField pointDistSqr(mesh.nPoints(), -sqr(great)); + for (label facei = 0; facei < mesh.nInternalFaces(); facei++) { - label own = fvm.faceOwner()[facei]; + label own = mesh.faceOwner()[facei]; label ownDistSqr = distSqr[own]; - const face& f = fvm.faces()[facei]; + const face& f = mesh.faces()[facei]; forAll(f, fp) { pointDistSqr[f[fp]] = max(pointDistSqr[f[fp]], ownDistSqr); @@ -696,7 +696,7 @@ int main(int argc, char *argv[]) } syncTools::syncPointList ( - fvm, + mesh, pointDistSqr, maxEqOp(), -sqr(great) // null value @@ -705,7 +705,7 @@ int main(int argc, char *argv[]) pointDistance.primitiveFieldRef() = signedDistance ( pointDistSqr, - fvm.points(), + mesh.points(), geometry, surfaces ); @@ -718,16 +718,16 @@ int main(int argc, char *argv[]) isoSurface iso ( + mesh, cellDistance, pointDistance, - 0, // distance, - false // regularise + 0 ); isoFaces.setSize(iso.size()); forAll(isoFaces, i) { - isoFaces[i] = iso[i].triFaceFace(); + isoFaces[i] = iso[i]; } isoPoints = iso.points(); } diff --git a/etc/controlDict b/etc/controlDict index f3e072fb71..b056a79b4b 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -566,7 +566,6 @@ DebugSwitches inversePointDistance 0; inverseVolume 0; isoSurface 0; - isoSurfaceCell 0; jplot 0; jumpCyclic 0; kEpsilon 0; diff --git a/src/sampling/sampledSurface/distanceSurface/distanceSurface.C b/src/sampling/sampledSurface/distanceSurface/distanceSurface.C index ec0bd17127..f74db82707 100644 --- a/src/sampling/sampledSurface/distanceSurface/distanceSurface.C +++ b/src/sampling/sampledSurface/distanceSurface/distanceSurface.C @@ -49,13 +49,12 @@ void Foam::distanceSurface::createGeometry() } // Clear any stored topologies - facesPtr_.clear(); isoSurfPtr_.clear(); // Clear derived data clearGeom(); - const fvMesh& fvm = static_cast(mesh()); + const fvMesh& mesh = static_cast(this->mesh()); // Distance to cell centres // ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -67,13 +66,13 @@ void Foam::distanceSurface::createGeometry() IOobject ( "cellDistance", - fvm.time().timeName(), - fvm.time(), + mesh.time().timeName(), + mesh.time(), IOobject::NO_READ, IOobject::NO_WRITE, false ), - fvm, + mesh, dimensionedScalar("zero", dimLength, 0) ) ); @@ -81,7 +80,7 @@ void Foam::distanceSurface::createGeometry() // Internal field { - const pointField& cc = fvm.C(); + const pointField& cc = mesh.C(); scalarField& fld = cellDistance.primitiveFieldRef(); List nearest; @@ -132,9 +131,9 @@ void Foam::distanceSurface::createGeometry() // Patch fields { - forAll(fvm.C().boundaryField(), patchi) + forAll(mesh.C().boundaryField(), patchi) { - const pointField& cc = fvm.C().boundaryField()[patchi]; + const pointField& cc = mesh.C().boundaryField()[patchi]; fvPatchScalarField& fld = cellDistanceBf[patchi]; List nearest; @@ -188,9 +187,9 @@ void Foam::distanceSurface::createGeometry() // Distance to points - pointDistance_.setSize(fvm.nPoints()); + pointDistance_.setSize(mesh.nPoints()); { - const pointField& pts = fvm.points(); + const pointField& pts = mesh.points(); List nearest; surfPtr_().findNearest @@ -247,13 +246,13 @@ void Foam::distanceSurface::createGeometry() IOobject ( "pointDistance", - fvm.time().timeName(), - fvm.time(), + mesh.time().timeName(), + mesh.time(), IOobject::NO_READ, IOobject::NO_WRITE, false ), - pointMesh::New(fvm), + pointMesh::New(mesh), dimensionedScalar("zero", dimLength, 0) ); pDist.primitiveFieldRef() = pointDistance_; @@ -268,10 +267,11 @@ void Foam::distanceSurface::createGeometry() ( new isoSurface ( + mesh, cellDistance, pointDistance_, distance_, - regularise_ + regularise_ ? isoSurface::DIAGCELL : isoSurface::NONE ) ); @@ -316,8 +316,7 @@ Foam::distanceSurface::distanceSurface average_(dict.lookupOrDefault("average", false)), zoneKey_(keyType::null), needsUpdate_(true), - isoSurfPtr_(nullptr), - facesPtr_(nullptr) + isoSurfPtr_(nullptr) {} @@ -330,7 +329,6 @@ Foam::distanceSurface::distanceSurface const word& surfaceName, const scalar distance, const bool signedDistance, - const bool cell, const Switch regularise, const Switch average ) @@ -359,8 +357,7 @@ Foam::distanceSurface::distanceSurface average_(average), zoneKey_(keyType::null), needsUpdate_(true), - isoSurfPtr_(nullptr), - facesPtr_(nullptr) + isoSurfPtr_(nullptr) {} @@ -383,13 +380,9 @@ bool Foam::distanceSurface::expire() if (debug) { Pout<< "distanceSurface::expire :" - << " have-facesPtr_:" << facesPtr_.valid() << " needsUpdate_:" << needsUpdate_ << endl; } - // Clear any stored topologies - facesPtr_.clear(); - // Clear derived data clearGeom(); @@ -409,7 +402,6 @@ bool Foam::distanceSurface::update() if (debug) { Pout<< "distanceSurface::update :" - << " have-facesPtr_:" << facesPtr_.valid() << " needsUpdate_:" << needsUpdate_ << endl; } diff --git a/src/sampling/sampledSurface/distanceSurface/distanceSurface.H b/src/sampling/sampledSurface/distanceSurface/distanceSurface.H index 206cb72931..e2001df9b7 100644 --- a/src/sampling/sampledSurface/distanceSurface/distanceSurface.H +++ b/src/sampling/sampledSurface/distanceSurface/distanceSurface.H @@ -85,9 +85,6 @@ class distanceSurface //- Constructed iso surface autoPtr isoSurfPtr_; - //- Triangles converted to faceList - mutable autoPtr facesPtr_; - // Private Member Functions @@ -133,7 +130,6 @@ public: const word& surfaceName, const scalar distance, const bool signedDistance, - const bool cell, const Switch regularise, const Switch average ); @@ -166,21 +162,10 @@ public: //- Faces of surface virtual const faceList& faces() const { - if (facesPtr_.empty()) - { - const triSurface& s = surface(); - - facesPtr_.reset(new faceList(s.size())); - - forAll(s, i) - { - facesPtr_()[i] = s[i].triFaceFace(); - } - } - return facesPtr_; + return surface().faces(); } - const triSurface& surface() const + const isoSurface& surface() const { return isoSurfPtr_(); } diff --git a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C index f3d8f7de7e..a2aac6432d 100644 --- a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C +++ b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C @@ -227,11 +227,11 @@ void Foam::sampledCuttingPlane::createGeometry() ( new isoSurface ( + mesh, cellDistance, pointDistance_, - 0.0, - regularise_, - mergeTol_ + 0, + regularise_ ? isoSurface::DIAGCELL : isoSurface::NONE ) ); @@ -254,7 +254,6 @@ Foam::sampledCuttingPlane::sampledCuttingPlane : sampledSurface(name, mesh, dict), plane_(dict), - mergeTol_(dict.lookupOrDefault("mergeTol", 1e-6)), regularise_(dict.lookupOrDefault("regularise", true)), average_(dict.lookupOrDefault("average", false)), zoneID_(dict.lookupOrDefault("zone", word::null), mesh.cellZones()), @@ -262,8 +261,7 @@ Foam::sampledCuttingPlane::sampledCuttingPlane needsUpdate_(true), subMeshPtr_(nullptr), cellDistancePtr_(nullptr), - isoSurfPtr_(nullptr), - facesPtr_(nullptr) + isoSurfPtr_(nullptr) { if (zoneID_.index() != -1) { @@ -307,13 +305,9 @@ bool Foam::sampledCuttingPlane::expire() if (debug) { Pout<< "sampledCuttingPlane::expire :" - << " have-facesPtr_:" << facesPtr_.valid() << " needsUpdate_:" << needsUpdate_ << endl; } - // Clear any stored topologies - facesPtr_.clear(); - // Clear derived data clearGeom(); @@ -333,7 +327,6 @@ bool Foam::sampledCuttingPlane::update() if (debug) { Pout<< "sampledCuttingPlane::update :" - << " have-facesPtr_:" << facesPtr_.valid() << " needsUpdate_:" << needsUpdate_ << endl; } diff --git a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H index 9b4a4bd80b..46bc128af8 100644 --- a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H +++ b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H @@ -60,9 +60,6 @@ class sampledCuttingPlane //- Plane const plane plane_; - //- Merge tolerance - const scalar mergeTol_; - //- Whether to coarsen const Switch regularise_; @@ -157,18 +154,7 @@ public: //- Faces of surface virtual const faceList& faces() const { - if (facesPtr_.empty()) - { - const triSurface& s = surface(); - - facesPtr_.reset(new faceList(s.size())); - - forAll(s, i) - { - facesPtr_()[i] = s[i].triFaceFace(); - } - } - return facesPtr_; + return surface().faces(); } const isoSurface& surface() const