1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "triSurfaceMeshPointSet.H"
27 #include "meshSearch.H"
28 #include "DynamicList.H"
30 #include "addToRunTimeSelectionTable.H"
31 #include "triSurfaceMesh.H"
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(triSurfaceMeshPointSet, 0);
39 addToRunTimeSelectionTable(sampledSet, triSurfaceMeshPointSet, word);
43 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 void Foam::triSurfaceMeshPointSet::calcSamples
47 DynamicList<point>& samplingPts,
48 DynamicList<label>& samplingCells,
49 DynamicList<label>& samplingFaces,
50 DynamicList<label>& samplingSegments,
51 DynamicList<scalar>& samplingCurveDist
54 forAll(sampleCoords_, sampleI)
56 label cellI = searchEngine().findCell(sampleCoords_[sampleI]);
60 samplingPts.append(sampleCoords_[sampleI]);
61 samplingCells.append(cellI);
62 samplingFaces.append(-1);
63 samplingSegments.append(0);
64 samplingCurveDist.append(1.0 * sampleI);
70 void Foam::triSurfaceMeshPointSet::genSamples()
72 // Storage for sample points
73 DynamicList<point> samplingPts;
74 DynamicList<label> samplingCells;
75 DynamicList<label> samplingFaces;
76 DynamicList<label> samplingSegments;
77 DynamicList<scalar> samplingCurveDist;
89 samplingCells.shrink();
90 samplingFaces.shrink();
91 samplingSegments.shrink();
92 samplingCurveDist.shrink();
105 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
107 Foam::triSurfaceMeshPointSet::triSurfaceMeshPointSet
110 const polyMesh& mesh,
111 meshSearch& searchEngine,
112 const dictionary& dict
115 sampledSet(name, mesh, searchEngine, dict),
116 surface_(dict.lookup("surface"))
119 if (mesh.time().foundObject<triSurfaceMesh>(surface_))
121 // Note: should use localPoints() instead of points() but assume
122 // trisurface is compact.
123 sampleCoords_ = mesh.time().lookupObject<triSurfaceMesh>
130 sampleCoords_ = triSurfaceMesh
135 mesh.time().constant(), // instance
136 "triSurface", // local
154 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
156 Foam::triSurfaceMeshPointSet::~triSurfaceMeshPointSet()
160 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
162 Foam::point Foam::triSurfaceMeshPointSet::getRefPoint(const List<point>& pts)
167 // Use first samplePt as starting point
177 // ************************************************************************* //