flipOp.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) 2015-2018 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::flipOp
26 
27 Description
28  Class containing functor to negate primitives. Dummy for all other types.
29 
30  Used in mesh transformations where face can flip.
31 
32 SourceFiles
33  flipOp.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef flipOp_H
38 #define flipOp_H
39 
40 #include "fieldTypes.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class flipOp Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class flipOp
52 {
53 public:
54 
55  template<class Type>
56  Type operator()(const Type& val) const
57  {
58  return val;
59  }
60 };
61 
62 
63 class noOp
64 {
65 public:
66 
67  template<class Type>
68  Type operator()(const Type& val) const
69  {
70  return val;
71  }
72 };
73 
74 
75 class flipLabelOp
76 {
77 public:
78 
79  label operator()(const label& val) const
80  {
81  return -val;
82  }
83 };
84 
85 
86 // Template specialisation for primitives that support negation
87 template<> scalar flipOp::operator()(const scalar&) const;
88 template<> vector flipOp::operator()(const vector&) const;
89 template<> sphericalTensor flipOp::operator()(const sphericalTensor&) const;
90 template<> symmTensor flipOp::operator()(const symmTensor&) const;
91 template<> tensor flipOp::operator()(const tensor&) const;
92 template<> triad flipOp::operator()(const triad&) const;
93 
94 
95 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96 
97 } // End namespace Foam
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 #endif
102 
103 // ************************************************************************* //
Class containing functor to negate primitives. Dummy for all other types.
Definition: flipOp.H:50
Type operator()(const Type &val) const
Definition: flipOp.H:55
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component, element access using th ii() member function and the inner-product (dot-product) and outer-product operators.
Include the header files for all the primitive types that Fields are instantiated for...
Representation of a 3D Cartesian coordinate system as a Vector of vectors.
Definition: triad.H:65
Namespace for OpenFOAM.