Go to the documentation of this file.
48 label ni = fcIndex(i);
53 vector vec(nextPt - thisPt);
69 label leftEdgeI = left(index);
70 label rightEdgeI = right(index);
73 return -(edges[leftEdgeI] & edges[rightEdgeI]);
91 label leftEdgeI = left(i);
92 label rightEdgeI = right(i);
94 vector edgeNormal = edges[rightEdgeI] ^ edges[leftEdgeI];
96 scalar edgeCos = edges[leftEdgeI] & edges[rightEdgeI];
97 scalar edgeAngle =
acos(
max(-1.0,
min(1.0, edgeCos)));
101 if ((edgeNormal &
n) > 0)
113 if (angle > maxAngle)
134 label oldIndices = (triI + quadI);
139 <<
"Serious problem: asked to split a face with < 3 vertices"
145 if (
mode == COUNTTRIANGLE ||
mode == COUNTQUAD)
151 triFaces[triI++] = *
this;
154 else if (size() == 4)
156 if (
mode == COUNTTRIANGLE)
160 if (
mode == COUNTQUAD)
164 else if (
mode == SPLITTRIANGLE)
170 label startIndex = mostConcaveAngle(
points, edges, minAngle);
172 label nextIndex = fcIndex(startIndex);
173 label splitIndex = fcIndex(nextIndex);
177 triFace[0] = operator[](startIndex);
178 triFace[1] = operator[](nextIndex);
179 triFace[2] = operator[](splitIndex);
183 triFace[0] = operator[](splitIndex);
184 triFace[1] = operator[](fcIndex(splitIndex));
185 triFace[2] = operator[](startIndex);
191 quadFaces[quadI++] = *
this;
201 label startIndex = mostConcaveAngle(
points, edges, minAngle);
203 scalar bisectAngle = minAngle/2;
204 vector rightEdge = edges[right(startIndex)];
211 label index = fcIndex(fcIndex(startIndex));
213 label minIndex = index;
216 for (
label i = 0; i < size() - 3; i++)
221 -
points[
operator[](startIndex)]
223 splitEdge /=
Foam::mag(splitEdge) + VSMALL;
225 const scalar splitCos = splitEdge & rightEdge;
226 const scalar splitAngle =
acos(
max(-1.0,
min(1.0, splitCos)));
227 const scalar angleDiff = fabs(splitAngle - bisectAngle);
229 if (angleDiff < minDiff)
236 index = fcIndex(index);
246 if (minIndex > startIndex)
248 diff = minIndex - startIndex;
253 diff = minIndex + size() - startIndex;
260 face face1(nPoints1);
263 for (
label i = 0; i < nPoints1; i++)
265 face1[i] = operator[](index);
266 index = fcIndex(index);
270 face face2(nPoints2);
273 for (
label i = 0; i < nPoints2; i++)
275 face2[i] = operator[](index);
276 index = fcIndex(index);
284 return (triI + quadI - oldIndices);
308 if (sizeA != sizeB || sizeA == 0)
330 if (aCirc() == bCirc())
351 if (aCirc() != bCirc())
379 if (aCirc() != bCirc())
429 if (a[i] == a[j]) aOcc++;
436 if (a[i] ==
b[j]) bOcc++;
440 if (aOcc != bOcc)
return false;
454 for (
label i=1; i<size(); i++)
456 if (
operator[](i) != operator[](ci))
458 operator[](++ci) = operator[](i);
462 if (
operator[](ci) !=
operator[](0))
480 for (
label i=1; i < (
n+1)/2; ++i)
482 Swap(
operator[](i),
operator[](
n-i));
511 centrePoint +=
points[operator[](pI)];
533 (
points[
operator[](pI)] - centrePoint)
534 ^ (nextPoint - centrePoint)
543 return sumAc/(3.0*sumA);
576 for (pI = 0; pI <
nPoints; ++pI)
578 centrePoint +=
p[operator[](pI)];
584 point nextPoint = centrePoint;
586 for (pI = 0; pI <
nPoints; ++pI)
590 nextPoint =
p[operator[](pI + 1)];
594 nextPoint =
p[operator[](0)];
621 for (
label pointI = 1; pointI < newList.
size(); pointI++)
623 newList[pointI] =
f[size() - pointI];
682 point centreOldPoint = centre(oldPoints);
683 point centreNewPoint = centre(newPoints);
693 oldPoints[
operator[](
pi)],
694 oldPoints[
operator[](
pi + 1)]
700 newPoints[
operator[](
pi)],
701 newPoints[
operator[](
pi + 1)]
709 oldPoints[
operator[](
nPoints-1)],
710 oldPoints[
operator[](0)]
716 newPoints[
operator[](
nPoints-1)],
717 newPoints[
operator[](0)]
740 ).inertia(refPt, density);
743 const point ctr = centre(
p);
752 p[
operator[](fcIndex(i))],
754 ).inertia(refPt, density);
767 for (
label pointI = 0; pointI <
points.size() - 1; ++pointI)
783 if (
operator[](i) ==
e.start())
785 if (
operator[](rcIndex(i)) ==
e.end())
790 else if (
operator[](fcIndex(i)) ==
e.end())
799 else if (
operator[](i) ==
e.end())
801 if (
operator[](rcIndex(i)) ==
e.start())
806 else if (
operator[](fcIndex(i)) ==
e.start())
839 return split(SPLITTRIANGLE,
points, triI, quadI, triFaces, quadFaces);
853 return split(COUNTQUAD,
points, triI, quadI, triFaces, quadFaces);
866 return split(SPLITQUAD,
points, triI, quadI, triFaces, quadFaces);
874 label longestEdgeI = -1;
875 scalar longestEdgeLength = -SMALL;
879 scalar edgeLength = eds[edI].mag(pts);
881 if (edgeLength > longestEdgeLength)
884 longestEdgeLength = edgeLength;
label longestEdge(const face &f, const pointField &pts)
Find the longest edge on a face. Face point labels index into pts.
vector normal(const pointField &) const
Vector normal; magnitude is equal to area of face.
static const char *const typeName
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
points setSize(newPointi)
int edgeDirection(const edge &) const
Return the edge direction on the face.
face reverseFace() const
Return face with reverse direction.
label trianglesQuads(const pointField &points, label &triI, label &quadI, faceList &triFaces, faceList &quadFaces) const
Split into triangles and quads.
#define forAll(list, i)
Loop across all elements in list.
A class for managing temporary objects.
Walks over a container as if it were circular. The container must have the following members defined:
label split(const splitMode mode, const pointField &points, label &triI, label &quadI, faceList &triFaces, faceList &quadFaces) const
Split face into triangles or triangles&quads.
point centre(const pointField &) const
Centre point of face.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
void setIteratorToFulcrum()
Set the iterator to the current position of the fulcrum.
label nTriangles() const
Number of triangles after splitting.
label triangles(const pointField &points, label &triI, faceList &triFaces) const
Split into triangles using existing points.
scalar edgeCos(const vectorField &edges, const label index) const
Cos between neighbouring edges.
dimensioned< scalar > mag(const dimensioned< Type > &)
scalar sweptVol(const pointField &oldPoints, const pointField &newPoints) const
Return the volume swept out by the face when its points move.
mode_t mode(const fileName &)
Return the file mode.
label which(const label globalIndex) const
Navigation through face vertices.
Field< vector > vectorField
Specialisation of Field<T> for vector.
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
A triangle primitive used to calculate face normals and swept volumes.
tmp< vectorField > calcEdges(const pointField &points) const
Construct list of edge vectors for face.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
label nTrianglesQuads(const pointField &points, label &nTris, label &nQuads) const
Number of triangles and quads after splitting.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Pre-declare SubField and related Field type.
tensor inertia(const pointField &, const point &refPt=vector::zero, scalar density=1.0) const
Return the inertia tensor, with optional reference.
label mostConcaveAngle(const pointField &points, const vectorField &edges, scalar &edgeCos) const
Find index of largest internal angle on face.
void flip()
Flip the face in-place.
edgeList edges() const
Return edges in face point ordering,.
errorManip< error > abort(error &err)
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
pointField points(const pointField &) const
Return the points corresponding to this face.
const double e
Elementary charge.
label size() const
Return the number of elements in the UList.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Xfer< T > xferMove(T &)
Construct by transferring the contents of the arg.
A triangular face using a FixedList of labels corresponding to mesh vertices.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
splitMode
Enumeration listing the modes for split()
dimensionedScalar acos(const dimensionedScalar &ds)
label collapse()
Collapse face by removing duplicate point labels.
A face is a list of labels corresponding to mesh vertices.
void setFulcrumToIterator()
Set the fulcrum to the current position of the iterator.
static int compare(const face &, const face &)
Compare faces.
void size(const label)
Override size to be inconsistent with allocated storage.
static bool sameVertices(const face &, const face &)
Return true if the faces have the same vertices.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
bool circulate(const CirculatorBase::direction dir=NONE)
Circulate around the list in the given direction.
A normal distribution model.
triangle< point, const point & > triPointRef