OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

pointFieldReconstructor.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "pointFieldReconstructor.H"
00028 
00029 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00030 
00031 Foam::pointFieldReconstructor::pointFieldReconstructor
00032 (
00033     const pointMesh& mesh,
00034     const PtrList<pointMesh>& procMeshes,
00035     const PtrList<labelIOList>& pointProcAddressing,
00036     const PtrList<labelIOList>& boundaryProcAddressing
00037 )
00038 :
00039     mesh_(mesh),
00040     procMeshes_(procMeshes),
00041     pointProcAddressing_(pointProcAddressing),
00042     boundaryProcAddressing_(boundaryProcAddressing),
00043     patchPointAddressing_(procMeshes.size())
00044 {
00045     // Inverse-addressing of the patch point labels.
00046     labelList pointMap(mesh_.size(), -1);
00047 
00048     // Create the pointPatch addressing
00049     forAll(procMeshes_, proci)
00050     {
00051         const pointMesh& procMesh = procMeshes_[proci];
00052 
00053         patchPointAddressing_[proci].setSize(procMesh.boundary().size());
00054 
00055         forAll(procMesh.boundary(), patchi)
00056         {
00057             if (boundaryProcAddressing_[proci][patchi] >= 0)
00058             {
00059                 labelList& procPatchAddr = patchPointAddressing_[proci][patchi];
00060                 procPatchAddr.setSize(procMesh.boundary()[patchi].size(), -1);
00061 
00062                 const labelList& patchPointLabels =
00063                     mesh_.boundary()[boundaryProcAddressing_[proci][patchi]]
00064                     .meshPoints();
00065 
00066                 // Create the inverse-addressing of the patch point labels.
00067                 forAll (patchPointLabels, pointi)
00068                 {
00069                     pointMap[patchPointLabels[pointi]] = pointi;
00070                 }
00071             
00072                 const labelList& procPatchPoints =
00073                     procMesh.boundary()[patchi].meshPoints();
00074 
00075                 forAll (procPatchPoints, pointi)
00076                 {
00077                     procPatchAddr[pointi] =
00078                         pointMap
00079                         [
00080                             pointProcAddressing_[proci][procPatchPoints[pointi]]
00081                         ];
00082                 }
00083 
00084                 if (procPatchAddr.size() && min(procPatchAddr) < 0)
00085                 {
00086                     FatalErrorIn
00087                     (
00088                         "pointFieldReconstructor::pointFieldReconstructor"
00089                         "(\n"
00090                         "    const pointMesh& mesh,\n"
00091                         "    const PtrList<pointMesh>& procMeshes,\n"
00092                         "    const PtrList<labelIOList>& pointProcAddressing,\n"
00093                         "    const PtrList<labelIOList>& "
00094                         "boundaryProcAddressing\n"
00095                         ")"
00096                     )   << "Incomplete patch point addressing"
00097                         << abort(FatalError);
00098                 }
00099             }
00100         }
00101     }
00102 }
00103 
00104 
00105 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd