face.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "face.H"
29 #include "triFace.H"
30 #include "triPointRef.H"
31 #include "mathematicalConstants.H"
32 #include "Swap.H"
33 #include "ConstCirculator.H"
34 
35 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36 
37 const char* const Foam::face::typeName = "face";
38 
39 
40 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
41 
43 Foam::face::calcEdges(const UList<point>& points) const
44 {
45  tmp<vectorField> tedges(new vectorField(size()));
46  vectorField& edges = tedges.ref();
47 
48  forAll(*this, i)
49  {
50  label ni = fcIndex(i);
51 
52  point thisPt = points[operator[](i)];
53  point nextPt = points[operator[](ni)];
54 
55  vector vec(nextPt - thisPt);
56  vec /= Foam::mag(vec) + VSMALL;
57 
58  edges[i] = vec;
59  }
60 
61  return tedges;
62 }
63 
64 
65 Foam::scalar Foam::face::edgeCos
66 (
67  const vectorField& edges,
68  const label index
69 ) const
70 {
71  label leftEdgeI = left(index);
72  label rightEdgeI = right(index);
73 
74  // Note negate on left edge to get correct left-pointing edge.
75  return -(edges[leftEdgeI] & edges[rightEdgeI]);
76 }
77 
78 
79 Foam::label Foam::face::mostConcaveAngle
80 (
81  const UList<point>& points,
82  const vectorField& edges,
83  scalar& maxAngle
84 ) const
85 {
86  vector n(areaNormal(points));
87 
88  label index = 0;
89  maxAngle = -GREAT;
90 
91  forAll(edges, i)
92  {
93  label leftEdgeI = left(i);
94  label rightEdgeI = right(i);
95 
96  vector edgeNormal = edges[rightEdgeI] ^ edges[leftEdgeI];
97 
98  scalar edgeCos = edges[leftEdgeI] & edges[rightEdgeI];
99  scalar edgeAngle = acos(max(-1.0, min(1.0, edgeCos)));
100 
101  scalar angle;
102 
103  if ((edgeNormal & n) > 0)
104  {
105  // Concave angle.
106  angle = constant::mathematical::pi + edgeAngle;
107  }
108  else
109  {
110  // Convex angle. Note '-' to take into account that rightEdge
111  // and leftEdge are head-to-tail connected.
112  angle = constant::mathematical::pi - edgeAngle;
113  }
114 
115  if (angle > maxAngle)
116  {
117  maxAngle = angle;
118  index = i;
119  }
120  }
121 
122  return index;
123 }
124 
125 
126 Foam::label Foam::face::split
127 (
128  const face::splitMode mode,
129  const UList<point>& points,
130  label& triI,
131  label& quadI,
132  faceList& triFaces,
133  faceList& quadFaces
134 ) const
135 {
136  label oldIndices = (triI + quadI);
137 
138  if (size() <= 2)
139  {
141  << "Serious problem: asked to split a face with < 3 vertices"
142  << abort(FatalError);
143  }
144  if (size() == 3)
145  {
146  // Triangle. Just copy.
147  if (mode == COUNTTRIANGLE || mode == COUNTQUAD)
148  {
149  triI++;
150  }
151  else
152  {
153  triFaces[triI++] = *this;
154  }
155  }
156  else if (size() == 4)
157  {
158  if (mode == COUNTTRIANGLE)
159  {
160  triI += 2;
161  }
162  if (mode == COUNTQUAD)
163  {
164  quadI++;
165  }
166  else if (mode == SPLITTRIANGLE)
167  {
168  // Start at point with largest internal angle.
169  const vectorField edges(calcEdges(points));
170 
171  scalar minAngle;
172  label startIndex = mostConcaveAngle(points, edges, minAngle);
173 
174  label nextIndex = fcIndex(startIndex);
175  label splitIndex = fcIndex(nextIndex);
176 
177  // Create triangles
178  face triFace(3);
179  triFace[0] = operator[](startIndex);
180  triFace[1] = operator[](nextIndex);
181  triFace[2] = operator[](splitIndex);
182 
183  triFaces[triI++] = triFace;
184 
185  triFace[0] = operator[](splitIndex);
186  triFace[1] = operator[](fcIndex(splitIndex));
187  triFace[2] = operator[](startIndex);
188 
189  triFaces[triI++] = triFace;
190  }
191  else
192  {
193  quadFaces[quadI++] = *this;
194  }
195  }
196  else
197  {
198  // General case. Like quad: search for largest internal angle.
199 
200  const vectorField edges(calcEdges(points));
201 
202  scalar minAngle = 1;
203  label startIndex = mostConcaveAngle(points, edges, minAngle);
204 
205  scalar bisectAngle = minAngle/2;
206  vector rightEdge = edges[right(startIndex)];
207 
208  //
209  // Look for opposite point which as close as possible bisects angle
210  //
211 
212  // split candidate starts two points away.
213  label index = fcIndex(fcIndex(startIndex));
214 
215  label minIndex = index;
216  scalar minDiff = constant::mathematical::pi;
217 
218  for (label i = 0; i < size() - 3; i++)
219  {
220  vector splitEdge
221  (
222  points[operator[](index)]
223  - points[operator[](startIndex)]
224  );
225  splitEdge /= Foam::mag(splitEdge) + VSMALL;
226 
227  const scalar splitCos = splitEdge & rightEdge;
228  const scalar splitAngle = acos(max(-1.0, min(1.0, splitCos)));
229  const scalar angleDiff = fabs(splitAngle - bisectAngle);
230 
231  if (angleDiff < minDiff)
232  {
233  minDiff = angleDiff;
234  minIndex = index;
235  }
236 
237  // Go to next candidate
238  index = fcIndex(index);
239  }
240 
241 
242  // Split into two subshapes.
243  // face1: startIndex to minIndex
244  // face2: minIndex to startIndex
245 
246  // Get sizes of the two subshapes
247  label diff = 0;
248  if (minIndex > startIndex)
249  {
250  diff = minIndex - startIndex;
251  }
252  else
253  {
254  // Folded around
255  diff = minIndex + size() - startIndex;
256  }
257 
258  label nPoints1 = diff + 1;
259  label nPoints2 = size() - diff + 1;
260 
261  // Collect face1 points
262  face face1(nPoints1);
263 
264  index = startIndex;
265  for (label i = 0; i < nPoints1; i++)
266  {
267  face1[i] = operator[](index);
268  index = fcIndex(index);
269  }
270 
271  // Collect face2 points
272  face face2(nPoints2);
273 
274  index = minIndex;
275  for (label i = 0; i < nPoints2; i++)
276  {
277  face2[i] = operator[](index);
278  index = fcIndex(index);
279  }
280 
281  // Split faces
282  face1.split(mode, points, triI, quadI, triFaces, quadFaces);
283  face2.split(mode, points, triI, quadI, triFaces, quadFaces);
284  }
285 
286  return (triI + quadI - oldIndices);
287 }
288 
289 
290 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
291 
293 :
294  labelList(f)
295 {}
296 
297 
298 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
299 
300 int Foam::face::compare(const face& a, const face& b)
301 {
302  // Basic rule: we assume that the sequence of labels in each list
303  // will be circular in the same order (but not necessarily in the
304  // same direction or from the same starting point).
305 
306  // Trivial reject: faces are different size
307  label sizeA = a.size();
308  label sizeB = b.size();
309 
310  if (sizeA != sizeB || sizeA == 0)
311  {
312  return 0;
313  }
314  else if (sizeA == 1)
315  {
316  if (a[0] == b[0])
317  {
318  return 1;
319  }
320  else
321  {
322  return 0;
323  }
324  }
325 
326  ConstCirculator<face> aCirc(a);
327  ConstCirculator<face> bCirc(b);
328 
329  // Rotate face b until its element matches the starting element of face a.
330  do
331  {
332  if (aCirc() == bCirc())
333  {
334  // Set bCirc fulcrum to its iterator and increment the iterators
335  bCirc.setFulcrumToIterator();
336  ++aCirc;
337  ++bCirc;
338 
339  break;
340  }
341  } while (bCirc.circulate(CirculatorBase::CLOCKWISE));
342 
343  // If the circulator has stopped then faces a and b do not share a matching
344  // point. Doesn't work on matching, single element face.
345  if (!bCirc.circulate())
346  {
347  return 0;
348  }
349 
350  // Look forwards around the faces for a match
351  do
352  {
353  if (aCirc() != bCirc())
354  {
355  break;
356  }
357  }
358  while
359  (
362  );
363 
364  // If the circulator has stopped then faces a and b matched.
365  if (!aCirc.circulate())
366  {
367  return 1;
368  }
369  else
370  {
371  // Reset the circulators back to their fulcrum
372  aCirc.setIteratorToFulcrum();
373  bCirc.setIteratorToFulcrum();
374  ++aCirc;
375  --bCirc;
376  }
377 
378  // Look backwards around the faces for a match
379  do
380  {
381  if (aCirc() != bCirc())
382  {
383  break;
384  }
385  }
386  while
387  (
390  );
391 
392  // If the circulator has stopped then faces a and b matched.
393  if (!aCirc.circulate())
394  {
395  return -1;
396  }
397 
398  return 0;
399 }
400 
401 
402 bool Foam::face::sameVertices(const face& a, const face& b)
403 {
404  const label sizeA = a.size();
405  const label sizeB = b.size();
406 
407  // Trivial reject: faces are different size
408  if (sizeA != sizeB)
409  {
410  return false;
411  }
412  // Check faces with a single vertex
413  else if (sizeA == 1)
414  {
415  return (a[0] == b[0]);
416  }
417 
418  forAll(a, i)
419  {
420  // Count occurrences of a[i] in a
421  label aOcc = 0;
422  forAll(a, j)
423  {
424  if (a[i] == a[j]) aOcc++;
425  }
426 
427  // Count occurrences of a[i] in b
428  label bOcc = 0;
429  forAll(b, j)
430  {
431  if (a[i] == b[j]) bOcc++;
432  }
433 
434  // Check if occurrences of a[i] in a and b are the same
435  if (aOcc != bOcc) return false;
436  }
437 
438  return true;
439 }
440 
441 
442 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
443 
444 Foam::label Foam::face::collapse()
445 {
446  if (size() > 1)
447  {
448  label ci = 0;
449  for (label i=1; i<size(); i++)
450  {
451  if (operator[](i) != operator[](ci))
452  {
453  operator[](++ci) = operator[](i);
454  }
455  }
456 
457  if (operator[](ci) != operator[](0))
458  {
459  ++ci;
460  }
461 
462  setSize(ci);
463  }
464 
465  return size();
466 }
467 
468 
470 {
471  const label n = size();
472 
473  if (n > 2)
474  {
475  for (label i=1; i < (n+1)/2; ++i)
476  {
477  Swap(operator[](i), operator[](n-i));
478  }
479  }
480 }
481 
482 
484 {
485  // Calculate the centre by breaking the face into triangles and
486  // area-weighted averaging their centres
487 
488  const label nPoints = size();
489 
490  // If the face is a triangle, do a direct calculation
491  if (nPoints == 3)
492  {
493  return
494  (1.0/3.0)
495  *(
496  points[operator[](0)]
497  + points[operator[](1)]
498  + points[operator[](2)]
499  );
500  }
501 
502 
503  point centrePoint = Zero;
504  for (label pI=0; pI<nPoints; ++pI)
505  {
506  centrePoint += points[operator[](pI)];
507  }
508  centrePoint /= nPoints;
509 
510  scalar sumA = 0;
511  vector sumAc = Zero;
512 
513  for (label pI=0; pI<nPoints; ++pI)
514  {
515  const point& nextPoint = points[operator[]((pI + 1) % nPoints)];
516 
517  // Calculate 3*triangle centre
518  const vector ttc
519  (
520  points[operator[](pI)]
521  + nextPoint
522  + centrePoint
523  );
524 
525  // Calculate 2*triangle area
526  const scalar ta = Foam::mag
527  (
528  (points[operator[](pI)] - centrePoint)
529  ^ (nextPoint - centrePoint)
530  );
531 
532  sumA += ta;
533  sumAc += ta*ttc;
534  }
535 
536  if (sumA > VSMALL)
537  {
538  return sumAc/(3.0*sumA);
539  }
540  else
541  {
542  return centrePoint;
543  }
544 }
545 
546 
548 {
549  const label nPoints = size();
550 
551  // Calculate the area normal by summing the face triangle area normals.
552  // Changed to deal with small concavity by using a central decomposition
553 
554  // If the face is a triangle, do a direct calculation to avoid round-off
555  // error-related problems
556 
557  if (nPoints == 3)
558  {
559  return triPointRef
560  (
561  p[operator[](0)],
562  p[operator[](1)],
563  p[operator[](2)]
564  ).areaNormal();
565  }
566 
567  label pI;
568 
569  point centrePoint = Zero;
570  for (pI = 0; pI < nPoints; ++pI)
571  {
572  centrePoint += p[operator[](pI)];
573  }
574  centrePoint /= nPoints;
575 
576  vector n = Zero;
577 
578  point nextPoint = centrePoint;
579 
580  for (pI = 0; pI < nPoints; ++pI)
581  {
582  if (pI < nPoints - 1)
583  {
584  nextPoint = p[operator[](pI + 1)];
585  }
586  else
587  {
588  nextPoint = p[operator[](0)];
589  }
590 
591  // Note: for best accuracy, centre point always comes last
592  //
593  n += triPointRef
594  (
595  p[operator[](pI)],
596  nextPoint,
597  centrePoint
598  ).areaNormal();
599  }
600 
601  return n;
602 }
603 
604 
606 {
607  // Reverse the label list and return
608  // The starting points of the original and reverse face are identical.
609 
610  const labelUList& origFace = *this;
611  const label len = origFace.size();
612 
613  face newFace(len);
614  if (len)
615  {
616  newFace[0] = origFace[0];
617  for (label i=1; i < len; ++i)
618  {
619  newFace[i] = origFace[len - i];
620  }
621  }
622 
623  return newFace;
624 }
625 
626 
627 Foam::scalar Foam::face::sweptVol
628 (
629  const UList<point>& oldPoints,
630  const UList<point>& newPoints
631 ) const
632 {
633  // This Optimization causes a small discrepancy between the swept-volume of
634  // opposite faces of complex cells with triangular faces opposing polygons.
635  // It could be used without problem for tetrahedral cells
636  // if (size() == 3)
637  // {
638  // return
639  // (
640  // triPointRef
641  // (
642  // oldPoints[operator[](0)],
643  // oldPoints[operator[](1)],
644  // oldPoints[operator[](2)]
645  // ).sweptVol
646  // (
647  // triPointRef
648  // (
649  // newPoints[operator[](0)],
650  // newPoints[operator[](1)],
651  // newPoints[operator[](2)]
652  // )
653  // )
654  // );
655  // }
656 
657  scalar sv = 0;
658 
659  // Calculate the swept volume by breaking the face into triangles and
660  // summing their swept volumes.
661  // Changed to deal with small concavity by using a central decomposition
662 
663  point centreOldPoint = centre(oldPoints);
664  point centreNewPoint = centre(newPoints);
665 
666  label nPoints = size();
667 
668  for (label pi=0; pi<nPoints-1; ++pi)
669  {
670  // Note: for best accuracy, centre point always comes last
671  sv += triPointRef
672  (
673  centreOldPoint,
674  oldPoints[operator[](pi)],
675  oldPoints[operator[](pi + 1)]
676  ).sweptVol
677  (
679  (
680  centreNewPoint,
681  newPoints[operator[](pi)],
682  newPoints[operator[](pi + 1)]
683  )
684  );
685  }
686 
687  sv += triPointRef
688  (
689  centreOldPoint,
690  oldPoints[operator[](nPoints-1)],
691  oldPoints[operator[](0)]
692  ).sweptVol
693  (
695  (
696  centreNewPoint,
697  newPoints[operator[](nPoints-1)],
698  newPoints[operator[](0)]
699  )
700  );
701 
702  return sv;
703 }
704 
705 
707 (
708  const UList<point>& p,
709  const point& refPt,
710  scalar density
711 ) const
712 {
713  // If the face is a triangle, do a direct calculation
714  if (size() == 3)
715  {
716  return triPointRef
717  (
718  p[operator[](0)],
719  p[operator[](1)],
720  p[operator[](2)]
721  ).inertia(refPt, density);
722  }
723 
724  const point ctr = centre(p);
725 
726  tensor J = Zero;
727 
728  forAll(*this, i)
729  {
730  J += triPointRef
731  (
732  p[operator[](i)],
733  p[operator[](fcIndex(i))],
734  ctr
735  ).inertia(refPt, density);
736  }
737 
738  return J;
739 }
740 
741 
743 {
744  const labelList& points = *this;
745 
746  edgeList e(points.size());
747 
748  for (label pointi = 0; pointi < points.size() - 1; ++pointi)
749  {
750  e[pointi] = edge(points[pointi], points[pointi + 1]);
751  }
752 
753  // Add last edge
754  e.last() = edge(points.last(), points[0]);
755 
756  return e;
757 }
758 
759 
761 {
762  forAll(*this, i)
763  {
764  if (operator[](i) == e.first())
765  {
766  if (operator[](rcIndex(i)) == e.second())
767  {
768  // Reverse direction
769  return -1;
770  }
771  else if (operator[](fcIndex(i)) == e.second())
772  {
773  // Forward direction
774  return 1;
775  }
776 
777  // No match
778  return 0;
779  }
780  else if (operator[](i) == e.second())
781  {
782  if (operator[](rcIndex(i)) == e.first())
783  {
784  // Forward direction
785  return 1;
786  }
787  else if (operator[](fcIndex(i)) == e.first())
788  {
789  // Reverse direction
790  return -1;
791  }
792 
793  // No match
794  return 0;
795  }
796  }
797 
798  // Not found
799  return 0;
800 }
801 
802 
803 Foam::label Foam::face::nTriangles(const UList<point>&) const
804 {
805  return nTriangles();
806 }
807 
808 
809 Foam::label Foam::face::triangles
810 (
811  const UList<point>& points,
812  label& triI,
813  faceList& triFaces
814 ) const
815 {
816  label quadI = 0;
817  faceList quadFaces;
818 
819  return split(SPLITTRIANGLE, points, triI, quadI, triFaces, quadFaces);
820 }
821 
822 
823 Foam::label Foam::face::nTrianglesQuads
824 (
825  const UList<point>& points,
826  label& triI,
827  label& quadI
828 ) const
829 {
830  faceList triFaces;
831  faceList quadFaces;
832 
833  return split(COUNTQUAD, points, triI, quadI, triFaces, quadFaces);
834 }
835 
836 
837 Foam::label Foam::face::trianglesQuads
838 (
839  const UList<point>& points,
840  label& triI,
841  label& quadI,
842  faceList& triFaces,
843  faceList& quadFaces
844 ) const
845 {
846  return split(SPLITQUAD, points, triI, quadI, triFaces, quadFaces);
847 }
848 
849 
850 Foam::label Foam::face::longestEdge(const UList<point>& pts) const
851 {
852  const edgeList& eds = this->edges();
853 
854  label longestEdgeI = -1;
855  scalar longestEdgeLength = -SMALL;
856 
857  forAll(eds, edI)
858  {
859  scalar edgeLength = eds[edI].mag(pts);
860 
861  if (edgeLength > longestEdgeLength)
862  {
863  longestEdgeI = edI;
864  longestEdgeLength = edgeLength;
865  }
866  }
867 
868  return longestEdgeI;
869 }
870 
871 
872 Foam::label Foam::longestEdge(const face& f, const UList<point>& pts)
873 {
874  return f.longestEdge(pts);
875 }
876 
877 
878 // ************************************************************************* //
Foam::face::typeName
static const char *const typeName
Definition: face.H:143
Foam::Tensor< scalar >
setSize
points setSize(newPointi)
mathematicalConstants.H
Foam::face::reverseFace
face reverseFace() const
Return face with reverse direction.
Definition: face.C:605
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::face::points
pointField points(const UList< point > &points) const
Return the points corresponding to this face.
Definition: faceI.H:102
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::ConstCirculator
Walks over a container as if it were circular. The container must have the following members defined:
Definition: ConstCirculator.H:93
Foam::face::edgeDirection
int edgeDirection(const edge &e) const
The edge direction on the face.
Definition: face.C:760
Foam::face::inertia
tensor inertia(const UList< point > &p, const point &refPt=vector::zero, scalar density=1.0) const
Definition: face.C:707
Foam::edge
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:63
face.H
Foam::face::sameVertices
static bool sameVertices(const face &a, const face &b)
Return true if the faces have the same vertices.
Definition: face.C:402
Foam::face::longestEdge
label longestEdge(const UList< point > &pts) const
Find the longest edge on a face.
Definition: face.C:850
ConstCirculator.H
Foam::ConstCirculator::setIteratorToFulcrum
void setIteratorToFulcrum()
Set the iterator to the current position of the fulcrum.
Definition: ConstCirculatorI.H:131
Foam::face::nTriangles
label nTriangles() const
Number of triangles after splitting.
Definition: faceI.H:173
triPointRef.H
triFace.H
Foam::Swap
void Swap(DynamicList< T, SizeMin1 > &a, DynamicList< T, SizeMin2 > &b)
Definition: DynamicListI.H:913
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
Foam::face::compare
static int compare(const face &a, const face &b)
Compare faces.
Definition: face.C:300
Swap.H
Swap arguments as per std::swap, but in Foam namespace.
nPoints
label nPoints
Definition: gmvOutputHeader.H:2
Foam::mode
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
Definition: MSwindows.C:564
Foam::diff
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
Definition: triad.C:378
Foam::triangle
A triangle primitive used to calculate face normals and swept volumes.
Definition: triangle.H:61
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::face::trianglesQuads
label trianglesQuads(const UList< point > &points, label &triI, label &quadI, faceList &triFaces, faceList &quadFaces) const
Split into triangles and quads.
Definition: face.C:838
Foam::face::centre
point centre(const UList< point > &points) const
Centre point of face.
Definition: face.C:483
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::face::areaNormal
vector areaNormal(const UList< point > &p) const
The area normal - with magnitude equal to area of face.
Definition: face.C:547
Foam::FatalError
error FatalError
Foam::face::flip
void flip()
Flip the face in-place.
Definition: face.C:469
Foam::face::edges
edgeList edges() const
Return edges in face point ordering,.
Definition: face.C:742
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::face::triangles
label triangles(const UList< point > &points, label &triI, faceList &triFaces) const
Split into triangles using existing points.
Definition: face.C:810
Foam::CirculatorBase::CLOCKWISE
Definition: CirculatorBase.H:56
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:381
Foam::constant::mathematical::pi
constexpr scalar pi(M_PI)
Foam::face::nTrianglesQuads
label nTrianglesQuads(const UList< point > &points, label &nTris, label &nQuads) const
Number of triangles and quads after splitting.
Definition: face.C:824
Foam::triFace
A triangular face using a FixedList of labels corresponding to mesh vertices.
Definition: triFace.H:69
f
labelList f(nPoints)
Foam::faceList
List< face > faceList
A List of faces.
Definition: faceListFwd.H:47
Foam::Vector< scalar >
Foam::List< label >
Foam::acos
dimensionedScalar acos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:268
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:103
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
split
static bool split(const std::string &line, std::string &key, std::string &val)
Definition: cpuInfo.C:39
Foam::UList::size
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
Definition: UListI.H:360
Foam::face::collapse
label collapse()
Collapse face by removing duplicate point labels.
Definition: face.C:444
Foam::longestEdge
label longestEdge(const face &f, const UList< point > &pts)
Definition: face.C:872
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:72
Foam::ConstCirculator::setFulcrumToIterator
void setFulcrumToIterator()
Set the fulcrum to the current position of the iterator.
Definition: ConstCirculatorI.H:124
Foam::face::face
constexpr face() noexcept=default
Default construct.
Foam::point
vector point
Point is a vector.
Definition: point.H:43
Foam::CirculatorBase::ANTICLOCKWISE
Definition: CirculatorBase.H:57
Foam::ConstCirculator::circulate
bool circulate(const CirculatorBase::direction dir=NONE)
Circulate around the list in the given direction.
Definition: ConstCirculatorI.H:106
triFace
face triFace(3)
Foam::triPointRef
triangle< point, const point & > triPointRef
A triangle using referred points.
Definition: triangle.H:73
Foam::angleDiff
static scalar angleDiff(scalar angle1, scalar angle2)
Definition: colourTools.C:310
Foam::face::sweptVol
scalar sweptVol(const UList< point > &oldPoints, const UList< point > &newPoints) const
Return the volume swept out by the face when its points move.
Definition: face.C:628