47 const label nextPointi
51 for (
const label edgei : pe[pointi])
60 const label edgei = es.
size();
61 pe[pointi].push_back(edgei);
63 if (nextPointi != pointi)
67 pe[nextPointi].push_back(edgei);
70 if (pointi < nextPointi)
86 void Foam::primitiveMesh::calcEdges(
const bool doFaceEdges)
const 90 Pout<<
"primitiveMesh::calcEdges(const bool) : " 91 <<
"calculating edges, pointEdges and optionally faceEdges" 97 if ((edgesPtr_ || pePtr_) || (doFaceEdges && fePtr_))
100 <<
"edges or pointEdges or faceEdges already calculated" 120 List<DynamicList<label>> pe(
nPoints());
147 nInternal0Edges_ = 0;
149 label nInt1Edges = 0;
154 if (nInternalPoints_ == -1)
159 const face&
f = fcs[facei];
163 label pointi =
f[fp];
164 label nextPointi =
f[
f.fcIndex(fp)];
166 label edgeI =
getEdge(pe, es, pointi, nextPointi);
170 (*fePtr_)[facei][fp] = edgeI;
176 nInternal0Edges_ = es.size();
182 for (label facei = nInternalFaces_; facei < fcs.size(); facei++)
184 const face&
f = fcs[facei];
188 label pointi =
f[fp];
189 label nextPointi =
f[
f.fcIndex(fp)];
191 label oldNEdges = es.size();
192 label edgeI =
getEdge(pe, es, pointi, nextPointi);
194 if (es.size() > oldNEdges)
200 (*fePtr_)[facei][fp] = edgeI;
206 for (label facei = 0; facei < nInternalFaces_; facei++)
208 const face&
f = fcs[facei];
212 label pointi =
f[fp];
213 label nextPointi =
f[
f.fcIndex(fp)];
215 label oldNEdges = es.size();
216 label edgeI =
getEdge(pe, es, pointi, nextPointi);
218 if (es.size() > oldNEdges)
220 if (pointi < nInternalPoints_)
222 if (nextPointi < nInternalPoints_)
233 if (nextPointi < nInternalPoints_)
245 (*fePtr_)[facei][fp] = edgeI;
256 if (nInternalPoints_ != -1)
258 nInternalEdges_ = es.size()-nExtEdges;
259 nInternal1Edges_ = nInternal0Edges_+nInt1Edges;
295 label internal0EdgeI = 0;
298 label internal1EdgeI = nInternal0Edges_;
301 label internal2EdgeI = nInternal1Edges_;
304 label externalEdgeI = nInternalEdges_;
314 const DynamicList<label>& pEdges = pe[pointi];
316 nbrPoints.setSize(pEdges.size());
320 const edge&
e = es[pEdges[i]];
322 label nbrPointi =
e.otherVertex(pointi);
324 if (nbrPointi < pointi)
330 nbrPoints[i] = nbrPointi;
336 if (nInternalPoints_ == -1)
341 if (nbrPoints[i] != -1)
343 label edgeI = pEdges[nbrPoints.indices()[i]];
345 oldToNew[edgeI] = internal0EdgeI++;
351 if (pointi < nInternalPoints_)
355 label nbrPointi = nbrPoints[i];
357 label edgeI = pEdges[nbrPoints.indices()[i]];
361 if (edgeI < nExtEdges)
364 oldToNew[edgeI] = externalEdgeI++;
366 else if (nbrPointi < nInternalPoints_)
369 oldToNew[edgeI] = internal0EdgeI++;
374 oldToNew[edgeI] = internal1EdgeI++;
383 label nbrPointi = nbrPoints[i];
385 label edgeI = pEdges[nbrPoints.indices()[i]];
389 if (edgeI < nExtEdges)
392 oldToNew[edgeI] = externalEdgeI++;
394 else if (nbrPointi < nInternalPoints_)
403 oldToNew[edgeI] = internal2EdgeI++;
414 label edgeI = oldToNew.find(-1);
418 const edge&
e = es[edgeI];
421 <<
"Did not sort edge " << edgeI <<
" points:" <<
e 424 <<
"Current buckets:" <<
endl 425 <<
" internal0EdgeI:" << internal0EdgeI <<
endl 426 <<
" internal1EdgeI:" << internal1EdgeI <<
endl 427 <<
" internal2EdgeI:" << internal2EdgeI <<
endl 428 <<
" externalEdgeI:" << externalEdgeI <<
endl 438 edgesPtr_ =
new edgeList(es.size());
442 edges[oldToNew[edgeI]] = es[edgeI];
450 DynamicList<label>& pEdges = pe[pointi];
484 auto iter1 = list1.
begin();
485 auto iter2 = list2.
begin();
487 while (iter1 != list1.
end() && iter2 != list2.
end())
493 else if (*iter1 > *iter2)
506 <<
"No common elements in lists " << list1 <<
" and " << list2
546 Pout<<
"primitiveMesh::faceEdges() : " 547 <<
"calculating faceEdges" <<
endl;
560 const face&
f = fcs[facei];
567 label pointi =
f[fp];
575 label edgeI = pEdges[i];
577 if (es[edgeI].otherVertex(pointi) == nextPointi)
591 void Foam::primitiveMesh::clearOutEdges()
609 return faceEdges()[facei];
613 const face&
f = faces()[facei];
628 pointEs[
f.nextLabel(fp)]
639 return faceEdges(facei, labels_);
652 return cellEdges()[celli];
659 for (
const label facei : cFaces)
661 set.insert(faceEdges(facei));
665 if (storage.
capacity() <
set.size())
670 for (
const label edgei :
set)
681 return cellEdges(celli, labelSet_, labels_);
bool contains(const T &val, label pos=0) const
Is the value contained in the list?
const labelListList & cellEdges() const
void size(const label n)
Older name for setAddressableSize.
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
label nPoints() const noexcept
Number of mesh points.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
const labelListList & faceEdges() const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< edge > edgeList
List of edge.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const labelListList & pointEdges() const
static label findFirstCommonElementFromSortedLists(const labelUList &list1, const labelUList &list2)
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual const pointField & points() const =0
Return mesh points.
void setCapacity(const label len)
Alter the size of the underlying storage.
static const unsigned edgesPerPoint_
Estimated number of edges per point.
List< labelList > labelListList
List of labelList.
Various functions to operate on Lists.
label capacity() const noexcept
Size of the underlying storage.
#define forAll(list, i)
Loop across all elements in list.
label fcIndex(const label i) const noexcept
The forward circular index. The next index in the list which returns to the first at the end of the l...
List< face > faceList
List of faces.
static label getEdge(List< DynamicList< label >> &pe, DynamicList< edge > &es, const label pointi, const label nextPointi)
const dimensionedScalar e
Elementary charge.
void setSize(const label n)
Alias for resize()
void clear()
Clear the list, i.e. set size to zero.
T & emplace_back(Args &&... args)
Construct an element at the end of the list, return reference to the new list element.
void sort(UList< T > &list)
Sort the list.
errorManip< error > abort(error &err)
iterator begin() noexcept
Return an iterator to begin traversing the UList.
int debug
Static debugging option.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void push_back(const T &val)
Copy append an element to the end of this list.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
Template functions to aid in the implementation of demand driven data.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values (not the indices) of a list.
virtual const faceList & faces() const =0
Return faces.
iterator end() noexcept
Return an iterator to end traversing the UList.
List< label > labelList
A List of labels.
void deleteDemandDrivenData(DataPtr &dataPtr)
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.