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-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 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 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward Declarations
50 class fvMesh;
51 
52 namespace ensightOutput
53 {
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 
58 //- Write cloud positions
60 (
62  ensightFile& os,
63 
65  const fvMesh& mesh,
66 
68  const word& cloudName,
69 
71  bool exists
72 );
73 
74 
75 //- Write cloud field, returning true if the field is non-empty.
76 template<class Type>
77 bool writeCloudField
78 (
80  ensightFile& os,
81 
83  const IOField<Type>& field
84 );
85 
86 
87 //- Read cloud field from IOobject (if exists == true) and write,
88 //- always returning true.
89 template<class Type>
91 (
93  ensightFile& os,
94 
96  const IOobject& fieldObject,
97 
99  bool existsAny
100 );
101 
102 
103 /*---------------------------------------------------------------------------*\
104  Namespace ensightOutput::Detail
105 \*---------------------------------------------------------------------------*/
106 
107 namespace Detail
108 {
109 
110 //- Write cloud field data (serial) with rounding and newlines.
111 // \return the current output count
112 template<class Type>
114 (
116  ensightFile& os,
117 
118  const UList<Type>& fld,
119 
121  label count = 0
122 );
123 
124 
125 } // End namespace Detail
126 
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 } // End namespace ensightOutput
131 } // End namespace Foam
132 
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #ifdef NoRepository
138 #endif
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 #endif
143 
144 // ************************************************************************* //
rDeltaTY field()
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:835
bool writeCloudPositions(ensightFile &os, const fvMesh &mesh, const word &cloudName, bool exists)
Write cloud positions.
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))
bool writeCloudField(ensightFile &os, const IOField< Type > &field)
Write cloud field, returning true if the field is non-empty.
label writeCloudFieldContent(ensightFile &os, const UList< Type > &fld, label count=0)
Write cloud field data (serial) with rounding and newlines.
Namespace for OpenFOAM.