fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / tetDecompositionFiniteElement / tetPolyMeshCellDecomp / MapTetFemFieldsCellDecomp / tetPolyPatchMapperCellDecomp.C
blob15c60bcd6298544cf4a770b2970842c240a5b089
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Description
26     PolyPatch mapper for the cell tetFem decomposition
28 \*---------------------------------------------------------------------------*/
30 #include "tetPolyPatchMapperCellDecomp.H"
31 #include "tetPolyPatchCellDecomp.H"
32 #include "tetPolyBoundaryMeshCellDecomp.H"
33 #include "tetPolyMeshCellDecomp.H"
34 #include "tetFemMatrices.H"
35 #include "mapPolyMesh.H"
36 #include "pointMapper.H"
37 #include "faceTetPolyPatchCellDecomp.H"
39 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
41 void Foam::tetPolyPatchMapperCellDecomp::calcAddressing() const
43     if (directAddrPtr_)
44     {
45         FatalErrorIn
46         (
47             "void tetPolyPatchMapperCellDecomp::calcAddressing() const)"
48         )   << "Addressing already calculated"
49             << abort(FatalError);
50     }
52     // Mapping
54     const labelList& curPatchPointMap = mpm_.patchPointMap()[patch_.index()];
56     // Assemble the map (direct mapping)
57     directAddrPtr_ = new labelList(size());
58     labelList& addr = *directAddrPtr_;
59     label nAddr = 0;
61     forAll (curPatchPointMap, pointI)
62     {
63         if (curPatchPointMap[pointI] > -1)
64         {
65             addr[nAddr] = curPatchPointMap[pointI];
66         }
67         else
68         {
69             addr[nAddr] = 0;
70         }
71         nAddr++;
72     }
76 void Foam::tetPolyPatchMapperCellDecomp::clearOut()
78     deleteDemandDrivenData(directPtr_);
79     deleteDemandDrivenData(directAddrPtr_);
83 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
85 // Construct from components
86 Foam::tetPolyPatchMapperCellDecomp::tetPolyPatchMapperCellDecomp
88     const tetPolyPatchCellDecomp& patch,
89     const mapPolyMesh& meshMap
92     patch_(patch),
93     mpm_(meshMap),
94     directPtr_(NULL),
95     directAddrPtr_(NULL)
99 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
101 Foam::tetPolyPatchMapperCellDecomp::~tetPolyPatchMapperCellDecomp()
103     clearOut();
107 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
109 Foam::label Foam::tetPolyPatchMapperCellDecomp::size() const
111     return patch_.size();
115 Foam::label Foam::tetPolyPatchMapperCellDecomp::sizeBeforeMapping() const
117     return mpm_.oldPatchNMeshPoints()[patch_.index()];
121 const Foam::unallocLabelList&
122 Foam::tetPolyPatchMapperCellDecomp::directAddressing() const
124     if (!directAddrPtr_)
125     {
126         calcAddressing();
127     }
129     return *directAddrPtr_;
133 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
136 // * * * * * * * * * * * * * * * Friend Functions  * * * * * * * * * * * * * //
139 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
142 // ************************************************************************* //