regionModelI.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 | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "regionModel.H"
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 inline const Foam::fvMesh&
32 {
33  return primaryMesh_;
34 }
35 
36 
38 {
39  return time_;
40 }
41 
42 
44 {
45  return active_;
46 }
47 
48 
50 {
51  return infoOutput_;
52 }
53 
54 
56 {
57  return modelName_;
58 }
59 
60 
62 {
63  if (time_.foundObject<fvMesh>(regionName_))
64  {
65  return time_.lookupObject<fvMesh>(regionName_);
66  }
67  else if (!regionMeshPtr_.valid())
68  {
70  << "Region mesh not available" << abort(FatalError);
71  }
72 
73  return regionMeshPtr_();
74 }
75 
76 
78 {
79  if (time_.foundObject<fvMesh>(regionName_))
80  {
81  return const_cast<fvMesh&>
82  (
83  time_.lookupObject<fvMesh>(regionName_)
84  );
85  }
86  else if (!regionMeshPtr_.valid())
87  {
89  << "Region mesh not available" << abort(FatalError);
90  }
91 
92  return regionMeshPtr_();
93 }
94 
95 
97 {
98  return coeffs_;
99 }
100 
101 
102 inline const Foam::dictionary&
104 {
105  return regionMesh().solutionDict();
106 }
107 
108 
109 inline const Foam::IOdictionary&
111 {
112  if (!outputPropertiesPtr_.valid())
113  {
115  << "outputProperties dictionary not available"
116  << abort(FatalError);
117  }
118 
119  return outputPropertiesPtr_();
120 }
121 
122 
123 inline Foam::IOdictionary&
125 {
126  if (!outputPropertiesPtr_.valid())
127  {
129  << "outputProperties dictionary not available"
130  << abort(FatalError);
131  }
132 
133  return outputPropertiesPtr_();
134 }
135 
136 
138 (
139  const label regionPatchI
140 ) const
141 {
142  forAll(intCoupledPatchIDs_, i)
143  {
144  if (intCoupledPatchIDs_[i] == regionPatchI)
145  {
146  return true;
147  }
148  }
149 
150  return false;
151 }
152 
153 
155 (
156  const label primaryPatchI
157 ) const
158 {
159  forAll(primaryPatchIDs_, i)
160  {
161  if (primaryPatchIDs_[i] == primaryPatchI)
162  {
163  return true;
164  }
165  }
166 
167  return false;
168 }
169 
170 
171 inline const Foam::labelList&
173 {
174  return primaryPatchIDs_;
175 }
176 
177 
178 inline const Foam::labelList&
180 {
181  return intCoupledPatchIDs_;
182 }
183 
184 
186 (
187  const label primaryPatchID
188 ) const
189 {
190  forAll(primaryPatchIDs_, i)
191  {
192  if (primaryPatchIDs_[i] == primaryPatchID)
193  {
194  return intCoupledPatchIDs_[i];
195  }
196  }
197 
198  return -1;
199 }
200 
201 
202 // ************************************************************************* //
Foam::regionModels::regionModel::primaryMesh_
const fvMesh & primaryMesh_
Reference to the primary mesh database.
Definition: regionModel.H:87
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
Foam::regionModels::regionModel::active
const Switch & active() const
Return the active flag.
Definition: regionModelI.H:43
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:60
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::regionModels::regionModel::isCoupledPatch
bool isCoupledPatch(const label regionPatchI) const
Return true if patchI on the local region is a coupled.
Definition: regionModelI.H:138
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::regionModels::regionModel::outputProperties
const IOdictionary & outputProperties() const
Return const access to the output properties dictionary.
Definition: regionModelI.H:110
Foam::regionModels::regionModel::time
const Time & time() const
Return the reference to the time database.
Definition: regionModelI.H:37
Foam::regionModels::regionModel::isRegionPatch
bool isRegionPatch(const label primaryPatchI) const
Return true if patchI on the primary region is a coupled.
Definition: regionModelI.H:155
regionModel.H
Foam::regionModels::regionModel::modelName
const word & modelName() const
Return the model name.
Definition: regionModelI.H:55
Foam::regionModels::regionModel::primaryMesh
const fvMesh & primaryMesh() const
Return the reference to the primary mesh database.
Definition: regionModelI.H:31
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::regionModels::regionModel::solution
const dictionary & solution() const
Return the solution dictionary.
Definition: regionModelI.H:103
Foam::regionModels::regionModel::regionPatchID
label regionPatchID(const label primaryPatchID) const
Return region ID corresponding to primaryPatchID.
Definition: regionModelI.H:186
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::regionModels::regionModel::primaryPatchIDs
const labelList & primaryPatchIDs() const
Return the list of patch IDs on the primary region coupled.
Definition: regionModelI.H:172
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::regionModels::regionModel::coeffs
const dictionary & coeffs() const
Return the model coefficients dictionary.
Definition: regionModelI.H:96
Foam::objectRegistry::lookupObject
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Definition: objectRegistryTemplates.C:165
Foam::regionModels::regionModel::infoOutput
const Switch & infoOutput() const
Return the information flag.
Definition: regionModelI.H:49
Foam::regionModels::regionModel::intCoupledPatchIDs
const labelList & intCoupledPatchIDs() const
Return the list of patch IDs internally coupled with the.
Definition: regionModelI.H:179
Foam::regionModels::regionModel::regionMesh
const fvMesh & regionMesh() const
Return the region mesh database.
Definition: regionModelI.H:61