1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
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
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 \*---------------------------------------------------------------------------*/
27 #include "processorTetPolyPatchCellDecomp.H"
28 #include "tetPolyMeshCellDecomp.H"
29 #include "globalTetPolyPatchCellDecomp.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
38 template<template<class> class FaceList>
39 labelList processorTetPolyPatchCellDecomp::calcProcLocalEdgesIndices
41 const PrimitivePatch<face, FaceList, const pointField&>& p
46 Info<< "labelList processorTetPolyPatchCellDecomp::"
47 << "calcProcLocalEdgesIndices(const primitivePatch& p) const : "
48 << "calculating local edge indices"
52 // Count number of edges in the patch
54 // Get reference to the mesh
55 const tetPolyMeshCellDecomp& mesh = boundaryMesh().mesh();
57 // Get reference to edges of the primitive patch
58 const edgeList& patchEdges = p.edges();
60 // Get reference to faces of the primitive patch
61 const faceList& patchFaces = p;
63 // Get reference to faces of the primitive patch
64 const faceList& patchLocalFaces = p.localFaces();
66 // Get reference to mesh points of the primitive patch
67 const labelList& patchMeshPoints = p.meshPoints();
69 // Make a point rejection list to remove shared processor points
71 // Get reference to shared processor points
72 const labelList& sharedPoints =
73 boundaryMesh().globalPatch().meshPoints();
75 boolList acceptPoint(patchMeshPoints.size(), true);
77 forAll (patchMeshPoints, pointI)
79 label curP = patchMeshPoints[pointI];
81 forAll (sharedPoints, sharedI)
83 if (sharedPoints[sharedI] == curP)
85 acceptPoint[pointI] = false;
91 // edges of the polyPatch
92 label maxNEdgesInPatch = patchEdges.size();
94 // diagonal edges across faces
95 forAll (patchFaces, faceI)
97 maxNEdgesInPatch += patchFaces[faceI].size() - 3;
100 labelList localEdgeInd(maxNEdgesInPatch, -1);
104 const lduAddressing& lduAddr = mesh.lduAddr();
106 // First do the edges of the primitive patch
107 forAll (patchEdges, edgeI)
111 acceptPoint[patchEdges[edgeI].start()]
112 || acceptPoint[patchEdges[edgeI].end()]
115 localEdgeInd[nEdges] =
118 patchMeshPoints[patchEdges[edgeI].start()],
119 patchMeshPoints[patchEdges[edgeI].end()]
126 // Now do the diagonal edges
127 forAll (patchFaces, faceI)
129 const face& curFace = patchFaces[faceI];
130 const face& curLocalFace = patchLocalFaces[faceI];
132 for (label pointI = 2; pointI < curFace.size() - 1; pointI++)
136 acceptPoint[curLocalFace[0]]
137 || acceptPoint[curLocalFace[pointI]]
140 localEdgeInd[nEdges] =
141 lduAddr.triIndex(curFace[0], curFace[pointI]);
148 // Reset the size of the list
149 localEdgeInd.setSize(nEdges);
151 # ifdef DEBUGtetFemMatrix
152 if (min(localEdgeInd) < 0)
156 "labelList processorTetPolyPatchCellDecomp::"
157 "calcProcLocalEdgesIndices(const primitivePatch& p) const"
158 ) << "Problem in local edge addressing"
159 << abort(FatalError);
165 Info<< "labelList processorTetPolyPatchCellDecomp::"
166 << "calcProcLocalEdgesIndices(const primitivePatch& p) const : "
167 << "finished calculating local edge indices"
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 } // End namespace Foam
179 // ************************************************************************* //