37 template<
class>
class FaceList,
47 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
49 "calculating mesh data in PrimitivePatch"
53 if (meshPointsPtr_ || localFacesPtr_)
57 <<
"meshPointsPtr_ or localFacesPtr_ already allocated"
63 Map<label> markedPoints(4*this->size());
99 DynamicList<label> meshPoints(2*this->size());
102 const Face& curPoints = this->operator[](facei);
106 if (markedPoints.insert(curPoints[pointi], meshPoints.size()))
108 meshPoints.append(curPoints[pointi]);
113 meshPointsPtr_ =
new labelList(meshPoints,
true);
119 localFacesPtr_ =
new List<Face>(*
this);
120 List<Face>& lf = *localFacesPtr_;
124 const Face& curFace = this->operator[](facei);
125 lf[facei].setSize(curFace.size());
129 lf[facei][
labelI] = markedPoints.find(curFace[
labelI])();
135 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
137 "finished calculating mesh data in PrimitivePatch"
146 template<
class>
class FaceList,
156 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
157 "calcMeshPointMap() : "
158 "calculating mesh point map in PrimitivePatch"
162 if (meshPointMapPtr_)
166 <<
"meshPointMapPtr_ already allocated"
172 meshPointMapPtr_ =
new Map<label>(2*
mp.size());
173 Map<label>& mpMap = *meshPointMapPtr_;
177 mpMap.insert(
mp[i], i);
182 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
183 "calcMeshPointMap() : "
184 "finished calculating mesh point map in PrimitivePatch"
193 template<
class>
class FaceList,
203 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
204 "calcLocalPoints() : "
205 "calculating localPoints in PrimitivePatch"
213 <<
"localPointsPtr_ already allocated"
219 localPointsPtr_ =
new Field<PointType>(meshPts.size());
221 Field<PointType>& locPts = *localPointsPtr_;
225 locPts[pointi] = points_[meshPts[pointi]];
230 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
231 <<
"calcLocalPoints() : "
232 <<
"finished calculating localPoints in PrimitivePatch"
241 template<
class>
class FaceList,
251 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
252 "calcPointNormals() : "
253 "calculating pointNormals in PrimitivePatch"
257 if (pointNormalsPtr_)
261 <<
"pointNormalsPtr_ already allocated"
265 const Field<PointType>& faceUnitNormals =
faceNormals();
269 pointNormalsPtr_ =
new Field<PointType>
275 Field<PointType>&
n = *pointNormalsPtr_;
279 PointType& curNormal =
n[pointi];
283 for (
const label facei : curFaces)
285 curNormal += faceUnitNormals[facei];
288 curNormal.normalise();
293 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
294 "calcPointNormals() : "
295 "finished calculating pointNormals in PrimitivePatch"
304 template<
class>
class FaceList,
314 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
315 "calcFaceCentres() : "
316 "calculating faceCentres in PrimitivePatch"
324 <<
"faceCentresPtr_ already allocated"
328 faceCentresPtr_ =
new Field<PointType>(this->size());
330 Field<PointType>&
c = *faceCentresPtr_;
334 c[facei] = this->operator[](facei).centre(points_);
339 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
340 "calcFaceCentres() : "
341 "finished calculating faceCentres in PrimitivePatch"
350 template<
class>
class FaceList,
360 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
361 "calcMagFaceAreas() : "
362 "calculating magFaceAreas in PrimitivePatch"
366 if (magFaceAreasPtr_)
370 <<
"magFaceAreasPtr_ already allocated"
374 magFaceAreasPtr_ =
new Field<scalar>(this->size());
375 Field<scalar>& a = *magFaceAreasPtr_;
379 a[facei] = this->operator[](facei).mag(points_);
384 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
385 "calcMagFaceAreas() : "
386 "finished calculating magFaceAreas in PrimitivePatch"
395 template<
class>
class FaceList,
405 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
407 "calculating faceAreas in PrimitivePatch"
415 <<
"faceAreasPtr_ already allocated"
419 faceAreasPtr_ =
new Field<PointType>(this->size());
421 Field<PointType>&
n = *faceAreasPtr_;
425 n[facei] = this->operator[](facei).areaNormal(points_);
430 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
432 "finished calculating faceAreas in PrimitivePatch"
441 template<
class>
class FaceList,
451 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
452 "calcFaceNormals() : "
453 "calculating faceNormals in PrimitivePatch"
461 <<
"faceNormalsPtr_ already allocated"
465 faceNormalsPtr_ =
new Field<PointType>(this->size());
467 Field<PointType>&
n = *faceNormalsPtr_;
471 n[facei] = this->operator[](facei).unitNormal(points_);
476 Pout<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
477 "calcFaceNormals() : "
478 "finished calculating faceNormals in PrimitivePatch"