interRegionModel.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2023 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 Class
25  Foam::fv::interRegionModel
26 
27 Description
28  Base class for inter-region exchange.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #include "fvModel.H"
33 #include "volFields.H"
34 #include "cellsToCells.H"
35 
36 #ifndef interRegionModel_H
37 #define interRegionModel_H
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 namespace fv
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class interRegionModel Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class interRegionModel
51 :
52  public fvModel
53 {
54  // Private data
55 
56  //- Master or slave region
57  bool master_;
58 
59  //- Name of the neighbour region to map
60  word nbrRegionName_;
61 
62  //- Interpolation method
63  word interpolationMethod_;
64 
65  //- Mesh to mesh interpolation object
66  mutable autoPtr<cellsToCells> interpolationPtr_;
67 
68 
69  // Private member functions
70 
71  //- Non-virtual read
72  void readCoeffs();
73 
74 
75 protected:
76 
77  // Protected member functions
78 
79  //- Get the neighbour interRegionModel
80  const interRegionModel& nbrModel() const;
81 
82 
83 public:
84 
85  //- Runtime type information
86  TypeName("interRegionModel");
87 
88 
89  // Constructors
90 
91  //- Construct from dictionary
93  (
94  const word& name,
95  const word& modelType,
96  const fvMesh& mesh,
97  const dictionary& dict
98  );
99 
100 
101  //- Destructor
102  virtual ~interRegionModel();
103 
104 
105  // Member Functions
106 
107  // Access
108 
109  //- Return whether the master region
110  inline bool master() const;
111 
112  //- Return const access to the neighbour region name
113  inline const word& nbrRegionName() const;
114 
115  //- Return const access to the neighbour mesh
116  inline const fvMesh& nbrMesh() const;
117 
118  //- Return const access to the interpolation engine
119  const cellsToCells& interpolation() const;
120 
121 
122  // Interpolation
123 
124  //- Interpolate field
125  template<class Type>
127  (
128  const Field<Type>& field
129  ) const;
130 
131  //- Interpolate field
132  template<class Type>
133  void interpolate
134  (
135  const Field<Type>& field,
136  Field<Type>& result
137  ) const;
138 
139 
140  // IO
141 
142  //- Read dictionary
143  virtual bool read(const dictionary& dict);
144 };
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace fv
150 } // End namespace Foam
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #include "interRegionModelI.H"
155 
156 #ifdef NoRepository
157  #include "interRegionModelTemplates.C"
158 #endif
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
Pre-declare SubField and related Field type.
Definition: Field.H:83
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Class to calculate interpolative addressing and weights between the cells of two overlapping meshes.
Definition: cellsToCells.H:56
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
Finite volume model abstract base class.
Definition: fvModel.H:59
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:53
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:47
Base class for inter-region exchange.
bool master() const
Return whether the master region.
interRegionModel(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from dictionary.
TypeName("interRegionModel")
Runtime type information.
virtual bool read(const dictionary &dict)
Read dictionary.
const word & nbrRegionName() const
Return const access to the neighbour region name.
const cellsToCells & interpolation() const
Return const access to the interpolation engine.
const fvMesh & nbrMesh() const
Return const access to the neighbour mesh.
tmp< Field< Type > > interpolate(const Field< Type > &field) const
Interpolate field.
virtual ~interRegionModel()
Destructor.
const interRegionModel & nbrModel() const
Get the neighbour interRegionModel.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
labelList fv(nPoints)
dictionary dict