directPointPatchFieldMapper.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::directPointPatchFieldMapper
29 
30 Description
31  direct pointPatchFieldMapper
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef directPointPatchFieldMapper_H
36 #define directPointPatchFieldMapper_H
37 
38 #include "pointPatchFieldMapper.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class directPointPatchFieldMapper Declaration
47 \*---------------------------------------------------------------------------*/
48 
50 :
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 ~directPointPatchFieldMapper() = 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  const labelUList& directAddressing() const
95  {
96  return directAddressing_;
97  }
98 };
99 
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 } // End namespace Foam
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 #endif
108 
109 // ************************************************************************* //
Foam::directPointPatchFieldMapper::directPointPatchFieldMapper
directPointPatchFieldMapper(const labelUList &directAddressing)
Construct given addressing.
Definition: directPointPatchFieldMapper.H:65
pointPatchFieldMapper.H
Foam::directPointPatchFieldMapper::hasUnmapped
bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: directPointPatchFieldMapper.H:88
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::pointPatchFieldMapper
Foam::pointPatchFieldMapper.
Definition: pointPatchFieldMapper.H:48
Foam::directPointPatchFieldMapper::directAddressing
const labelUList & directAddressing() const
Definition: directPointPatchFieldMapper.H:93
Foam::directPointPatchFieldMapper::~directPointPatchFieldMapper
virtual ~directPointPatchFieldMapper()=default
Destructor.
Foam::directPointPatchFieldMapper::direct
bool direct() const
Definition: directPointPatchFieldMapper.H:83
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::UList< label >
Foam::directPointPatchFieldMapper::size
label size() const
Definition: directPointPatchFieldMapper.H:78
Foam::UList::size
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
Definition: UListI.H:360
Foam::directPointPatchFieldMapper
direct pointPatchFieldMapper
Definition: directPointPatchFieldMapper.H:48