Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
10License
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
26InNamespace
27 Foam::ensightOutput
28
29Description
30 A collection of functions for writing clouds as ensight file content.
31
32SourceFiles
33 ensightOutputCloud.cxx
34 ensightOutputCloud.txx
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
48namespace Foam
49{
50
51// Forward Declarations
52class fvMesh;
53class globalIndex;
54
55namespace ensightOutput
56{
57
58// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59
61//- Write cloud positions
63(
66
69 DynamicList<floatVector>& positions,
70
73 const globalIndex& procAddr
74);
75
76
77//- Write cloud positions
79(
82
86);
87
88
89//- Write cloud positions
91(
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.
107template<class Type>
109(
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.
123template<class Type>
125(
128
131);
132
133
134//- Read cloud field from IOobject (if exists == true) and write,
135//- always returning true.
136template<class Type>
138(
141
143 const IOobject& fieldObject,
144
146 bool existsAny
147);
148
149
150/*---------------------------------------------------------------------------*\
151 Namespace ensightOutput::Detail
152\*---------------------------------------------------------------------------*/
153
154namespace Detail
155{
156
157//- Write cloud field data (serial) with rounding and newlines.
158// \return the current output count
159template<class Type>
161(
164
165 const UList<Type>& fld,
166
168 label count = 0
169);
170
172} // End namespace Detail
173
174
175// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176
177} // End namespace ensightOutput
178} // End namespace Foam
179
180
181// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182
183#ifdef NoRepository
184 #include "ensightOutputCloud.txx"
185#endif
186
187// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188
189#endif
190
191// ************************************************************************* //
const word cloudName(propsDict.get< word >("cloud"))
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition DynamicList.H:68
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition UList.H:89
A variant of OFstream with specialised handling for Ensight writing of strings, integers and floats (...
Definition ensightFile.H:50
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
Definition globalIndex.H:77
A class for handling words, derived from Foam::string.
Definition word.H:66
rDeltaTY field()
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
Implementation details and output backends that would not normally be called directly by a user.
label writeCloudFieldContent(ensightFile &os, const UList< Type > &fld, label count=0)
Write cloud field data (serial) with rounding and newlines.
A collection of functions for writing ensight file content.
bool writeCloudField(ensightFile &os, const UList< Type > &field, const globalIndex &procAddr)
Write cloud field, returning true if the field is non-empty.
bool writeCloudPositions(ensightFile &os, DynamicList< floatVector > &positions, const globalIndex &procAddr)
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.
Namespace for OpenFOAM.
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