1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
28 #include <sampling/sampledSet.H>
29 #include <meshTools/meshSearch.H>
30 #include <OpenFOAM/DynamicList.H>
31 #include <OpenFOAM/polyMesh.H>
32 #include <OpenFOAM/addToRunTimeSelectionTable.H>
33 #include <OpenFOAM/word.H>
35 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 defineTypeNameAndDebug(cloudSet, 0);
40 addToRunTimeSelectionTable(sampledSet, cloudSet, word);
44 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
46 void Foam::cloudSet::calcSamples
48 DynamicList<point>& samplingPts,
49 DynamicList<label>& samplingCells,
50 DynamicList<label>& samplingFaces,
51 DynamicList<label>& samplingSegments,
52 DynamicList<scalar>& samplingCurveDist
55 forAll(sampleCoords_, sampleI)
57 label cellI = searchEngine().findCell(sampleCoords_[sampleI]);
61 samplingPts.append(sampleCoords_[sampleI]);
62 samplingCells.append(cellI);
63 samplingFaces.append(-1);
64 samplingSegments.append(0);
65 samplingCurveDist.append(1.0 * sampleI);
71 void Foam::cloudSet::genSamples()
73 // Storage for sample points
74 DynamicList<point> samplingPts;
75 DynamicList<label> samplingCells;
76 DynamicList<label> samplingFaces;
77 DynamicList<label> samplingSegments;
78 DynamicList<scalar> samplingCurveDist;
90 samplingCells.shrink();
91 samplingFaces.shrink();
92 samplingSegments.shrink();
93 samplingCurveDist.shrink();
106 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
108 Foam::cloudSet::cloudSet
111 const polyMesh& mesh,
112 meshSearch& searchEngine,
114 const List<point>& sampleCoords
117 sampledSet(name, mesh, searchEngine, axis),
118 sampleCoords_(sampleCoords)
129 Foam::cloudSet::cloudSet
132 const polyMesh& mesh,
133 meshSearch& searchEngine,
134 const dictionary& dict
137 sampledSet(name, mesh, searchEngine, dict),
138 sampleCoords_(dict.lookup("points"))
149 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
151 Foam::cloudSet::~cloudSet()
155 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
157 Foam::point Foam::cloudSet::getRefPoint(const List<point>& pts) const
161 // Use first samplePt as starting point
171 // ************************ vim: set sw=4 sts=4 et: ************************ //