diff --git a/src/meshTools/searchableSurface/triSurfaceMesh.C b/src/meshTools/searchableSurface/triSurfaceMesh.C index a51b3ff495..e8b7c0681f 100644 --- a/src/meshTools/searchableSurface/triSurfaceMesh.C +++ b/src/meshTools/searchableSurface/triSurfaceMesh.C @@ -188,7 +188,16 @@ Foam::triSurfaceMesh::triSurfaceMesh ) ), surfaceClosed_(-1) -{} +{ + scalar scaleFactor = 0; + + // allow rescaling of the surface points + // eg, CAD geometries are often done in millimeters + if (dict.readIfPresent("scale", scaleFactor) && scaleFactor > 0) + { + triSurface::scalePoints(scaleFactor); + } +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/meshTools/searchableSurface/triSurfaceMesh.H b/src/meshTools/searchableSurface/triSurfaceMesh.H index 12582c4e83..b8a7afb0c9 100644 --- a/src/meshTools/searchableSurface/triSurfaceMesh.H +++ b/src/meshTools/searchableSurface/triSurfaceMesh.H @@ -109,6 +109,7 @@ public: triSurfaceMesh(const IOobject& io); //- Construct from dictionary (used by searchableSurface) + // Dictionary may contain a 'scale' entry (eg, 0.001: mm -> m) triSurfaceMesh ( const IOobject& io, diff --git a/src/triSurface/triSurface/triSurface.C b/src/triSurface/triSurface/triSurface.C index 548c853890..64adb1bc74 100644 --- a/src/triSurface/triSurface/triSurface.C +++ b/src/triSurface/triSurface/triSurface.C @@ -35,15 +35,14 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(Foam::triSurface, 0); + defineTypeNameAndDebug(Foam::triSurface, 0); +} -fileName triSurface::triSurfInstance(const Time& d) +Foam::fileName Foam::triSurface::triSurfInstance(const Time& d) { fileName foamName(d.caseName() + ".ftr"); @@ -93,7 +92,7 @@ fileName triSurface::triSurfInstance(const Time& d) } -List triSurface::convertToTri +Foam::List Foam::triSurface::convertToTri ( const faceList& faces, const label defaultRegion @@ -128,7 +127,7 @@ List triSurface::convertToTri } -List triSurface::convertToTri +Foam::List Foam::triSurface::convertToTri ( const triFaceList& faces, const label defaultRegion @@ -154,7 +153,7 @@ List triSurface::convertToTri // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void triSurface::printTriangle +void Foam::triSurface::printTriangle ( Ostream& os, const string& pre, @@ -172,7 +171,7 @@ void triSurface::printTriangle } -string triSurface::getLineNoComment(IFstream& is) +Foam::string Foam::triSurface::getLineNoComment(IFstream& is) { string line; do @@ -186,7 +185,7 @@ string triSurface::getLineNoComment(IFstream& is) // Remove non-triangles, double triangles. -void triSurface::checkTriangles(const bool verbose) +void Foam::triSurface::checkTriangles(const bool verbose) { // Simple check on indices ok. const label maxPointI = points().size() - 1; @@ -320,7 +319,7 @@ void triSurface::checkTriangles(const bool verbose) // Check/fix edges with more than two triangles -void triSurface::checkEdges(const bool verbose) +void Foam::triSurface::checkEdges(const bool verbose) { const labelListList& eFaces = edgeFaces(); @@ -349,7 +348,7 @@ void triSurface::checkEdges(const bool verbose) // Check normals and orientation -boolList triSurface::checkOrientation(const bool verbose) +Foam::boolList Foam::triSurface::checkOrientation(const bool verbose) { const edgeList& es = edges(); const labelListList& faceEs = faceEdges(); @@ -470,7 +469,7 @@ boolList triSurface::checkOrientation(const bool verbose) // Read triangles, points from Istream -bool triSurface::read(Istream& is) +bool Foam::triSurface::read(Istream& is) { is >> patches_ >> const_cast(points()) >> static_cast&>(*this); @@ -480,7 +479,12 @@ bool triSurface::read(Istream& is) // Read from file in given format -bool triSurface::read(const fileName& name, const word& ext, const bool check) +bool Foam::triSurface::read +( + const fileName& name, + const word& ext, + const bool check +) { if (check && !exists(name)) { @@ -549,7 +553,7 @@ bool triSurface::read(const fileName& name, const word& ext, const bool check) // Write to file in given format -void triSurface::write +void Foam::triSurface::write ( const fileName& name, const word& ext, @@ -618,7 +622,7 @@ void triSurface::write // Returns patch info. Sets faceMap to the indexing according to patch // numbers. Patch numbers start at 0. -surfacePatchList triSurface::calcPatches(labelList& faceMap) const +Foam::surfacePatchList Foam::triSurface::calcPatches(labelList& faceMap) const { // Sort according to region numbers of labelledTri SortableList