lineCell.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "lineCell.H"
27 #include "meshSearch.H"
28 #include "DynamicList.H"
29 #include "polyMesh.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace sampledSets
37 {
40 }
41 }
42 
43 
44 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 
46 void Foam::sampledSets::lineCell::calcSamples
47 (
48  DynamicList<point>& samplingPositions,
49  DynamicList<scalar>& samplingDistances,
50  DynamicList<label>& samplingSegments,
51  DynamicList<label>& samplingCells,
52  DynamicList<label>& samplingFaces
53 ) const
54 {
55  lineFace::calcSamples
56  (
57  mesh(),
58  searchEngine(),
59  start_,
60  end_,
61  0,
62  true,
63  samplingPositions,
64  samplingDistances,
65  samplingSegments,
66  samplingCells,
67  samplingFaces
68  );
69 }
70 
71 
72 void Foam::sampledSets::lineCell::genSamples()
73 {
74  DynamicList<point> samplingPositions;
75  DynamicList<scalar> samplingDistances;
76  DynamicList<label> samplingSegments;
77  DynamicList<label> samplingCells;
78  DynamicList<label> samplingFaces;
79 
80  calcSamples
81  (
82  samplingPositions,
83  samplingDistances,
84  samplingSegments,
85  samplingCells,
86  samplingFaces
87  );
88 
89  samplingPositions.shrink();
90  samplingDistances.shrink();
91  samplingSegments.shrink();
92  samplingCells.shrink();
93  samplingFaces.shrink();
94 
95  setSamples
96  (
97  samplingPositions,
98  samplingDistances,
99  samplingSegments,
100  samplingCells,
101  samplingFaces
102  );
103 }
104 
105 
106 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
107 
109 (
110  const word& name,
111  const polyMesh& mesh,
112  const meshSearch& searchEngine,
113  const dictionary& dict
114 )
115 :
116  sampledSet(name, mesh, searchEngine, dict),
117  start_(dict.lookup("start")),
118  end_(dict.lookup("end"))
119 {
120  genSamples();
121 }
122 
123 
124 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
125 
127 {}
128 
129 
130 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
Definition: meshSearch.H:58
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Holds list of sampling points which is filled at construction time. Various implementations of this b...
Definition: sampledSet.H:64
const meshSearch & searchEngine() const
Access the search engine.
Definition: sampledSet.H:216
const polyMesh & mesh() const
Access the mesh.
Definition: sampledSet.H:210
Cell-samples along a line at the mid-points in-between face-intersections.
Definition: lineCell.H:91
virtual ~lineCell()
Destructor.
Definition: lineCell.C:126
lineCell(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Construct from dictionary.
Definition: lineCell.C:109
Set of sets to sample. Call sampledSets.write() to sample&write files.
A class for handling words, derived from string.
Definition: word.H:62
defineTypeNameAndDebug(arcUniform, 0)
addToRunTimeSelectionTable(sampledSet, arcUniform, word)
Namespace for OpenFOAM.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
dictionary dict