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  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "regionModel.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
34 {
35  const fvMesh* regionPtr = time_.getObjectPtr<fvMesh>(regionName_);
36 
37  if (!regionPtr)
38  {
40  << "Region mesh not available" << abort(FatalError);
41  }
42 
43  return *regionPtr;
44 }
45 
46 
48 {
49  fvMesh* regionPtr = time_.getObjectPtr<fvMesh>(regionName_);
50 
51  if (!regionPtr)
52  {
54  << "Region mesh not available" << abort(FatalError);
55  }
56 
57  return *regionPtr;
58 }
59 
60 
61 inline const Foam::dictionary&
63 {
64  return regionMesh().solutionDict();
65 }
66 
67 
68 inline const Foam::IOdictionary&
70 {
71  if (!outputPropertiesPtr_)
72  {
74  << "outputProperties dictionary not available"
75  << abort(FatalError);
76  }
77 
78  return *outputPropertiesPtr_;
79 }
80 
81 
82 inline Foam::IOdictionary&
84 {
85  if (!outputPropertiesPtr_)
86  {
88  << "outputProperties dictionary not available"
89  << abort(FatalError);
90  }
91 
92  return *outputPropertiesPtr_;
93 }
94 
95 
96 inline const Foam::labelList&
98 {
99  return primaryPatchIDs_;
100 }
101 
102 
103 inline const Foam::labelList&
105 {
106  return intCoupledPatchIDs_;
107 }
108 
109 
111 (
112  const label regionPatchi
113 ) const
114 {
115  return intCoupledPatchIDs_.found(regionPatchi);
116 }
117 
118 
120 (
121  const label primaryPatchi
122 ) const
123 {
124  return primaryPatchIDs_.found(primaryPatchi);
125 }
126 
127 
129 (
130  const label primaryPatchi
131 ) const
132 {
133  const label i = primaryPatchIDs_.find(primaryPatchi);
134 
135  return (i >= 0 ? intCoupledPatchIDs_[i] : -1);
136 }
137 
138 
139 // ************************************************************************* //
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
bool isRegionPatch(const label primaryPatchi) const
True if patchi on the primary region is a coupled patch to the local region.
Definition: regionModelI.H:113
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:598
const labelList & primaryPatchIDs() const noexcept
List of patch IDs on the primary region coupled to this region.
Definition: regionModelI.H:90
label regionPatchID(const label primaryPatchi) const
Return region ID corresponding to primaryPatch ID.
Definition: regionModelI.H:122
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:50
const labelList & intCoupledPatchIDs() const noexcept
List of patch IDs internally coupled with the primary region.
Definition: regionModelI.H:97
Type * getObjectPtr(const word &name, const bool recursive=false) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
bool isCoupledPatch(const label regionPatchi) const
True if patchi on the local region is a coupled patch to the primary region.
Definition: regionModelI.H:104
const IOdictionary & outputProperties() const
Return const access to the output properties dictionary.
Definition: regionModelI.H:62
const dictionary & solution() const
Return the solution dictionary.
Definition: regionModelI.H:55
const fvMesh & regionMesh() const
Return the region mesh database.
Definition: regionModelI.H:26
errorManip< error > abort(error &err)
Definition: errorManip.H:139
const direction noexcept
Definition: Scalar.H:258
const Time & time_
Reference to the time database.
Definition: regionModel.H:97
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
word regionName_
Region name.
Definition: regionModel.H:141