/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 1991-2008 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 "intersectedSurface.H" #include "surfaceIntersection.H" #include "faceList.H" #include "faceTriangulation.H" #include "treeBoundBox.H" #include "OFstream.H" #include "error.H" #include "meshTools.H" #include "edgeSurface.H" #include "DynamicList.H" #include "transform.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // defineTypeNameAndDebug(Foam::intersectedSurface, 0); const Foam::label Foam::intersectedSurface::UNVISITED = 0; const Foam::label Foam::intersectedSurface::STARTTOEND = 1; const Foam::label Foam::intersectedSurface::ENDTOSTART = 2; const Foam::label Foam::intersectedSurface::BOTH = STARTTOEND | ENDTOSTART; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // Write whole pointField and edges to stream void Foam::intersectedSurface::writeOBJ ( const pointField& points, const edgeList& edges, Ostream& os ) { forAll(points, pointI) { const point& pt = points[pointI]; os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl; } forAll(edges, edgeI) { const edge& e = edges[edgeI]; os << "l " << e.start()+1 << ' ' << e.end()+1 << nl; } } // Write whole pointField and selected edges to stream void Foam::intersectedSurface::writeOBJ ( const pointField& points, const edgeList& edges, const labelList& faceEdges, Ostream& os ) { forAll(points, pointI) { const point& pt = points[pointI]; os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl; } forAll(faceEdges, i) { const edge& e = edges[faceEdges[i]]; os << "l " << e.start()+1 << ' ' << e.end()+1 << nl; } } // write local points and edges to stream void Foam::intersectedSurface::writeLocalOBJ ( const pointField& points, const edgeList& edges, const labelList& faceEdges, const fileName& fName ) { OFstream os(fName); labelList pointMap(points.size(), -1); label maxVertI = 0; forAll(faceEdges, i) { const edge& e = edges[faceEdges[i]]; forAll(e, i) { label pointI = e[i]; if (pointMap[pointI] == -1) { const point& pt = points[pointI]; os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl; pointMap[pointI] = maxVertI++; } } } forAll(faceEdges, i) { const edge& e = edges[faceEdges[i]]; os << "l " << pointMap[e.start()]+1 << ' ' << pointMap[e.end()]+1 << nl; } } // Write whole pointField and face to stream void Foam::intersectedSurface::writeOBJ ( const pointField& points, const face& f, Ostream& os ) { forAll(points, pointI) { const point& pt = points[pointI]; os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl; } os << 'f'; forAll(f, fp) { os << ' ' << f[fp]+1; } os << nl; } // Print current visited state. void Foam::intersectedSurface::printVisit ( const edgeList& edges, const labelList& edgeLabels, const Map