ccmInternal.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) 2016-2020 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 Description
27  Internal bits for wrapping libccmio - do not use directly
28 
29 \*---------------------------------------------------------------------------*/
30 #ifndef ccmInternal_H
31 #define ccmInternal_H
32 
33 #include "className.H"
34 #include "List.H"
35 
36 // Headers and definitions for using libccmio
37 #include "libccmio/ccmio.h"
38 
39 // Low-level routines are also needed
40 #include "libccmio/ccmiocore.h"
41 #include "libccmio/ccmioutility.h"
42 
43 // Do not allow these defines to leak through
44 #undef TRUE
45 #undef FALSE
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 // @cond
50 // internal use only - skip doxygen documentation
51 namespace Foam
52 {
53 namespace ccm
54 {
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 //- Declare namespace and debug information.
59 NamespaceName("ccm");
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 
64 //- A C++ wrapper for the C struct
65 class ccmID : public CCMIOID {};
66 
67 //- A C++ wrapper for the C struct
68 class ccmNODE
69 :
70  public CCMIONode
71 {
72 public:
73 
74  //- Recast constructor
75  ccmNODE(CCMIONode node)
76  :
77  CCMIONode(node)
78  {}
79 };
80 
81 
82 //- A C++ wrapper for the enum
83 class ccmDimension
84 {
85  CCMIODimensionality dims_;
86 
87 public:
88 
89  //- Construct from components
90  ccmDimension(CCMIODimensionality dims)
91  :
92  dims_(dims)
93  {}
94 
95  //- Return underlying enum
96  CCMIODimensionality operator()() const
97  {
98  return dims_;
99  }
100 };
101 
102 
103 //- Maintain overall global states (error, rootNode)
104 class ccmGlobalState
105 {
106 public:
107 
108  //- Maintain error state between calls
109  CCMIOError error;
110 
111  //- Root node in the CCM file
112  ccmID root;
113 
114  //- Null constructor. Start with no error, but root in invalid state.
115  ccmGlobalState();
116 
117  //- True if there is an error
118  bool hasError() const
119  {
120  return (error != kCCMIONoErr);
121  }
122 
123  //- Die with msg if there is an error
124  // Return true if there is no error
125  static bool assertNoError(CCMIOError err, const char *msg);
126 
127  //- Die with msg if there is an error
128  // Return true if there is no error
129  static bool assertNoError(CCMIOError err, const std::string& msg);
130 
131  //- Die with msg if there is an error
132  // Return true if there is no error
133  bool assertNoError(const char *msg) const;
134 
135  //- Die with msg if there is an error
136  // Return true if there is no error
137  bool assertNoError(const std::string& msg) const;
138 
139 };
140 
141 
142 //- MapIds for various parts
143 class ccmMaps
144 {
145 public:
146 
147  //- The cell map
148  ccmID cells;
149 
150  //- The internalFaces map
151  ccmID internalFaces;
152 
153  //- Boundary region maps
154  List<ccmID> boundary;
155 };
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace ccm
161 } // End namespace Foam
162 
163 // @endcond
164 // internal use only - skip doxygen documentation
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
List.H
className.H
Macro definitions for declaring ClassName(), NamespaceName(), etc.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
cells
const cellShapeList & cells
Definition: gmvOutputHeader.H:3
NamespaceName
#define NamespaceName(TypeNameString)
Add typeName information from argument TypeNameString to a namespace.
Definition: className.H:73
boundary
faceListList boundary
Definition: createBlockMesh.H:4