internalWriter.H
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-2022 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 Class
25  Foam::internalWriter
26 
27 Description
28  Write fields (internal).
29 
30 SourceFiles
31  internalWriter.C
32  internalWriterTemplates.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef internalWriter_H
37 #define internalWriter_H
38 
39 #include "OFstream.H"
40 #include "volFields.H"
41 #include "pointFields.H"
42 #include "vtkMesh.H"
43 
44 using namespace Foam;
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
52 
53 /*---------------------------------------------------------------------------*\
54  Class internalWriter Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class internalWriter
58 {
59  const vtkMesh& vMesh_;
60 
61  const bool binary_;
62 
63  const fileName fName_;
64 
65  std::ofstream os_;
66 
67 
68 public:
69 
70  // Constructors
71 
72  //- Construct from components
74  (
75  const vtkMesh&,
76  const bool binary,
77  const fileName&
78  );
79 
80 
81  // Member Functions
82 
83  std::ofstream& os()
84  {
85  return os_;
86  }
87 
88  //- Write cellIDs
89  void writeCellIDs();
90 
91  //- Write generic GeometricFields
92  template<class Type, class GeoMesh>
94 
95  //- Write generic GeometricFields
96  template<class Type, template<class> class PatchField, class GeoMesh>
97  void write
98  (
100  );
101 
102  //- Interpolate and write volFields
103  template<class Type>
104  void write
105  (
106  const volPointInterpolation&,
107  const UPtrList<const VolField<Type>>&
108  );
109 };
110 
111 
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 
114 } // End namespace Foam
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 #ifdef NoRepository
119  #include "internalWriterTemplates.C"
120 #endif
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 #endif
126 
127 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:47
Generic GeometricField class.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: UPtrList.H:66
A class for handling file names.
Definition: fileName.H:82
Write fields (internal).
internalWriter(const vtkMesh &, const bool binary, const fileName &)
Construct from components.
void write(const UPtrList< const DimensionedField< Type, GeoMesh >> &)
Write generic GeometricFields.
void writeCellIDs()
Write cellIDs.
std::ofstream & os()
Interpolate from cell centres to points (vertices) using inverse distance weighting.
Encapsulation of VTK mesh data. Holds mesh or meshsubset and polyhedral-cell decomposition on it.
Definition: vtkMesh.H:53
Namespace for OpenFOAM.