31 template<
class FaceList,
class Po
intField>
36 Pout<<
"PrimitivePatch<FaceList, PointField>::calcMeshData() : "
37 "calculating mesh data in PrimitivePatch"
43 if (meshPointsPtr_ || localFacesPtr_)
46 <<
"meshPointsPtr_ or localFacesPtr_already allocated"
52 Map<label> markedPoints(4*this->size());
88 DynamicList<label> meshPoints(2*this->size());
91 const FaceType& curPoints = this->operator[](facei);
95 if (markedPoints.insert(curPoints[pointi], meshPoints.size()))
97 meshPoints.append(curPoints[pointi]);
102 meshPointsPtr_ =
new labelList(meshPoints,
true);
108 localFacesPtr_ =
new List<FaceType>(*
this);
109 List<FaceType>& lf = *localFacesPtr_;
113 const FaceType& curFace = this->operator[](facei);
114 lf[facei].setSize(curFace.size());
118 lf[facei][
labelI] = markedPoints.find(curFace[
labelI])();
124 Pout<<
"PrimitivePatch<FaceList, PointField>::calcMeshData() : "
125 "finished calculating mesh data in PrimitivePatch"
131 template<
class FaceList,
class Po
intField>
136 Pout<<
"PrimitivePatch<FaceList, PointField>::calcMeshPointMap() : "
137 "calculating mesh point map in PrimitivePatch"
143 if (meshPointMapPtr_)
146 <<
"meshPointMapPtr_ already allocated"
152 meshPointMapPtr_ =
new Map<label>(2*
mp.size());
153 Map<label>& mpMap = *meshPointMapPtr_;
157 mpMap.insert(
mp[i], i);
162 Pout<<
"PrimitivePatch<FaceList, PointField>::calcMeshPointMap() : "
163 "finished calculating mesh point map in PrimitivePatch"
169 template<
class FaceList,
class Po
intField>
174 Pout<<
"PrimitivePatch<FaceList, PointField>::calcLocalPoints() : "
175 "calculating localPoints in PrimitivePatch"
184 <<
"localPointsPtr_already allocated"
190 localPointsPtr_ =
new Field<PointType>(meshPts.size());
192 Field<PointType>& locPts = *localPointsPtr_;
196 locPts[pointi] = points_[meshPts[pointi]];
201 Pout<<
"PrimitivePatch<FaceList, PointField>::calcLocalPoints() : "
202 <<
"finished calculating localPoints in PrimitivePatch"
208 template<
class FaceList,
class Po
intField>
213 Pout<<
"PrimitivePatch<FaceList, PointField>::calcPointNormals() : "
214 "calculating pointNormals in PrimitivePatch"
220 if (pointNormalsPtr_)
223 <<
"pointNormalsPtr_already allocated"
227 const Field<PointType>& faceUnitNormals = faceNormals();
231 pointNormalsPtr_ =
new Field<PointType>
237 Field<PointType>&
n = *pointNormalsPtr_;
241 PointType& curNormal =
n[pointi];
247 curNormal += faceUnitNormals[curFaces[facei]];
250 curNormal /=
mag(curNormal) + vSmall;
255 Pout<<
"PrimitivePatch<FaceList, PointField>::calcPointNormals() : "
256 "finished calculating pointNormals in PrimitivePatch"
262 template<
class FaceList,
class Po
intField>
267 Pout<<
"PrimitivePatch<FaceList, PointField>::calcFaceCentres() : "
268 "calculating faceCentres in PrimitivePatch"
277 <<
"faceCentresPtr_already allocated"
281 faceCentresPtr_ =
new Field<PointType>(this->size());
283 Field<PointType>&
c = *faceCentresPtr_;
287 c[facei] = this->operator[](facei).centre(points_);
292 Pout<<
"PrimitivePatch<FaceList, PointField>::calcFaceCentres() : "
293 "finished calculating faceCentres in PrimitivePatch"
299 template<
class FaceList,
class Po
intField>
304 Pout<<
"PrimitivePatch<FaceList, PointField>::calcFaceAreas() : "
305 "calculating faceAreas in PrimitivePatch"
314 <<
"faceAreasPtr_already allocated"
318 faceAreasPtr_ =
new Field<PointType>(this->size());
320 Field<PointType>&
c = *faceAreasPtr_;
324 c[facei] = this->operator[](facei).area(points_);
329 Pout<<
"PrimitivePatch<FaceList, PointField>::calcFaceAreas() : "
330 "finished calculating faceAreas in PrimitivePatch"
336 template<
class FaceList,
class Po
intField>
341 Pout<<
"PrimitivePatch<FaceList, PointField>::calcFaceNormals() : "
342 "calculating faceNormals in PrimitivePatch"
351 <<
"faceNormalsPtr_already allocated"
355 faceNormalsPtr_ =
new Field<PointType>(this->size());
357 Field<PointType>&
n = *faceNormalsPtr_;
361 n[facei] = this->operator[](facei).normal(points_);
366 Pout<<
"PrimitivePatch<FaceList, PointField>::calcFaceNormals() : "
367 "finished calculating faceNormals in PrimitivePatch"
#define forAll(list, i)
Loop across all elements in list.
A list of faces which address into the list of points.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const dimensionedScalar mp
Proton mass.
const dimensionedScalar c
Speed of light in a vacuum.
List< label > labelList
A List of labels.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const labelSphericalTensor labelI(1)
Identity labelTensor.
errorManip< error > abort(error &err)
List< labelList > labelListList
A List of labelList.
dimensioned< scalar > mag(const dimensioned< Type > &)
prefixOSstream Pout(cout, "Pout")