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-2024 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 Foam_ensightOutputCloud_H
39 #define Foam_ensightOutputCloud_H
40 
41 #include "ensightFile.H"
42 #include "IOField.H"
43 #include "DynamicList.H"
44 #include "vector.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward Declarations
52 class fvMesh;
53 class globalIndex;
54 
55 namespace ensightOutput
56 {
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 
61 //- Write cloud positions
63 (
65  ensightFile& os,
66 
69  DynamicList<floatVector>& positions,
70 
73  const globalIndex& procAddr
74 );
75 
76 
77 //- Write cloud positions
79 (
81  ensightFile& os,
82 
85  DynamicList<floatVector>& positions
86 );
87 
88 
89 //- Write cloud positions
91 (
93  ensightFile& os,
94 
96  const fvMesh& mesh,
97 
99  const word& cloudName,
100 
102  bool exists
103 );
104 
105 
106 //- Write cloud field, returning true if the field is non-empty.
107 template<class Type>
108 bool writeCloudField
109 (
111  ensightFile& os,
112 
114  const UList<Type>& field,
115 
118  const globalIndex& procAddr
119 );
120 
121 
122 //- Write cloud field, returning true if the field is non-empty.
123 template<class Type>
124 bool writeCloudField
125 (
127  ensightFile& os,
128 
130  const UList<Type>& field
131 );
132 
133 
134 //- Read cloud field from IOobject (if exists == true) and write,
135 //- always returning true.
136 template<class Type>
138 (
140  ensightFile& os,
141 
143  const IOobject& fieldObject,
144 
146  bool existsAny
147 );
148 
149 
150 /*---------------------------------------------------------------------------*\
151  Namespace ensightOutput::Detail
152 \*---------------------------------------------------------------------------*/
153 
154 namespace Detail
155 {
156 
157 //- Write cloud field data (serial) with rounding and newlines.
158 // \return the current output count
159 template<class Type>
161 (
163  ensightFile& os,
164 
165  const UList<Type>& fld,
166 
168  label count = 0
169 );
170 
171 
172 } // End namespace Detail
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace ensightOutput
178 } // End namespace Foam
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #ifdef NoRepository
185 #endif
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
rDeltaTY field()
bool writeCloudPositions(ensightFile &os, DynamicList< floatVector > &positions, const globalIndex &procAddr)
Write cloud positions.
bool writeCloudField(ensightFile &os, const UList< Type > &field, const globalIndex &procAddr)
Write cloud field, returning true if the field is non-empty.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of &#39;true&#39; entries.
Definition: BitOps.H:73
dynamicFvMesh & mesh
const word cloudName(propsDict.get< word >("cloud"))
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: POSIX.C:837
bool readWriteCloudField(ensightFile &os, const IOobject &fieldObject, bool existsAny)
Read cloud field from IOobject (if exists == true) and write, always returning true.
OBJstream os(runTime.globalPath()/outputName)
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))
globalIndex procAddr(aMesh.nFaces())
label writeCloudFieldContent(ensightFile &os, const UList< Type > &fld, label count=0)
Write cloud field data (serial) with rounding and newlines.
Namespace for OpenFOAM.