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 \*---------------------------------------------------------------------------*/
31 #include "blockDescriptor.H"
32 #include "scalarList.H"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
41 void blockDescriptor::makeBlockEdges()
43 // for all edges check the list of curved edges. If the edge is curved,
44 // add it to the list. If the edge is not found, create is as a line
46 setEdge(0, 0, 1, n_.x());
47 setEdge(1, 3, 2, n_.x());
48 setEdge(2, 7, 6, n_.x());
49 setEdge(3, 4, 5, n_.x());
51 setEdge(4, 0, 3, n_.y());
52 setEdge(5, 1, 2, n_.y());
53 setEdge(6, 5, 6, n_.y());
54 setEdge(7, 4, 7, n_.y());
56 setEdge(8, 0, 4, n_.z());
57 setEdge(9, 1, 5, n_.z());
58 setEdge(10, 2, 6, n_.z());
59 setEdge(11, 3, 7, n_.z());
63 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
66 blockDescriptor::blockDescriptor
68 const cellShape& bshape,
69 const pointField& blockMeshPoints,
70 const curvedEdgeList& edges,
71 const Vector<label>& n,
72 const scalarList& expand,
76 blockMeshPoints_(blockMeshPoints),
85 if (expand_.size() != 12)
89 "blockDescriptor::blockDescriptor"
90 "(const cellShape& bshape, const pointField& blockMeshPoints, "
91 "const curvedEdgeList& edges, label xnum, label ynum, label znum, "
92 "const scalarList& expand, const word& zoneName)"
93 ) << "Unknown definition of expansion ratios"
102 blockDescriptor::blockDescriptor
104 const pointField& blockMeshPoints,
105 const curvedEdgeList& edges,
109 blockMeshPoints_(blockMeshPoints),
118 // Look at first token
122 // Optional zone name
125 zoneName_ = t.wordToken();
127 // Consume zoneName token
135 if (t.isPunctuation())
137 if (t.pToken() == token::BEGIN_LIST)
145 "blockDescriptor::blockDescriptor"
146 "(const pointField&, const curvedEdgeList&, Istream& is)",
148 ) << "incorrect token while reading n, expected '(', found "
150 << exit(FatalIOError);
155 is >> n_.x() >> n_.y() >> n_.z();
164 scalarList expRatios(is);
166 if (expRatios.size() == 3)
168 expand_[0] = expRatios[0];
169 expand_[1] = expRatios[0];
170 expand_[2] = expRatios[0];
171 expand_[3] = expRatios[0];
173 expand_[4] = expRatios[1];
174 expand_[5] = expRatios[1];
175 expand_[6] = expRatios[1];
176 expand_[7] = expRatios[1];
178 expand_[8] = expRatios[2];
179 expand_[9] = expRatios[2];
180 expand_[10] = expRatios[2];
181 expand_[11] = expRatios[2];
183 else if (expRatios.size() == 12)
191 "blockDescriptor::blockDescriptor"
192 "(const pointField& blockMeshPoints, const curvedEdgeList& edges,"
194 ) << "Unknown definition of expansion ratios"
198 // create a list of edges
203 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
205 const pointField& blockDescriptor::points() const
207 return blockMeshPoints_;
210 const cellShape& blockDescriptor::blockShape() const
215 const List<List<point> >& blockDescriptor::blockEdgePoints() const
220 const scalarListList& blockDescriptor::blockEdgeWeights() const
225 const Vector<label>& blockDescriptor::n() const
230 const word& blockDescriptor::zoneName() const
236 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
238 void blockDescriptor::operator=(const blockDescriptor&)
240 notImplemented("void blockDescriptor::operator=(const blockDescriptor&)");
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 } // End namespace Foam
248 // ************************************************************************* //