nullSurfaceWriter.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) 2019-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::surfaceWriters::nullWriter
28 
29 Description
30  Suppresses output of geometry and fields
31 
32 SourceFiles
33  nullSurfaceWriter.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef Foam_surfaceWriters_nullWriter_H
38 #define Foam_surfaceWriters_nullWriter_H
39 
40 #include "surfaceWriter.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 namespace surfaceWriters
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class nullWriter Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class nullWriter
54 :
55  public surfaceWriter
56 {
57 public:
58 
59  //- Declare type-name, virtual type (without debug switch)
60  TypeNameNoDebug("none");
61 
62 
63  // Constructors
64 
65  //- Default construct
66  nullWriter();
67 
68  //- Construct with some output options
69  explicit nullWriter(const dictionary& options);
70 
71  //- Construct from components
73  (
74  const meshedSurf& surf,
75  const fileName& outputPath,
76  bool parallel = UPstream::parRun(),
77  const dictionary& options = dictionary()
78  );
79 
80  //- Construct from components
82  (
83  const pointField& points,
84  const faceList& faces,
85  const fileName& outputPath,
86  bool parallel = UPstream::parRun(),
87  const dictionary& options = dictionary()
88  );
89 
90 
91  //- Destructor
92  virtual ~nullWriter() = default;
93 
94 
95  // Member Functions
96 
97  // Capability
98 
99  //- False: never needs an update.
100  virtual bool needsUpdate() const;
101 
102  //- True: like a /dev/null device.
103  virtual bool wroteData() const;
104 
105  //- False: The null writer is never enabled, which lets the caller
106  //- skip various (possibly expensive) preparatory operations.
107  virtual bool enabled() const;
108 
109 
110  // Surface Association
111 
112  //- Change association with a surface (no-op).
113  virtual void setSurface
114  (
115  const meshedSurf& s,
116  bool parallel
117  ); // override
118 
119  //- Change association with a surface (no-op).
120  virtual void setSurface
121  (
122  const pointField& points,
123  const faceList& faces,
124  bool parallel
125  ); // override
126 
127 
128  // Output
129 
130  //- Open for output on specified path, using existing surface (no-op)
131  virtual void open(const fileName& outputPath); // override
132 
133 
134  // Write
135 
136  virtual fileName write(); // override;
137 
144 };
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace surfaceWriters
150 } // End namespace Foam
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #endif
155 
156 // ************************************************************************* //
Suppresses output of geometry and fields.
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
virtual void open(const fileName &outputPath)
Open for output on specified path, using existing surface (no-op)
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:1049
Abstract definition of a meshed surface defined by faces and points.
Definition: meshedSurf.H:43
const pointField & points
TypeNameNoDebug("none")
Declare type-name, virtual type (without debug switch)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
virtual fileName write()
Write separate surface geometry to file.
virtual ~nullWriter()=default
Destructor.
Base class for surface writers.
virtual bool enabled() const
False: The null writer is never enabled, which lets the caller skip various (possibly expensive) prep...
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Tensor of scalars, i.e. Tensor<scalar>.
virtual bool needsUpdate() const
False: never needs an update.
Namespace for OpenFOAM.
virtual bool wroteData() const
True: like a /dev/null device.
virtual void setSurface(const meshedSurf &s, bool parallel)
Change association with a surface (no-op).