FreeFOAM The Cross-Platform CFD Toolkit
surfaceWriter.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) 1991-2010 OpenCFD Ltd.
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::surfaceWriter
26 
27 Description
28 
29 SourceFiles
30  surfaceWriter.C
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef surfaceWriter_H
35 #define surfaceWriter_H
36 
37 #include <OpenFOAM/Field.H>
38 #include <OpenFOAM/typeInfo.H>
39 #include <OpenFOAM/autoPtr.H>
40 #include <OpenFOAM/pointField.H>
41 #include <OpenFOAM/faceList.H>
42 #include <OpenFOAM/fileName.H>
43 
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declaration of friend functions and operators
52 
53 template<class Type> class surfaceWriter;
54 template<class Type> class nullSurfaceWriter;
55 template<class Type> class proxySurfaceWriter;
56 
57 /*---------------------------------------------------------------------------*\
58  Class surfaceWriter Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 template<class Type>
63 {
64  //- friendship between writer data types
65  template<class Type2> friend class surfaceWriter;
66 
67 public:
68 
69  //- Runtime type information
70  TypeName("surfaceWriter");
71 
72  // Declare run-time constructor selection table
73 
75  (
76  autoPtr,
78  word,
79  (),
80  ()
81  );
82 
83 
84  // Selectors
85 
86  //- Return a reference to the selected surfaceWriter
87  static autoPtr<surfaceWriter> New(const word& writeFormat);
88 
89 
90  // Constructors
91 
92  //- Construct null
93  surfaceWriter();
94 
95 
96  // Destructor
97 
98  virtual ~surfaceWriter();
99 
100 
101  // Member Functions
102 
103  //- Return true if the surface format supports separate files
104  virtual bool separateFiles()
105  {
106  return false;
107  }
108 
109 
110  //- Writes single surface geometry to file.
111  virtual void write
112  (
113  const fileName& outputDir, // <root>/<case>/surface/TIME
114  const fileName& surfaceName, // name of surface
115  const pointField& points,
116  const faceList& faces,
117  const bool verbose = false
118  ) const
119  {}
120 
121 
122  //- Writes single surface to file. Either one value per vertex or
123  // one value per face (detected by values.size()==faces.size())
124  virtual void write
125  (
126  const fileName& outputDir, // <root>/<case>/surface/TIME
127  const fileName& surfaceName, // name of surface
128  const pointField& points,
129  const faceList& faces,
130  const fileName& fieldName, // name of field
131  const Field<Type>& values,
132  const bool verbose = false
133  ) const = 0;
134 };
135 
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 } // End namespace Foam
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 #ifdef NoRepository
144 # include "surfaceWriter.C"
145 #endif
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 #endif
150 
151 // ************************ vim: set sw=4 sts=4 et: ************************ //