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-------------------------------------------------------------------------------
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
26\*---------------------------------------------------------------------------*/
27
29#include "ensightOutput.H"
30
31// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32
33template<class Type>
35(
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
52template<class Type>
54(
56 const Field<Type>& fld
57) const
58{
60 (
61 os,
62 fld,
63 *this,
64 false /* serial only! */
65 );
66}
67
68
69template<class Type>
71(
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// ************************************************************************* //
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Generic templated field type.
Definition: Field.H:82
Ensight output with specialized write() for strings, integers and floats. Correctly handles binary wr...
Definition: ensightFile.H:55
static const char *const coordinates
The keyword "coordinates".
Definition: ensightFile.H:88
A variant of ensightFaces that holds references to contiguous points/faces with its own encapsulated ...
void writePointData(ensightFile &os, const Field< Type > &fld) const
Write a field of point values (serial-only)
void writeFaceData(ensightFile &os, const Field< Type > &fld) const
Write a field of face values (serial-only)
void writeData(ensightFile &os, const Field< Type > &fld, const bool isPointData=false) const
Write a field of face or point values (serial-only)
bool empty() const noexcept
Processor-local test for any elements.
Definition: ensightPart.H:148
label index() const noexcept
The index in a list (0-based)
Definition: ensightPart.H:124
OBJstream os(runTime.globalPath()/outputName)
bool writeFieldComponents(ensightFile &os, const char *key, const FieldContainer< Type > &fld, bool parallel)
Write field content (component-wise) for the given ensight element type.
bool writeField(ensightFile &os, const Field< Type > &fld, const ensightCells &part, bool parallel)