distributedUnallocatedDirectFieldMapper.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) 2015 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::distributedUnallocatedDirectFieldMapper
29 
30 Description
31  FieldMapper with direct mapping from remote quantities.
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef distributedUnallocatedDirectFieldMapper_H
36 #define distributedUnallocatedDirectFieldMapper_H
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 
43 /*---------------------------------------------------------------------------*\
44  Class distributedUnallocatedDirectFieldMapper Declaration
45 \*---------------------------------------------------------------------------*/
46 
48 :
49  public FieldMapper
50 {
51  const labelUList& directAddressing_;
52 
53  const mapDistributeBase& distMap_;
54 
55  bool hasUnmapped_;
56 
57 public:
58 
59  // Constructors
60 
61  //- Construct given addressing
63  (
65  const mapDistributeBase& distMap
66  )
67  :
68  directAddressing_(directAddressing),
69  distMap_(distMap),
70  hasUnmapped_(directAddressing_.size() && min(directAddressing_) < 0)
71  {}
72 
73 
74  //- Destructor
75  virtual ~distributedUnallocatedDirectFieldMapper() = default;
76 
77 
78  // Member Functions
79 
80  virtual label size() const
81  {
82  return
83  (
84  notNull(directAddressing_)
85  ? directAddressing_.size()
86  : distMap_.constructSize()
87  );
88  }
89 
90  virtual bool direct() const
91  {
92  return true;
93  }
94 
95  virtual bool distributed() const
96  {
97  return true;
98  }
99 
100  virtual const mapDistributeBase& distributeMap() const
101  {
102  return distMap_;
103  }
104 
105  virtual bool hasUnmapped() const
106  {
107  return hasUnmapped_;
108  }
109 
110  virtual const labelUList& directAddressing() const
111  {
112  return directAddressing_;
113  }
114 };
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 } // End namespace Foam
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 #endif
123 
124 // ************************************************************************* //
Foam::distributedUnallocatedDirectFieldMapper::directAddressing
virtual const labelUList & directAddressing() const
Definition: distributedUnallocatedDirectFieldMapper.H:109
Foam::distributedUnallocatedDirectFieldMapper
FieldMapper with direct mapping from remote quantities.
Definition: distributedUnallocatedDirectFieldMapper.H:46
Foam::distributedUnallocatedDirectFieldMapper::direct
virtual bool direct() const
Definition: distributedUnallocatedDirectFieldMapper.H:89
Foam::distributedUnallocatedDirectFieldMapper::size
virtual label size() const
Definition: distributedUnallocatedDirectFieldMapper.H:79
Foam::distributedUnallocatedDirectFieldMapper::distributeMap
virtual const mapDistributeBase & distributeMap() const
Definition: distributedUnallocatedDirectFieldMapper.H:99
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::distributedUnallocatedDirectFieldMapper::hasUnmapped
virtual bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: distributedUnallocatedDirectFieldMapper.H:104
Foam::notNull
bool notNull(const T *ptr)
True if ptr is not a pointer (of type T) to the nullObject.
Definition: nullObject.H:207
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::distributedUnallocatedDirectFieldMapper::distributedUnallocatedDirectFieldMapper
distributedUnallocatedDirectFieldMapper(const labelUList &directAddressing, const mapDistributeBase &distMap)
Construct given addressing.
Definition: distributedUnallocatedDirectFieldMapper.H:62
Foam::mapDistributeBase::constructSize
label constructSize() const
Constructed data size.
Definition: mapDistributeBase.H:277
Foam::UList< label >
Foam::distributedUnallocatedDirectFieldMapper::distributed
virtual bool distributed() const
Definition: distributedUnallocatedDirectFieldMapper.H:94
Foam::mapDistributeBase
Class containing processor-to-processor mapping information.
Definition: mapDistributeBase.H:103
Foam::UList::size
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
Foam::distributedUnallocatedDirectFieldMapper::~distributedUnallocatedDirectFieldMapper
virtual ~distributedUnallocatedDirectFieldMapper()=default
Destructor.