/usr/include/freefoam/OpenFOAM/globalPoints.H is in libfreefoam-dev 0.1.0+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
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.
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
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::globalPoints
Description
Calculates points shared by more than two processor patches or cyclic
patches.
Is used in globalMeshData. (this info is needed for point-edge
communication where you do all but these shared points with patch to
patch communication but need to do a reduce on these shared points)
Works purely topological and using local communication only.
Needs:
- domain to be one single domain (i.e. all faces can be reached through
face-cell walk).
- patch face ordering to be ok
- f[0] ordering on patch faces to be ok.
Works by constructing equivalence lists for all the points on processor
patches. These list are procPointList and give processor and meshPoint
label on that processor.
E.g.
@verbatim
((7 93)(4 731)(3 114))
@endverbatim
means point 93 on proc7 is connected to point 731 on proc4 and 114 on proc3.
It then gets the lowest numbered processor (the 'master') to request a
sharedPoint label from processor0 and it redistributes this label back to
the other processors in the equivalence list.
Algorithm:
- get meshPoints of all my points on processor patches and initialize
equivalence lists to this.
loop
- send to all neighbours in relative form:
- patchFace
- index in face
- receive and convert into meshPoints. Add to to my equivalence lists.
- mark meshPoints for which information changed.
- send data for these meshPoints again
endloop until nothing changes
At this point one will have complete point-point connectivity for all
points on processor patches. Now
- remove point equivalences of size 2. These are just normal points
shared between two neighbouring procPatches.
- collect on each processor points for which it is the master
- request number of sharedPointLabels from the Pstream::master.
This information gets redistributed to all processors in a similar way
as that in which the equivalence lists were collected:
- initialize the indices of shared points I am the master for
loop
- send my known sharedPoints + meshPoints to all neighbours
- receive from all neighbour. Find which meshPoint on my processor
the sharedpoint is connected to
- mark indices for which information has changed
endloop until nothing changes.
SourceFiles
globalPoints.C
\*---------------------------------------------------------------------------*/
#ifndef globalPoints_H
#define globalPoints_H
#include <OpenFOAM/DynamicList.H>
#include <OpenFOAM/Map.H>
#include <OpenFOAM/labelList.H>
#include <OpenFOAM/FixedList.H>
#include <OpenFOAM/primitivePatch.H>
#include <OpenFOAM/className.H>
#include <OpenFOAM/edgeList.H>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class polyMesh;
class polyBoundaryMesh;
class cyclicPolyPatch;
/*---------------------------------------------------------------------------*\
Class globalPoints Declaration
\*---------------------------------------------------------------------------*/
class globalPoints
{
// Private classes
//- Define procPointList as holding a list of meshPoint/processor labels
typedef FixedList<label, 2> procPoint;
typedef List<procPoint> procPointList;
// Private data
//- Mesh reference
const polyMesh& mesh_;
//- Sum of points on processor patches (unfiltered, point on 2 patches
// counts as 2)
const label nPatchPoints_;
//- All points on boundaries and their corresponding connected points
// on other processors.
DynamicList<procPointList> procPoints_;
//- Map from mesh point to index in procPoints
Map<label> meshToProcPoint_;
//- Shared points used by this processor (= global point number)
labelList sharedPointAddr_;
//- My meshpoints corresponding to the shared points
labelList sharedPointLabels_;
//- Total number of shared points.
label nGlobalPoints_;
// Private Member Functions
//- Count all points on processorPatches. Is all points for which
// information is collected.
static label countPatchPoints(const polyBoundaryMesh&);
//- Add information about patchPointI in relative indices to send
// buffers (patchFaces, indexInFace etc.)
static void addToSend
(
const primitivePatch&,
const label patchPointI,
const procPointList&,
DynamicList<label>& patchFaces,
DynamicList<label>& indexInFace,
DynamicList<procPointList>& allInfo
);
//- Merge info from neighbour into my data
static bool mergeInfo
(
const procPointList& nbrInfo,
procPointList& myInfo
);
//- Store (and merge) info for meshPointI
bool storeInfo(const procPointList& nbrInfo, const label meshPointI);
//- Initialize procPoints_ to my patch points. allPoints = true:
// seed with all patch points, = false: only boundaryPoints().
void initOwnPoints(const bool allPoints, labelHashSet& changedPoints);
//- Send subset of procPoints to neighbours
void sendPatchPoints(const labelHashSet& changedPoints) const;
//- Receive neighbour points and merge into my procPoints.
void receivePatchPoints(labelHashSet& changedPoints);
//- Remove entries of size 2 where meshPoint is in provided Map.
// Used to remove normal face-face connected points.
void remove(const Map<label>&);
//- Get indices of point for which I am master (lowest numbered proc)
labelList getMasterPoints() const;
//- Send subset of shared points to neighbours
void sendSharedPoints(const labelList& changedIndices) const;
//- Receive shared points and update subset.
void receiveSharedPoints(labelList& changedIndices);
//- Should move into cyclicPolyPatch but some ordering problem
// keeps on giving problems.
static edgeList coupledPoints(const cyclicPolyPatch&);
//- Disallow default bitwise copy construct
globalPoints(const globalPoints&);
//- Disallow default bitwise assignment
void operator=(const globalPoints&);
public:
//- Declare name of the class and its debug switch
ClassName("globalPoints");
// Constructors
//- Construct from mesh
globalPoints(const polyMesh& mesh);
// Member Functions
// Access
label nPatchPoints() const
{
return nPatchPoints_;
}
const Map<label>& meshToProcPoint() const
{
return meshToProcPoint_;
}
//- shared points used by this processor (= global point number)
const labelList& sharedPointAddr() const
{
return sharedPointAddr_;
}
//- my meshpoints corresponding to the shared points
const labelList& sharedPointLabels() const
{
return sharedPointLabels_;
}
label nGlobalPoints() const
{
return nGlobalPoints_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************ vim: set sw=4 sts=4 et: ************************ //
|