regionCoupledBase.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 | Copyright (C) 2011-2016 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::regionCoupledBase
26 
27 Description
28  Base class with common functinality for regionCoupled polyPatch.
29  It includes AMI.
30 
31 
32 SourceFiles
33  regionCoupledBase.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef regionCoupledBase_H
38 #define regionCoupledBase_H
39 
41 #include "polyBoundaryMesh.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class regionCoupledBase Declaration
50 \*---------------------------------------------------------------------------*/
51 
53 {
54 private:
55 
56  // Private data
57 
58  //- Patch to sample
59  const polyPatch& patch_;
60 
61  //- Name of other half
62  const word nbrPatchName_;
63 
64  //- Index of other half
65  mutable label nbrPatchID_;
66 
67  //- Name of other region
68  const word nbrRegionName_;
69 
70  //- Same region
71  const bool sameRegion_;
72 
73  //- AMI interpolation class
75 
76  //- Flag to indicate that slave patch should be reversed for AMI
77  const bool AMIReverse_;
78 
79  //- Projection surface
80  mutable autoPtr<searchableSurface> surfPtr_;
81 
82  //- Dictionary used during projection surface construction
83  const dictionary surfDict_;
84 
85 
86  // Private Member Functions
87 
88  //- Reset the AMI interpolator
89  void resetAMI() const;
90 
91 
92 protected:
93 
94 
95  //- Clear geometry
96  virtual void clearGeom();
97 
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("regionCoupledBase");
103 
104 
105  // Constructors
106 
107  //- Construct from patch
109 
110  //- Construct from dictionary
111  regionCoupledBase(const polyPatch&, const dictionary&);
112 
113  //- Construct as copy, resetting patch
115 
116 
117  //- Destructor
118  virtual ~regionCoupledBase();
119 
120 
121  // Member Functions
122 
123 
124  // Access
125 
126  //- Neighbour patch name
127  const word& nbrPatchName() const
128  {
129  return nbrPatchName_;
130  }
131 
132  //- Neighbour region name
133  const word& nbrRegionName() const
134  {
135  return nbrRegionName_;
136  }
137 
138  //- Cached sampleRegion != mesh.name()
139  bool sameRegion() const
140  {
141  return sameRegion_;
142  }
143 
144  //- Neighbour patch ID
145  label neighbPatchID() const;
146 
147  //- Does this side own the patch?
148  bool owner() const;
149 
150  //- Return a reference to the neighbour patch
151  const regionCoupledBase& neighbPatch() const;
152 
153  //- Return a reference to the projection surface
154  const autoPtr<searchableSurface>& surfPtr() const;
155 
156  //- Return a reference to the AMI interpolator
157  const AMIPatchToPatchInterpolation& AMI() const;
158 
159 
160  // Interpolations
161 
162  //- Interpolate field
163  template<class Type>
165 
166  //- Interpolate tmp field
167  template<class Type>
169  (
170  const tmp<Field<Type>>& tFld
171  ) const;
172 
173  //- Low-level interpolate List
174  template<class Type, class BinaryOp>
175  void interpolate
176  (
177  const UList<Type>& fld,
178  const BinaryOp& bop,
179  List<Type>& result
180  ) const;
181 
182 
183  //- Return new ordering for primitivePatch.
184  // Ordering is -faceMap: for every face
185  // index of the new face -rotation:for every new face the clockwise
186  // shift of the original face. Return false if nothing changes
187  // (faceMap is identity, rotation is 0), true otherwise.
188  virtual bool order
189  (
191  const primitivePatch&,
193  labelList& rotation
194  ) const;
195 
196 
197  //- Return the type
198  virtual const word& regionCoupleType() const = 0;
199 
200  //- Write the polyPatch data as a dictionary
201  virtual void write(Ostream&) const;
202 };
203 
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 } // End namespace Foam
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #ifdef NoRepository
213 #endif
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
Base class with common functinality for regionCoupled polyPatch. It includes AMI. ...
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:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual void clearGeom()
Clear geometry.
bool owner() const
Does this side own the patch?
const regionCoupledBase & neighbPatch() const
Return a reference to the neighbour patch.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
label neighbPatchID() const
Neighbour patch ID.
A list of faces which address into the list of points.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Pre-declare SubField and related Field type.
Definition: Field.H:57
A class for handling words, derived from string.
Definition: word.H:59
virtual const word & regionCoupleType() const =0
Return the type.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
TypeName("regionCoupledBase")
Runtime type information.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
virtual ~regionCoupledBase()
Destructor.
tmp< Field< Type > > interpolate(const Field< Type > &fld) const
Interpolate field.
bool sameRegion() const
Cached sampleRegion != mesh.name()
regionCoupledBase(const polyPatch &)
Construct from patch.
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
const word & nbrRegionName() const
Neighbour region name.
const word & nbrPatchName() const
Neighbour patch name.
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
A class for managing temporary objects.
Definition: PtrList.H:53
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
const autoPtr< searchableSurface > & surfPtr() const
Return a reference to the projection surface.
const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
Namespace for OpenFOAM.