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_.getObjectPtr<fvMesh>(regionName_);
66 
67  if (!regionPtr)
68  {
70  << "Region mesh not available" << abort(FatalError);
71  }
72 
73  return *regionPtr;
74 }
75 
76 
78 {
79  fvMesh* regionPtr = time_.getObjectPtr<fvMesh>(regionName_);
80 
81  if (!regionPtr)
82  {
84  << "Region mesh not available" << abort(FatalError);
85  }
86 
87  return *regionPtr;
88 }
89 
90 
92 {
93  return coeffs_;
94 }
95 
96 
97 inline const Foam::dictionary&
99 {
100  return regionMesh().solutionDict();
101 }
102 
103 
104 inline const Foam::IOdictionary&
106 {
107  if (!outputPropertiesPtr_.valid())
108  {
110  << "outputProperties dictionary not available"
111  << abort(FatalError);
112  }
113 
114  return *outputPropertiesPtr_;
115 }
116 
117 
118 inline Foam::IOdictionary&
120 {
121  if (!outputPropertiesPtr_.valid())
122  {
124  << "outputProperties dictionary not available"
125  << abort(FatalError);
126  }
127 
128  return *outputPropertiesPtr_;
129 }
130 
131 
133 (
134  const label regionPatchi
135 ) const
136 {
137  forAll(intCoupledPatchIDs_, i)
138  {
139  if (intCoupledPatchIDs_[i] == regionPatchi)
140  {
141  return true;
142  }
143  }
144 
145  return false;
146 }
147 
148 
150 (
151  const label primaryPatchi
152 ) const
153 {
154  forAll(primaryPatchIDs_, i)
155  {
156  if (primaryPatchIDs_[i] == primaryPatchi)
157  {
158  return true;
159  }
160  }
161 
162  return false;
163 }
164 
165 
166 inline const Foam::labelList&
168 {
169  return primaryPatchIDs_;
170 }
171 
172 
173 inline const Foam::labelList&
175 {
176  return intCoupledPatchIDs_;
177 }
178 
179 
181 (
182  const label primaryPatchID
183 ) const
184 {
185  forAll(primaryPatchIDs_, i)
186  {
187  if (primaryPatchIDs_[i] == primaryPatchID)
188  {
189  return intCoupledPatchIDs_[i];
190  }
191  }
192 
193  return -1;
194 }
195 
196 
197 // ************************************************************************* //
Foam::regionModels::regionModel::primaryMesh_
const fvMesh & primaryMesh_
Reference to the primary mesh database.
Definition: regionModel.H:87
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::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:76
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::active
Switch active() const
Return the active flag.
Definition: regionModelI.H:45
Foam::regionModels::regionModel::isRegionPatch
bool isRegionPatch(const label primaryPatchi) const
Return true if patchi on the primary region is a coupled.
Definition: regionModelI.H:150
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:296
Foam::regionModels::regionModel::primaryMesh
const fvMesh & primaryMesh() const
Return the reference to the primary mesh database.
Definition: regionModelI.H:33
Foam::regionModels::regionModel::isCoupledPatch
bool isCoupledPatch(const label regionPatchi) const
Return true if patchi on the local region is a coupled.
Definition: regionModelI.H:133
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:105
Foam::regionModels::regionModel::solution
const dictionary & solution() const
Return the solution dictionary.
Definition: regionModelI.H:98
Foam::regionModels::regionModel::regionPatchID
label regionPatchID(const label primaryPatchID) const
Return region ID corresponding to primaryPatchID.
Definition: regionModelI.H:181
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::infoOutput
Switch infoOutput() const
Return the information flag.
Definition: regionModelI.H:51
Foam::regionModels::regionModel::primaryPatchIDs
const labelList & primaryPatchIDs() const
Return the list of patch IDs on the primary region coupled.
Definition: regionModelI.H:167
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:372
Foam::List< label >
Foam::regionModels::regionModel::coeffs
const dictionary & coeffs() const
Return the model coefficients dictionary.
Definition: regionModelI.H:91
Foam::regionModels::regionModel::intCoupledPatchIDs
const labelList & intCoupledPatchIDs() const
Return the list of patch IDs internally coupled with the.
Definition: regionModelI.H:174