00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <OpenFOAM/error.H>
00029
00030 #include "blockDescriptor.H"
00031 #include <OpenFOAM/scalarList.H>
00032
00033
00034
00035 namespace Foam
00036 {
00037
00038
00039
00040 void blockDescriptor::makeBlockEdges()
00041 {
00042
00043
00044
00045 setEdge(0, 0, 1, n_.x());
00046 setEdge(1, 3, 2, n_.x());
00047 setEdge(2, 7, 6, n_.x());
00048 setEdge(3, 4, 5, n_.x());
00049
00050 setEdge(4, 0, 3, n_.y());
00051 setEdge(5, 1, 2, n_.y());
00052 setEdge(6, 5, 6, n_.y());
00053 setEdge(7, 4, 7, n_.y());
00054
00055 setEdge(8, 0, 4, n_.z());
00056 setEdge(9, 1, 5, n_.z());
00057 setEdge(10, 2, 6, n_.z());
00058 setEdge(11, 3, 7, n_.z());
00059 }
00060
00061
00062
00063
00064
00065 blockDescriptor::blockDescriptor
00066 (
00067 const cellShape& bshape,
00068 const pointField& blockMeshPoints,
00069 const curvedEdgeList& edges,
00070 const Vector<label>& n,
00071 const scalarList& expand,
00072 const word& zoneName
00073 )
00074 :
00075 blockMeshPoints_(blockMeshPoints),
00076 blockShape_(bshape),
00077 curvedEdges_(edges),
00078 edgePoints_(12),
00079 edgeWeights_(12),
00080 n_(n),
00081 expand_(expand),
00082 zoneName_(zoneName)
00083 {
00084 if (expand_.size() != 12)
00085 {
00086 FatalErrorIn
00087 (
00088 "blockDescriptor::blockDescriptor"
00089 "(const cellShape& bshape, const pointField& blockMeshPoints, "
00090 "const curvedEdgeList& edges, label xnum, label ynum, label znum, "
00091 "const scalarList& expand, const word& zoneName)"
00092 ) << "Unknown definition of expansion ratios"
00093 << exit(FatalError);
00094 }
00095
00096 makeBlockEdges();
00097 }
00098
00099
00100
00101 blockDescriptor::blockDescriptor
00102 (
00103 const pointField& blockMeshPoints,
00104 const curvedEdgeList& edges,
00105 Istream& is
00106 )
00107 :
00108 blockMeshPoints_(blockMeshPoints),
00109 blockShape_(is),
00110 curvedEdges_(edges),
00111 edgePoints_(12),
00112 edgeWeights_(12),
00113 n_(),
00114 expand_(12),
00115 zoneName_()
00116 {
00117
00118 token t(is);
00119 is.putBack(t);
00120
00121
00122 if (t.isWord())
00123 {
00124 zoneName_ = t.wordToken();
00125
00126
00127 is >> t;
00128
00129
00130 is >> t;
00131 is.putBack(t);
00132 }
00133
00134 if (t.isPunctuation())
00135 {
00136 if (t.pToken() == token::BEGIN_LIST)
00137 {
00138 is >> n_;
00139 }
00140 else
00141 {
00142 FatalIOErrorIn
00143 (
00144 "blockDescriptor::blockDescriptor"
00145 "(const pointField&, const curvedEdgeList&, Istream& is)",
00146 is
00147 ) << "incorrect token while reading n, expected '(', found "
00148 << t.info()
00149 << exit(FatalIOError);
00150 }
00151 }
00152 else
00153 {
00154 is >> n_.x() >> n_.y() >> n_.z();
00155 }
00156
00157 is >> t;
00158 if (!t.isWord())
00159 {
00160 is.putBack(t);
00161 }
00162
00163 scalarList expRatios(is);
00164
00165 if (expRatios.size() == 3)
00166 {
00167 expand_[0] = expRatios[0];
00168 expand_[1] = expRatios[0];
00169 expand_[2] = expRatios[0];
00170 expand_[3] = expRatios[0];
00171
00172 expand_[4] = expRatios[1];
00173 expand_[5] = expRatios[1];
00174 expand_[6] = expRatios[1];
00175 expand_[7] = expRatios[1];
00176
00177 expand_[8] = expRatios[2];
00178 expand_[9] = expRatios[2];
00179 expand_[10] = expRatios[2];
00180 expand_[11] = expRatios[2];
00181 }
00182 else if (expRatios.size() == 12)
00183 {
00184 expand_ = expRatios;
00185 }
00186 else
00187 {
00188 FatalErrorIn
00189 (
00190 "blockDescriptor::blockDescriptor"
00191 "(const pointField& blockMeshPoints, const curvedEdgeList& edges,"
00192 "Istream& is)"
00193 ) << "Unknown definition of expansion ratios"
00194 << exit(FatalError);
00195 }
00196
00197
00198 makeBlockEdges();
00199 }
00200
00201
00202
00203
00204 const pointField& blockDescriptor::points() const
00205 {
00206 return blockMeshPoints_;
00207 }
00208
00209 const cellShape& blockDescriptor::blockShape() const
00210 {
00211 return blockShape_;
00212 }
00213
00214 const List<List<point> >& blockDescriptor::blockEdgePoints() const
00215 {
00216 return edgePoints_;
00217 }
00218
00219 const scalarListList& blockDescriptor::blockEdgeWeights() const
00220 {
00221 return edgeWeights_;
00222 }
00223
00224 const Vector<label>& blockDescriptor::n() const
00225 {
00226 return n_;
00227 }
00228
00229 const word& blockDescriptor::zoneName() const
00230 {
00231 return zoneName_;
00232 }
00233
00234
00235
00236
00237 void blockDescriptor::operator=(const blockDescriptor&)
00238 {
00239 notImplemented("void blockDescriptor::operator=(const blockDescriptor&)");
00240 }
00241
00242
00243
00244
00245 }
00246
00247