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