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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
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 \*---------------------------------------------------------------------------*/
27 
28 #include "regionModel.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 inline const Foam::fvMesh&
34 {
35  return primaryMesh_;
36 }
37 
38 
40 {
41  return time_;
42 }
43 
44 
46 {
47  return active_;
48 }
49 
50 
52 {
53  return infoOutput_;
54 }
55 
56 
58 {
59  return modelName_;
60 }
61 
62 
64 {
65  const fvMesh* regionPtr = time_.findObject<fvMesh>(regionName_);
66 
67  if (regionPtr)
68  {
69  return *regionPtr;
70  }
71  else if (!regionMeshPtr_.valid())
72  {
74  << "Region mesh not available" << abort(FatalError);
75  }
76 
77  return *regionMeshPtr_;
78 }
79 
80 
82 {
83  fvMesh* regionPtr = time_.getObjectPtr<fvMesh>(regionName_);
84 
85  if (regionPtr)
86  {
87  return *regionPtr;
88  }
89  else if (!regionMeshPtr_.valid())
90  {
92  << "Region mesh not available" << abort(FatalError);
93  }
94 
95  return *regionMeshPtr_;
96 }
97 
98 
100 {
101  return coeffs_;
102 }
103 
104 
105 inline const Foam::dictionary&
107 {
108  return regionMesh().solutionDict();
109 }
110 
111 
112 inline const Foam::IOdictionary&
114 {
115  if (!outputPropertiesPtr_.valid())
116  {
118  << "outputProperties dictionary not available"
119  << abort(FatalError);
120  }
121 
122  return *outputPropertiesPtr_;
123 }
124 
125 
126 inline Foam::IOdictionary&
128 {
129  if (!outputPropertiesPtr_.valid())
130  {
132  << "outputProperties dictionary not available"
133  << abort(FatalError);
134  }
135 
136  return *outputPropertiesPtr_;
137 }
138 
139 
141 (
142  const label regionPatchi
143 ) const
144 {
145  forAll(intCoupledPatchIDs_, i)
146  {
147  if (intCoupledPatchIDs_[i] == regionPatchi)
148  {
149  return true;
150  }
151  }
152 
153  return false;
154 }
155 
156 
158 (
159  const label primaryPatchi
160 ) const
161 {
162  forAll(primaryPatchIDs_, i)
163  {
164  if (primaryPatchIDs_[i] == primaryPatchi)
165  {
166  return true;
167  }
168  }
169 
170  return false;
171 }
172 
173 
174 inline const Foam::labelList&
176 {
177  return primaryPatchIDs_;
178 }
179 
180 
181 inline const Foam::labelList&
183 {
184  return intCoupledPatchIDs_;
185 }
186 
187 
189 (
190  const label primaryPatchID
191 ) const
192 {
193  forAll(primaryPatchIDs_, i)
194  {
195  if (primaryPatchIDs_[i] == primaryPatchID)
196  {
197  return intCoupledPatchIDs_[i];
198  }
199  }
200 
201  return -1;
202 }
203 
204 
205 // ************************************************************************* //
Foam::regionModels::regionModel::primaryMesh_
const fvMesh & primaryMesh_
Reference to the primary mesh database.
Definition: regionModel.H:86
Foam::objectRegistry::getObjectPtr
Type * getObjectPtr(const word &name, const bool recursive=false) const
Definition: objectRegistryTemplates.C:423
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::regionModels::regionModel::active
const Switch & active() const
Return the active flag.
Definition: regionModelI.H:45
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:70
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::regionModels::regionModel::isRegionPatch
bool isRegionPatch(const label primaryPatchi) const
Return true if patchi on the primary region is a coupled.
Definition: regionModelI.H:158
Foam::regionModels::regionModel::time
const Time & time() const
Return the reference to the time database.
Definition: regionModelI.H:39
regionModel.H
Foam::regionModels::regionModel::modelName
const word & modelName() const
Return the model name.
Definition: regionModelI.H:57
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:290
Foam::regionModels::regionModel::primaryMesh
const fvMesh & primaryMesh() const
Return the reference to the primary mesh database.
Definition: regionModelI.H:33
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:62
Foam::regionModels::regionModel::isCoupledPatch
bool isCoupledPatch(const label regionPatchi) const
Return true if patchi on the local region is a coupled.
Definition: regionModelI.H:141
Foam::regionModels::regionModel::regionMesh
const fvMesh & regionMesh() const
Return the region mesh database.
Definition: regionModelI.H:63
Foam::regionModels::regionModel::outputProperties
const IOdictionary & outputProperties() const
Return const access to the output properties dictionary.
Definition: regionModelI.H:113
Foam::regionModels::regionModel::solution
const dictionary & solution() const
Return the solution dictionary.
Definition: regionModelI.H:106
Foam::regionModels::regionModel::regionPatchID
label regionPatchID(const label primaryPatchID) const
Return region ID corresponding to primaryPatchID.
Definition: regionModelI.H:189
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:137
Foam::regionModels::regionModel::primaryPatchIDs
const labelList & primaryPatchIDs() const
Return the list of patch IDs on the primary region coupled.
Definition: regionModelI.H:175
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:355
Foam::objectRegistry::findObject
const Type * findObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
Definition: objectRegistryTemplates.C:401
Foam::List< label >
Foam::regionModels::regionModel::coeffs
const dictionary & coeffs() const
Return the model coefficients dictionary.
Definition: regionModelI.H:99
Foam::regionModels::regionModel::infoOutput
const Switch & infoOutput() const
Return the information flag.
Definition: regionModelI.H:51
Foam::regionModels::regionModel::intCoupledPatchIDs
const labelList & intCoupledPatchIDs() const
Return the list of patch IDs internally coupled with the.
Definition: regionModelI.H:182