46 externalDisplacementMeshMover,
60 DynamicList<label> adaptPatchIDs;
63 const pointPatchField<vector>& patchFld =
64 fld.boundaryField()[
patchi];
66 if (
isA<valuePointPatchField<vector>>(patchFld))
68 if (
isA<zeroFixedValuePointPatchField<vector>>(patchFld))
75 adaptPatchIDs.append(
patchi);
84 Foam::medialAxisMeshMover::getPatch
90 const polyBoundaryMesh& patches = mesh.boundaryMesh();
97 const polyPatch& pp = patches[patchIDs[i]];
108 const polyPatch& pp = patches[patchIDs[i]];
110 label meshFacei = pp.start();
114 addressing[nFaces++] = meshFacei++;
118 return autoPtr<indirectPrimitivePatch>
122 IndirectList<face>(mesh.faces(), addressing),
129 void Foam::medialAxisMeshMover::smoothPatchNormals
131 const label nSmoothDisp,
132 const PackedBoolList& isPatchMasterPoint,
133 const PackedBoolList& isPatchMasterEdge,
139 const labelList& meshPoints = pp.meshPoints();
142 Info<< typeName <<
" : Smoothing normals ..." <<
endl;
158 for (
label iter = 0; iter < nSmoothDisp; iter++)
170 average *= invSumWeight;
173 if ((iter % 10) == 0)
178 mag(normals-average)()
180 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
187 average[pointi] = 0.5*(normals[pointi]+average[pointi]);
188 normals[pointi] = average[pointi];
189 normals[pointi] /=
mag(normals[pointi]) + VSMALL;
196 void Foam::medialAxisMeshMover::smoothNormals
198 const label nSmoothDisp,
199 const PackedBoolList& isMeshMasterPoint,
200 const PackedBoolList& isMeshMasterEdge,
207 <<
" : Smoothing normals in interior ..." <<
endl;
217 label meshPointi = fixedPoints[i];
218 isFixedPoint.set(meshPointi, 1);
244 for (
label iter = 0; iter < nSmoothDisp; iter++)
256 average *= invSumWeight;
259 if ((iter % 10) == 0)
264 mag(normals-average)()
266 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
273 if (isFixedPoint.get(pointi) == 0)
276 average[pointi] = 0.5*(normals[pointi]+average[pointi]);
277 normals[pointi] = average[pointi];
278 normals[pointi] /=
mag(normals[pointi]) + VSMALL;
287 bool Foam::medialAxisMeshMover::isMaxEdge
289 const List<pointData>& pointWallDist,
300 vector v0(points[e[0]] - pointWallDist[e[0]].origin());
301 scalar magV0(
mag(v0));
308 vector v1(points[e[1]] - pointWallDist[e[1]].origin());
309 scalar magV1(
mag(v1));
334 if ((pointWallDist[e[0]].v() & pointWallDist[e[1]].v()) < minCos)
345 void Foam::medialAxisMeshMover::update(
const dictionary& coeffDict)
348 <<
" : Calculating distance to Medial Axis ..." <<
endl;
353 const labelList& meshPoints = pp.meshPoints();
362 coeffDict.lookup(
"nSmoothSurfaceNormals")
366 word angleKey =
"minMedialAxisAngle";
367 if (!coeffDict.found(angleKey))
370 angleKey =
"minMedianAxisAngle";
378 const scalar featureAngle =
readScalar(coeffDict.lookup(
"featureAngle"));
381 const scalar slipFeatureAngle =
383 coeffDict.found(
"slipFeatureAngle")
384 ?
readScalar(coeffDict.lookup(
"slipFeatureAngle"))
391 coeffDict.lookup(
"nSmoothNormals")
395 const label nMedialAxisIter = coeffDict.lookupOrDefault<
label>
419 const PackedBoolList isPatchMasterPoint
427 const PackedBoolList isPatchMasterEdge
444 nSmoothSurfaceNormals,
458 int dummyTrackData = 0;
464 List<pointData> wallInfo(meshPoints.size());
466 forAll(meshPoints, patchPointi)
468 label pointi = meshPoints[patchPointi];
469 wallInfo[patchPointi] = pointData
474 pointNormals[patchPointi]
479 List<pointData> edgeWallDist(
mesh().nEdges());
480 PointEdgeWave<pointData> wallDistCalc
490 wallDistCalc.iterate(nMedialAxisIter);
494 wallDistCalc.getUnsetPoints(),
500 if (nMedialAxisIter > 0)
503 <<
" : Limited walk to " << nMedialAxisIter
504 <<
" steps. Not visited " << nUnvisit
506 <<
" points" <<
endl;
511 <<
"Walking did not visit all points." <<
nl 512 <<
" Did not visit " << nUnvisit
514 <<
" points. This is not necessarily a problem" <<
nl 515 <<
" and might be due to faceZones splitting of part" 516 <<
" of the domain." <<
nl <<
endl;
526 List<pointData> edgeMedialDist(
mesh().nEdges());
529 DynamicList<pointData> maxInfo(meshPoints.size());
530 DynamicList<label> maxPoints(meshPoints.size());
538 const edge& e = edges[edgeI];
542 !pointWallDist[e[0]].valid(dummyTrackData)
543 || !pointWallDist[e[1]].valid(dummyTrackData)
549 label pointi = e[ep];
551 if (!pointMedialDist[pointi].valid(dummyTrackData))
553 maxPoints.append(pointi);
564 pointMedialDist[pointi] = maxInfo.last();
569 else if (isMaxEdge(pointWallDist, edgeI, minMedialAxisAngleCos))
576 vector eVec = e.vec(points);
577 scalar eMag =
mag(eVec);
583 const point& p0 = points[e[0]];
584 const point& p1 = points[e[1]];
585 scalar dist0 = (p0-pointWallDist[e[0]].origin()) & eVec;
586 scalar dist1 = (pointWallDist[e[1]].origin()-p1) & eVec;
587 scalar s = 0.5*(dist1+eMag+dist0);
594 else if (s >= dist0+eMag)
600 medialAxisPt = p0+(s-dist0)*eVec;
605 label pointi = e[ep];
607 if (!pointMedialDist[pointi].valid(dummyTrackData))
609 maxPoints.append(pointi);
615 magSqr(points[pointi]-medialAxisPt),
620 pointMedialDist[pointi] = maxInfo.last();
636 const polyPatch& pp = patches[
patchi];
643 && !isA<emptyPolyPatch>(pp)
644 && !adaptPatches.found(
patchi)
647 const labelList& meshPoints = pp.meshPoints();
654 if (pvf.fixesValue())
658 <<
" : Inserting all points on patch " << pp.name()
663 label pointi = meshPoints[i];
664 if (!pointMedialDist[pointi].valid(dummyTrackData))
666 maxPoints.append(pointi);
677 pointMedialDist[pointi] = maxInfo.last();
689 <<
" : Inserting points on patch " << pp.name()
690 <<
" if angle to nearest layer patch > " 691 << slipFeatureAngle <<
" degrees." <<
endl;
704 label pointi = meshPoints[i];
708 pointWallDist[pointi].valid(dummyTrackData)
709 && !pointMedialDist[pointi].valid(dummyTrackData)
715 -pointWallDist[pointi].v()
718 if (cosAngle > slipFeatureAngleCos)
723 maxPoints.append(pointi);
734 pointMedialDist[pointi] = maxInfo.last();
751 PointEdgeWave<pointData> medialDistCalc
762 medialDistCalc.iterate(2*nMedialAxisIter);
766 forAll(pointMedialDist, pointi)
768 if (pointMedialDist[pointi].valid(dummyTrackData))
772 pointMedialDist[pointi].distSqr()
774 medialVec_[pointi] = pointMedialDist[pointi].origin();
779 medialDist_[pointi] = 0.0;
780 medialVec_[pointi] =
point(1, 0, 0);
788 if (!pointWallDist[i].valid(dummyTrackData))
790 dispVec_[i] =
vector(1, 0, 0);
794 dispVec_[i] = pointWallDist[i].v();
809 forAll(medialRatio_, pointi)
811 if (!pointWallDist[pointi].valid(dummyTrackData))
813 medialRatio_[pointi] = 0.0;
817 scalar wDist2 = pointWallDist[pointi].distSqr();
818 scalar mDist = medialDist_[pointi];
820 if (wDist2 <
sqr(SMALL) && mDist < SMALL)
827 medialRatio_[pointi] = 0.0;
831 medialRatio_[pointi] = mDist / (
Foam::sqrt(wDist2) + mDist);
840 <<
" : Writing medial axis fields:" <<
nl 842 <<
"ratio of medial distance to wall distance : " 843 << medialRatio_.
name() <<
nl 844 <<
"distance to nearest medial axis : " 845 << medialDist_.name() <<
nl 846 <<
"nearest medial axis location : " 847 << medialVec_.name() <<
nl 848 <<
"normal at nearest wall : " 849 << dispVec_.name() <<
nl 854 medialRatio_.
write();
861 bool Foam::medialAxisMeshMover::unmarkExtrusion
863 const label patchPointi,
865 List<snappyLayerDriver::extrudeMode>& extrudeStatus
871 patchDisp[patchPointi] =
Zero;
877 patchDisp[patchPointi] =
Zero;
887 void Foam::medialAxisMeshMover::syncPatchDisplacement
891 List<snappyLayerDriver::extrudeMode>& extrudeStatus
895 const labelList& meshPoints = pp.meshPoints();
897 label nChangedTotal = 0;
909 minMagSqrEqOp<vector>(),
916 if (
mag(patchDisp[i]) < minThickness[i])
918 if (unmarkExtrusion(i, patchDisp, extrudeStatus))
989 nChangedTotal += nChanged;
1003 void Foam::medialAxisMeshMover::minSmoothField
1005 const label nSmoothDisp,
1006 const PackedBoolList& isPatchMasterPoint,
1007 const PackedBoolList& isPatchMasterEdge,
1013 const edgeList& edges = pp.edges();
1014 const labelList& meshPoints = pp.meshPoints();
1029 Info<< typeName <<
" : Smoothing field ..." <<
endl;
1031 for (
label iter = 0; iter < nSmoothDisp; iter++)
1044 average *= invSumWeight;
1050 average[pointi] = 0.5*(field[pointi]+average[pointi]);
1055 average[pointi] < field[pointi]
1056 && average[pointi] >= fieldMin[pointi]
1059 field[pointi] = average[pointi];
1064 if ((iter % 10) == 0)
1069 mag(field-average)()
1071 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
1078 void Foam::medialAxisMeshMover::
1079 handleFeatureAngleLayerTerminations
1081 const scalar minCos,
1082 const PackedBoolList& isPatchMasterPoint,
1084 List<snappyLayerDriver::extrudeMode>& extrudeStatus,
1086 label& nPointCounter
1094 boolList extrudedFaces(pp.size(),
true);
1096 forAll(pp.localFaces(), facei)
1098 const face& f = pp.localFaces()[facei];
1104 extrudedFaces[facei] =
false;
1119 List<List<point>> edgeFaceNormals(pp.nEdges());
1120 List<List<bool>> edgeFaceExtrude(pp.nEdges());
1123 const vectorField& faceNormals = pp.faceNormals();
1127 const labelList& eFaces = edgeFaces[edgeI];
1129 edgeFaceNormals[edgeI].
setSize(eFaces.size());
1130 edgeFaceExtrude[edgeI].setSize(eFaces.size());
1133 label facei = eFaces[i];
1134 edgeFaceNormals[edgeI][i] = faceNormals[facei];
1135 edgeFaceExtrude[edgeI][i] = extrudedFaces[facei];
1144 globalMeshData::ListPlusEqOp<List<point>>(),
1153 globalMeshData::ListPlusEqOp<List<bool>>(),
1158 forAll(edgeFaceNormals, edgeI)
1160 const List<point>& eFaceNormals = edgeFaceNormals[edgeI];
1161 const List<bool>& eFaceExtrude = edgeFaceExtrude[edgeI];
1163 if (eFaceNormals.size() == 2)
1165 const edge& e = pp.edges()[edgeI];
1175 if (!eFaceExtrude[0] || !eFaceExtrude[1])
1177 const vector& n0 = eFaceNormals[0];
1178 const vector& n1 = eFaceNormals[1];
1180 if ((n0 & n1) < minCos)
1182 if (unmarkExtrusion(v0, patchDisp, extrudeStatus))
1184 if (isPatchMasterPoint[v0])
1189 if (unmarkExtrusion(v1, patchDisp, extrudeStatus))
1191 if (isPatchMasterPoint[v1])
1210 void Foam::medialAxisMeshMover::findIsolatedRegions
1212 const scalar minCosLayerTermination,
1213 const bool detectExtrusionIsland,
1214 const PackedBoolList& isPatchMasterPoint,
1215 const PackedBoolList& isPatchMasterEdge,
1218 List<snappyLayerDriver::extrudeMode>& extrudeStatus,
1224 const labelList& meshPoints = pp.meshPoints();
1226 Info<< typeName <<
" : Removing isolated regions ..." <<
endl;
1229 label nPointCounter = 0;
1232 autoPtr<OBJstream> str;
1240 /
"islandExcludePoints_" 1246 <<
" : Writing points surrounded by non-extruded points to " 1247 << str().name() <<
endl;
1254 handleFeatureAngleLayerTerminations
1256 minCosLayerTermination,
1265 syncPatchDisplacement(minThickness, patchDisp, extrudeStatus);
1276 boolList keptPoints(pp.nPoints(),
false);
1278 if (detectExtrusionIsland)
1287 const face& f = pp.localFaces()[facei];
1293 if (islandPoint[facei] == -1)
1296 islandPoint[facei] = f[fp];
1298 else if (islandPoint[facei] != -2)
1301 islandPoint[facei] = -2;
1313 forAll(pointFaces, patchPointi)
1321 label facei = pFaces[i];
1322 if (islandPoint[facei] != patchPointi)
1324 keptPoints[patchPointi] =
true;
1337 boolList extrudedFaces(pp.size(),
true);
1338 forAll(pp.localFaces(), facei)
1340 const face& f = pp.localFaces()[facei];
1345 extrudedFaces[facei] =
false;
1353 forAll(keptPoints, patchPointi)
1359 label facei = pFaces[i];
1360 if (extrudedFaces[facei])
1362 keptPoints[patchPointi] =
true;
1381 forAll(keptPoints, patchPointi)
1383 if (!keptPoints[patchPointi])
1385 if (unmarkExtrusion(patchPointi, patchDisp, extrudeStatus))
1392 str().write(pp.points()[meshPoints[patchPointi]]);
1405 const edgeList& edges = pp.edges();
1411 labelList isolatedPoint(pp.nPoints(),0);
1415 if (isPatchMasterEdge[edgeI])
1417 const edge& e = edges[edgeI];
1424 isolatedPoint[v0] += 1;
1428 isolatedPoint[v1] += 1;
1446 const face& f = pp.localFaces()[facei];
1447 bool failed =
false;
1450 if (isolatedPoint[f[fp]] > 2)
1456 bool allPointsExtruded =
true;
1463 allPointsExtruded =
false;
1468 if (allPointsExtruded)
1486 str().write(pp.points()[meshPoints[f[fp]]]);
1494 reduce(nPointCounter, sumOp<label>());
1496 <<
" : Number of isolated points extrusion stopped : "<< nPointCounter
1501 void Foam::medialAxisMeshMover::smoothLambdaMuDisplacement
1503 const label nSmoothDisp,
1504 const PackedBoolList& isMeshMasterPoint,
1505 const PackedBoolList& isMeshMasterEdge,
1528 Info<< typeName <<
" : Smoothing displacement ..." <<
endl;
1530 const scalar lambda = 0.33;
1531 const scalar mu = -0.34;
1535 for (
label iter = 0; iter < nSmoothDisp; iter++)
1547 average *= invSumWeight;
1551 if (medialRatio_[i] > SMALL && medialRatio_[i] < 1-SMALL)
1553 displacement[i] = (1-
lambda)*displacement[i]+lambda*average[i];
1567 average *= invSumWeight;
1572 if (medialRatio_[i] > SMALL && medialRatio_[i] < 1-SMALL)
1574 displacement[i] = (1-
mu)*displacement[i]+mu*average[i];
1580 if ((iter % 10) == 0)
1585 mag(displacement-average)()
1587 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
1595 Foam::medialAxisMeshMover::medialAxisMeshMover
1603 adaptPatchIDs_(getFixedValueBCs(pointDisplacement)),
1604 adaptPatchPtr_(getPatch(
mesh(), adaptPatchIDs_)),
1611 pointDisplacement.
db(),
1621 const_cast<polyMesh&>(
mesh()),
1636 pointDisplacement.
db(),
1650 pointDisplacement.
db(),
1664 pointDisplacement.
db(),
1678 pointDisplacement.
db(),
1699 void Foam::medialAxisMeshMover::calculateDisplacement
1707 Info<< typeName <<
" : Smoothing using Medial Axis ..." <<
endl;
1719 "nSmoothDisplacement",
1724 const scalar maxThicknessToMedialRatio =
readScalar 1726 coeffDict.
lookup(
"maxThicknessToMedialRatio")
1733 const scalar minCosLayerTermination =
Foam::cos 1741 coeffDict.
lookup(
"nSmoothThickness")
1754 "detectExtrusionIsland",
1793 thickness =
mag(patchDisp);
1795 forAll(thickness, patchPointi)
1799 thickness[patchPointi] = 0.0;
1803 label numThicknessRatioExclude = 0;
1816 /
"thicknessRatioExcludePoints_" 1822 <<
" : Writing points with too large an extrusion distance to " 1823 << str().name() <<
endl;
1834 /
"thicknessRatioExcludeMedialVec_" 1840 <<
" : Writing medial axis vectors on points with too large" 1841 <<
" an extrusion distance to " << medialVecStr().name() <<
endl;
1844 forAll(meshPoints, patchPointi)
1848 label pointi = meshPoints[patchPointi];
1852 scalar mDist = medialDist_[pointi];
1853 scalar thicknessRatio = thickness[patchPointi]/(mDist+VSMALL);
1858 patchDisp[patchPointi]
1859 / (
mag(patchDisp[patchPointi]) + VSMALL);
1861 mVec /=
mag(mVec)+VSMALL;
1862 thicknessRatio *= (n&mVec);
1864 if (thicknessRatio > maxThicknessToMedialRatio)
1869 Pout<<
"truncating displacement at " 1871 <<
" from " << thickness[patchPointi]
1875 minThickness[patchPointi]
1876 +thickness[patchPointi]
1878 <<
" medial direction:" << mVec
1879 <<
" extrusion direction:" << n
1880 <<
" with thicknessRatio:" << thicknessRatio
1884 thickness[patchPointi] =
1885 0.5*(minThickness[patchPointi]+thickness[patchPointi]);
1887 patchDisp[patchPointi] = thickness[patchPointi]*
n;
1889 if (isPatchMasterPoint[patchPointi])
1891 numThicknessRatioExclude++;
1897 str().write(
linePointRef(pt, pt+patchDisp[patchPointi]));
1899 if (medialVecStr.
valid())
1902 medialVecStr().write
1916 Info<< typeName <<
" : Reducing layer thickness at " 1917 << numThicknessRatioExclude
1918 <<
" nodes where thickness to medial axis distance is large " <<
endl;
1925 minCosLayerTermination,
1926 detectExtrusionIsland,
1938 forAll(thickness, patchPointi)
1942 thickness[patchPointi] = 0.0;
1950 nSmoothPatchThickness,
1960 int dummyTrackData = 0;
1975 forAll(meshPoints, patchPointi)
1977 label pointi = meshPoints[patchPointi];
1978 wallPoints[patchPointi] = pointi;
1983 thickness[patchPointi],
1999 wallDistCalc.
iterate(nMedialAxisIter);
2004 pointField& displacement = pointDisplacement_;
2006 forAll(displacement, pointi)
2008 if (!pointWallDist[pointi].valid(dummyTrackData))
2010 displacement[pointi] =
Zero;
2019 displacement[pointi] =
2020 -medialRatio_[pointi]
2021 *pointWallDist[pointi].s()
2028 if (nSmoothDisplacement > 0)
2030 smoothLambdaMuDisplacement
2032 nSmoothDisplacement,
2041 bool Foam::medialAxisMeshMover::shrinkMesh
2044 const label nAllowableErrors,
2056 meshMover_.setDisplacementPatchFields();
2058 Info<< typeName <<
" : Moving mesh ..." <<
endl;
2059 scalar oldErrorReduction = -1;
2061 bool meshOk =
false;
2063 for (
label iter = 0; iter < 2*nSnap ; iter++)
2066 <<
" : Iteration " << iter <<
endl;
2070 <<
" : Displacement scaling for error reduction set to 0." 2072 oldErrorReduction = meshMover_.setErrorReduction(0.0);
2077 meshMover_.scaleMesh
2081 meshMover_.paramDict(),
2088 Info<< typeName <<
" : Successfully moved mesh" <<
endl;
2094 if (oldErrorReduction >= 0)
2096 meshMover_.setErrorReduction(oldErrorReduction);
2099 Info<< typeName <<
" : Finished moving mesh ..." <<
endl;
2108 const label nAllowableErrors,
2116 const word minThicknessName =
word(moveDict.
lookup(
"minThicknessName"));
2131 if (minThicknessName ==
"none")
2137 (minThicknessName ==
"none")
2145 pointDisplacement_.primitiveField(),
2154 forAll(extrudeStatus, pointi)
2156 if (
mag(patchDisp[pointi]) <= minThickness[pointi]+SMALL)
2164 calculateDisplacement(moveDict, minThickness, extrudeStatus, patchDisp);
2181 adaptPatchPtr_().movePoints(p);
2184 meshMover_.movePoints();
2187 meshMover_.correct();
Variant of pointEdgePoint with some transported additional data. WIP - should be templated on data li...
bool isA(const Type &t)
Check if a dynamic_cast to typeid is possible.
List< labelList > labelListList
A List of labelList.
label nPoints() const
Return number of points supporting patch faces.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
const objectRegistry & db() const
Return the local objectRegistry.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
A list of keyword definitions, which are a keyword followed by any number of values (e...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Unit conversion functions.
label iterate(const label maxIter)
Iterate until no changes or maxIter reached. Returns actual.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
void size(const label)
Override size to be inconsistent with allocated storage.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const Vector< scalar > rootMax
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Vector< scalar > vector
A scalar version of the templated Vector.
PrimitivePatch< face, IndirectList, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Macros for easy insertion into run-time selection tables.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
virtual const pointField & points() const
Return raw points.
Mesh representing a set of points created from polyMesh.
List< bool > boolList
Bool container classes.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
A list of faces which address into the list of points.
vectorField pointField
pointField is a vectorField.
void reset(T *=0)
If object pointer already set, delete object and set to given.
dimensionedScalar cos(const dimensionedScalar &ds)
line< point, const point & > linePointRef
Line using referred points.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
static void weightedSum(const polyMesh &mesh, const PackedBoolList &isMasterEdge, const labelList &meshPoints, const edgeList &edges, const scalarField &edgeWeights, const Field< Type > &data, Field< Type > &sum)
Helper: weighted sum (over all subset of mesh points) by.
static void calculateEdgeWeights(const polyMesh &mesh, const PackedBoolList &isMasterEdge, const labelList &meshPoints, const edgeList &edges, scalarField &edgeWeights, scalarField &invSumWeight)
Helper: calculate edge weights (1/length)
A class for handling words, derived from string.
Do not extrude. No layers added.
static PackedBoolList getMasterEdges(const polyMesh &mesh, const labelList &meshEdges)
Determine master edge for subset of edges. If coupled.
const Time & time() const
Return time.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints,-1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){pointMap[i]=i;}for(label i=0;i< nPoints;i++){if(f[i] > 0.0){hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei){if(edges[ei].mag(points)< SMALL){label start=pointMap[edges[ei].start()];while(start!=pointMap[start]){start=pointMap[start];}label end=pointMap[edges[ei].end()];while(end!=pointMap[end]){end=pointMap[end];}label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;}}cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){cellShape &cs=cellShapes[celli];forAll(cs, i){cs[i]=pointMap[cs[i]];}cs.collapse();}label bcIDs[11]={-1, 0, 2, 4,-1, 5,-1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={&wallPolyPatch::typeName,&wallPolyPatch::typeName,&wallPolyPatch::typeName,&wallPolyPatch::typeName,&symmetryPolyPatch::typeName,&wedgePolyPatch::typeName,&polyPatch::typeName,&polyPatch::typeName,&polyPatch::typeName,&polyPatch::typeName,&symmetryPolyPatch::typeName,&oldCyclicPolyPatch::typeName};enum patchTypeNames{PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={"piston","valve","liner","cylinderHead","axis","wedge","inflow","outflow","presin","presout","symmetryPlane","cyclic"};List< SLList< face > > pFaces[nBCs]
label nTotalPoints() const
Return total number of points in decomposed mesh. Not.
List< label > labelList
A List of labels.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
label readLabel(Istream &is)
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set).
const globalMeshData & globalData() const
Return parallel info.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
prefixOSstream Pout(cout,"Pout")
virtual const fileName & name() const
Return the name of the stream.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
OFstream which keeps track of vertices.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
defineTypeNameAndDebug(combustionModel, 0)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
pointPatchField< vector > pointPatchVectorField
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const dimensionedScalar mu
Atomic mass unit.
Virtual base class for mesh movers with externally provided displacement field giving the boundary co...
void setSize(const label)
Reset size of List.
static T gAverage(const PackedBoolList &isMasterElem, const UList< T > &values)
Helper: calculate average.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dimensionedScalar lambda(laminarTransport.lookup("lambda"))
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual Ostream & write(const token &)=0
Write next token to stream.
static PackedBoolList getMasterPoints(const polyMesh &mesh, const labelList &meshPoints)
Determine master point for subset of points. If coupled.
Wave propagation of information through grid. Every iteration information goes through one layer of e...
Ostream & incrIndent(Ostream &os)
Increment the indent level.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
labelList meshEdges(const edgeList &allEdges, const labelListList &cellEdges, const labelList &faceCells) const
Return labels of patch edges in the global edge list using.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.