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