faPatchMapper.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) 2016-2017 Wikki Ltd
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::faPatchMapper
28 
29 Description
30  Mapping class for a faPatchField. Edge mapping is calculated based on
31  faceCells comparison of old and new patch
32 
33 Author
34  Zeljko Tukovic, FMENA
35  Hrvoje Jasak, Wikki Ltd.
36 
37 SourceFiles
38  faPatchMapper.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef faPatchMapper_H
43 #define faPatchMapper_H
44 
45 #include "faPatchFieldMapper.H"
46 #include "faceMapper.H"
47 #include "faPatch.H"
48 #include "primitiveFields.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward declaration of classes
56 class faPatch;
57 class mapPolyMesh;
58 
59 /*---------------------------------------------------------------------------*\
60  Class faPatchMapper Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class faPatchMapper
64 :
65  public faPatchFieldMapper
66 {
67  // Private data
68 
69  //- Reference to patch
70  const faPatch& patch_;
71 
72  //- Reference to mapPolyMesh
73  const mapPolyMesh& mpm_;
74 
75  //- Size before mapping
76  const label sizeBeforeMapping_;
77 
78  //- faceCells before mapping
79  const labelList oldEdgeFaces_;
80 
81 
82  // Demand-driven private data
83 
84  mutable bool hasUnmapped_;
85 
86  //- Direct addressing
87  mutable labelList* directAddrPtr_;
88 
89 
90  // Private Member Functions
91 
92  //- No copy construct
93  faPatchMapper(const faPatchMapper&) = delete;
94 
95  //- No copy assignment
96  void operator=(const faPatchMapper&) = delete;
97 
98 
99  //- Calculate addressing for mapping with inserted cells
100  void calcAddressing() const;
101 
102  //- Clear out local storage
103  void clearOut();
104 
105 
106 public:
107 
108  //- Construct from mappers
110  (
111  const faPatch& patch,
112  const mapPolyMesh& mpm
113  );
114 
115 
116  //- Destructor
117  virtual ~faPatchMapper();
118 
119 
120  // Member Functions
121 
122  //- Return size
123  virtual label size() const
124  {
125  return patch_.size();
126  }
127 
128  //- Return size of field before mapping
129  virtual label sizeBeforeMapping() const
130  {
131  return sizeBeforeMapping_;
132  }
133 
134  //- Is the mapping direct
135  virtual bool direct() const
136  {
137  return true;
138  }
139 
140  virtual bool hasUnmapped() const
141  {
142  return hasUnmapped_;
143  }
144 
145  //- Return direct addressing
146  virtual const labelUList& directAddressing() const;
147 
148  //- Return interpolated addressing
149  virtual const labelListList& addressing() const;
150 
151  //- Return interpolation weights
152  virtual const scalarListList& weights() const;
153 };
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
Foam::faPatchMapper::size
virtual label size() const
Return size.
Definition: faPatchMapper.H:122
Foam::faPatchMapper::directAddressing
virtual const labelUList & directAddressing() const
Return direct addressing.
Definition: faPatchMapper.C:125
Foam::faPatchMapper::weights
virtual const scalarListList & weights() const
Return interpolation weights.
Definition: faPatchMapper.C:146
Foam::faPatchMapper::~faPatchMapper
virtual ~faPatchMapper()
Destructor.
Definition: faPatchMapper.C:117
Foam::faPatchMapper::addressing
virtual const labelListList & addressing() const
Return interpolated addressing.
Definition: faPatchMapper.C:136
Foam::faPatchFieldMapper
Definition: faPatchFieldMapper.H:44
faPatchFieldMapper.H
primitiveFields.H
Specialisations of Field<T> for scalar, vector and tensor.
Foam::faPatchMapper::direct
virtual bool direct() const
Is the mapping direct.
Definition: faPatchMapper.H:134
faceMapper.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::List< label >
faPatch.H
Foam::UList< label >
Foam::faPatchMapper::sizeBeforeMapping
virtual label sizeBeforeMapping() const
Return size of field before mapping.
Definition: faPatchMapper.H:128
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::faPatch
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:69
Foam::faPatchMapper::hasUnmapped
virtual bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: faPatchMapper.H:139
Foam::faPatchMapper
Mapping class for a faPatchField. Edge mapping is calculated based on faceCells comparison of old and...
Definition: faPatchMapper.H:62
Foam::faPatch::size
virtual label size() const
Patch size is the number of edge labels.
Definition: faPatch.H:264