CloudToVTK.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 | Copyright (C) 2015 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
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 Class
25  Foam::CloudToVTK
26 
27 Description
28  Write cloud data in VTK format
29 
30 SourceFiles
31  CloudToVTK.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef CloudToVTK_H
36 #define CloudToVTK_H
37 
38 #include "CloudFunctionObject.H"
39 #include "volFields.H"
40 #include "OFstream.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class CloudToVTK Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template<class CloudType>
52 class CloudToVTK
53 :
54  public CloudFunctionObject<CloudType>
55 {
56 
57 protected:
58 
59  // Protected data
60 
61  //- Ascii/binary output flag
62  bool binary_;
63 
64 
65  // Protected Member Functions
66 
67  //- Write post-processing info
68  virtual void write();
69 
70  //- Helper function to write VTK data
71  void writeData
72  (
73  std::ostream& vtkOs,
74  const bool binary,
75  const List<floatScalar>& data
76  ) const;
77 
78  //- Helper function to write VTK field data
79  template<class Type>
80  void writeFieldData
81  (
82  std::ostream& vtkOs,
83  const bool binary,
84  const List<floatScalar>& data,
85  const word& title,
86  const label nParcels
87  ) const;
88 
89 
90 public:
91 
92  //- Runtime type information
93  TypeName("cloudToVTK");
94 
95 
96  // Constructors
97 
98  //- Construct from dictionary
100  (
101  const dictionary& dict,
102  CloudType& owner,
103  const word& modelName
104  );
105 
106  //- Construct copy
108 
109  //- Construct and return a clone
111  {
113  (
114  new CloudToVTK<CloudType>(*this)
115  );
116  }
117 
118 
119  //- Destructor
120  virtual ~CloudToVTK();
121 };
122 
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 } // End namespace Foam
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 #ifdef NoRepository
131 # include "CloudToVTK.C"
132 #endif
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #endif
137 
138 // ************************************************************************* //
volFields.H
Foam::CloudToVTK::clone
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
Definition: CloudToVTK.H:109
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::CloudToVTK::binary_
bool binary_
Ascii/binary output flag.
Definition: CloudToVTK.H:61
Foam::CloudToVTK::~CloudToVTK
virtual ~CloudToVTK()
Destructor.
Definition: CloudToVTK.C:160
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:103
Foam::CloudToVTK::CloudToVTK
CloudToVTK(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: CloudToVTK.C:135
Foam::CloudToVTK::writeData
void writeData(std::ostream &vtkOs, const bool binary, const List< floatScalar > &data) const
Helper function to write VTK data.
Definition: CloudToVTK.C:34
Foam::CloudToVTK::writeFieldData
void writeFieldData(std::ostream &vtkOs, const bool binary, const List< floatScalar > &data, const word &title, const label nParcels) const
Helper function to write VTK field data.
Definition: CloudToVTK.C:59
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
CloudFunctionObject.H
OFstream.H
CloudToVTK.C
Foam::label
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
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::CloudToVTK::TypeName
TypeName("cloudToVTK")
Runtime type information.
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::CloudFunctionObject
Templated cloud function object base class.
Definition: CloudFunctionObject.H:56
Foam::CloudToVTK
Write cloud data in VTK format.
Definition: CloudToVTK.H:51
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:52
Foam::CloudToVTK::write
virtual void write()
Write post-processing info.
Definition: CloudToVTK.C:75