ensightOutputSurfaceTemplates.C
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) 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 \*---------------------------------------------------------------------------*/
27 
28 #include "ensightOutputSurface.H"
29 #include "ensightOutput.H"
30 
31 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32 
33 template<class Type>
35 (
36  ensightFile& os,
37  const Field<Type>& fld,
38  const bool isPointData
39 ) const
40 {
41  if (isPointData)
42  {
43  this->writePointData(os, fld);
44  }
45  else
46  {
47  this->writeFaceData(os, fld);
48  }
49 }
50 
51 
52 template<class Type>
54 (
55  ensightFile& os,
56  const Field<Type>& fld
57 ) const
58 {
60  (
61  os,
62  fld,
63  *this,
64  false /* serial only! */
65  );
66 }
67 
68 
69 template<class Type>
71 (
72  ensightFile& os,
73  const Field<Type>& fld
74 ) const
75 {
76  const ensightOutputSurface& part = *this;
77 
78  // No geometry or field
79  if (part.empty() || fld.empty())
80  {
81  return;
82  }
83 
84 
85  os.beginPart(part.index());
86 
88  (
89  os,
91  fld,
92  false /* serial only! */
93  );
94 }
95 
96 
97 // ************************************************************************* //
Foam::ensightPart::index
label index() const noexcept
The index in a list (0-based)
Definition: ensightPart.H:124
Foam::ensightOutput::Detail::writeFieldComponents
bool writeFieldComponents(ensightFile &os, const char *key, const FieldContainer< Type > &fld, bool parallel)
Write field content (component-wise) for the given ensight element type.
Definition: ensightOutputTemplates.C:161
Foam::ensightOutputSurface::writeFaceData
void writeFaceData(ensightFile &os, const Field< Type > &fld) const
Write a field of face values (serial-only)
Definition: ensightOutputSurfaceTemplates.C:54
Foam::ensightPart::empty
bool empty() const noexcept
Processor-local test for any elements.
Definition: ensightPart.H:148
Foam::ensightOutputSurface::writePointData
void writePointData(ensightFile &os, const Field< Type > &fld) const
Write a field of point values (serial-only)
Definition: ensightOutputSurfaceTemplates.C:71
ensightOutput.H
Foam::Field
Generic templated field type.
Definition: Field.H:63
coordinates
PtrList< coordinateSystem > coordinates(solidRegions.size())
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
os
OBJstream os(runTime.globalPath()/outputName)
Foam::ensightOutputSurface::writeData
void writeData(ensightFile &os, const Field< Type > &fld, const bool isPointData=false) const
Write a field of face or point values (serial-only)
Definition: ensightOutputSurfaceTemplates.C:35
Foam::ensightFile
Ensight output with specialized write() for strings, integers and floats. Correctly handles binary wr...
Definition: ensightFile.H:52
Foam::ensightOutputSurface
A variant of ensightFaces that holds references to contiguous points/faces with its own encapsulated ...
Definition: ensightOutputSurface.H:58
Foam::ensightOutput::writeField
bool writeField(ensightFile &os, const Field< Type > &fld, const ensightCells &part, bool parallel)
Definition: ensightOutputTemplates.C:313
ensightOutputSurface.H