ccmBoundaryInfo.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 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  Container for holding STARCCM boundary information
28 
29 \*---------------------------------------------------------------------------*/
30 #ifndef ccmBoundaryInfo_H
31 #define ccmBoundaryInfo_H
32 
33 #include "word.H"
34 #include "Ostream.H"
35 
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 
39 // internal use only - skip doxygen documentation
40 namespace Foam
41 {
42 namespace ccm
43 {
44 
45 class ccmBoundaryInfo;
46 Ostream& operator<<(Ostream& os, const ccmBoundaryInfo& entry);
47 
48 /*---------------------------------------------------------------------------*\
49  Class Foam::ccm::ccmBoundaryInfo Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 //- Helper when reading raw boundary information
53 class ccmBoundaryInfo
54 {
55 public:
56  //- The ccm region
57  int ccmIndex;
58 
59  //- Number of faces
60  label size;
61 
62  //- The openfoam patch id to map to
63  label patchId;
64 
65  //- The patch name, as per the BoundaryRegion "Label" entry
66  std::string patchName;
67 
68  //- The patch type, as per the BoundaryRegion "BoundaryType" entry
69  std::string patchType;
70 
71 
72  //- Construct null
73  ccmBoundaryInfo()
74  :
75  ccmIndex(0),
76  size(0),
77  patchId(-1),
78  patchName(),
79  patchType("patch")
80  {}
81 
82 
83  //- Set patch name, default to "patch_CCMID" for an empty string
84  void setPatchName(const std::string& str)
85  {
86  if (str.empty())
87  {
88  patchName = "patch_" + ::Foam::name(ccmIndex);
89  }
90  else
91  {
92  patchName = str;
93  }
94  }
95 
96 
97  //- Info doesn't match if the ccm boundaries are different
98  bool operator!=(const ccmBoundaryInfo& rhs) const
99  {
100  return ccmIndex != rhs.ccmIndex;
101  }
102 
103 
104  //- Ostream Operator
105  friend Ostream& operator<<(Ostream& os, const ccmBoundaryInfo& entry)
106  {
107  os << "BoundaryFaces-" << entry.ccmIndex;
108  os << " size=" << entry.size;
109  os << " name=" << entry.patchName;
110  os << " type=" << entry.patchType;
111  os << " foam-patch=" << entry.patchId;
112 
113  return os;
114  }
115 };
116 
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 } // End namespace ccm
121 } // End namespace Foam
122 
124 // internal use only - skip doxygen documentation
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 #endif
129 
130 // ************************************************************************* //
Foam::ccm::operator<<
Ostream & operator<<(Ostream &os, const interfaceEntry &entry)
Definition: ccmInterfaceDefinitions.H:158
Foam::operator!=
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:235
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Ostream.H
patchId
label patchId(-1)
word.H