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