nullCoordSetWriter.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) 2022 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::coordSetWriters::nullWriter
28 
29 Description
30  A coordSet(s) writer with suppressed output.
31 
32 SourceFiles
33  nullCoordSetWriter.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef Foam_coordSetWriters_nullWriter_H
38 #define Foam_coordSetWriters_nullWriter_H
39 
40 #include "coordSetWriter.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 namespace coordSetWriters
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class nullWriter Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class nullWriter
54 :
55  public coordSetWriter
56 {
57  // Private Member Functions
58 
59  //- Templated write operation
60  template<class Type>
61  fileName writeTemplate
62  (
63  const word& fieldName,
64  const Field<Type>& values
65  )
66  {
67  return fileName();
68  }
69 
70  //- Templated write operation
71  template<class Type>
72  fileName writeTemplate
73  (
74  const word& fieldName,
75  const List<Field<Type>>& fieldValues
76  )
77  {
78  return fileName();
79  }
80 
81 
82 public:
83 
84  //- Runtime type information (no debug)
85  TypeNameNoDebug("none");
86 
87 
88  // Constructors
89 
90  //- Default construct
91  nullWriter();
92 
93  //- Construct with some output options
94  explicit nullWriter(const dictionary& options);
95 
96  //- Construct from components
98  (
99  const coordSet& coords,
100  const fileName& outputPath,
101  const dictionary& options = dictionary()
102  );
103 
104  //- Construct from components
105  nullWriter
106  (
107  const UPtrList<coordSet>& tracks,
108  const fileName& outputPath,
109  const dictionary& options = dictionary()
110  );
111 
112 
113  //- Destructor
114  virtual ~nullWriter();
115 
116 
117  // Member Functions
118 
119  // Capability
120 
121  //- False: The null writer is never enabled, which lets the caller
122  //- skip various (possibly expensive) preparatory operations.
123  virtual bool enabled() const;
124 
125  //- False: no internal buffering possible
126  virtual bool buffering() const; // override
127 
128  //- False: never needs an update.
129  virtual bool needsUpdate() const;
130 
131  //- True: like a /dev/null device.
132  virtual bool wroteData() const;
133 
134 
135  // Content Association
136 
137  //- Set coordinates (no-op).
138  virtual void setCoordinates(const coordSet*); // override
139 
140  //- Set coordinates (no-op).
141  virtual void setCoordinates(const coordSet&); // override
142 
143  //- Set tracks (no-op).
144  virtual void setTracks(const UPtrList<coordSet>&); // override
145 
146 
147  // Output
148 
149  //- Characteristic output file name - information only.
150  //- Always an empty fileName
151  virtual fileName path() const; // override
152 
153  //- Open for output on specified path, using existing content (no-op)
154  virtual void open(const fileName& outputPath); // override
155 
156 
157  // Member Functions
158 
165 };
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace coordSetWriters
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:72
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:56
virtual bool needsUpdate() const
False: never needs an update.
virtual void setTracks(const UPtrList< coordSet > &)
Set tracks (no-op).
A coordSet(s) writer with suppressed output.
virtual void open(const fileName &outputPath)
Open for output on specified path, using existing content (no-op)
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Definition: HashOps.H:164
Holds list of sampling positions.
Definition: coordSet.H:49
Generic templated field type.
Definition: Field.H:62
A class for handling words, derived from Foam::string.
Definition: word.H:63
Base class for writing coordSet(s) and tracks with fields.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: HashTable.H:106
virtual fileName path() const
Characteristic output file name - information only. Always an empty fileName.
TypeNameNoDebug("none")
Runtime type information (no debug)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
virtual bool enabled() const
False: The null writer is never enabled, which lets the caller skip various (possibly expensive) prep...
virtual bool buffering() const
False: no internal buffering possible.
virtual bool wroteData() const
True: like a /dev/null device.
Tensor of scalars, i.e. Tensor<scalar>.
virtual void setCoordinates(const coordSet *)
Set coordinates (no-op).
Namespace for OpenFOAM.