lineCellFace.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-2021 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 "lineCellFace.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 {
38  defineTypeNameAndDebug(lineCellFace, 0);
39  addToRunTimeSelectionTable(sampledSet, lineCellFace, word);
40 }
41 }
42 
43 
44 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 
46 void Foam::sampledSets::lineCellFace::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  true,
62  true,
63  samplingPositions,
64  samplingDistances,
65  samplingSegments,
66  samplingCells,
67  samplingFaces
68  );
69 }
70 
71 
72 void Foam::sampledSets::lineCellFace::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 
125 (
126  const word& name,
127  const polyMesh& mesh,
128  const meshSearch& searchEngine,
129  const word& axis,
130  const point& start,
131  const point& end
132 )
133 :
134  sampledSet(name, mesh, searchEngine, axis),
135  start_(start),
136  end_(end)
137 {
138  genSamples();
139 }
140 
141 
142 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
143 
145 {}
146 
147 
148 // ************************************************************************* //
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
Definition: meshSearch.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual ~lineCellFace()
Destructor.
Definition: lineCellFace.C:144
fvMesh & mesh
Macros for easy insertion into run-time selection tables.
Holds list of sampling points which is filled at construction time. Various implementations of this b...
Definition: sampledSet.H:61
lineCellFace(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Construct from dictionary.
Definition: lineCellFace.C:109
A class for handling words, derived from string.
Definition: word.H:59
addToRunTimeSelectionTable(sampledSet, arcUniform, word)
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
defineTypeNameAndDebug(arcUniform, 0)
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:864