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 "pointFieldDecomposer.H"
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
37 const pointPatch& completeMeshPatch,
38 const pointPatch& procMeshPatch,
39 const labelList& directAddr
42 PointPatchFieldMapperPatchRef<pointPatch>
47 sizeBeforeMapping_(completeMeshPatch.size()),
48 directAddressing_(procMeshPatch.size(), -1)
50 // Create the inverse-addressing of the patch point labels.
51 labelList pointMap(completeMeshPatch.boundaryMesh().mesh().size(), -1);
53 const labelList& completeMeshPatchPoints = completeMeshPatch.meshPoints();
55 forAll (completeMeshPatchPoints, pointi)
57 pointMap[completeMeshPatchPoints[pointi]] = pointi;
60 // Use the inverse point addressing to create the addressing table for this
62 const labelList& procMeshPatchPoints = procMeshPatch.meshPoints();
64 forAll (procMeshPatchPoints, pointi)
66 directAddressing_[pointi] =
67 pointMap[directAddr[procMeshPatchPoints[pointi]]];
70 // Check that all the patch point addresses are set
71 if (directAddressing_.size() && min(directAddressing_) < 0)
75 "pointFieldDecomposer::patchFieldDecomposer()"
76 ) << "Incomplete patch point addressing"
82 pointFieldDecomposer::pointFieldDecomposer
84 const pointMesh& completeMesh,
85 const pointMesh& procMesh,
86 const labelList& pointAddressing,
87 const labelList& boundaryAddressing
90 completeMesh_(completeMesh),
92 pointAddressing_(pointAddressing),
93 boundaryAddressing_(boundaryAddressing),
94 patchFieldDecomposerPtrs_
96 procMesh_.boundary().size(),
97 static_cast<patchFieldDecomposer*>(NULL)
100 forAll (boundaryAddressing_, patchi)
102 if (boundaryAddressing_[patchi] >= 0)
104 patchFieldDecomposerPtrs_[patchi] = new patchFieldDecomposer
106 completeMesh_.boundary()[boundaryAddressing_[patchi]],
107 procMesh_.boundary()[patchi],
115 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
117 pointFieldDecomposer::~pointFieldDecomposer()
119 forAll (patchFieldDecomposerPtrs_, patchi)
121 if (patchFieldDecomposerPtrs_[patchi])
123 delete patchFieldDecomposerPtrs_[patchi];
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 } // End namespace Foam
133 // ************************************************************************* //