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 nullSurfaceWriter_H
38 #define nullSurfaceWriter_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 = Pstream::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 = Pstream::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 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::SymmTensor< scalar >
Foam::surfaceWriters::nullWriter::setSurface
virtual void setSurface(const meshedSurf &s, bool parallel)
Change association with a surface (no-op).
Definition: nullSurfaceWriter.C:105
Foam::surfaceWriter
Base class for surface writers.
Definition: surfaceWriter.H:114
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
s
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))
Definition: gmvOutputSpray.H:25
Foam::meshedSurf
Abstract definition of a meshed surface defined by faces and points.
Definition: meshedSurf.H:49
surfaceWriter.H
Foam::surfaceWriters::nullWriter::write
virtual fileName write()
Write separate surface geometry to file.
Definition: nullSurfaceWriter.C:125
Foam::surfaceWriters::nullWriter::needsUpdate
virtual bool needsUpdate() const
False: never needs an update.
Definition: nullSurfaceWriter.C:86
Foam::surfaceWriters::nullWriter::nullWriter
nullWriter()
Default construct.
Definition: nullSurfaceWriter.C:47
Foam::Field< vector >
Foam::surfaceWriters::nullWriter::~nullWriter
virtual ~nullWriter()=default
Destructor.
Foam::surfaceWriters::nullWriter
Suppresses output of geometry and fields.
Definition: nullSurfaceWriter.H:52
Foam::surfaceWriters::nullWriter::enabled
virtual bool enabled() const
Definition: nullSurfaceWriter.C:98
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::surfaceWriters::nullWriter::wroteData
virtual bool wroteData() const
True: like a /dev/null device.
Definition: nullSurfaceWriter.C:92
Foam::SphericalTensor< scalar >
Foam::surfaceWriters::nullWriter::declareSurfaceWriterWriteMethod
declareSurfaceWriterWriteMethod(label)
Foam::Vector< scalar >
Foam::UPstream::parRun
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:433
Foam::List< face >
Foam::surfaceWriters::nullWriter::open
virtual void open(const fileName &outputPath)
Open for output on specified path, using existing surface (no-op)
Definition: nullSurfaceWriter.C:121
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::surfaceWriters::nullWriter::TypeNameNoDebug
TypeNameNoDebug("none")
Declare type-name, virtual type (without debug switch)