extendedCentredFaceToCellStencil.C 2.35 KB
Newer Older
1
2
3
4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
5
    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
6
7
8
9
10
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

11
12
13
14
    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
15
16
17
18
19
20
21

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
22
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
23
24
25

\*---------------------------------------------------------------------------*/

mattijs's avatar
mattijs committed
26
#include "extendedCentredFaceToCellStencil.H"
27
#include "mapDistribute.H"
mattijs's avatar
mattijs committed
28
29
#include "faceToCellStencil.H"

30
31
// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

mattijs's avatar
mattijs committed
32
33
34
35
Foam::extendedCentredFaceToCellStencil::extendedCentredFaceToCellStencil
(
    const faceToCellStencil& stencil
)
36
:
37
38
    extendedFaceToCellStencil(stencil.mesh()),
    stencil_(stencil)
39
{
mattijs's avatar
mattijs committed
40
    // Calculate distribute map (also renumbers elements in stencil)
41
42
    List<Map<label> > compactMap(Pstream::nProcs());
    mapPtr_.reset
mattijs's avatar
mattijs committed
43
    (
44
45
46
47
48
49
        new mapDistribute
        (
            stencil.globalNumbering(),
            stencil_,
            compactMap
        )
mattijs's avatar
mattijs committed
50
    );
51
52
53
54
55
56
}


// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //

// Per face which elements of the stencil to keep.
mattijs's avatar
mattijs committed
57
void Foam::extendedCentredFaceToCellStencil::compact()
58
59
60
61
62
63
64
65
66
67
68
69
70
{
    boolList isInStencil(map().constructSize(), false);

    forAll(stencil_, faceI)
    {
        const labelList& stencilCells = stencil_[faceI];

        forAll(stencilCells, i)
        {
            isInStencil[stencilCells[i]] = true;
        }
    }

mattijs's avatar
mattijs committed
71
    mapPtr_().compact(isInStencil, Pstream::msgType());
72
73
74
75
}


// ************************************************************************* //