indexedCellOpsTemplates.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) 2013-2016 OpenFOAM Foundation
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 "indexedCellOps.H"
29#include "Pstream.H"
30
31// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
32
33template<class CellType>
34Foam::label CGAL::indexedCellOps::dualVertexMasterProc(const CellType& c)
35{
36 if (!c->parallelDualVertex())
37 {
38 return -1;
39 }
40
41 // The master processor is the lowest numbered of the four on this tet.
42
43 int masterProc = Foam::Pstream::nProcs() + 1;
44
45 for (Foam::label vI = 0; vI < 4; ++vI)
46 {
47 if (c->vertex(vI)->referred())
48 {
49 masterProc = min(masterProc, c->vertex(vI)->procIndex());
50 }
51 else
52 {
53 masterProc = min(masterProc, Foam::Pstream::myProcNo());
54 }
55 }
56
57 return masterProc;
58}
59
60
61template<class CellType>
64{
66
67 if (!c->parallelDualVertex())
68 {
69 return procsAttached;
70 }
71
72 for (Foam::label vI = 0; vI < 4; ++vI)
73 {
74 if (c->vertex(vI)->referred())
75 {
76 procsAttached[vI] = c->vertex(vI)->procIndex();
77 }
78 }
79
80 return procsAttached;
81}
82
83
84// ************************************************************************* //
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: FixedList.H:81
label nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
int myProcNo() const noexcept
Return processor number.
Foam::label dualVertexMasterProc(const CellType &c)
Does the Dual vertex form part of a processor patch.
Foam::FixedList< Foam::label, 4 > processorsAttached(const CellType &c)
const dimensionedScalar c
Speed of light in a vacuum.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33