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 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 "cloud.H"
29 #include "ensightPTraits.H"
30 
31 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32 
33 template<class Type>
36 (
37  const word& name
38 ) const
39 {
40  autoPtr<ensightFile> output;
41 
42  if (Pstream::master())
43  {
44  const ensight::VarName varName(name);
45  output = createDataFile(varName);
46 
47  // description
48  output().write
49  (
50  string
51  (
52  padded(timeIndex_) / varName
53  + " <" + pTraits<Type>::typeName + ">"
54  )
55  );
56  output().newline();
57 
58  // note field variable for later use
59  noteVariable(varName, ensightPTraits<Type>::typeName);
60  }
61 
62  return output;
63 }
64 
65 
66 template<class Type>
69 (
70  const word& cloudName,
71  const word& name
72 ) const
73 {
75 
76  if (Pstream::master())
77  {
78  const ensight::VarName varName(name);
79  output = createCloudFile(cloudName, varName);
80 
81  // description
82  output().write
83  (
84  string
85  (
86  padded(timeIndex_) / cloudName / varName
87  + " <" + pTraits<Type>::typeName + ">"
88  )
89  );
90  output().newline();
91 
92  // note cloud variable for later use
93  noteCloud(cloudName, varName, ensightPTraits<Type>::typeName);
94  }
95 
96  return output;
97 }
98 
99 
100 // ************************************************************************* //
cloudName
const word cloudName(propsDict.get< word >("cloud"))
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::ensightCase::newData
autoPtr< ensightFile > newData(const word &varName) const
Open stream for new data file (on master), with current index.
cloud.H
Foam::ensightCase::newCloudData
autoPtr< ensightFile > newCloudData(const word &cloudName, const word &varName) const
Open stream for new cloud data file (on master), with current index.
Foam::ensightPTraits
Conversion of OpenFOAM pTraits into the Ensight equivalent.
Definition: ensightPTraits.H:54
Foam::ensight::VarName
Specification of a valid Ensight variable-name.
Definition: ensightVarName.H:58
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
ensightPTraits.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::pTraits
Traits class for primitives.
Definition: pTraits.H:52