surfaceFormatsCore.H
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) 2011 OpenFOAM Foundation
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 Class
27  Foam::fileFormats::surfaceFormatsCore
28 
29 Description
30  A collection of helper functions for reading/writing surface formats.
31 
32 SourceFiles
33  surfaceFormatsCore.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef surfaceFormatsCore_H
38 #define surfaceFormatsCore_H
39 
40 #include "Map.H"
41 #include "HashSet.H"
42 #include "labelList.H"
43 #include "surfZoneList.H"
44 #include "surfZoneIdentifierList.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declarations
52 class ISstream;
53 class Time;
54 
55 namespace fileFormats
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class fileFormats::surfaceFormatsCore Declaration
60 \*---------------------------------------------------------------------------*/
61 
63 {
64 protected:
65 
66  //- Read non-empty and non-comment line
67  static string getLineNoComment(ISstream& is, const char comment='#');
68 
69 
70  //- Return a surfZone list with a single entry, the size of which
71  //- corresponds to that of the container
72  template<class Container>
74  (
75  const Container& container,
76  const word& name = "zone0"
77  )
78  {
79  return List<surfZone>(1, surfZone(name, container.size(), 0, 0));
80  }
81 
82 public:
83 
84  // Static Data
85 
86  //- The file extension corresponding to 'native' surface format
87  // Normally "ofs" (mnemonic: OF = OpenFOAM, S = Surface)
88  static word nativeExt;
89 
90 
91  // Static Member Functions
92 
93  //- Helper function when checking if a file extension is supported.
94  static bool checkSupport
95  (
96  const wordHashSet& available,
97  const word& ext,
98  const bool verbose,
99  const word& functionName
100  );
101 
102  //- Return the local file name (within time directory)
103  // NEEDS FIXING
105  (
106  const word& surfName = word::null
107  );
108 
109  //- Find instance with surfName
110  // NEEDS FIXING
112  (
113  const Time&,
114  const word& surfName = word::null
115  );
116 
117  //- Find mesh file with surfName
118  // NEEDS FIXING
119  static fileName findMeshFile
120  (
121  const Time&,
122  const word& surfName = word::null
123  );
124 
125 
126  // Constructors
127 
128  //- Construct null
129  surfaceFormatsCore() = default;
130 
131 
132  //- Destructor
133  virtual ~surfaceFormatsCore() = default;
134 
135 };
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace fileFormats
141 } // End namespace Foam
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 #endif
146 
147 // ************************************************************************* //
Foam::fileFormats::surfaceFormatsCore
A collection of helper functions for reading/writing surface formats.
Definition: surfaceFormatsCore.H:61
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::fileFormats::surfaceFormatsCore::nativeExt
static word nativeExt
The file extension corresponding to 'native' surface format.
Definition: surfaceFormatsCore.H:87
Foam::ISstream
Generic input stream using standard (STL) streams.
Definition: ISstream.H:54
Foam::HashSet< word >
Foam::fileFormats::surfaceFormatsCore::~surfaceFormatsCore
virtual ~surfaceFormatsCore()=default
Destructor.
Foam::fileFormats::surfaceFormatsCore::surfaceFormatsCore
surfaceFormatsCore()=default
Construct null.
Map.H
labelList.H
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::fileFormats::surfaceFormatsCore::getLineNoComment
static string getLineNoComment(ISstream &is, const char comment='#')
Read non-empty and non-comment line.
Definition: surfaceFormatsCore.C:44
HashSet.H
Foam::fileFormats::surfaceFormatsCore::oneZone
static List< surfZone > oneZone(const Container &container, const word &name="zone0")
Definition: surfaceFormatsCore.H:73
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fileFormats::surfaceFormatsCore::findMeshFile
static fileName findMeshFile(const Time &, const word &surfName=word::null)
Find mesh file with surfName.
Foam::fileFormats::surfaceFormatsCore::localMeshFileName
static fileName localMeshFileName(const word &surfName=word::null)
Return the local file name (within time directory)
Foam::List< surfZone >
Foam::surfZone
A surface zone on a MeshedSurface.
Definition: surfZone.H:65
Foam::fileFormats::surfaceFormatsCore::findMeshInstance
static fileName findMeshInstance(const Time &, const word &surfName=word::null)
Find instance with surfName.
Foam::word::null
static const word null
An empty word.
Definition: word.H:77
surfZoneList.H
Foam::fileFormats::surfaceFormatsCore::checkSupport
static bool checkSupport(const wordHashSet &available, const word &ext, const bool verbose, const word &functionName)
Helper function when checking if a file extension is supported.
Definition: surfaceFormatsCore.C:161
surfZoneIdentifierList.H