34 template<
class>
class FaceList,
44 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
46 "calculating mesh data in PrimitivePatch"
52 if (meshPointsPtr_ || localFacesPtr_)
56 "PrimitivePatch<Face, FaceList, PointField, PointType>::"
58 ) <<
"meshPointsPtr_ or localFacesPtr_already allocated"
64 Map<label> markedPoints(4*this->size());
100 DynamicList<label> meshPoints(2*this->size());
103 const Face& curPoints = this->operator[](facei);
107 if (markedPoints.insert(curPoints[pointi], meshPoints.size()))
109 meshPoints.append(curPoints[pointi]);
114 meshPointsPtr_ =
new labelList(meshPoints,
true);
120 localFacesPtr_ =
new List<Face>(*this);
121 List<Face>& lf = *localFacesPtr_;
125 const Face& curFace = this->operator[](facei);
126 lf[facei].setSize(curFace.size());
130 lf[facei][
labelI] = markedPoints.find(curFace[
labelI])();
136 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
138 "finished calculating mesh data in PrimitivePatch"
147 template<
class>
class FaceList,
157 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
158 "calcMeshPointMap() : "
159 "calculating mesh point map in PrimitivePatch"
165 if (meshPointMapPtr_)
169 "PrimitivePatch<Face, FaceList, PointField, PointType>::"
171 ) <<
"meshPointMapPtr_ already allocated"
177 meshPointMapPtr_ =
new Map<label>(2*mp.size());
178 Map<label>& mpMap = *meshPointMapPtr_;
182 mpMap.insert(mp[i], i);
187 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
188 "calcMeshPointMap() : "
189 "finished calculating mesh point map in PrimitivePatch"
198 template<
class>
class FaceList,
208 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
209 "calcLocalPoints() : "
210 "calculating localPoints in PrimitivePatch"
220 "PrimitivePatch<Face, FaceList, PointField, PointType>::"
222 ) <<
"localPointsPtr_already allocated"
228 localPointsPtr_ =
new Field<PointType>(meshPts.size());
230 Field<PointType>& locPts = *localPointsPtr_;
234 locPts[pointi] = points_[meshPts[pointi]];
239 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
240 <<
"calcLocalPoints() : "
241 <<
"finished calculating localPoints in PrimitivePatch"
250 template<
class>
class FaceList,
260 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
261 "calcPointNormals() : "
262 "calculating pointNormals in PrimitivePatch"
268 if (pointNormalsPtr_)
272 "PrimitivePatch<Face, FaceList, PointField, PointType>::"
274 ) <<
"pointNormalsPtr_already allocated"
278 const Field<PointType>& faceUnitNormals = faceNormals();
282 pointNormalsPtr_ =
new Field<PointType>
288 Field<PointType>& n = *pointNormalsPtr_;
292 PointType& curNormal = n[pointi];
298 curNormal += faceUnitNormals[curFaces[facei]];
301 curNormal /=
mag(curNormal) + VSMALL;
306 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
307 "calcPointNormals() : "
308 "finished calculating pointNormals in PrimitivePatch"
317 template<
class>
class FaceList,
327 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
328 "calcFaceCentres() : "
329 "calculating faceCentres in PrimitivePatch"
339 "PrimitivePatch<Face, FaceList, PointField, PointType>::"
341 ) <<
"faceCentresPtr_already allocated"
345 faceCentresPtr_ =
new Field<PointType>(this->size());
347 Field<PointType>& c = *faceCentresPtr_;
351 c[facei] = this->operator[](facei).centre(points_);
356 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
357 "calcFaceCentres() : "
358 "finished calculating faceCentres in PrimitivePatch"
367 template<
class>
class FaceList,
377 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
378 "calcFaceNormals() : "
379 "calculating faceNormals in PrimitivePatch"
389 "PrimitivePatch<Face, FaceList, PointField, PointType>::"
391 ) <<
"faceNormalsPtr_already allocated"
395 faceNormalsPtr_ =
new Field<PointType>(this->size());
397 Field<PointType>& n = *faceNormalsPtr_;
401 n[facei] = this->operator[](facei).normal(points_);
402 n[facei] /=
mag(n[facei]) + VSMALL;
407 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
408 "calcFaceNormals() : "
409 "finished calculating faceNormals in PrimitivePatch"