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-2012 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
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>
164  tmp<Field<Type> > interpolate(const Field<Type>& fld) const;
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 // ************************************************************************* //
Foam::regionCoupledBase::surfPtr
const autoPtr< searchableSurface > & surfPtr() const
Return a reference to the projection surface.
Definition: regionCoupledBase.C:251
Foam::regionCoupledBase::neighbPatch
const regionCoupledBase & neighbPatch() const
Return a reference to the neighbour patch.
Definition: regionCoupledBase.C:301
Foam::faceMap
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Definition: blockMeshMergeFast.C:90
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::regionCoupledBase::AMI
const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
Definition: regionCoupledBase.C:282
Foam::PstreamBuffers
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Definition: PstreamBuffers.H:85
Foam::regionCoupledBase::surfPtr_
autoPtr< searchableSurface > surfPtr_
Projection surface.
Definition: regionCoupledBase.H:79
Foam::regionCoupledBase::nbrRegionName
const word & nbrRegionName() const
Neighbour region name.
Definition: regionCoupledBase.H:132
Foam::regionCoupledBase::patch_
const polyPatch & patch_
Patch to sample.
Definition: regionCoupledBase.H:58
Foam::regionCoupledBase::AMIPtr_
autoPtr< AMIPatchToPatchInterpolation > AMIPtr_
AMI interpolation class.
Definition: regionCoupledBase.H:73
Foam::regionCoupledBase::order
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
Definition: regionCoupledBase.C:315
Foam::regionCoupledBase::sameRegion_
const bool sameRegion_
Same region.
Definition: regionCoupledBase.H:70
Foam::label
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
Foam::Field< Type >
Foam::regionCoupledBase::~regionCoupledBase
virtual ~regionCoupledBase()
Destructor.
Definition: regionCoupledBase.C:180
Foam::regionCoupledBase::interpolate
tmp< Field< Type > > interpolate(const Field< Type > &fld) const
Interpolate field.
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::regionCoupledBase::neighbPatchID
label neighbPatchID() const
Neighbour patch ID.
Definition: regionCoupledBase.C:186
Foam::regionCoupledBase
Base class with common functinality for regionCoupled polyPatch. It includes AMI.
Definition: regionCoupledBase.H:51
Foam::regionCoupledBase::surfDict_
const dictionary surfDict_
Dictionary used during projection surface construction.
Definition: regionCoupledBase.H:82
AMIPatchToPatchInterpolation.H
Foam::regionCoupledBase::owner
bool owner() const
Does this side own the patch?
Definition: regionCoupledBase.C:237
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
fld
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))
Foam::regionCoupledBase::nbrPatchName_
const word nbrPatchName_
Name of other half.
Definition: regionCoupledBase.H:61
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::regionCoupledBase::sameRegion
bool sameRegion() const
Cached sampleRegion != mesh.name()
Definition: regionCoupledBase.H:138
Foam::regionCoupledBase::AMIReverse_
const bool AMIReverse_
Flag to indicate that slave patch should be reversed for AMI.
Definition: regionCoupledBase.H:76
Foam::regionCoupledBase::regionCoupledBase
regionCoupledBase(const polyPatch &)
Construct from patch.
Definition: regionCoupledBase.C:126
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::regionCoupledBase::TypeName
TypeName("regionCoupledBase")
Runtime type information.
Foam::regionCoupledBase::regionCoupleType
virtual const word & regionCoupleType() const =0
Return the type.
Foam::List< Type >
Foam::regionCoupledBase::resetAMI
void resetAMI() const
Reset the AMI interpolator.
Definition: regionCoupledBase.C:42
Foam::AMIInterpolation
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
Definition: AMIInterpolation.H:77
Foam::UList< Type >
Foam::regionCoupledBase::write
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
Definition: regionCoupledBase.C:333
polyBoundaryMesh.H
regionCoupledBaseTemplates.C
Foam::regionCoupledBase::nbrPatchName
const word & nbrPatchName() const
Neighbour patch name.
Definition: regionCoupledBase.H:126
Foam::regionCoupledBase::nbrRegionName_
const word nbrRegionName_
Name of other region.
Definition: regionCoupledBase.H:67
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::regionCoupledBase::clearGeom
virtual void clearGeom()
Clear geometry.
Definition: regionCoupledBase.C:116
Foam::regionCoupledBase::nbrPatchID_
label nbrPatchID_
Index of other half.
Definition: regionCoupledBase.H:64
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatchTemplate.H:88