ensightWriteTemplates.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) 2016-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
30// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
31
32template<class Type>
33Foam::label Foam::functionObjects::ensightWrite::writeVolFields
34(
35 const fvMeshSubset& proxy,
36 const wordHashSet& acceptField
37)
38{
40
41 const fvMesh& baseMesh = proxy.baseMesh();
42
43 label count = 0;
44
45 for (const word& fieldName : baseMesh.sortedNames<GeoField>(acceptField))
46 {
47 const auto* fieldptr = baseMesh.findObject<GeoField>(fieldName);
48
49 if (!fieldptr)
50 {
51 continue;
52 }
53
54 auto tfield = fvMeshSubsetProxy::interpolate(proxy, *fieldptr);
55 const auto& field = tfield();
56
57 autoPtr<ensightFile> os = ensCase().newData<Type>(fieldName);
58
59 ensightOutput::writeVolField<Type>
60 (
61 os.ref(),
62 field,
63 ensMesh(),
64 caseOpts_.nodeValues()
65 );
66
67 Log << ' ' << fieldName;
68
69 ++count;
70 }
71
72 return count;
73}
74
75
76// ************************************************************************* //
#define Log
Definition: PDRblock.C:35
Generic GeometricField class.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
bool nodeValues() const noexcept
Forced use of values per node instead of per element.
Definition: ensightCase.H:453
autoPtr< ensightFile > newData(const word &varName, const bool isPointData=false) const
Open stream for new data file (on master), with current index.
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
Definition: fvMeshSubset.H:80
const fvMesh & baseMesh() const noexcept
Original mesh.
Definition: fvMeshSubsetI.H:30
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
wordList sortedNames() const
The sorted names of all objects.
const Type * findObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
bool interpolate() const noexcept
Same as isPointData()
A class for handling words, derived from Foam::string.
Definition: word.H:68
rDeltaTY field()
A collection of functions for writing volField content in ensight format.
OBJstream os(runTime.globalPath()/outputName)