34 template<
class FaceList,
class Po
intField>
40 Pout<<
"PrimitivePatch<FaceList, PointField>::"
42 "calculating mesh data in PrimitivePatch"
46 if (meshPointsPtr_ || localFacesPtr_)
50 <<
"meshPointsPtr_ or localFacesPtr_ already allocated"
56 Map<label> markedPoints(4*this->size());
92 DynamicList<label> meshPoints(2*this->size());
93 for (
const face_type&
f : *
this)
95 for (
const label pointi :
f)
97 if (markedPoints.insert(pointi, meshPoints.size()))
99 meshPoints.append(pointi);
104 meshPointsPtr_.reset(
new labelList(meshPoints,
true));
109 localFacesPtr_.reset(
new List<face_type>(*
this));
110 auto& locFaces = *localFacesPtr_;
112 for (face_type&
f : locFaces)
114 for (label& pointi :
f)
116 pointi = *(markedPoints.cfind(pointi));
122 Pout<<
"PrimitivePatch<FaceList, PointField>::"
124 "finished calculating mesh data in PrimitivePatch"
130 template<
class FaceList,
class Po
intField>
136 Pout<<
"PrimitivePatch<FaceList, PointField>::"
137 "calcMeshPointMap() : "
138 "calculating mesh point map in PrimitivePatch"
142 if (meshPointMapPtr_)
146 <<
"meshPointMapPtr_ already allocated"
152 meshPointMapPtr_.reset(
new Map<label>(2*
mp.size()));
153 auto& mpMap = *meshPointMapPtr_;
157 mpMap.insert(
mp[i], i);
162 Pout<<
"PrimitivePatch<FaceList, PointField>::"
163 "calcMeshPointMap() : "
164 "finished calculating mesh point map in PrimitivePatch"
170 template<
class FaceList,
class Po
intField>
176 Pout<<
"PrimitivePatch<FaceList, PointField>::"
177 "calcLocalPoints() : "
178 "calculating localPoints in PrimitivePatch"
186 <<
"localPointsPtr_ already allocated"
192 localPointsPtr_.reset(
new Field<point_type>(meshPts.size()));
193 auto& locPts = *localPointsPtr_;
197 locPts[pointi] = points_[meshPts[pointi]];
202 Pout<<
"PrimitivePatch<FaceList, PointField>::"
203 <<
"calcLocalPoints() : "
204 <<
"finished calculating localPoints in PrimitivePatch"
210 template<
class FaceList,
class Po
intField>
216 Pout<<
"PrimitivePatch<FaceList, PointField>::"
217 "calcPointNormals() : "
218 "calculating pointNormals in PrimitivePatch"
222 if (pointNormalsPtr_)
226 <<
"pointNormalsPtr_ already allocated"
234 pointNormalsPtr_.reset(
new Field<point_type>(meshPoints().size(),
Zero));
235 auto&
n = *pointNormalsPtr_;
239 point_type& curNormal =
n[pointi];
243 for (
const label facei : curFaces)
245 curNormal += faceUnitNormals[facei];
248 curNormal.normalise();
253 Pout<<
"PrimitivePatch<FaceList, PointField>::"
254 "calcPointNormals() : "
255 "finished calculating pointNormals in PrimitivePatch"
261 template<
class FaceList,
class Po
intField>
267 Pout<<
"PrimitivePatch<FaceList, PointField>::"
268 "calcFaceCentres() : "
269 "calculating faceCentres in PrimitivePatch"
277 <<
"faceCentresPtr_ already allocated"
281 faceCentresPtr_.reset(
new Field<point_type>(this->size()));
282 auto&
c = *faceCentresPtr_;
286 c[facei] = this->operator[](facei).centre(points_);
291 Pout<<
"PrimitivePatch<FaceList, PointField>::"
292 "calcFaceCentres() : "
293 "finished calculating faceCentres in PrimitivePatch"
299 template<
class FaceList,
class Po
intField>
305 Pout<<
"PrimitivePatch<FaceList, PointField>::"
306 "calcMagFaceAreas() : "
307 "calculating magFaceAreas in PrimitivePatch"
311 if (magFaceAreasPtr_)
315 <<
"magFaceAreasPtr_ already allocated"
319 magFaceAreasPtr_.reset(
new Field<scalar>(this->size()));
320 auto& a = *magFaceAreasPtr_;
324 a[facei] = this->operator[](facei).mag(points_);
329 Pout<<
"PrimitivePatch<FaceList, PointField>::"
330 "calcMagFaceAreas() : "
331 "finished calculating magFaceAreas in PrimitivePatch"
337 template<
class FaceList,
class Po
intField>
343 Pout<<
"PrimitivePatch<FaceList, PointField>::"
345 "calculating faceAreas in PrimitivePatch"
353 <<
"faceAreasPtr_ already allocated"
357 faceAreasPtr_.reset(
new Field<point_type>(this->size()));
358 auto&
n = *faceAreasPtr_;
362 n[facei] = this->operator[](facei).areaNormal(points_);
367 Pout<<
"PrimitivePatch<FaceList, PointField>::"
369 "finished calculating faceAreas in PrimitivePatch"
375 template<
class FaceList,
class Po
intField>
381 Pout<<
"PrimitivePatch<FaceList, PointField>::"
382 "calcFaceNormals() : "
383 "calculating faceNormals in PrimitivePatch"
391 <<
"faceNormalsPtr_ already allocated"
395 faceNormalsPtr_.reset(
new Field<point_type>(this->size()));
396 auto&
n = *faceNormalsPtr_;
400 n[facei] = this->operator[](facei).unitNormal(points_);
405 Pout<<
"PrimitivePatch<FaceList, PointField>::"
406 "calcFaceNormals() : "
407 "finished calculating faceNormals in PrimitivePatch"