51 return wordHashSet(*fileExtensionConstructorTablePtr_);
57 return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
94 return canReadType(ext, verbose);
100void Foam::edgeMesh::calcPointEdges()
const
105 <<
"pointEdges already calculated."
110 auto& pointEdges = *pointEdgesPtr_;
122 pointEdgesPtr_.reset(
nullptr);
133 points_.transfer(
mesh.points_);
134 edges_.transfer(
mesh.edges_);
135 pointEdgesPtr_ = std::move(
mesh.pointEdgesPtr_);
141 edgeRegion.
setSize(edges_.size());
144 label startEdgeI = 0;
145 label currentRegion = 0;
149 while (startEdgeI < edges_.size() && edgeRegion[startEdgeI] != -1)
154 if (startEdgeI == edges_.size())
162 edgeRegion[startEdgeI] = currentRegion;
165 while (edgesToVisit.size())
173 label edgeI = edgesToVisit[i];
176 const edge&
e = edges_[edgeI];
180 const labelList& pEdges = pointEdges()[
e[fp]];
184 label nbrEdgeI = pEdges[pEdgeI];
186 if (edgeRegion[nbrEdgeI] == -1)
188 edgeRegion[nbrEdgeI] = currentRegion;
189 newEdgesToVisit.
append(nbrEdgeI);
195 edgesToVisit.
transfer(newEdgesToVisit);
201 return currentRegion;
208 if (scaleFactor > VSMALL && !
equal(scaleFactor, 1))
210 points_ *= scaleFactor;
229 pointEdgesPtr_.reset(
nullptr);
231 for (edge&
e : edges_)
233 e = edge(pointMap,
e);
244 bitSet pointIsUsed(points_.size());
246 label nUniqEdges = 0;
247 label nUniqPoints = 0;
250 const edge&
e = edges_[edgeI];
254 if (
e[0] !=
e[1] && uniqEdges.insert(
e))
256 if (nUniqEdges != edgeI)
258 edges_[nUniqEdges] =
e;
260 edges_[nUniqEdges].sort();
263 if (pointIsUsed.set(
e[0]))
267 if (pointIsUsed.set(
e[1]))
276 Info<<
"Merging duplicate edges: "
277 << (edges_.size() - nUniqEdges)
278 <<
" edges will be deleted, "
279 << (points_.size() - nUniqPoints)
280 <<
" unused points will be removed." <<
endl;
283 if (nUniqEdges < edges_.size())
285 pointEdgesPtr_.reset(
nullptr);
286 edges_.setSize(nUniqEdges);
289 if (nUniqPoints < points_.size())
291 pointEdgesPtr_.reset(
nullptr);
301 if (pointIsUsed.test(pointi))
303 pointMap[pointi] = newId;
308 points_[newId] = points_[pointi];
316 for (
edge&
e : edges_)
Various functions to operate on Lists.
Macros for easy insertion into member function selection tables.
Macros for easy insertion into run-time selection tables.
writer write("magLe", fld)
void setSize(const label n)
Alias for resize().
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
void append(const T &val)
Append an element at the end of the list.
void setSize(label n)
Alias for resize().
void size(const label n)
Older name for setAddressableSize.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void set(const bitSet &bitset)
Set specified bits from another bitset.
bool test(const label pos) const
Test for True value at specified position, never auto-vivify entries.
Mesh data needed to do the Finite Area discretisation.
virtual void mergeEdges()
Merge duplicate edges and eliminate unused points.
const labelListList & pointEdges() const
Return edges.
static bool canWriteType(const word &fileType, bool verbose=false)
Can we write this file format type?
static wordHashSet writeTypes()
Summary of supported write file types.
virtual void mergePoints(const scalar mergeDist)
Geometric merge points (points within mergeDist) prior to.
edgeMesh(const faMesh &mesh)
Construct finite-area edge mesh faMesh reference.
static bool canReadType(const word &fileType, bool verbose=false)
Can we read this file format?
void transfer(edgeMesh &mesh)
Transfer the contents of the argument and annul the argument.
label regions(labelList &edgeRegion) const
Find connected regions. Set region number per edge.
static bool canRead(const fileName &name, bool verbose=false)
Can we read this file format?
virtual void clear()
Clear all storage.
static void write(const fileName &name, const edgeMesh &mesh, IOstreamOption streamOpt=IOstreamOption(), const dictionary &options=dictionary::null)
Write to file (format implicit in the extension).
virtual void scalePoints(const scalar scaleFactor)
Scale points. A non-positive factor is ignored.
static wordHashSet readTypes()
Summary of supported read file types.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A class for handling file names.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define defineMemberFunctionSelectionTable(baseType, funcName, argNames)
Define run-time selection table.
Geometric merging of points. See below.
Namespace for handling debugging switches.
void invertManyToMany(const label len, const UList< InputIntListType > &input, List< OutputIntListType > &output)
Invert many-to-many.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
List< labelList > labelListList
List of labelList.
HashSet< edge, Hash< edge > > edgeHashSet
A HashSet with edge for its key. Hashing (and ==) on an edge is symmetric.
List< label > labelList
A List of labels.
bool equal(const T &a, const T &b)
Compare two values for equality.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
label inplaceMergePoints(PointList &points, const scalar mergeTol, const bool verbose, labelList &pointToUnique)
Inplace merge points, preserving the original point order. All points closer/equal mergeTol are to be...
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
#define forAll(list, i)
Loop across all elements in list.