1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "tetPointFieldReconstructor.H"
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
35 // Calculate point addressing
36 labelList tetPointFieldReconstructor::procAddressing
41 // Allocate the addressing
42 labelList addr(procMeshes_[procNo].nPoints(), -1);
44 const labelList& pointAddr = pointProcAddressing_[procNo];
45 const labelList& cellAddr = cellProcAddressing_[procNo];
49 // Insert point addressing
51 // Use only live points. HJ, 14/Apr/2009
52 for (label pointI = 0; pointI < procMeshes_[procNo]().nPoints(); pointI++)
54 addr[nAddr] = pointAddr[pointI];
58 // Insert face addressing. Only for face decomposition
59 const labelList& faceAddr = faceProcAddressing_[procNo];
61 const label faceOffset = mesh_.faceOffset();
63 // Use only live faces. HJ, 14/Apr/2009
64 for (label faceI = 0; faceI < procMeshes_[procNo]().nFaces(); faceI++)
66 // Remember to decrement the index by one (turning index)
67 addr[nAddr] = faceOffset + mag(faceAddr[faceI]) - 1;
71 // Insert cell addressing
72 const label cellOffset = mesh_.cellOffset();
74 forAll (cellAddr, cellI)
76 addr[nAddr] = cellOffset + cellAddr[cellI];
84 labelList tetPointFieldReconstructor::procPatchAddressing
86 const labelList& procToGlobalAddr,
91 labelList addr(procMeshes_[procNo].boundary()[patchNo].size(), -1);
94 // Go to the global patch, create a lookup list the size of all
95 // points in the mesh and then gather the points for the current
97 labelList pointLookup(mesh_.nPoints(), -1);
99 const labelList& globalPatchPoints =
100 mesh_.boundary()[boundaryProcAddressing_[procNo][patchNo]].meshPoints();
102 forAll (globalPatchPoints, pointI)
104 pointLookup[globalPatchPoints[pointI]] = pointI;
107 // Gather the information
109 const labelList& procPatchPoints =
110 procMeshes_[procNo].boundary()[patchNo].meshPoints();
112 forAll (procPatchPoints, pointI)
115 pointLookup[procToGlobalAddr[procPatchPoints[pointI]]];
118 if (addr.size() && min(addr) < 0)
122 "labelList tetPointFieldReconstructor::"
123 "patchProcAddressing\n"
125 " const labelList& procToGlobalAddr,\n"
126 " const label procNo,\n"
127 " const label patchNo\n"
129 ) << "error in addressing"
130 << abort(FatalError);
137 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
139 // Construct from components
140 tetPointFieldReconstructor::tetPointFieldReconstructor
143 const PtrList<tetPolyMesh>& procMeshes,
144 const PtrList<labelIOList>& pointProcAddressing,
145 const PtrList<labelIOList>& faceProcAddressing,
146 const PtrList<labelIOList>& cellProcAddressing,
147 const PtrList<labelIOList>& boundaryProcAddressing
151 procMeshes_(procMeshes),
152 pointProcAddressing_(pointProcAddressing),
153 faceProcAddressing_(faceProcAddressing),
154 cellProcAddressing_(cellProcAddressing),
155 boundaryProcAddressing_(boundaryProcAddressing)
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 } // End namespace Foam
163 // ************************************************************************* //