directFieldMapper.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) 2013-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::directFieldMapper
26 
27 Description
28  FieldMapper with direct mapping.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef directFieldMapper_H
33 #define directFieldMapper_H
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39 
40 /*---------------------------------------------------------------------------*\
41  Class directFieldMapper Declaration
42 \*---------------------------------------------------------------------------*/
43 
45 :
46  public FieldMapper
47 {
48  const labelUList& directAddressing_;
49 
50  bool hasUnmapped_;
51 
52 public:
53 
54  // Constructors
55 
56  //- Construct given addressing
58  :
59  directAddressing_(directAddressing),
60  hasUnmapped_(false)
61  {
62  if (directAddressing_.size() && min(directAddressing_) < 0)
63  {
64  hasUnmapped_ = true;
65  }
66  }
67 
68  //- Destructor
69  virtual ~directFieldMapper()
70  {}
71 
72 
73  // Member Functions
74 
75  label size() const
76  {
77  return directAddressing_.size();
78  }
79 
80  bool direct() const
81  {
82  return true;
83  }
84 
85  bool hasUnmapped() const
86  {
87  return hasUnmapped_;
88  }
89 
90  const labelUList& directAddressing() const
91  {
92  return directAddressing_;
93  }
94 };
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 } // End namespace Foam
99 
100 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101 
102 #endif
103 
104 // ************************************************************************* //
directFieldMapper(const labelUList &directAddressing)
Construct given addressing.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
FieldMapper with direct mapping.
bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
const labelUList & directAddressing() const
Abstract base class to hold the Field mapping addressing and weights.
Definition: FieldMapper.H:45
virtual ~directFieldMapper()
Destructor.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:61
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
label size() const
Return the number of elements in the UList.
Definition: UListI.H:299
Namespace for OpenFOAM.