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 \*---------------------------------------------------------------------------*/
27 #include "sampledSet.H"
28 #include "meshSearch.H"
29 #include "DynamicList.H"
31 #include "addToRunTimeSelectionTable.H"
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(cloudSet, 0);
39 addToRunTimeSelectionTable(sampledSet, cloudSet, word);
43 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 void Foam::cloudSet::calcSamples
47 DynamicList<point>& samplingPts,
48 DynamicList<label>& samplingCells,
49 DynamicList<label>& samplingFaces,
50 DynamicList<label>& samplingSegments,
51 DynamicList<scalar>& samplingCurveDist
54 // Force calculation of face-diagonals
55 (void)mesh().tetBasePtIs();
57 const meshSearch& queryMesh = searchEngine();
59 forAll(sampleCoords_, sampleI)
61 label cellI = queryMesh.findCell(sampleCoords_[sampleI]);
65 samplingPts.append(sampleCoords_[sampleI]);
66 samplingCells.append(cellI);
67 samplingFaces.append(-1);
68 samplingSegments.append(0);
69 samplingCurveDist.append(1.0 * sampleI);
75 void Foam::cloudSet::genSamples()
77 // Storage for sample points
78 DynamicList<point> samplingPts;
79 DynamicList<label> samplingCells;
80 DynamicList<label> samplingFaces;
81 DynamicList<label> samplingSegments;
82 DynamicList<scalar> samplingCurveDist;
94 samplingCells.shrink();
95 samplingFaces.shrink();
96 samplingSegments.shrink();
97 samplingCurveDist.shrink();
110 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
112 Foam::cloudSet::cloudSet
115 const polyMesh& mesh,
116 meshSearch& searchEngine,
118 const List<point>& sampleCoords
121 sampledSet(name, mesh, searchEngine, axis),
122 sampleCoords_(sampleCoords)
133 Foam::cloudSet::cloudSet
136 const polyMesh& mesh,
137 meshSearch& searchEngine,
138 const dictionary& dict
141 sampledSet(name, mesh, searchEngine, dict),
142 sampleCoords_(dict.lookup("points"))
153 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
155 Foam::cloudSet::~cloudSet()
159 // ************************************************************************* //