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-2024 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::genSamplesStoreFaces
74 (
75  const label storeFaces
76 )
77 {
78  DynamicList<point> samplingPositions;
79  DynamicList<scalar> samplingDistances;
80  DynamicList<label> samplingSegments;
81  DynamicList<label> samplingCells;
82  DynamicList<label> samplingFaces;
83 
84  calcSamples
85  (
86  storeFaces,
87  samplingPositions,
88  samplingDistances,
89  samplingSegments,
90  samplingCells,
91  samplingFaces
92  );
93 
94  samplingPositions.shrink();
95  samplingDistances.shrink();
96  samplingSegments.shrink();
97  samplingCells.shrink();
98  samplingFaces.shrink();
99 
100  setSamples
101  (
102  samplingPositions,
103  samplingDistances,
104  samplingSegments,
105  samplingCells,
106  samplingFaces
107  );
108 }
109 
110 
111 void Foam::sampledSets::lineCellFace::genSamples()
112 {
113  genSamplesStoreFaces(1);
114 }
115 
116 
117 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
118 
120 (
121  const word& name,
122  const polyMesh& mesh,
123  const meshSearch& searchEngine,
124  const dictionary& dict
125 )
126 :
127  sampledSet(name, mesh, searchEngine, dict),
128  start_(dict.lookup("start")),
129  end_(dict.lookup("end"))
130 {
131  genSamples();
132 }
133 
134 
136 (
137  const word& name,
138  const polyMesh& mesh,
139  const meshSearch& searchEngine,
140  const word& axis,
141  const point& start,
142  const point& end
143 )
144 :
145  sampledSet(name, mesh, searchEngine, axis),
146  start_(start),
147  end_(end)
148 {
149  genSamplesStoreFaces(2);
150 }
151 
152 
153 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
154 
156 {}
157 
158 
159 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
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:67
const meshSearch & searchEngine() const
Access the search engine.
Definition: sampledSet.H:222
const polyMesh & mesh() const
Access the mesh.
Definition: sampledSet.H:216
Face-intersections along a line, plus cell-samples at the mid-points in-between.
Definition: lineCellFace.H:92
virtual ~lineCellFace()
Destructor.
Definition: lineCellFace.C:155
lineCellFace(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Construct from dictionary.
Definition: lineCellFace.C:120
Set of sets to sample. Call sampledSets.write() to sample&write files.
A class for handling words, derived from string.
Definition: word.H:62
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
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 LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
dictionary dict