directFvPatchFieldMapper.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) 2013 OpenFOAM Foundation
9  Copyright (C) 2019 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::directFvPatchFieldMapper
29 
30 Description
31  direct fvPatchFieldMapper
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef directFvPatchFieldMapper_H
36 #define directFvPatchFieldMapper_H
37 
38 #include "fvPatchFieldMapper.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class directFvPatchFieldMapper Declaration
47 \*---------------------------------------------------------------------------*/
48 
50 :
51  public fvPatchFieldMapper
52 {
53 
54  //- Addressing from new back to old
55  const labelUList& directAddressing_;
56 
57  //- Does map contain any unmapped values
58  bool hasUnmapped_;
59 
60 
61 public:
62 
63  // Constructors
64 
65  //- Construct given addressing
67  :
68  directAddressing_(directAddressing),
69  hasUnmapped_(directAddressing_.size() && min(directAddressing_) < 0)
70  {}
71 
72 
73  //- Destructor
74  virtual ~directFvPatchFieldMapper() = default;
75 
76 
77  // Member Functions
78 
79  label size() const
80  {
81  return directAddressing_.size();
82  }
83 
84  bool direct() const
85  {
86  return true;
87  }
88 
89  bool hasUnmapped() const
90  {
91  return hasUnmapped_;
92  }
93 
94  bool& hasUnmapped()
95  {
96  return hasUnmapped_;
97  }
98 
99  const labelUList& directAddressing() const
100  {
101  return directAddressing_;
102  }
103 };
104 
105 
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 
108 } // End namespace Foam
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 #endif
113 
114 // ************************************************************************* //
Foam::directFvPatchFieldMapper::hasUnmapped
bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: directFvPatchFieldMapper.H:88
Foam::directFvPatchFieldMapper::direct
bool direct() const
Definition: directFvPatchFieldMapper.H:83
Foam::directFvPatchFieldMapper::directAddressing
const labelUList & directAddressing() const
Definition: directFvPatchFieldMapper.H:98
fvPatchFieldMapper.H
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::directFvPatchFieldMapper::hasUnmapped
bool & hasUnmapped()
Definition: directFvPatchFieldMapper.H:93
Foam::directFvPatchFieldMapper::directFvPatchFieldMapper
directFvPatchFieldMapper(const labelUList &directAddressing)
Construct given addressing.
Definition: directFvPatchFieldMapper.H:65
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::UList< label >
Foam::directFvPatchFieldMapper
direct fvPatchFieldMapper
Definition: directFvPatchFieldMapper.H:48
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::UList::size
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
Foam::directFvPatchFieldMapper::size
label size() const
Definition: directFvPatchFieldMapper.H:78
Foam::directFvPatchFieldMapper::~directFvPatchFieldMapper
virtual ~directFvPatchFieldMapper()=default
Destructor.