Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
10License
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
31// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32
33void Foam::faEdgeMapper::calcAddressing() const
34{
35 if (directAddrPtr_)
36 {
38 << "Addressing already calculated"
39 << abort(FatalError);
40 }
41
42 hasUnmapped_ = false;
43
44 // Dummy mapping: take value from edge 0
45 directAddrPtr_ = std::make_unique<labelList>(size(), Foam::zero{});
46}
47
48
49// void Foam::faEdgeMapper::clearOut()
50// {
51// directAddrPtr_.reset(nullptr);
52// hasUnmapped_ = false;
53// }
54
55
56// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
57
59(
60 const faMesh& mesh,
61 const mapPolyMesh& mpm
62)
63:
64 // currently unused: mesh_(mesh),
65 // currently unused: mpm_(mpm),
66 mapperLen_(mesh.nInternalEdges()),
67 sizeBeforeMapping_(mesh.nInternalEdges()),
68 hasUnmapped_(false)
69{}
70
71
72// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
77
78// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
80Foam::label Foam::faEdgeMapper::size() const
81{
82 return mapperLen_;
83}
84
85
87{
88 if (!directAddrPtr_)
89 {
90 calcAddressing();
91 }
92
93 return *directAddrPtr_;
94}
95
96
98{
100 << "Requested interpolative addressing for a direct mapper."
101 << abort(FatalError);
102
103 return labelListList::null();
104}
105
106
108{
110 << "Requested interpolative weights for a direct mapper."
111 << abort(FatalError);
112
113 return scalarListList::null();
114}
115
116
117// ************************************************************************* //
static const List< labelList > & null() noexcept
Definition List.H:138
virtual const labelListList & addressing() const
Return interpolated addressing.
virtual const scalarListList & weights() const
Return interpolation weights.
virtual const labelUList & directAddressing() const
Return direct addressing.
virtual label size() const
Return mapper size.
virtual ~faEdgeMapper()
Destructor.
faEdgeMapper(const faEdgeMapper &)=delete
No copy construct.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition faMesh.H:140
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
List< scalarList > scalarListList
List of scalarList.
Definition scalarList.H:35
List< labelList > labelListList
List of labelList.
Definition labelList.H:38
errorManip< error > abort(error &err)
Definition errorManip.H:139
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
UList< label > labelUList
A UList of labels.
Definition UList.H:75