1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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
26 from the list of curved edges creates a list
27 of edges that are not curved. It is assumed
28 that all other edges are straight lines
30 \*---------------------------------------------------------------------------*/
34 #include "blockDescriptor.H"
36 #include "lineDivide.H"
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 scalar calcGexp(const scalar expRatio, const label dim)
53 return pow(expRatio, 1.0/(dim - 1));
58 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
60 void blockDescriptor::setEdge(label edgeI, label start, label end, label dim)
62 // for all edges check the list of curved edges. If the edge is curved,
63 // add it to the list. If the edge is not found, create is as a line
67 // set reference to the list of labels defining the block
68 const labelList& blockLabels = blockShape_;
70 // set reference to global list of points
71 const pointField blockPoints = blockShape_.points(blockMeshPoints_);
76 forAll (curvedEdges_, nCEI)
78 if (curvedEdges_[nCEI].compare(blockLabels[start], blockLabels[end]))
82 // check the orientation:
83 // if the starting point of the curve is the same as the starting
84 // point of the edge, do the parametrisation and pick up the points
85 if (blockLabels[start] == curvedEdges_[nCEI].start())
87 // calculate the geometric expension factor out of the
89 scalar gExp = calcGexp(expand_[edgeI], dim);
92 lineDivide divEdge(curvedEdges_[nCEI], dim, gExp);
94 edgePoints_[edgeI] = divEdge.points();
95 edgeWeights_[edgeI] = divEdge.lambdaDivisions();
99 // the curve has got the opposite orientation
100 scalar gExp = calcGexp(expand_[edgeI], dim);
103 lineDivide divEdge(curvedEdges_[nCEI], dim, 1.0/(gExp+SMALL));
105 pointField p = divEdge.points();
106 scalarList d = divEdge.lambdaDivisions();
108 edgePoints_[edgeI].setSize(p.size());
109 edgeWeights_[edgeI].setSize(d.size());
111 label pMax = p.size() - 1;
114 edgePoints_[edgeI][pI] = p[pMax - pI];
115 edgeWeights_[edgeI][pI] = 1.0 - d[pMax - pI];
125 // edge is a straight line
126 scalar gExp = calcGexp(expand_[edgeI], dim);
131 lineEdge(blockPoints, start, end),
136 edgePoints_[edgeI] = divEdge.points();
137 edgeWeights_[edgeI] = divEdge.lambdaDivisions();
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 } // End namespace Foam
146 // ************************************************************************* //