faEdgeMapper.C
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 \*---------------------------------------------------------------------------*/
27 
28 #include "faEdgeMapper.H"
29 #include "mapPolyMesh.H"
30 #include "demandDrivenData.H"
31 
32 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
33 
34 void Foam::faEdgeMapper::calcAddressing() const
35 {
36  if (directAddrPtr_)
37  {
39  << "Addressing already calculated"
40  << abort(FatalError);
41  }
42 
43  hasUnmapped_ = false;
44 
45  // Dummy mapping: take value from edge 0
46  directAddrPtr_ = new labelList(size(), Zero);
47 }
48 
49 
50 void Foam::faEdgeMapper::clearOut()
51 {
52  deleteDemandDrivenData(directAddrPtr_);
53  hasUnmapped_ = false;
54 }
55 
56 
57 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
58 
59 Foam::faEdgeMapper::faEdgeMapper
60 (
61  const faMesh& mesh,
62  const mapPolyMesh& mpm
63 )
64 :
65  mesh_(mesh),
66 // mpm_(mpm),
67  sizeBeforeMapping_(mesh.nInternalEdges()),
68  hasUnmapped_(false),
69  directAddrPtr_(nullptr)
70 {}
71 
72 
73 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
74 
76 {
77  clearOut();
78 }
79 
80 
81 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
82 
84 {
85  if (!directAddrPtr_)
86  {
87  calcAddressing();
88  }
89 
90  return *directAddrPtr_;
91 }
92 
93 
95 {
97  << "Requested interpolative addressing for a direct mapper."
98  << abort(FatalError);
99 
100  return labelListList::null();
101 }
102 
103 
105 {
107  << "Requested interpolative weights for a direct mapper."
108  << abort(FatalError);
109 
110  return scalarListList::null();
111 }
112 
113 
114 // ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::faEdgeMapper::~faEdgeMapper
virtual ~faEdgeMapper()
Destructor.
Definition: faEdgeMapper.C:75
Foam::faEdgeMapper::size
virtual label size() const
Return size.
Definition: faEdgeMapper.H:115
Foam::List< labelList >::null
static const List< labelList > & null()
Return a null List.
Definition: ListI.H:109
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
mapPolyMesh.H
Foam::faEdgeMapper::directAddressing
virtual const labelUList & directAddressing() const
Return direct addressing.
Definition: faEdgeMapper.C:83
Foam::deleteDemandDrivenData
void deleteDemandDrivenData(DataPtr &dataPtr)
Definition: demandDrivenData.H:42
faEdgeMapper.H
Foam::primitiveMesh::nInternalEdges
label nInternalEdges() const
Internal edges using 0,1 or 2 boundary points.
Definition: primitiveMeshI.H:59
Foam::FatalError
error FatalError
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::List< labelList >
Foam::UList< label >
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:82
Foam::faEdgeMapper::addressing
virtual const labelListList & addressing() const
Return interpolated addressing.
Definition: faEdgeMapper.C:94
Foam::faEdgeMapper::weights
virtual const scalarListList & weights() const
Return interpolation weights.
Definition: faEdgeMapper.C:104