FieldMapper.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) 2011-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::FieldMapper
26 
27 Description
28  Abstract base class to hold the Field mapping addressing and weights.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef FieldMapper_H
33 #define FieldMapper_H
34 
35 #include "mapDistributeBase.H"
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 namespace Foam
40 {
41 
42 /*---------------------------------------------------------------------------*\
43  Class FieldMapper Declaration
44 \*---------------------------------------------------------------------------*/
45 
46 class FieldMapper
47 {
48 
49 public:
50 
51  // Constructors
52 
53  //- Null constructor
54  FieldMapper()
55  {}
56 
57 
58  //- Destructor
59  virtual ~FieldMapper()
60  {}
61 
62 
63  // Member Functions
64 
65  virtual label size() const = 0;
66 
67  virtual bool direct() const = 0;
68 
69  virtual bool distributed() const
70  {
71  return false;
72  }
73 
74  virtual const mapDistributeBase& distributeMap() const
75  {
77  << "attempt to access null distributeMap"
78  << abort(FatalError);
79  return *(new mapDistributeBase());
80  }
81 
82  //- Are there unmapped values? I.e. do all size() elements get
83  // get value
84  virtual bool hasUnmapped() const = 0;
85 
86  virtual const labelUList& directAddressing() const
87  {
89  << "attempt to access null direct addressing"
90  << abort(FatalError);
91 
92  return labelUList::null();
93  }
94 
95  virtual const labelListList& addressing() const
96  {
98  << "attempt to access null interpolation addressing"
99  << abort(FatalError);
100 
101  return labelListList::null();
102  }
104  virtual const scalarListList& weights() const
105  {
107  << "attempt to access null interpolation weights"
108  << abort(FatalError);
109 
110  return scalarListList::null();
111  }
112 
113 
114  // Member Operators
115 
116  template<class Type>
117  tmp<Field<Type>> operator()(const Field<Type>& f) const
118  {
119  return tmp<Field<Type>>(new Field<Type>(f, *this));
120  }
121 };
122 
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 } // End namespace Foam
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 #endif
131 
132 // ************************************************************************* //
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
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
virtual const labelListList & addressing() const
Definition: FieldMapper.H:94
virtual bool direct() const =0
virtual const scalarListList & weights() const
Definition: FieldMapper.H:103
static const List< labelList > & null()
Return a null List.
Definition: ListI.H:117
virtual const labelUList & directAddressing() const
Definition: FieldMapper.H:85
tmp< Field< Type > > operator()(const Field< Type > &f) const
Definition: FieldMapper.H:116
virtual label size() const =0
Abstract base class to hold the Field mapping addressing and weights.
Definition: FieldMapper.H:45
Pre-declare SubField and related Field type.
Definition: Field.H:57
errorManip< error > abort(error &err)
Definition: errorManip.H:131
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
virtual bool hasUnmapped() const =0
Are there unmapped values? I.e. do all size() elements get.
virtual const mapDistributeBase & distributeMap() const
Definition: FieldMapper.H:73
Class containing processor-to-processor mapping information.
virtual bool distributed() const
Definition: FieldMapper.H:68
static const UList< T > & null()
Return a null UList.
Definition: UListI.H:51
labelList f(nPoints)
virtual ~FieldMapper()
Destructor.
Definition: FieldMapper.H:58
A class for managing temporary objects.
Definition: PtrList.H:53
FieldMapper()
Null constructor.
Definition: FieldMapper.H:53
Namespace for OpenFOAM.