97 Foam::label Foam::extendedEdgeMesh::convexStart_ = 0;
100 Foam::label Foam::extendedEdgeMesh::externalStart_ = 0;
103 Foam::label Foam::extendedEdgeMesh::nPointTypes = 4;
106 Foam::label Foam::extendedEdgeMesh::nEdgeTypes = 5;
111 return wordHashSet(*fileExtensionConstructorTablePtr_);
117 return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
130 return edgeMeshFormatsCore::checkSupport
146 return edgeMeshFormatsCore::checkSupport
167 return canReadType(ext, verbose);
179 const labelList& ptEds(pointEdges()[ptI]);
195 if (edStat == EXTERNAL)
199 else if (edStat == INTERNAL)
205 if (nExternal == nPtEds)
209 else if (nInternal == nPtEds)
234 else if (nEdNorms == 2)
236 const vector& n0(norms[edNorms[0]]);
237 const vector& n1(norms[edNorms[1]]);
239 if ((n0 & n1) > cosNormalAngleTol_)
243 else if ((fC0tofC1 & n0) > 0.0)
252 else if (nEdNorms > 2)
277 normalVolumeTypes_(0),
279 normalDirections_(0),
281 featurePointNormals_(0),
282 featurePointEdges_(0),
350 edgeMesh(move(pointLst), move(edgeLst)),
425 label sFEI = featureEdges[i];
428 const labelList& eFaces = edgeFaces[sFEI];
432 label eFI = eFaces[j];
439 surfBaffleRegions[surf[eFI].region()]
495 label nonFeatureStart,
602 return read(unzipName, unzipName.
ext());
606 return read(name, ext);
627 scalar searchDistSqr,
642 scalar searchDistSqr,
696 info[i] = edgeTrees[i].findNearest
706 info[i].setIndex(info[i].index() + sliceStarts[i]);
714 scalar searchRadiusSqr,
729 label index = elems[elemI];
735 dynPointHit.append(nearHit);
745 const scalar searchRadiusSqr,
767 labelList elems = edgeTrees[i].findSphere
775 label index = elems[elemI];
776 label edgeI = edgeTrees[i].shapes().edgeLabels()[index];
781 label hitIndex = index + sliceStarts[i];
790 dynEdgeHit.append(nearHit);
808 hi1 < hitList.
size() - 1;
821 hi2 < hitList.
size();
837 minDist =
min(curDist, minDist);
1032 reversePointMap[i] = newPointi++;
1036 reverseFemPointMap[i] = newPointi++;
1043 reversePointMap[i] = newPointi++;
1047 reverseFemPointMap[i] = newPointi++;
1054 reversePointMap[i] = newPointi++;
1058 reverseFemPointMap[i] = newPointi++;
1065 reversePointMap[i] = newPointi++;
1069 reverseFemPointMap[i] = newPointi++;
1074 newPoints.
rmap(fem.
points(), reverseFemPointMap);
1088 reverseEdgeMap[i] = newEdgeI++;
1092 reverseFemEdgeMap[i] = newEdgeI++;
1096 label newInternalStart = newEdgeI;
1099 reverseEdgeMap[i] = newEdgeI++;
1103 reverseFemEdgeMap[i] = newEdgeI++;
1107 label newFlatStart = newEdgeI;
1110 reverseEdgeMap[i] = newEdgeI++;
1114 reverseFemEdgeMap[i] = newEdgeI++;
1118 label newOpenStart = newEdgeI;
1121 reverseEdgeMap[i] = newEdgeI++;
1125 reverseFemEdgeMap[i] = newEdgeI++;
1129 label newMultipleStart = newEdgeI;
1132 reverseEdgeMap[i] = newEdgeI++;
1136 reverseFemEdgeMap[i] = newEdgeI++;
1143 newEdges[reverseEdgeMap[i]] =
edge 1145 reversePointMap[e[0]],
1146 reversePointMap[e[1]]
1152 newEdges[reverseFemEdgeMap[i]] =
edge 1154 reverseFemPointMap[e[0]],
1155 reverseFemPointMap[e[1]]
1172 newNormals.append(fem.
normals());
1179 UIndirectList<labelList>(newEdgeNormals, reverseFemEdgeMap) =
1181 forAll(reverseFemEdgeMap, i)
1183 label mapI = reverseFemEdgeMap[i];
1200 UIndirectList<labelList>
1202 newFeaturePointNormals,
1205 UIndirectList<labelList>
1207 newFeaturePointNormals,
1212 label mapI = reverseFemPointMap[i];
1213 labelList& fn = newFeaturePointNormals[mapI];
1229 newRegionEdges.append(reverseEdgeMap[
regionEdges()[i]]);
1233 newRegionEdges.append(reverseFemEdgeMap[fem.
regionEdges()[i]]);
1246 reset(move(newPoints), move(newEdges));
1282 reversePointMap[i] = newPointi++;
1288 reversePointMap[i] = newPointi++;
1304 reverseEdgeMap[i] = newEdgeI++;
1307 label newInternalStart = newEdgeI;
1310 reverseEdgeMap[i] = newEdgeI++;
1321 newEdges[reverseEdgeMap[i]] =
edge 1323 reversePointMap[e[0]],
1324 reversePointMap[e[1]]
1345 newFeaturePointNormals,
1352 newRegionEdges[i] = reverseEdgeMap[
regionEdges()[i]];
1359 reset(move(newPoints), move(newEdges));
1382 Info<<
nl <<
"Writing extendedEdgeMesh components to " << prefix
1387 if (!verbose)
return;
1389 OBJstream convexFtPtStr(prefix +
"_convexFeaturePts.obj");
1390 Info<<
"Writing convex feature points to " << convexFtPtStr.
name() <<
endl;
1397 OBJstream concaveFtPtStr(prefix +
"_concaveFeaturePts.obj");
1398 Info<<
"Writing concave feature points to " 1406 OBJstream mixedFtPtStr(prefix +
"_mixedFeaturePts.obj");
1407 Info<<
"Writing mixed feature points to " << mixedFtPtStr.
name() <<
endl;
1414 OBJstream mixedFtPtStructureStr(prefix +
"_mixedFeaturePtsStructure.obj");
1415 Info<<
"Writing mixed feature point structure to " 1416 << mixedFtPtStructureStr.
name() <<
endl;
1425 mixedFtPtStructureStr.
write 1433 OBJstream externalStr(prefix +
"_externalEdges.obj");
1434 Info<<
"Writing external edges to " << externalStr.
name() <<
endl;
1442 OBJstream internalStr(prefix +
"_internalEdges.obj");
1443 Info<<
"Writing internal edges to " << internalStr.
name() <<
endl;
1451 OBJstream flatStr(prefix +
"_flatEdges.obj");
1452 Info<<
"Writing flat edges to " << flatStr.
name() <<
endl;
1460 OBJstream openStr(prefix +
"_openEdges.obj");
1461 Info<<
"Writing open edges to " << openStr.
name() <<
endl;
1469 OBJstream multipleStr(prefix +
"_multipleEdges.obj");
1470 Info<<
"Writing multiple edges to " << multipleStr.
name() <<
endl;
1478 OBJstream regionStr(prefix +
"_regionEdges.obj");
1479 Info<<
"Writing region edges to " << regionStr.
name() <<
endl;
1487 OBJstream edgeDirsStr(prefix +
"_edgeDirections.obj");
1488 Info<<
"Writing edge directions to " << edgeDirsStr.
name() <<
endl;
1507 os <<
indent <<
"point classification :" <<
nl;
1509 os <<
indent <<
"convex feature points : " 1512 os <<
indent <<
"concave feature points : " 1515 os <<
indent <<
"mixed feature points : " 1518 os <<
indent <<
"other (non-feature) points : " 1523 os <<
indent <<
"edge classification :" <<
nl;
1525 os <<
indent <<
"external (convex angle) edges : " 1528 os <<
indent <<
"internal (concave angle) edges : " 1531 os <<
indent <<
"flat region edges : " 1534 os <<
indent <<
"open edges : " 1537 os <<
indent <<
"multiply connected edges : " 1558 is.
check(
"operator>>(Istream&, sideVolumeType&)");
1570 os << static_cast<label>(vt);
1579 os <<
"// points" <<
nl 1583 <<
"// concaveStart mixedStart nonFeatureStart" <<
nl 1587 <<
"// internalStart flatStart openStart multipleStart" <<
nl 1592 <<
"// normals" <<
nl 1594 <<
"// normal volume types" <<
nl 1596 <<
"// normalDirections" <<
nl 1598 <<
"// edgeNormals" <<
nl 1600 <<
"// featurePointNormals" <<
nl 1602 <<
"// featurePointEdges" <<
nl 1604 <<
"// regionEdges" <<
nl 1609 os.
check(
"Ostream& operator<<(Ostream&, const extendedEdgeMesh&)");
1635 is.
check(
"Istream& operator>>(Istream&, extendedEdgeMesh&)");
extendedEdgeMesh()
Construct null.
label nonFeatureStart() const
Return the index of the start of the non-feature points.
static autoPtr< extendedEdgeMesh > New(const fileName &, const word &ext)
Select constructed from filename (explicit extension)
void transfer(edgeMesh &)
Transfer the contents of the argument and annul the argument.
const labelListList & featurePointNormals() const
Return the indices of the normals that are adjacent to the.
A HashTable with keys but without contents.
static const scalar GREAT
#define forAll(list, i)
Loop across all elements in list.
A class for handling file names.
Holds (reference to) pointField. Encapsulation of data needed for octree searches. Used for searching for nearest point. No bounding boxes around points. Only overlaps and calcNearest are implemented, rest makes little sense.
static wordHashSet readTypes()
Ostream & indent(Ostream &os)
Indent stream.
vectorField normals_
Normals of the features, to be referred to by index by both feature.
label nRegionEdges() const
Return number of region edges.
const labelListList & edgeNormals() const
Return the indices of the normals that are adjacent to the.
void nearestFeaturePoint(const point &sample, scalar searchDistSqr, pointIndexHit &info) const
Find nearest surface edge for the sample point.
static bool canWriteType(const word &ext, const bool verbose=false)
Can we write this file format type?
virtual bool check(const char *operation) const
Check IOstream status for given operation.
void sortPointsAndEdges(const Patch &, const labelList &featureEdges, const labelList ®ionFeatureEdges, const labelList &feaurePoints)
PtrList< indexedOctree< treeDataEdge > > edgeTreesByType_
Individual search trees for each type of edge.
label mixedStart_
Index of the start of the mixed type feature points.
virtual void writeStats(Ostream &os) const
Dump some information.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
void size(const label)
Override size to be inconsistent with allocated storage.
Description of feature edges and points.
label multipleStart() const
Return the index of the start of the multiply-connected feature.
label openStart_
Index of the start of the open feature edges.
static const Foam::NamedEnum< sideVolumeType, 4 > sideVolumeTypeNames_
Ostream & endl(Ostream &os)
Add newline and flush stream.
Holds data for octree to work on an edges subset.
virtual void clear()
Clear all storage.
static const Foam::NamedEnum< edgeStatus, 6 > edgeStatusNames_
const vectorField & normals() const
Return the normals of the surfaces adjacent to the feature edges.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
label concaveStart_
Index of the start of the concave feature points.
label openStart() const
Return the index of the start of the open feature edges.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
List< sideVolumeType > normalVolumeTypes_
Type per normal: which side of normal to mesh.
void add(const extendedEdgeMesh &)
Add extendedEdgeMesh. No filtering of duplicates.
const labelList & featureEdges() const
Return feature edge list.
const labelList & regionEdges() const
Return the feature edges which are on the boundary between.
virtual Ostream & write(const char)
Write character.
const fileName & name() const
Return the name of the stream.
Initialise the NamedEnum HashTable from the static list of names.
scalar minDist(const List< pointIndexHit > &hitList)
word ext() const
Return file name extension (part after last .)
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
edgeMesh()
Construct null.
label internalStart_
Index of the start of the internal feature edges.
void nearestFeatureEdgeByType(const point &sample, const scalarField &searchDistSqr, pointIndexHitList &info) const
Find the nearest point on each type of feature edge.
labelListList normalDirections_
Starting directions for the edges.
A list of faces which address into the list of points.
const Point & hitPoint() const
Return hit point.
A List obtained as a section of another List.
linePointRef line(const pointField &) const
Return edge line.
const labelListList & pointEdges() const
Return edges.
void allNearestFeatureEdges(const point &sample, const scalar searchRadiusSqr, pointIndexHitList &info) const
Find all the feature edges within searchDistSqr of sample.
vectorField pointField
pointField is a vectorField.
void flipNormals()
Flip normals. All concave become convex, all internal external.
label flatStart() const
Return the index of the start of the flat feature edges.
dimensionedScalar cos(const dimensionedScalar &ds)
line< point, const point & > linePointRef
Line using referred points.
labelList regionEdges_
Feature edges which are on the boundary between regions.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
static label convexStart_
Index of the start of the convex feature points - static as 0.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
label internalStart() const
Return the index of the start of the internal feature edges.
static label nEdgeTypes
Number of possible feature edge types (i.e. number of slices)
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from string.
label flatStart_
Index of the start of the flat feature edges.
Istream & operator>>(Istream &, directionInfo &)
const edgeList & edges() const
Return edges.
const triSurface & surface() const
bool read(const fileName &, const word &ext)
Read from file. Chooses reader based on explicit extension.
~extendedEdgeMesh()
Destructor.
bool hit() const
Is there a hit.
sideVolumeType
Normals point to the outside.
static label externalStart_
Index of the start of the external feature edges - static as 0.
void transfer(extendedEdgeMesh &)
Transfer the contents of the argument and annul the argument.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const labelListList & edgeFaces() const
Return edge-face addressing.
bool hit() const
Is there a hit.
HashSet wordHashSet
A HashSet with word keys.
autoPtr< indexedOctree< treeDataEdge > > edgeTree_
Search tree for all edges.
const indexedOctree< treeDataEdge > & edgeTree() const
Demand driven construction of octree for boundary edges.
static scalar cosNormalAngleTol_
Angular closeness tolerance for treating normals as the same.
label mixedStart() const
Return the index of the start of the mixed type feature points.
bool connected(const edge &a) const
Return true if connected to given edge.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
const Point & rawPoint() const
Return point with no checking.
Istream and Ostream manipulators taking arguments.
OFstream which keeps track of vertices.
const labelList & featurePoints() const
Return feature point list.
const pointField & points() const
Return points.
defineTypeNameAndDebug(combustionModel, 0)
Points connected by edges.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
virtual void writeStats(Ostream &) const
const PtrList< indexedOctree< treeDataEdge > > & edgeTreesByType() const
Demand driven construction of octree for boundary edges by type.
virtual void reset(pointField &&points, edgeList &&edges)
Reset primitive data (points, edges)
static edgeStatus classifyEdge(const List< vector > &norms, const labelList &edNorms, const vector &fC0tofC1)
Classify the type of feature edge. Requires face centre 0 to face.
label size() const
Return the number of elements in the UPtrList.
static bool canReadType(const word &ext, const bool verbose=false)
Can we read this file format?
virtual void clear()
Clear all storage.
void setSize(const label)
Reset size of List.
const vectorField & edgeDirections() const
Return the edgeDirection vectors.
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
label multipleStart_
Index of the start of the multiply-connected feature edges.
static const Foam::NamedEnum< pointStatus, 4 > pointStatusNames_
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
A List with indirect addressing.
Ostream & operator<<(Ostream &, const ensightPart &)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
static bool canRead(const fileName &, const bool verbose=false)
Can we read this file format?
static void write(const fileName &, const edgeMesh &)
Write to file.
fileName lessExt() const
Return file name without extension (part before last .)
labelListList featurePointEdges_
Indices of feature edges attached to feature points. The edges are.
void writeObj(const fileName &prefix, const bool verbose=true) const
Write all components of the extendedEdgeMesh as obj files.
Standard boundBox + extra functionality for use in octree.
const indexedOctree< treeDataPoint > & pointTree() const
Demand driven construction of octree for feature points.
dimensioned< scalar > mag(const dimensioned< Type > &)
static wordHashSet writeTypes()
scalar minDisconnectedDist(const pointIndexHitList &hitList) const
Return the minimum distance between disconnected edges.
const doubleScalar e
Elementary charge.
Omanip< int > setw(const int i)
labelListList featurePointNormals_
Indices of the normals that are adjacent to the feature points.
labelListList edgeNormals_
Indices of the normals that are adjacent to the feature edges.
Triangulated surface description with patch information.
label nonFeatureStart_
Index of the start of the non-feature points.
void nearestFeatureEdge(const point &sample, scalar searchDistSqr, pointIndexHit &info) const
Find nearest surface edge for the sample point.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
vectorField edgeDirections_
Flat and open edges require the direction of the edge.
autoPtr< indexedOctree< treeDataPoint > > pointTree_
Search tree for all feature points.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
label index() const
Return index.
PointHit< Point > nearestDist(const Point &p) const
Return nearest distance to line from a given point.
DynamicField< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
label start() const
Return start vertex label.
Holds feature edges/points of surface.
void allNearestFeaturePoints(const point &sample, scalar searchRadiusSqr, pointIndexHitList &info) const
Find all the feature points within searchDistSqr of sample.
label concaveStart() const
Return the index of the start of the concave feature points.
pointStatus classifyFeaturePoint(label ptI) const
Classify the type of feature point. Requires valid stored member.