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 \*---------------------------------------------------------------------------*/
27 #include "addToRunTimeSelectionTable.H"
28 #include "mathematicalConstants.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace extrudeModels
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 defineTypeNameAndDebug(wedge, 0);
41 addToRunTimeSelectionTable(extrudeModel, wedge, dictionary);
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 wedge::wedge(const dictionary& dict)
48 extrudeModel(typeName, dict),
49 axisPt_(coeffDict_.lookup("axisPt")),
50 axis_(coeffDict_.lookup("axis")),
53 readScalar(coeffDict_.lookup("angle"))
54 *mathematicalConstant::pi/180.0
59 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
65 // * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
67 point wedge::operator()
69 const point& surfacePoint,
70 const vector& surfaceNormal,
75 // For the case of a single layer extrusion assume a
76 // symmetric wedge about the reference plane is required
81 sliceAngle = -angle_/2.0;
85 sliceAngle = angle_/2.0;
90 //sliceAngle = angle_*(layer + 1)/nLayers_;
91 sliceAngle = angle_*layer/nLayers_;
94 // Find projection onto axis (or rather decompose surfacePoint
95 // into vector along edge (proj), vector normal to edge in plane
96 // of surface point and surface normal.
97 point d = surfacePoint - axisPt_;
99 d -= (axis_ & d)*axis_;
101 scalar dMag = mag(d);
103 point edgePt = surfacePoint - d;
105 // Rotate point around sliceAngle.
106 point rotatedPoint = edgePt;
110 vector n = (d/dMag) ^ axis_;
114 - sin(sliceAngle)*mag(d)*n; // Use either n or surfaceNormal
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 } // End namespace extrudeModels
124 } // End namespace Foam
126 // ************************************************************************* //