47 os <<
"v " << pt.x() <<
' ' << pt.y() <<
' ' << pt.z() <<
nl;
58 Foam::scalar Foam::surfaceIntersection::minEdgeLen
60 const triSurface& surf,
64 const labelList& pEdges = surf.pointEdges()[pointi];
66 scalar minLen = GREAT;
70 const edge&
e = surf.edges()[pEdges[pEdgeI]];
72 minLen =
min(minLen,
e.mag(surf.localPoints()));
80 Foam::label Foam::surfaceIntersection::getEdge
82 const triSurface& surf,
87 const edge faceEdge = surf.localFaces()[facei].edge(fp);
89 const labelList& eLabels = surf.faceEdges()[facei];
93 const label edgeI = eLabels[eI];
95 if (surf.edges()[edgeI] == faceEdge)
102 <<
"Problem:: Cannot find edge with vertices " << faceEdge
103 <<
" in face " << facei
111 void Foam::surfaceIntersection::removeDuplicates
117 bool hasDuplicate =
false;
119 label prevVertI = -1;
123 label newVertI = map[elems[elemI]];
125 if (newVertI == prevVertI)
131 prevVertI = newVertI;
142 elems[elemI++] = map[oldElems[0]];
144 for (label vertI = 1; vertI < oldElems.size(); vertI++)
147 label newVertI = map[oldElems[vertI]];
149 if (newVertI != elems.last())
151 elems[elemI++] = newVertI;
154 elems.setSize(elemI);
178 const edge&
e = edges[edgeI];
180 if ((
e.start() !=
e.end()) && uniqueEdges.insert(
e))
184 map[edgeI] = newEdgeI;
186 newEdges[newEdgeI++] =
e;
190 newEdges.setSize(newEdgeI);
214 label elem = elems[elemI];
216 if (uniqueElems.insert(elem))
220 map[elemI] = newElemI;
222 newElems[newElemI++] = elem;
226 newElems.setSize(newElemI);
232 void Foam::surfaceIntersection::writeIntersectedEdges
234 const triSurface& surf,
245 forAll(edgeCutVerts, edgeI)
247 const labelList& extraVerts = edgeCutVerts[edgeI];
249 if (extraVerts.size())
251 const edge&
e = surf.edges()[edgeI];
254 os <<
"l " <<
e.start()+1 <<
' ' 255 << extraVerts[0] + surf.nPoints() + 1 <<
nl;
257 for (label i = 1; i < extraVerts.size(); i++)
259 os <<
"l " << extraVerts[i-1] + surf.nPoints() + 1 <<
' ' 260 << extraVerts[i] + surf.nPoints() + 1 <<
nl;
263 os <<
"l " << extraVerts.last() + surf.nPoints() + 1
264 <<
' ' <<
e.end()+1 <<
nl;
271 Foam::label Foam::surfaceIntersection::classify
273 const scalar startTol,
277 const UList<point>&
points dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< edge > edgeList
List of edge.
constexpr char nl
The newline '\n' character (0x0a)
HashSet< edge, Hash< edge > > edgeHashSet
A HashSet with edge for its key. Hashing (and ==) on an edge is symmetric.
List< labelList > labelListList
List of labelList.
#define forAll(list, i)
Loop across all elements in list.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
void setSize(const label n)
Alias for resize()
static void writeObjPoints(const UList< point > &pts, Ostream &os)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
A HashTable to objects of type <T> with a labelPair key. The hashing is based on labelPair (FixedList...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
vector point
Point is a vector.
List< label > labelList
A List of labels.