cyclicAMIPointPatchField.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-2017 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 Class
28  Foam::cyclicAMIPointPatchField
29 
30 Description
31  Cyclic AMI front and back plane patch field
32 
33 SourceFiles
34  cyclicAMIPointPatchField.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef cyclicAMIPointPatchField_H
39 #define cyclicAMIPointPatchField_H
40 
41 #include "coupledPointPatchField.H"
42 #include "cyclicAMIPointPatch.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class cyclicAMIPointPatchField Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class Type>
56 :
57  public coupledPointPatchField<Type>
58 {
59  // Private Data
60 
61  //- Local reference cast into the cyclicAMI patch
62  const cyclicAMIPointPatch& cyclicAMIPatch_;
63 
64  //- Owner side patch interpolation pointer
66 
67  //- Neighbour side patch interpolation pointer
69  nbrPpiPtr_;
70 
71 
72  // Private Member Functions
73 
74  //- Owner side patch interpolation
76  {
77  if (!ppiPtr_)
78  {
79  ppiPtr_.reset
80  (
82  (
83  cyclicAMIPatch_.cyclicAMIPatch()
84  )
85  );
86  }
87 
88  return *ppiPtr_;
89  }
90 
91  //- Neighbour side patch interpolation
93  {
94  if (!nbrPpiPtr_)
95  {
96  nbrPpiPtr_.reset
97  (
99  (
100  cyclicAMIPatch_.cyclicAMIPatch().neighbPatch()
101  )
102  );
103  }
104 
105  return *nbrPpiPtr_;
106  }
107 
108 
109 public:
110 
111  //- Runtime type information
112  TypeName(cyclicAMIPointPatch::typeName_());
113 
114 
115  // Constructors
116 
117  //- Construct from patch and internal field
119  (
120  const pointPatch&,
122  );
123 
124  //- Construct from patch, internal field and dictionary
126  (
127  const pointPatch&,
129  const dictionary&
130  );
131 
132  //- Construct by mapping given patchField<Type> onto a new patch
134  (
136  const pointPatch&,
138  const pointPatchFieldMapper&
139  );
140 
141  //- Construct and return a clone
142  virtual autoPtr<pointPatchField<Type>> clone() const
143  {
145  (
147  (
148  *this
149  )
150  );
151  }
152 
153  //- Construct as copy setting internal field reference
155  (
158  );
159 
160  //- Construct and return a clone setting internal field reference
162  (
164  ) const
165  {
167  (
169  (
170  *this, iF
171  )
172  );
173  }
174 
175 
176  // Member functions
177 
178  // Constraint handling
179 
180  //- Return the constraint type this pointPatchField implements
181  virtual const word& constraintType() const
182  {
183  return cyclicAMIPointPatch::typeName;
184  }
185 
186 
187  // Cyclic AMI coupled interface functions
188 
189  //- Does the patch field perform the transformation
190  virtual bool doTransform() const
191  {
192  return
193  !(
194  cyclicAMIPatch_.parallel()
195  || pTraits<Type>::rank == 0
196  );
197  }
198 
199  //- Return face transformation tensor
200  virtual const tensorField& forwardT() const
201  {
202  return cyclicAMIPatch_.forwardT();
203  }
204 
205  //- Return neighbour-cell transformation tensor
206  virtual const tensorField& reverseT() const
207  {
208  return cyclicAMIPatch_.reverseT();
209  }
210 
211 
212  // Evaluation functions
213 
214  //- Return true if coupled. Note that the underlying patch
215  //- is not coupled() - the points don't align.
216  virtual bool coupled() const;
217 
218  //- Evaluate the patch field
219  virtual void evaluate
220  (
221  const Pstream::commsTypes commsType =
223  )
224  {}
225 
226  //- Complete swap of patch point values and add to local values
227  virtual void swapAddSeparated
228  (
229  const Pstream::commsTypes commsType,
230  Field<Type>&
231  ) const;
232 };
233 
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 } // End namespace Foam
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #ifdef NoRepository
242  #include "cyclicAMIPointPatchField.C"
243 #endif
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 #endif
248 
249 // ************************************************************************* //
Foam::cyclicAMIPointPatchField
Cyclic AMI front and back plane patch field.
Definition: cyclicAMIPointPatchField.H:54
cyclicAMIPointPatchField.C
coupledPointPatchField.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::coupledPointPatchField
A Coupled boundary condition for pointField.
Definition: coupledPointPatchField.H:52
Foam::cyclicAMIPointPatch::parallel
bool parallel() const
Are the cyclic planes parallel.
Definition: cyclicAMIPointPatch.H:140
PrimitivePatchInterpolation.H
Foam::cyclicAMIPointPatch
Cyclic AMI point patch - place holder only.
Definition: cyclicAMIPointPatch.H:52
Foam::cyclicAMIPointPatchField::clone
virtual autoPtr< pointPatchField< Type > > clone() const
Construct and return a clone.
Definition: cyclicAMIPointPatchField.H:141
Foam::cyclicAMIPointPatchField::reverseT
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Definition: cyclicAMIPointPatchField.H:205
Foam::pointPatch
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:58
Foam::pointPatchFieldMapper
Foam::pointPatchFieldMapper.
Definition: pointPatchFieldMapper.H:48
Foam::cyclicAMIPointPatch::cyclicAMIPatch
const cyclicAMIPolyPatch & cyclicAMIPatch() const
Return the underlying cyclicAMIPolyPatch.
Definition: cyclicAMIPointPatch.H:126
Foam::Field< tensor >
Foam::cyclicAMIPointPatchField::TypeName
TypeName(cyclicAMIPointPatch::typeName_())
Runtime type information.
Foam::cyclicAMIPointPatchField::doTransform
virtual bool doTransform() const
Does the patch field perform the transformation.
Definition: cyclicAMIPointPatchField.H:189
Foam::cyclicAMIPointPatch::reverseT
const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Definition: cyclicAMIPointPatch.H:152
Foam::cyclicAMIPointPatchField::swapAddSeparated
virtual void swapAddSeparated(const Pstream::commsTypes commsType, Field< Type > &) const
Complete swap of patch point values and add to local values.
Definition: cyclicAMIPointPatchField.C:123
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::cyclicAMIPolyPatch::neighbPatch
virtual const cyclicAMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
Definition: cyclicAMIPolyPatch.C:970
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cyclicAMIPointPatchField::constraintType
virtual const word & constraintType() const
Return the constraint type this pointPatchField implements.
Definition: cyclicAMIPointPatchField.H:180
Foam::autoPtr::reset
void reset(autoPtr< T > &&other) noexcept
Delete managed object and set to new given pointer.
Definition: autoPtrI.H:117
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::PrimitivePatchInterpolation
Interpolation class within a primitive patch. Allows interpolation from points to faces and vice vers...
Definition: PrimitivePatchInterpolation.H:53
Foam::pTraits
A traits class, which is primarily used for primitives.
Definition: pTraits.H:56
Foam::cyclicAMIPointPatch::forwardT
const tensorField & forwardT() const
Return face transformation tensor.
Definition: cyclicAMIPointPatch.H:146
Foam::cyclicAMIPointPatchField::evaluate
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
Definition: cyclicAMIPointPatchField.H:219
Foam::cyclicAMIPointPatchField::coupled
virtual bool coupled() const
Definition: cyclicAMIPointPatchField.C:115
cyclicAMIPointPatch.H
Foam::cyclicAMIPointPatchField::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: cyclicAMIPointPatchField.H:199
Foam::cyclicAMIPointPatchField::cyclicAMIPointPatchField
cyclicAMIPointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &)
Construct from patch and internal field.
Definition: cyclicAMIPointPatchField.C:37
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::UPstream::commsTypes::blocking