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 "tetPointFieldReconstructor.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
36 // Calculate point addressing
37 labelList tetPointFieldReconstructor::procAddressing
42 // Allocate the addressing
43 labelList addr(procMeshes_[procNo].nPoints(), -1);
45 const labelList& pointAddr = pointProcAddressing_[procNo];
46 const labelList& cellAddr = cellProcAddressing_[procNo];
50 // Insert point addressing
52 // Use only live points. HJ, 14/Apr/2009
53 for (label pointI = 0; pointI < procMeshes_[procNo]().nPoints(); pointI++)
55 addr[nAddr] = pointAddr[pointI];
59 // Insert face addressing. Only for face decomposition
60 const labelList& faceAddr = faceProcAddressing_[procNo];
62 const label faceOffset = mesh_.faceOffset();
64 // Use only live faces. HJ, 14/Apr/2009
65 for (label faceI = 0; faceI < procMeshes_[procNo]().nFaces(); faceI++)
67 // Remember to decrement the index by one (turning index)
68 addr[nAddr] = faceOffset + mag(faceAddr[faceI]) - 1;
72 // Insert cell addressing
73 const label cellOffset = mesh_.cellOffset();
75 forAll (cellAddr, cellI)
77 addr[nAddr] = cellOffset + cellAddr[cellI];
85 labelList tetPointFieldReconstructor::procPatchAddressing
87 const labelList& procToGlobalAddr,
92 labelList addr(procMeshes_[procNo].boundary()[patchNo].size(), -1);
95 // Go to the global patch, create a lookup list the size of all
96 // points in the mesh and then gather the points for the current
98 labelList pointLookup(mesh_.nPoints(), -1);
100 const labelList& globalPatchPoints =
101 mesh_.boundary()[boundaryProcAddressing_[procNo][patchNo]].meshPoints();
103 forAll (globalPatchPoints, pointI)
105 pointLookup[globalPatchPoints[pointI]] = pointI;
108 // Gather the information
110 const labelList& procPatchPoints =
111 procMeshes_[procNo].boundary()[patchNo].meshPoints();
113 forAll (procPatchPoints, pointI)
116 pointLookup[procToGlobalAddr[procPatchPoints[pointI]]];
119 if (addr.size() && min(addr) < 0)
123 "labelList tetPointFieldReconstructor::"
124 "patchProcAddressing\n"
126 " const labelList& procToGlobalAddr,\n"
127 " const label procNo,\n"
128 " const label patchNo\n"
130 ) << "error in addressing"
131 << abort(FatalError);
138 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
140 // Construct from components
141 tetPointFieldReconstructor::tetPointFieldReconstructor
144 const PtrList<tetPolyMesh>& procMeshes,
145 const PtrList<labelIOList>& pointProcAddressing,
146 const PtrList<labelIOList>& faceProcAddressing,
147 const PtrList<labelIOList>& cellProcAddressing,
148 const PtrList<labelIOList>& boundaryProcAddressing
152 procMeshes_(procMeshes),
153 pointProcAddressing_(pointProcAddressing),
154 faceProcAddressing_(faceProcAddressing),
155 cellProcAddressing_(cellProcAddressing),
156 boundaryProcAddressing_(boundaryProcAddressing)
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 } // End namespace Foam
164 // ************************************************************************* //