ensightOutputCloud.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) 2016-2021 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 InNamespace
27  Foam::ensightOutput
28 
29 Description
30  A collection of functions for writing clouds as ensight file content.
31 
32 SourceFiles
33  ensightOutputCloud.C
34  ensightOutputCloudTemplates.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef ensightOutputCloud_H
39 #define ensightOutputCloud_H
40 
41 #include "ensightFile.H"
42 #include "autoPtr.H"
43 #include "IOField.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward Declarations
51 class fvMesh;
52 
53 namespace ensightOutput
54 {
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 
59 //- Write cloud positions
61 (
62  const fvMesh& mesh,
63  const word& cloudName,
64  bool exists,
65  autoPtr<ensightFile>& output
66 );
67 
68 
69 //- Write cloud field, returning true if the field is non-empty.
70 template<class Type>
71 bool writeCloudField
72 (
73  const IOField<Type>& field,
74  ensightFile& os
75 );
76 
77 
78 //- Read cloud field from IOobject (if exists == true) and write,
79 //- always returning true.
80 template<class Type>
81 bool writeCloudField
82 (
83  const IOobject& io,
84  bool exists,
85  autoPtr<ensightFile>& output
86 );
87 
88 
89 /*---------------------------------------------------------------------------*\
90  Namespace ensightOutput::Detail
91 \*---------------------------------------------------------------------------*/
92 
93 namespace Detail
94 {
95 
96 //- Write cloud field data (serial) with rounding and newlines.
97 // \return the current output count
98 template<class Type>
100 (
101  ensightFile& os,
102  const UList<Type>& fld,
103  label count = 0
104 );
105 
106 
107 } // End namespace Detail
108 
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 } // End namespace ensightOutput
113 } // End namespace Foam
114 
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 #ifdef NoRepository
120 #endif
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #endif
125 
126 // ************************************************************************* //
Foam::exists
bool exists(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
Definition: MSwindows.C:625
Foam::output
static Ostream & output(Ostream &os, const IntRange< T > &range)
Definition: IntRanges.C:66
cloudName
const word cloudName(propsDict.get< word >("cloud"))
ensightFile.H
field
rDeltaTY field()
ensightOutputCloudTemplates.C
fld
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;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
Foam::ensightOutput::writeCloudField
bool writeCloudField(const IOField< Type > &field, ensightFile &os)
Write cloud field, returning true if the field is non-empty.
Definition: ensightOutputCloudTemplates.C:71
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ensightOutput::writeCloudPositions
bool writeCloudPositions(const fvMesh &mesh, const word &cloudName, bool exists, autoPtr< ensightFile > &output)
Write cloud positions.
Definition: ensightOutputCloud.C:79
Foam::BitOps::count
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
Definition: BitOps.H:77
IOField.H
Foam::ensightOutput::Detail::writeCloudFieldContent
label writeCloudFieldContent(ensightFile &os, const UList< Type > &fld, label count=0)
Write cloud field data (serial) with rounding and newlines.
autoPtr.H