Loading...
Searching...
No Matches
dataCloud.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2018-2024 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::functionObjects::dataCloud
28
29Group
30 grpLagrangianFunctionObjects
31
32Description
33 This functionObject writes cloud positions in ASCII.
34
35Usage
36 Minimal example by using \c system/controlDict.functions:
37 \verbatim
38 cloudWriteFO
39 {
40 // Mandatory entries
41 type dataCloud;
42 libs (lagrangianFunctionObjects);
43 field <word>;
44
45 // Conditional entries
46
47 // Option-1
48 cloud <word>;
49
50 // Option-2
51 clouds (<wordRes>);
52
53 // Optional entries
54 selection <dictionary>;
55 directory <fileName>;
56 width <int>;
57 precision <unsigned>;
58
59 // Inherited entries
60 ...
61 }
62 \endverbatim
63
64 where the entries mean:
65 \table
66 Property | Description | Type | Reqd | Deflt
67 type | Type name: dataCloud | word | yes | -
68 libs | Library name: lagrangianFunctionObjects | word | yes | -
69 field | Name of cloud field to write | word | yes | -
70 cloud | Name of cloud to process | word | conditional | -
71 clouds | Names of clouds to process | wordRes | conditional | -
72 selection | Parcel selection control | no | empty-dict
73 directory | The output directory name | no | postProcessing/NAME
74 width | Padding width for file name | no | 8
75 precision | The write precision | no | same as IOstream
76 \endtable
77
78 \heading Output Options
79 \table
80 Property | Description | Required | Default
81 precision | The write precision | no | same as IOstream
82 directory | The output directory name | no | postProcessing/NAME
83 width | Padding width for file name | no | 8
84 writeControl | Output control | recommended | timeStep
85 \endtable
86
87 The inherited entries are elaborated in:
88 - \link regionFunctionObject.H \endlink
89 - \link parcelSelectionDetail.H \endlink
90
91Note
92 See Foam::functionObjects::vtkCloud and Foam::Detail::parcelSelection
93 for more details about the parcel selection mechanism.
94
95See also
96 Foam::Detail::parcelSelection
97 Foam::functionObjects::vtkCloud
98 Foam::functionObjects::fvMeshFunctionObject
99 Foam::functionObjects::timeControl
100
101SourceFiles
102 dataCloud.C
103 dataCloudTemplates.C
104
105\*---------------------------------------------------------------------------*/
106
107#ifndef Foam_functionObjects_dataCloud_H
108#define Foam_functionObjects_dataCloud_H
109
110#include "fvMeshFunctionObject.H"
112#include "vectorField.H"
113
114// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115
116namespace Foam
117{
118namespace functionObjects
119{
120
121/*---------------------------------------------------------------------------*\
122 Class dataCloud Declaration
123\*---------------------------------------------------------------------------*/
124
125class dataCloud
126:
128 public Foam::Detail::parcelSelection
129{
130 // Private Data
131
132 //- The printf format for zero-padding names
133 string printf_;
134
135 //- The output precision
136 unsigned precision_;
137
138 //- Apply output filter (for the current cloud)
139 bool applyFilter_;
140
141 //- Requested names of clouds to process
142 wordRes selectClouds_;
143
144 //- Subset of cloud fields to process
145 word fieldName_;
146
147 //- Output directory
148 fileName directory_;
149
150
151 // Private Member Functions
152
153 //- Output (point,value) combination on a single line
154 template<class Type>
155 static void writePointValue
156 (
157 Ostream& os,
158 const vector& pt,
159 const Type& val
160 );
161
162 template<class Type>
163 static void writeList
164 (
165 Ostream& os,
166 const vectorField& points,
167 const List<Type>& field
168 );
169
170 template<class Type>
171 static void writeListParallel
172 (
173 Ostream& os,
174 const vectorField& points,
175 const List<Type>& field
176 );
177
178 template<class Type>
179 static void writeList
180 (
181 Ostream& os,
182 const vectorField& points,
183 const List<Type>& field,
184 const bitSet& selected
185 );
186
187 template<class Type>
188 static void writeListParallel
189 (
190 Ostream& os,
191 const vectorField& points,
192 const List<Type>& field,
193 const bitSet& selected
194 );
195
196 //- Write to disk
197 bool writeCloud(const fileName& outputName, const word& cloudName);
198
199 //- Write from objectRegistry entry
200 template<class Type>
201 bool writeField
202 (
203 const fileName& outputName,
204 const objectRegistry& obr
205 ) const;
206
207
208 //- No copy construct
209 dataCloud(const dataCloud&) = delete;
210
211 //- No copy assignment
212 void operator=(const dataCloud&) = delete;
213
214
215public:
216
217 //- Runtime type information
218 TypeName("dataCloud");
219
220
221 // Constructors
222
223 //- Construct from name, Time and dictionary
224 dataCloud
225 (
226 const word& name,
227 const Time& runTime,
228 const dictionary& dict
229 );
230
231
232 //- Destructor
233 virtual ~dataCloud() = default;
234
235
236 // Member Functions
237
238 //- Read the function-object dictionary
239 virtual bool read(const dictionary& dict);
240
241 //- Execute the function-object operations, currently does nothing
242 virtual bool execute();
243
244 //- Write the function-object results
245 virtual bool write();
246};
247
248
249// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250
251} // End namespace functionObjects
252} // End namespace Foam
253
254// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255
256#ifdef NoRepository
257 #include "dataCloudTemplates.C"
258#endif
259
260// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261
262#endif
263
264// ************************************************************************* //
const word cloudName(propsDict.get< word >("cloud"))
Selection of parcels based on their objectRegistry entries. Normally accessed via a dictionary entry.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition bitSet.H:61
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A class for handling file names.
Definition fileName.H:75
This functionObject writes cloud positions in ASCII.
Definition dataCloud.H:205
TypeName("dataCloud")
Runtime type information.
virtual ~dataCloud()=default
Destructor.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
Definition dataCloud.C:144
virtual bool execute()
Execute the function-object operations, currently does nothing.
Definition dataCloud.C:207
virtual bool write()
Write the function-object results.
Definition dataCloud.C:213
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
virtual const objectRegistry & obr() const
The region or sub-region registry being used.
Registry of regIOobjects.
A List of wordRe with additional matching capabilities.
Definition wordRes.H:56
A class for handling words, derived from Foam::string.
Definition word.H:66
rDeltaTY field()
engineTime & runTime
word outputName("finiteArea-edges.obj")
OBJstream os(runTime.globalPath()/outputName)
const pointField & points
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
Field< vector > vectorField
Specialisation of Field<T> for vector.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
Vector< scalar > vector
Definition vector.H:57
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68