Go to the documentation of this file.
43 const label excludeElem,
49 if (elems[i] != excludeElem)
68 label edgeI = edgeLabels[i];
70 const edge&
e = edges[edgeI];
74 (
e[0] == v0 &&
e[1] == v1)
75 || (
e[0] == v1 &&
e[1] == v0)
83 <<
" and " << v1 <<
" in edge labels " << edgeLabels
100 const face&
f = mesh_.faces()[faceI];
101 const labelList& fEdges = mesh_.faceEdges()[faceI];
113 label fp1 =
f.fcIndex(fp);
121 splitEdges.find(edgeI);
123 if (edgeFnd != splitEdges.end())
131 if (v0 == mesh_.edges()[edgeI].start())
135 newFace.
append(extraVerts[i]);
142 newFace.
append(extraVerts[i]);
158 if (mesh_.isInternalFace(faceI))
160 nei = mesh_.faceNeighbour()[faceI];
164 patchI = mesh_.boundaryMesh().whichPatch(faceI);
168 label zoneID = mesh_.faceZones().whichZone(faceI);
170 bool zoneFlip =
false;
174 const faceZone& fZone = mesh_.faceZones()[zoneID];
185 mesh_.faceOwner()[faceI],
218 const edgeList& edges = mesh_.edges();
219 const faceList& faces = mesh_.faces();
238 const label faceI = faceLabels[i];
240 const face&
f = faces[faceI];
242 const label fpA = fpStart[i];
243 const label fpB = fpEnd[i];
248 Pout<<
"Face:" <<
f <<
" collapsed to fp:" << fpA <<
' ' << fpB
249 <<
" with points:" << pA <<
' ' << pB
261 dist[fpB] =
magSqr(pB - pA);
268 label fp =
f.fcIndex(fpMin1);
277 if (
w <= dist[fpMin1])
280 w = dist[fpMin1] + 1
e-6*(dist[fpB] - dist[fpA]);
284 pA +
Foam::sqrt(
w / (dist[fpB] - dist[fpA]))*(pB - pA)
287 Pout<<
"Adapting position of vertex " <<
f[fp] <<
" on face "
288 <<
f <<
" from " << near.
rawPoint() <<
" to " << newPoint
313 fp =
f.fcIndex(fpMin1);
321 fp =
f.rcIndex(fpMin1);
330 if (
w <= dist[fpMin1])
333 w = dist[fpMin1] + 1
e-6*(dist[fpB] - dist[fpA]);
337 pA +
Foam::sqrt(
w / (dist[fpB] - dist[fpA]))*(pB - pA)
340 Pout<<
"Adapting position of vertex " <<
f[fp] <<
" on face "
341 <<
f <<
" from " << near.
rawPoint() <<
" to " << newPoint
366 fp =
f.rcIndex(fpMin1);
372 if (dist.
indices()[dist.size()-1] != fpB)
374 OFstream str(
"conflictingFace.obj");
378 <<
"Trying to collapse face:" << faceI <<
" vertices:" <<
f
379 <<
" to edges between vertices " <<
f[fpA] <<
" and "
380 <<
f[fpB] <<
" but " <<
f[fpB] <<
" does not seem to be the"
381 <<
" vertex furthest away from " <<
f[fpA] <<
endl
382 <<
"Dumped conflicting face to obj file conflictingFace.obj"
388 Pout<<
"Face:" <<
f <<
" fpA:" << fpA <<
" fpB:" << fpB <<
nl;
395 Pout<<
" fp:" << fp <<
" distance:" << dist[i] <<
nl;
400 const labelList& fEdges = mesh_.faceEdges()[faceI];
410 label fp1 =
f.fcIndex(fp);
413 label sorted0 = sortedFp[fp];
414 label sorted1 = sortedFp[fp1];
422 if (sorted0 < sorted1)
426 for (
label j = sorted0+1; j < sorted1; j++)
435 for (
label j = sorted1+1; j < sorted0; j++)
441 if (edgePoints.size())
447 const edge&
e = edges[edgeI];
449 if (fpToFp1 == (
f[fp] ==
e.start()))
451 splitEdges.insert(edgeI, edgePoints);
456 splitEdges.insert(edgeI, edgePoints);
460 insert(edgeFaces[edgeI], faceI, affectedFaces);
467 Pout<<
"Split edge:" << iter.key()
468 <<
" verts:" << mesh_.edges()[iter.key()]
474 Pout<<
" " << edgePoints[i] <<
nl;
485 const label faceI = faceLabels[i];
490 affectedFaces.
erase(faceI);
500 filterFace(splitEdges, iter.key(), meshMod);
volScalarField w(IOobject("w", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE), mesh, dimensionedScalar("w", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0))
void sort()
(stable) sort the list (if changed after construction time)
#define forAll(list, i)
Loop across all elements in list.
void filterFace(const Map< labelList > &splitEdges, const label faceI, polyTopoChange &meshMod) const
Replace vertices in face.
This class describes the interaction of a face and a point. It carries the info of a successful hit a...
const Point & rawPoint() const
Return point with no checking.
An STL-conforming const_iterator.
Direct mesh changes based on v1.3 polyTopoChange syntax.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A HashTable to objects of type <T> with a label key.
Class describing modification of a face.
Class describing modification of a point.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static label findEdge(const edgeList &edges, const labelList &edgeLabels, const label v0, const label v1)
Find edge amongst candidate edges.
Mesh consisting of general polyhedral cells.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
A subset of mesh faces organised as a primitive patch.
void setPoint(const Point &p)
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
void setRefinement(const labelList &faceLabels, const labelList &fpA, const labelList &fpB, polyTopoChange &) const
Collapse faces along endpoints. Play commands into.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
A list that is sorted upon construction or when explicitly requested with the sort() method.
static void insert(const labelList &elems, const label excludeElem, labelHashSet &set)
Insert labelList into labelHashSet. Optional excluded element.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
errorManip< error > abort(error &err)
const double e
Elementary charge.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
prefixOSstream Pout(cout, "Pout")
faceCollapser(const faceCollapser &)
Disallow default bitwise copy construct.
Class containing data for face removal.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensionedScalar sqrt(const dimensionedScalar &ds)
const dimensionedScalar e
Elementary charge.
bool insert(const Key &key)
Insert a new entry.
const labelList & indices() const
Return the list of sorted indices. Updated every sort.
A face is a list of labels corresponding to mesh vertices.
void size(const label)
Override size to be inconsistent with allocated storage.
const boolList & flipMap() const
Return face flip map.
PointHit< Point > nearestDist(const Point &p) const
Return nearest distance to line from a given point.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
timeIndices insert(timeIndex, timeDirs[timeI].value())
void reverse(UList< T > &, const label n)