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-2020 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 a cloud position and in ASCII.
34
35 Example of function object specification:
36 \verbatim
37 cloudWrite1
38 {
39 type dataCloud;
40 libs (lagrangianFunctionObjects);
41 writeControl writeTime;
42 writeInterval 1;
43 cloud myCloud;
44 field d;
45 }
46 \endverbatim
47
48 \heading Basic Usage
49 \table
50 Property | Description | Required | Default
51 type | Type name: dataCloud | yes |
52 clouds | List of clouds (name or regex) | no |
53 cloud | Cloud name | no | defaultCloud
54 field | Name of the field | yes |
55 selection | Parcel selection control | no | empty-dict
56 \endtable
57
58 \heading Output Options
59 \table
60 Property | Description | Required | Default
61 precision | The write precision | no | same as IOstream
62 directory | The output directory name | no | postProcessing/NAME
63 width | Padding width for file name | no | 8
64 writeControl | Output control | recommended | timeStep
65 \endtable
66
67Note
68 See Foam::functionObjects::vtkCloud and Foam::Detail::parcelSelection
69 for more details about the parcel selection mechanism.
70
71See also
72 Foam::Detail::parcelSelection
73 Foam::functionObjects::vtkCloud
74 Foam::functionObjects::fvMeshFunctionObject
75 Foam::functionObjects::timeControl
76
77SourceFiles
78 dataCloud.C
79 dataCloudTemplates.C
80
81\*---------------------------------------------------------------------------*/
82
83#ifndef functionObjects_dataCloud_H
84#define functionObjects_dataCloud_H
85
88#include "vectorField.H"
89
90// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91
92namespace Foam
93{
94namespace functionObjects
95{
96
97/*---------------------------------------------------------------------------*\
98 Class dataCloud Declaration
99\*---------------------------------------------------------------------------*/
100
101class dataCloud
102:
103 public fvMeshFunctionObject,
105{
106 // Private data
107
108 //- The printf format for zero-padding names
109 string printf_;
110
111 //- The output precision
112 unsigned precision_;
113
114 //- Apply output filter (for the current cloud)
115 bool applyFilter_;
116
117 //- Requested names of clouds to process
118 wordRes selectClouds_;
119
120 //- Subset of cloud fields to process
121 word fieldName_;
122
123 //- Output directory
124 fileName directory_;
125
126
127 // Private Member Functions
128
129 //- Output (point,value) combination on a single line
130 template<class Type>
131 static void writePointValue
132 (
133 Ostream& os,
134 const vector& pt,
135 const Type& val
136 );
137
138 template<class Type>
139 static void writeList
140 (
141 Ostream& os,
142 const vectorField& points,
143 const List<Type>& field
144 );
145
146 template<class Type>
147 static void writeListParallel
148 (
149 Ostream& os,
150 const vectorField& points,
151 const List<Type>& field
152 );
153
154 template<class Type>
155 static void writeList
156 (
157 Ostream& os,
158 const vectorField& points,
159 const List<Type>& field,
160 const bitSet& selected
161 );
162
163 template<class Type>
164 static void writeListParallel
165 (
166 Ostream& os,
167 const vectorField& points,
168 const List<Type>& field,
169 const bitSet& selected
170 );
171
172 //- Write to disk
173 bool writeCloud(const fileName& outputName, const word& cloudName);
174
175 //- Write from objectRegistry entry
176 template<class Type>
177 bool writeField
178 (
179 const fileName& outputName,
180 const objectRegistry& obrTmp
181 ) const;
182
183
184 //- No copy construct
185 dataCloud(const dataCloud&) = delete;
186
187 //- No copy assignment
188 void operator=(const dataCloud&) = delete;
189
190
191public:
192
193 //- Runtime type information
194 TypeName("dataCloud");
195
196
197 // Constructors
198
199 //- Construct from Time and dictionary
201 (
202 const word& name,
203 const Time& runTime,
204 const dictionary& dict
205 );
206
207
208 //- Destructor
209 virtual ~dataCloud() = default;
210
211
212 // Member Functions
213
214 //- Read the dataCloud specification
215 virtual bool read(const dictionary& dict);
216
217 //- Execute, currently does nothing
218 virtual bool execute();
219
220 //- Write fields
221 virtual bool write();
222};
223
224
225// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226
227} // End namespace functionObjects
228} // End namespace Foam
229
230// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231
232#ifdef NoRepository
233 #include "dataCloudTemplates.C"
234#endif
235
236// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237
238#endif
239
240// ************************************************************************* //
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:77
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling file names.
Definition: fileName.H:76
const word & name() const noexcept
Return the name of this functionObject.
This functionObject writes a cloud position and in ASCII.
Definition: dataCloud.H:159
TypeName("dataCloud")
Runtime type information.
virtual ~dataCloud()=default
Destructor.
virtual bool read(const dictionary &dict)
Read the dataCloud specification.
Definition: dataCloud.C:144
virtual bool execute()
Execute, currently does nothing.
Definition: dataCloud.C:204
virtual bool write()
Write fields.
Definition: dataCloud.C:210
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Registry of regIOobjects.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:54
A class for handling words, derived from Foam::string.
Definition: word.H:68
rDeltaTY field()
engineTime & runTime
word outputName("finiteArea-edges.obj")
OBJstream os(runTime.globalPath()/outputName)
const pointField & points
Namespace for OpenFOAM.
Field< vector > vectorField
Specialisation of Field<T> for vector.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73
const word cloudName(propsDict.get< word >("cloud"))