1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "pointFieldDecomposer.H"
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
32 const pointPatch& completeMeshPatch,
33 const pointPatch& procMeshPatch,
34 const labelList& directAddr
37 pointPatchFieldMapperPatchRef
42 directAddressing_(procMeshPatch.size(), -1)
44 // Create the inverse-addressing of the patch point labels.
45 labelList pointMap(completeMeshPatch.boundaryMesh().mesh().size(), -1);
47 const labelList& completeMeshPatchPoints = completeMeshPatch.meshPoints();
49 forAll(completeMeshPatchPoints, pointi)
51 pointMap[completeMeshPatchPoints[pointi]] = pointi;
54 // Use the inverse point addressing to create the addressing table for this
56 const labelList& procMeshPatchPoints = procMeshPatch.meshPoints();
58 forAll(procMeshPatchPoints, pointi)
60 directAddressing_[pointi] =
61 pointMap[directAddr[procMeshPatchPoints[pointi]]];
64 // Check that all the patch point addresses are set
65 if (directAddressing_.size() && min(directAddressing_) < 0)
69 "pointFieldDecomposer::patchFieldDecomposer()"
70 ) << "Incomplete patch point addressing"
76 Foam::pointFieldDecomposer::pointFieldDecomposer
78 const pointMesh& completeMesh,
79 const pointMesh& procMesh,
80 const labelList& pointAddressing,
81 const labelList& boundaryAddressing
84 completeMesh_(completeMesh),
86 pointAddressing_(pointAddressing),
87 boundaryAddressing_(boundaryAddressing),
88 patchFieldDecomposerPtrs_
90 procMesh_.boundary().size(),
91 static_cast<patchFieldDecomposer*>(NULL)
94 forAll(boundaryAddressing_, patchi)
96 if (boundaryAddressing_[patchi] >= 0)
98 patchFieldDecomposerPtrs_[patchi] = new patchFieldDecomposer
100 completeMesh_.boundary()[boundaryAddressing_[patchi]],
101 procMesh_.boundary()[patchi],
109 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
111 Foam::pointFieldDecomposer::~pointFieldDecomposer()
113 forAll(patchFieldDecomposerPtrs_, patchi)
115 if (patchFieldDecomposerPtrs_[patchi])
117 delete patchFieldDecomposerPtrs_[patchi];
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 // ************************************************************************* //