directFieldMapper.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-2018 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::directFieldMapper
29 
30 Description
31  FieldMapper with direct mapping.
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef directFieldMapper_H
36 #define directFieldMapper_H
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 
43 /*---------------------------------------------------------------------------*\
44  Class directFieldMapper Declaration
45 \*---------------------------------------------------------------------------*/
46 
48 :
49  public FieldMapper
50 {
51  const labelUList& directAddressing_;
52 
53  bool hasUnmapped_;
54 
55 public:
56 
57  // Constructors
58 
59  //- Construct given addressing
61  :
62  directAddressing_(directAddressing),
63  hasUnmapped_(directAddressing_.size() && min(directAddressing_) < 0)
64  {}
65 
66 
67  //- Destructor
68  virtual ~directFieldMapper() = default;
69 
70 
71  // Member Functions
72 
73  label size() const
74  {
75  return directAddressing_.size();
76  }
77 
78  bool direct() const
79  {
80  return true;
81  }
82 
83  bool hasUnmapped() const
84  {
85  return hasUnmapped_;
86  }
87 
88  const labelUList& directAddressing() const
89  {
90  return directAddressing_;
91  }
92 };
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
96 } // End namespace Foam
97 
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 
100 #endif
101 
102 // ************************************************************************* //
Foam::FieldMapper
Abstract base class to hold the Field mapping addressing and weights.
Definition: FieldMapper.H:49
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::directFieldMapper::direct
bool direct() const
Definition: directFieldMapper.H:77
Foam::directFieldMapper::~directFieldMapper
virtual ~directFieldMapper()=default
Destructor.
Foam::directFieldMapper::directFieldMapper
directFieldMapper(const labelUList &directAddressing)
Construct given addressing.
Definition: directFieldMapper.H:59
Foam::directFieldMapper::hasUnmapped
bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: directFieldMapper.H:82
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::directFieldMapper
FieldMapper with direct mapping.
Definition: directFieldMapper.H:46
Foam::directFieldMapper::size
label size() const
Definition: directFieldMapper.H:72
Foam::UList< label >
Foam::directFieldMapper::directAddressing
const labelUList & directAddressing() const
Definition: directFieldMapper.H:87
Foam::UList::size
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114