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-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 "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 {
40 }
41 }
42 
43 
44 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 
46 void Foam::sampledSets::lineCellFace::calcSamples
47 (
48  const label storeFaces,
49  DynamicList<point>& samplingPositions,
50  DynamicList<scalar>& samplingDistances,
51  DynamicList<label>& samplingSegments,
52  DynamicList<label>& samplingCells,
53  DynamicList<label>& samplingFaces
54 ) const
55 {
56  lineFace::calcSamples
57  (
58  mesh(),
59  searchEngine(),
60  start_,
61  end_,
62  storeFaces,
63  true,
64  samplingPositions,
65  samplingDistances,
66  samplingSegments,
67  samplingCells,
68  samplingFaces
69  );
70 }
71 
72 
73 void Foam::sampledSets::lineCellFace::genSamples(const label storeFaces)
74 {
75  DynamicList<point> samplingPositions;
76  DynamicList<scalar> samplingDistances;
77  DynamicList<label> samplingSegments;
78  DynamicList<label> samplingCells;
79  DynamicList<label> samplingFaces;
80 
81  calcSamples
82  (
83  storeFaces,
84  samplingPositions,
85  samplingDistances,
86  samplingSegments,
87  samplingCells,
88  samplingFaces
89  );
90 
91  samplingPositions.shrink();
92  samplingDistances.shrink();
93  samplingSegments.shrink();
94  samplingCells.shrink();
95  samplingFaces.shrink();
96 
97  setSamples
98  (
99  samplingPositions,
100  samplingDistances,
101  samplingSegments,
102  samplingCells,
103  samplingFaces
104  );
105 }
106 
107 
108 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
109 
111 (
112  const word& name,
113  const polyMesh& mesh,
114  const meshSearch& searchEngine,
115  const dictionary& dict
116 )
117 :
118  sampledSet(name, mesh, searchEngine, dict),
119  start_(dict.lookup("start")),
120  end_(dict.lookup("end"))
121 {
122  genSamples(1);
123 }
124 
125 
127 (
128  const word& name,
129  const polyMesh& mesh,
130  const meshSearch& searchEngine,
131  const word& axis,
132  const point& start,
133  const point& end
134 )
135 :
136  sampledSet(name, mesh, searchEngine, axis),
137  start_(start),
138  end_(end)
139 {
140  genSamples(2);
141 }
142 
143 
144 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
145 
147 {}
148 
149 
150 // ************************************************************************* //
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
Face-intersections along a line, plus cell-samples at the mid-points in-between.
Definition: lineCellFace.H:92
virtual ~lineCellFace()
Destructor.
Definition: lineCellFace.C:146
lineCellFace(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Construct from dictionary.
Definition: lineCellFace.C:111
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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
dictionary dict