processorCyclicPointPatchField.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) 2023 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::processorCyclicPointPatchField
29 
30 Description
31  Foam::processorCyclicPointPatchField
32 
33 SourceFiles
34  processorCyclicPointPatchField.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_processorCyclicPointPatchField_H
39 #define Foam_processorCyclicPointPatchField_H
40 
41 #include "coupledPointPatchField.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class processorCyclicPointPatchField Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template<class Type>
55 :
56  public coupledPointPatchField<Type>
57 {
58  // Private Data
59 
60  //- Local reference to processor patch
61  const processorCyclicPointPatch& procPatch_;
62 
63  //- Send buffer for non-blocking communication
64  mutable Field<Type> sendBuf_;
65 
66  //- Receive buffer for non-blocking communication
67  mutable Field<Type> recvBuf_;
68 
69 
70 public:
71 
72  //- Runtime type information
73  TypeName(processorCyclicPointPatch::typeName_());
74 
75 
76  // Constructors
77 
78  //- Construct from patch and internal field
80  (
81  const pointPatch&,
83  );
84 
85  //- Construct from patch, internal field and dictionary
87  (
88  const pointPatch&,
90  const dictionary&
91  );
92 
93  //- Construct by mapping given patch field onto a new patch
95  (
97  const pointPatch&,
100  );
101 
102  //- Construct as copy setting internal field reference
104  (
107  );
108 
109  //- Return a clone
110  virtual autoPtr<pointPatchField<Type>> clone() const
111  {
112  return pointPatchField<Type>::Clone(*this);
113  }
114 
115  //- Construct and return a clone setting internal field reference
117  (
119  ) const
120  {
121  return pointPatchField<Type>::Clone(*this, iF);
122  }
124 
125  //- Destructor
126  virtual ~processorCyclicPointPatchField() = default;
127 
128 
129  // Member functions
130 
131  // Access
133  //- Return true if running parallel
134  virtual bool coupled() const
135  {
136  return Pstream::parRun();
137  }
138 
139  //- Does the patch field perform the transformation
140  virtual bool doTransform() const
141  {
142  return
143  (
145  && !procPatch_.procPolyPatch().parallel()
146  );
147  }
148 
149 
150  // Evaluation functions
151 
152  //- Evaluate the patch field
153  virtual void evaluate
154  (
155  const Pstream::commsTypes commsType =
157  )
158  {}
159 
160  //- Initialise swap of non-collocated patch point values
161  virtual void initSwapAddSeparated
162  (
163  const Pstream::commsTypes commsType,
164  Field<Type>&
165  ) const;
166 
167  //- Complete swap of patch point values and add to local values
168  virtual void swapAddSeparated
169  (
170  const Pstream::commsTypes commsType,
171  Field<Type>&
172  ) const;
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #ifdef NoRepository
184 #endif
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************************************************************* //
Foam::processorCyclicPointPatchField.
virtual ~processorCyclicPointPatchField()=default
Destructor.
virtual bool doTransform() const
Does the patch field perform the transformation.
processorCyclicPointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &)
Construct from patch and internal field.
commsTypes
Communications types.
Definition: UPstream.H:77
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Processor patch boundary needs to be such that the ordering of points in the patch is the same on bot...
Foam::pointPatchFieldMapper.
A traits class, which is primarily used for primitives and vector-space.
Definition: pTraits.H:75
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:1061
virtual void initSwapAddSeparated(const Pstream::commsTypes commsType, Field< Type > &) const
Initialise swap of non-collocated patch point values.
virtual bool parallel() const
Are the cyclic planes parallel.
Generic templated field type.
Definition: Field.H:62
virtual bool coupled() const
Return true if running parallel.
static autoPtr< pointPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
TypeName(processorCyclicPointPatch::typeName_())
Runtime type information.
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:61
A Coupled boundary condition for pointField.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual autoPtr< pointPatchField< Type > > clone() const
Return a clone.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
"buffered" : (MPI_Bsend, MPI_Recv)
virtual void swapAddSeparated(const Pstream::commsTypes commsType, Field< Type > &) const
Complete swap of patch point values and add to local values.
const processorPolyPatch & procPolyPatch() const
Return the underlying processorPolyPatch.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Evaluate the patch field.
Namespace for OpenFOAM.