processorLduInterfaceField.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-2020 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::processorLduInterfaceField
26 
27 Description
28  Abstract base class for processor coupled interfaces.
29 
30 SourceFiles
31  processorLduInterfaceField.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef processorLduInterfaceField_H
36 #define processorLduInterfaceField_H
37 
38 #include "primitiveFieldsFwd.H"
39 #include "transformer.H"
40 #include "typeInfo.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class processorLduInterfaceField Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 {
53 
54 public:
55 
56  //- Runtime type information
57  TypeName("processorLduInterfaceField");
58 
59 
60  // Constructors
61 
62  //- Construct given coupled patch
64  {}
65 
66 
67  //- Destructor
69 
70 
71  // Member Functions
72 
73  // Access
74 
75  //- Return communicator used for comms
76  virtual label comm() const = 0;
77 
78  //- Return processor number
79  virtual int myProcNo() const = 0;
80 
81  //- Return neighbour processor number
82  virtual int neighbProcNo() const = 0;
83 
84  //- Return transformation between the coupled patches
85  virtual const transformer& transform() const = 0;
86 
87  //- Return rank of component for transform
88  virtual int rank() const = 0;
89 
90  //- Is the transform required
91  bool transforms() const
92  {
93  return transform().transforms() && rank() != 0;
94  }
95 
96 
97  //- Transform given patch field
98  template<class Type>
99  void transformCoupleField(Field<Type>& f) const;
100 
101  //- Transform given patch component field
103  (
104  scalarField& f,
105  const direction cmpt
106  ) const;
107 };
108 
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 } // End namespace Foam
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 #include "tensorField.H"
117 
118 template<class Type>
120 (
121  Field<Type>& f
122 ) const
123 {
124  if (transforms())
125  {
126  transform().transform(f, f);
127  }
128 }
129 
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 #endif
134 
135 // ************************************************************************* //
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space...
Definition: transformer.H:83
bool transforms() const
Is the transform required.
bool transforms() const
Return true if the transformer transforms a type.
Definition: transformerI.H:133
uint8_t direction
Definition: direction.H:45
virtual int rank() const =0
Return rank of component for transform.
Abstract base class for processor coupled interfaces.
Forward declarations of the specialisations of Field<T> for scalar, vector and tensor.
Pre-declare SubField and related Field type.
Definition: Field.H:56
processorLduInterfaceField()
Construct given coupled patch.
void transformCoupleField(Field< Type > &f) const
Transform given patch field.
virtual int myProcNo() const =0
Return processor number.
virtual int neighbProcNo() const =0
Return neighbour processor number.
TypeName("processorLduInterfaceField")
Runtime type information.
virtual const transformer & transform() const =0
Return transformation between the coupled patches.
Type transform(const Type &) const
Transform the given type.
virtual label comm() const =0
Return communicator used for comms.
Namespace for OpenFOAM.