1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 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
27 \*---------------------------------------------------------------------------*/
29 #include "calcFaceAddressing.H"
33 // * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
35 // Returns the face labels of the shape in an order consistent with the
37 labelList calcFaceAddressing
39 const faceList& allFaces, // faces given faceLabels
40 const cellShape& shape,
41 const labelList& faces, // faceLabels for given cell
46 labelList shapeToMesh(shape.nFaces(), -1);
48 const faceList modelFaces(shape.faces());
50 // Loop over all faces of cellShape
51 forAll(modelFaces, cellFaceI)
54 const face& modelFace = modelFaces[cellFaceI];
56 // Loop over all face labels
59 const face& vertLabels = allFaces[faces[faceI]];
61 if (vertLabels == modelFace)
63 //Info<< "match:" << modelFace
64 // << " to " << vertLabels << endl;
65 shapeToMesh[cellFaceI] = faces[faceI];
70 if (shapeToMesh[cellFaceI] == -1)
72 FatalErrorIn("foamToFieldview : calcFaceAddressing")
73 << "calcFaceAddressing : can't match face to shape.\n"
74 << " shape face:" << modelFace << endl
75 << " face labels:" << faces << endl
76 << " cellI:" << cellI << endl;
78 FatalError << "Faces consist of vertices:" << endl;
82 << " face:" << faces[faceI]
83 << allFaces[faces[faceI]] << endl;
85 FatalError << exit(FatalError);
92 // ************************************************************************* //