regionFaModelI.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) 2019-2022 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 \*---------------------------------------------------------------------------*/
27 
28 #include "regionFaModel.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
33 {
34  auto* regionPtr = time_.getObjectPtr<faMesh>(regionName_);
35 
36  if (regionPtr)
37  {
38  return *regionPtr;
39  }
40  else if (!regionMeshPtr_)
41  {
43  << "Region mesh not available" << abort(FatalError);
44  }
45 
46  return *regionMeshPtr_;
47 }
48 
49 
51 {
52  auto* regionPtr = time_.getObjectPtr<faMesh>(regionName_);
53 
54  if (regionPtr)
55  {
56  return *regionPtr;
57  }
58  else if (!regionMeshPtr_)
59  {
61  << "Region mesh not available" << abort(FatalError);
62  }
63 
64  return *regionMeshPtr_;
65 }
66 
67 
68 inline const Foam::IOdictionary&
70 {
71  if (!outputPropertiesPtr_)
72  {
74  << "outputProperties dictionary not available"
76  }
77  return *outputPropertiesPtr_;
78 }
79 
80 
81 inline Foam::IOdictionary&
83 {
84  if (!outputPropertiesPtr_)
85  {
87  << "outputProperties dictionary not available"
88  << abort(FatalError);
89  }
90 
91  return *outputPropertiesPtr_;
92 }
93 
94 
95 inline const Foam::dictionary&
97 {
98  return regionMesh().solutionDict();
99 }
100 
101 
102 inline const Foam::labelList&
104 {
105  return regionMesh().whichPolyPatches();
106 }
107 
108 
110 (
111  const label patchi
112 ) const
113 {
114  return primaryPatchIDs().found(patchi);
115 }
116 
117 
118 // ************************************************************************* //
const Time & time_
Reference to the time database.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:88
const dictionary & solution() const
Return the solution dictionary.
bool isRegionPatch(const label patchi) const
True if patchi on the primary region is coupled to this region.
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:120
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:578
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:50
autoPtr< faMesh > regionMeshPtr_
Pointer to the region mesh database.
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...
const faMesh & regionMesh() const
Return the region mesh database.
errorManip< error > abort(error &err)
Definition: errorManip.H:139
const labelList & primaryPatchIDs() const
List of patch IDs on the primary region coupled to this region.
const IOdictionary & outputProperties() const
Return const access to the output properties dictionary.