FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "pointFieldReconstructor.H"
00027 
00028 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00029 
00030 Foam::pointFieldReconstructor::pointFieldReconstructor
00031 (
00032     const pointMesh& mesh,
00033     const PtrList<pointMesh>& procMeshes,
00034     const PtrList<labelIOList>& pointProcAddressing,
00035     const PtrList<labelIOList>& boundaryProcAddressing
00036 )
00037 :
00038     mesh_(mesh),
00039     procMeshes_(procMeshes),
00040     pointProcAddressing_(pointProcAddressing),
00041     boundaryProcAddressing_(boundaryProcAddressing),
00042     patchPointAddressing_(procMeshes.size())
00043 {
00044     // Inverse-addressing of the patch point labels.
00045     labelList pointMap(mesh_.size(), -1);
00046 
00047     // Create the pointPatch addressing
00048     forAll(procMeshes_, proci)
00049     {
00050         const pointMesh& procMesh = procMeshes_[proci];
00051 
00052         patchPointAddressing_[proci].setSize(procMesh.boundary().size());
00053 
00054         forAll(procMesh.boundary(), patchi)
00055         {
00056             if (boundaryProcAddressing_[proci][patchi] >= 0)
00057             {
00058                 labelList& procPatchAddr = patchPointAddressing_[proci][patchi];
00059                 procPatchAddr.setSize(procMesh.boundary()[patchi].size(), -1);
00060 
00061                 const labelList& patchPointLabels =
00062                     mesh_.boundary()[boundaryProcAddressing_[proci][patchi]]
00063                     .meshPoints();
00064 
00065                 // Create the inverse-addressing of the patch point labels.
00066                 forAll (patchPointLabels, pointi)
00067                 {
00068                     pointMap[patchPointLabels[pointi]] = pointi;
00069                 }
00070             
00071                 const labelList& procPatchPoints =
00072                     procMesh.boundary()[patchi].meshPoints();
00073 
00074                 forAll (procPatchPoints, pointi)
00075                 {
00076                     procPatchAddr[pointi] =
00077                         pointMap
00078                         [
00079                             pointProcAddressing_[proci][procPatchPoints[pointi]]
00080                         ];
00081                 }
00082 
00083                 if (procPatchAddr.size() && min(procPatchAddr) < 0)
00084                 {
00085                     FatalErrorIn
00086                     (
00087                         "pointFieldReconstructor::pointFieldReconstructor"
00088                         "(\n"
00089                         "    const pointMesh& mesh,\n"
00090                         "    const PtrList<pointMesh>& procMeshes,\n"
00091                         "    const PtrList<labelIOList>& pointProcAddressing,\n"
00092                         "    const PtrList<labelIOList>& "
00093                         "boundaryProcAddressing\n"
00094                         ")"
00095                     )   << "Incomplete patch point addressing"
00096                         << abort(FatalError);
00097                 }
00098             }
00099         }
00100     }
00101 }
00102 
00103 
00104 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines