ensightCaseTemplates.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
28#include "cloud.H"
29#include "ensightPTraits.H"
30
31// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32
33template<class Type>
36(
37 const word& name,
38 const bool isPointData
39) const
40{
42
43 if (Pstream::master())
44 {
45 const ensight::VarName varName(name);
46
47 output = createDataFile(varName);
48
49 // Description
51 (
52 string
53 (
54 padded(timeIndex_) / varName
55 + " <" + pTraits<Type>::typeName + ">"
56 )
57 );
58 output().newline();
59
60 // Remember the field variable for later use
61 noteVariable(varName, ensightPTraits<Type>::typeName);
62
63 // Could warn about existing variables that changed representation
64 if (isPointData)
65 {
66 nodeVariables_.set(varName);
67 }
68 }
69
70 return output;
71}
72
73
74template<class Type>
77(
78 const word& name
79) const
80{
81 return newData<Type>(name, true); // POINT_DATA
82}
83
84
85template<class Type>
88(
89 const word& cloudName,
90 const word& name
91) const
92{
94
95 if (Pstream::master())
96 {
97 const ensight::VarName varName(name);
98 output = createCloudFile(cloudName, varName);
99
100 // Description
101 output().write
102 (
103 string
104 (
105 padded(timeIndex_) / cloudName / varName
106 + " <" + pTraits<Type>::typeName + ">"
107 )
108 );
109 output().newline();
110
111 // Remember the cloud variable for later use
112 noteCloud(cloudName, varName, ensightPTraits<Type>::typeName);
113 }
114
115 return output;
116}
117
118
119// ************************************************************************* //
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
autoPtr< ensightFile > newData(const word &varName, const bool isPointData=false) const
Open stream for new data file (on master), with current index.
autoPtr< ensightFile > newPointData(const word &varName) const
word padded(const label i) const
Consistent zero-padded integer value.
Definition: ensightCaseI.H:54
autoPtr< ensightFile > newCloudData(const word &cloudName, const word &varName) const
Open stream for new cloud data file (on master), with current index.
Specification of a valid Ensight variable-name.
A traits class, which is primarily used for primitives.
Definition: pTraits.H:59
splitCell * master() const
Definition: splitCell.H:113
A class for handling words, derived from Foam::string.
Definition: word.H:68
static Ostream & output(Ostream &os, const IntRange< T > &range)
Definition: IntRanges.C:66
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Ensight names and component order for base types.
const word cloudName(propsDict.get< word >("cloud"))