36 List<DynamicList<label>>& pe,
37 DynamicList<edge>&
es,
40 const label nextPointi
46 label eI = pe[pointi][ppI];
48 const edge&
e =
es[eI];
50 if (
e.start() == nextPointi ||
e.end() == nextPointi)
58 pe[pointi].append(edgeI);
60 if (nextPointi != pointi)
64 pe[nextPointi].append(edgeI);
67 if (pointi < nextPointi)
69 es.append(edge(pointi, nextPointi));
73 es.append(edge(nextPointi, pointi));
79 void Foam::primitiveMesh::calcEdges(
const bool doFaceEdges)
const
83 Pout<<
"primitiveMesh::calcEdges(const bool) : "
84 <<
"calculating edges, pointEdges and optionally faceEdges"
90 if ((edgesPtr_ || pePtr_) || (doFaceEdges && fePtr_))
93 <<
"edges or pointEdges or faceEdges already calculated"
113 List<DynamicList<label>> pe(
nPoints());
129 faceEdges[facei].setSize(fcs[facei].size());
140 nInternal0Edges_ = 0;
142 label nInt1Edges = 0;
147 if (nInternalPoints_ == -1)
152 const face&
f = fcs[facei];
159 label edgeI = getEdge(pe,
es, pointi, nextPointi);
163 (*fePtr_)[facei][fp] = edgeI;
169 nInternal0Edges_ =
es.size();
175 for (
label facei = nInternalFaces_; facei < fcs.size(); facei++)
177 const face&
f = fcs[facei];
185 label edgeI = getEdge(pe,
es, pointi, nextPointi);
187 if (
es.size() > oldNEdges)
193 (*fePtr_)[facei][fp] = edgeI;
199 for (
label facei = 0; facei < nInternalFaces_; facei++)
201 const face&
f = fcs[facei];
209 label edgeI = getEdge(pe,
es, pointi, nextPointi);
211 if (
es.size() > oldNEdges)
213 if (pointi < nInternalPoints_)
215 if (nextPointi < nInternalPoints_)
226 if (nextPointi < nInternalPoints_)
238 (*fePtr_)[facei][fp] = edgeI;
249 if (nInternalPoints_ != -1)
251 nInternalEdges_ =
es.size()-nExtEdges;
252 nInternal1Edges_ = nInternal0Edges_+nInt1Edges;
288 label internal0EdgeI = 0;
291 label internal1EdgeI = nInternal0Edges_;
294 label internal2EdgeI = nInternal1Edges_;
297 label externalEdgeI = nInternalEdges_;
307 const DynamicList<label>& pEdges = pe[pointi];
309 nbrPoints.setSize(pEdges.size());
313 const edge&
e =
es[pEdges[i]];
315 label nbrPointi =
e.otherVertex(pointi);
317 if (nbrPointi < pointi)
323 nbrPoints[i] = nbrPointi;
329 if (nInternalPoints_ == -1)
334 if (nbrPoints[i] != -1)
336 label edgeI = pEdges[nbrPoints.indices()[i]];
338 oldToNew[edgeI] = internal0EdgeI++;
344 if (pointi < nInternalPoints_)
348 label nbrPointi = nbrPoints[i];
350 label edgeI = pEdges[nbrPoints.indices()[i]];
354 if (edgeI < nExtEdges)
357 oldToNew[edgeI] = externalEdgeI++;
359 else if (nbrPointi < nInternalPoints_)
362 oldToNew[edgeI] = internal0EdgeI++;
367 oldToNew[edgeI] = internal1EdgeI++;
376 label nbrPointi = nbrPoints[i];
378 label edgeI = pEdges[nbrPoints.indices()[i]];
382 if (edgeI < nExtEdges)
385 oldToNew[edgeI] = externalEdgeI++;
387 else if (nbrPointi < nInternalPoints_)
396 oldToNew[edgeI] = internal2EdgeI++;
411 const edge&
e =
es[edgeI];
414 <<
"Did not sort edge " << edgeI <<
" points:" <<
e
417 <<
"Current buckets:" <<
endl
418 <<
" internal0EdgeI:" << internal0EdgeI <<
endl
419 <<
" internal1EdgeI:" << internal1EdgeI <<
endl
420 <<
" internal2EdgeI:" << internal2EdgeI <<
endl
421 <<
" externalEdgeI:" << externalEdgeI <<
endl
435 edges[oldToNew[edgeI]] =
es[edgeI];
443 DynamicList<label>& pEdges = pe[pointi];
446 pointEdges[pointi].transfer(pEdges);
463 Foam::label Foam::primitiveMesh::findFirstCommonElementFromSortedLists
474 while (iter1 != list1.end() && iter2 != list2.end())
480 else if (*iter1 > *iter2)
493 <<
"No common elements in lists " << list1 <<
" and " << list2
531 Pout<<
"primitiveMesh::faceEdges() : "
532 <<
"calculating faceEdges" <<
endl;
545 const face&
f = fcs[facei];
560 label edgeI = pEdges[i];
562 if (
es[edgeI].otherVertex(pointi) == nextPointi)
576 void Foam::primitiveMesh::clearOutEdges()
594 return faceEdges()[facei];
599 const face&
f = faces()[facei];
611 findFirstCommonElementFromSortedLists
614 pointEs[
f.nextLabel(fp)]
626 return faceEdges(facei, labels_);
638 return cellEdges()[celli];
648 const labelList& fe = faceEdges(cFaces[i]);
652 labelSet_.insert(fe[feI]);
658 if (labelSet_.size() > storage.
capacity())
665 storage.
append(iter.key());
675 return cellEdges(celli, labels_);
scalar es(const scalar p, const scalar T) const
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
void setCapacity(const label)
Alter the size of the underlying storage.
label capacity() const
Size of the underlying storage.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
void clear()
Clear the addressed list, i.e. set the size to zero.
void size(const label)
Override size to be inconsistent with allocated storage.
void clear()
Clear the list, i.e. set size to zero.
void setSize(const label)
Reset size of List.
const label * const_iterator
Random access iterator for traversing UList.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
A face is a list of labels corresponding to mesh vertices.
const labelListList & pointEdges() const
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const labelListList & cellEdges() const
static const unsigned edgesPerPoint_
Estimated number of edges per point.
const labelListList & faceEdges() const
Template functions to aid in the implementation of demand driven data.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void deleteDemandDrivenData(DataType *&dataPtr)
errorManip< error > abort(error &err)
List< labelList > labelListList
A List of labelList.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
prefixOSstream Pout(cout, "Pout")
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.