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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::functionObjects::dataCloud
28 
29 Group
30  grpLagrangianFunctionObjects
31 
32 Description
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 
67 Note
68  See Foam::functionObjects::vtkCloud and Foam::Detail::parcelSelection
69  for more details about the parcel selection mechanism.
70 
71 See also
72  Foam::Detail::parcelSelection
73  Foam::functionObjects::vtkCloud
74  Foam::functionObjects::fvMeshFunctionObject
75  Foam::functionObjects::timeControl
76 
77 SourceFiles
78  dataCloud.C
79  dataCloudTemplates.C
80 
81 \*---------------------------------------------------------------------------*/
82 
83 #ifndef functionObjects_dataCloud_H
84 #define functionObjects_dataCloud_H
85 
86 #include "fvMeshFunctionObject.H"
87 #include "parcelSelectionDetail.H"
88 #include "vectorField.H"
89 
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91 
92 namespace Foam
93 {
94 namespace functionObjects
95 {
96 
97 /*---------------------------------------------------------------------------*\
98  Class dataCloud Declaration
99 \*---------------------------------------------------------------------------*/
100 
101 class 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 
191 public:
192 
193  //- Runtime type information
194  TypeName("dataCloud");
195 
196 
197  // Constructors
198 
199  //- Construct from Time and dictionary
200  dataCloud
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 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::functionObjects::dataCloud::TypeName
TypeName("dataCloud")
Runtime type information.
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
cloudName
const word cloudName(propsDict.get< word >("cloud"))
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:63
fvMeshFunctionObject.H
dataCloudTemplates.C
Foam::Detail::parcelSelection
Selection of parcels based on their objectRegistry entries. Normally accessed via a dictionary entry.
Definition: parcelSelectionDetail.H:180
parcelSelectionDetail.H
Foam::functionObjects::dataCloud::~dataCloud
virtual ~dataCloud()=default
Destructor.
Foam::functionObjects::fvMeshFunctionObject
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Definition: fvMeshFunctionObject.H:64
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
outputName
word outputName("finiteArea-edges.obj")
Foam::functionObjects::dataCloud::execute
virtual bool execute()
Execute, currently does nothing.
Definition: dataCloud.C:204
Foam::Field< vector >
Foam::functionObjects::dataCloud::write
virtual bool write()
Write fields.
Definition: dataCloud.C:210
field
rDeltaTY field()
Foam::functionObjects::dataCloud::read
virtual bool read(const dictionary &dict)
Read the dataCloud specification.
Definition: dataCloud.C:144
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::functionObjects::dataCloud
This functionObject writes a cloud position and in ASCII.
Definition: dataCloud.H:155
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::functionObject::name
const word & name() const noexcept
Return the name of this functionObject.
Definition: functionObject.C:143
Foam::Vector< scalar >
Foam::List< Type >
vectorField.H
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56