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