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);
80 return Foam::move(adaptPatchIDs);
85 Foam::medialAxisMeshMover::getPatch
91 const polyBoundaryMesh& patches = mesh.boundaryMesh();
98 const polyPatch& pp = patches[patchIDs[i]];
109 const polyPatch& pp = patches[patchIDs[i]];
111 label meshFacei = pp.start();
115 addressing[nFaces++] = meshFacei++;
119 return autoPtr<indirectPrimitivePatch>
123 IndirectList<face>(mesh.faces(), addressing),
130 void Foam::medialAxisMeshMover::smoothPatchNormals
132 const label nSmoothDisp,
133 const PackedBoolList& isPatchMasterPoint,
134 const PackedBoolList& isPatchMasterEdge,
140 const labelList& meshPoints = pp.meshPoints();
143 Info<< typeName <<
" : Smoothing normals ..." <<
endl;
159 for (
label iter = 0; iter < nSmoothDisp; iter++)
171 average *= invSumWeight;
174 if ((iter % 10) == 0)
179 mag(normals-average)()
181 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
188 average[pointi] = 0.5*(normals[pointi]+average[pointi]);
189 normals[pointi] = average[pointi];
190 normals[pointi] /=
mag(normals[pointi]) + vSmall;
197 void Foam::medialAxisMeshMover::smoothNormals
199 const label nSmoothDisp,
200 const PackedBoolList& isMeshMasterPoint,
201 const PackedBoolList& isMeshMasterEdge,
208 <<
" : Smoothing normals in interior ..." <<
endl;
218 label meshPointi = fixedPoints[i];
219 isFixedPoint.set(meshPointi, 1);
245 for (
label iter = 0; iter < nSmoothDisp; iter++)
257 average *= invSumWeight;
260 if ((iter % 10) == 0)
265 mag(normals-average)()
267 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
274 if (isFixedPoint.get(pointi) == 0)
277 average[pointi] = 0.5*(normals[pointi]+average[pointi]);
278 normals[pointi] = average[pointi];
279 normals[pointi] /=
mag(normals[pointi]) + vSmall;
288 bool Foam::medialAxisMeshMover::isMaxEdge
290 const List<pointData>& pointWallDist,
301 vector v0(points[e[0]] - pointWallDist[e[0]].origin());
302 scalar magV0(
mag(v0));
309 vector v1(points[e[1]] - pointWallDist[e[1]].origin());
310 scalar magV1(
mag(v1));
335 if ((pointWallDist[e[0]].v() & pointWallDist[e[1]].v()) < minCos)
346 void Foam::medialAxisMeshMover::update(
const dictionary& coeffDict)
349 <<
" : Calculating distance to Medial Axis ..." <<
endl;
354 const labelList& meshPoints = pp.meshPoints();
361 const label nSmoothSurfaceNormals =
362 coeffDict.lookup<
label>(
"nSmoothSurfaceNormals");
365 word angleKey =
"minMedialAxisAngle";
366 if (!coeffDict.found(angleKey))
369 angleKey =
"minMedianAxisAngle";
373 degToRad(coeffDict.lookup<scalar>(angleKey))
377 const scalar featureAngle = coeffDict.lookup<scalar>(
"featureAngle");
380 const scalar slipFeatureAngle =
382 coeffDict.found(
"slipFeatureAngle")
383 ? coeffDict.lookup<scalar>(
"slipFeatureAngle")
388 const label nSmoothNormals =
389 coeffDict.lookup<
label>(
"nSmoothNormals");
392 const label nMedialAxisIter = coeffDict.lookupOrDefault<
label>
417 const PackedBoolList isPatchMasterPoint
425 const PackedBoolList isPatchMasterEdge
442 nSmoothSurfaceNormals,
456 int dummyTrackData = 0;
462 List<pointData> wallInfo(meshPoints.size());
464 forAll(meshPoints, patchPointi)
466 label pointi = meshPoints[patchPointi];
467 wallInfo[patchPointi] = pointData
472 pointNormals[patchPointi]
477 List<pointData> edgeWallDist(
mesh().nEdges());
478 PointEdgeWave<pointData> wallDistCalc
488 wallDistCalc.iterate(nMedialAxisIter);
492 wallDistCalc.getUnsetPoints(),
498 if (nMedialAxisIter > 0)
501 <<
" : Limited walk to " << nMedialAxisIter
502 <<
" steps. Not visited " << nUnvisit
504 <<
" points" <<
endl;
509 <<
"Walking did not visit all points." <<
nl 510 <<
" Did not visit " << nUnvisit
512 <<
" points. This is not necessarily a problem" <<
nl 513 <<
" and might be due to faceZones splitting of part" 514 <<
" of the domain." <<
nl <<
endl;
524 List<pointData> edgeMedialDist(
mesh().nEdges());
527 DynamicList<pointData> maxInfo(meshPoints.size());
528 DynamicList<label> maxPoints(meshPoints.size());
536 const edge& e = edges[edgei];
540 !pointWallDist[e[0]].valid(dummyTrackData)
541 || !pointWallDist[e[1]].valid(dummyTrackData)
547 label pointi = e[ep];
549 if (!pointMedialDist[pointi].valid(dummyTrackData))
551 maxPoints.append(pointi);
562 pointMedialDist[pointi] = maxInfo.last();
567 else if (isMaxEdge(pointWallDist, edgei, minMedialAxisAngleCos))
574 vector eVec = e.vec(points);
575 scalar eMag =
mag(eVec);
581 const point& p0 = points[e[0]];
582 const point& p1 = points[e[1]];
583 scalar dist0 = (p0-pointWallDist[e[0]].origin()) & eVec;
584 scalar dist1 = (pointWallDist[e[1]].origin()-p1) & eVec;
585 scalar s = 0.5*(dist1+eMag+dist0);
592 else if (s >= dist0+eMag)
598 medialAxisPt = p0+(s-dist0)*eVec;
603 label pointi = e[ep];
605 if (!pointMedialDist[pointi].valid(dummyTrackData))
607 maxPoints.append(pointi);
613 magSqr(points[pointi]-medialAxisPt),
618 pointMedialDist[pointi] = maxInfo.last();
634 const polyPatch& pp = patches[
patchi];
641 && !isA<emptyPolyPatch>(pp)
642 && !adaptPatches.found(
patchi)
645 const labelList& meshPoints = pp.meshPoints();
652 if (pvf.fixesValue())
656 <<
" : Inserting all points on patch " << pp.name()
661 label pointi = meshPoints[i];
662 if (!pointMedialDist[pointi].valid(dummyTrackData))
664 maxPoints.append(pointi);
675 pointMedialDist[pointi] = maxInfo.last();
687 <<
" : Inserting points on patch " << pp.name()
688 <<
" if angle to nearest layer patch > " 689 << slipFeatureAngle <<
" degrees." <<
endl;
702 label pointi = meshPoints[i];
706 pointWallDist[pointi].valid(dummyTrackData)
707 && !pointMedialDist[pointi].valid(dummyTrackData)
713 -pointWallDist[pointi].v()
716 if (cosAngle > slipFeatureAngleCos)
721 maxPoints.append(pointi);
732 pointMedialDist[pointi] = maxInfo.last();
749 PointEdgeWave<pointData> medialDistCalc
760 medialDistCalc.iterate(2*nMedialAxisIter);
764 forAll(pointMedialDist, pointi)
766 if (pointMedialDist[pointi].valid(dummyTrackData))
770 pointMedialDist[pointi].distSqr()
772 medialVec_[pointi] = pointMedialDist[pointi].origin();
777 medialDist_[pointi] = 0.0;
778 medialVec_[pointi] =
point(1, 0, 0);
786 if (!pointWallDist[i].valid(dummyTrackData))
788 dispVec_[i] =
vector(1, 0, 0);
792 dispVec_[i] = pointWallDist[i].v();
807 forAll(medialRatio_, pointi)
809 if (!pointWallDist[pointi].valid(dummyTrackData))
811 medialRatio_[pointi] = 0.0;
815 scalar wDist2 = pointWallDist[pointi].distSqr();
816 scalar mDist = medialDist_[pointi];
818 if (wDist2 <
sqr(small) && mDist < small)
825 medialRatio_[pointi] = 0.0;
829 medialRatio_[pointi] = mDist / (
Foam::sqrt(wDist2) + mDist);
838 <<
" : Writing medial axis fields:" <<
nl 840 <<
"ratio of medial distance to wall distance : " 841 << medialRatio_.
name() <<
nl 842 <<
"distance to nearest medial axis : " 843 << medialDist_.name() <<
nl 844 <<
"nearest medial axis location : " 845 << medialVec_.name() <<
nl 846 <<
"normal at nearest wall : " 847 << dispVec_.name() <<
nl 852 medialRatio_.
write();
859 bool Foam::medialAxisMeshMover::unmarkExtrusion
861 const label patchPointi,
863 List<snappyLayerDriver::extrudeMode>& extrudeStatus
869 patchDisp[patchPointi] =
Zero;
875 patchDisp[patchPointi] =
Zero;
885 void Foam::medialAxisMeshMover::syncPatchDisplacement
889 List<snappyLayerDriver::extrudeMode>& extrudeStatus
893 const labelList& meshPoints = pp.meshPoints();
895 label nChangedTotal = 0;
907 minMagSqrEqOp<vector>(),
914 if (
mag(patchDisp[i]) < minThickness[i])
916 if (unmarkExtrusion(i, patchDisp, extrudeStatus))
987 nChangedTotal += nChanged;
1001 void Foam::medialAxisMeshMover::minSmoothField
1003 const label nSmoothDisp,
1004 const PackedBoolList& isPatchMasterPoint,
1005 const PackedBoolList& isPatchMasterEdge,
1011 const edgeList& edges = pp.edges();
1012 const labelList& meshPoints = pp.meshPoints();
1027 Info<< typeName <<
" : Smoothing field ..." <<
endl;
1029 for (
label iter = 0; iter < nSmoothDisp; iter++)
1042 average *= invSumWeight;
1048 average[pointi] = 0.5*(field[pointi]+average[pointi]);
1053 average[pointi] < field[pointi]
1054 && average[pointi] >= fieldMin[pointi]
1057 field[pointi] = average[pointi];
1062 if ((iter % 10) == 0)
1067 mag(field-average)()
1069 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
1076 void Foam::medialAxisMeshMover::
1077 handleFeatureAngleLayerTerminations
1079 const scalar minCos,
1080 const PackedBoolList& isPatchMasterPoint,
1082 List<snappyLayerDriver::extrudeMode>& extrudeStatus,
1084 label& nPointCounter
1092 boolList extrudedFaces(pp.size(),
true);
1094 forAll(pp.localFaces(), facei)
1096 const face& f = pp.localFaces()[facei];
1102 extrudedFaces[facei] =
false;
1117 List<List<point>> edgeFaceNormals(pp.nEdges());
1118 List<List<bool>> edgeFaceExtrude(pp.nEdges());
1121 const vectorField& faceNormals = pp.faceNormals();
1125 const labelList& eFaces = edgeFaces[edgei];
1127 edgeFaceNormals[edgei].
setSize(eFaces.size());
1128 edgeFaceExtrude[edgei].setSize(eFaces.size());
1131 label facei = eFaces[i];
1132 edgeFaceNormals[edgei][i] = faceNormals[facei];
1133 edgeFaceExtrude[edgei][i] = extrudedFaces[facei];
1142 globalMeshData::ListPlusEqOp<List<point>>(),
1151 globalMeshData::ListPlusEqOp<List<bool>>(),
1156 forAll(edgeFaceNormals, edgei)
1158 const List<point>& eFaceNormals = edgeFaceNormals[edgei];
1159 const List<bool>& eFaceExtrude = edgeFaceExtrude[edgei];
1161 if (eFaceNormals.size() == 2)
1163 const edge& e = pp.edges()[edgei];
1173 if (!eFaceExtrude[0] || !eFaceExtrude[1])
1175 const vector& n0 = eFaceNormals[0];
1176 const vector& n1 = eFaceNormals[1];
1178 if ((n0 & n1) < minCos)
1180 if (unmarkExtrusion(v0, patchDisp, extrudeStatus))
1182 if (isPatchMasterPoint[v0])
1187 if (unmarkExtrusion(v1, patchDisp, extrudeStatus))
1189 if (isPatchMasterPoint[v1])
1208 void Foam::medialAxisMeshMover::findIsolatedRegions
1210 const scalar minCosLayerTermination,
1211 const bool detectExtrusionIsland,
1212 const PackedBoolList& isPatchMasterPoint,
1213 const PackedBoolList& isPatchMasterEdge,
1216 List<snappyLayerDriver::extrudeMode>& extrudeStatus,
1222 const labelList& meshPoints = pp.meshPoints();
1224 Info<< typeName <<
" : Removing isolated regions ..." <<
endl;
1227 label nPointCounter = 0;
1230 autoPtr<OBJstream> str;
1237 mesh().time().path()
1238 /
"islandExcludePoints_" 1244 <<
" : Writing points surrounded by non-extruded points to " 1245 << str().name() <<
endl;
1252 handleFeatureAngleLayerTerminations
1254 minCosLayerTermination,
1263 syncPatchDisplacement(minThickness, patchDisp, extrudeStatus);
1274 boolList keptPoints(pp.nPoints(),
false);
1276 if (detectExtrusionIsland)
1285 const face& f = pp.localFaces()[facei];
1291 if (islandPoint[facei] == -1)
1294 islandPoint[facei] = f[fp];
1296 else if (islandPoint[facei] != -2)
1299 islandPoint[facei] = -2;
1311 forAll(pointFaces, patchPointi)
1319 label facei = pFaces[i];
1320 if (islandPoint[facei] != patchPointi)
1322 keptPoints[patchPointi] =
true;
1335 boolList extrudedFaces(pp.size(),
true);
1336 forAll(pp.localFaces(), facei)
1338 const face& f = pp.localFaces()[facei];
1343 extrudedFaces[facei] =
false;
1351 forAll(keptPoints, patchPointi)
1357 label facei = pFaces[i];
1358 if (extrudedFaces[facei])
1360 keptPoints[patchPointi] =
true;
1379 forAll(keptPoints, patchPointi)
1381 if (!keptPoints[patchPointi])
1383 if (unmarkExtrusion(patchPointi, patchDisp, extrudeStatus))
1390 str().write(pp.points()[meshPoints[patchPointi]]);
1403 const edgeList& edges = pp.edges();
1409 labelList isolatedPoint(pp.nPoints(),0);
1413 if (isPatchMasterEdge[edgei])
1415 const edge& e = edges[edgei];
1422 isolatedPoint[v0] += 1;
1426 isolatedPoint[v1] += 1;
1444 const face& f = pp.localFaces()[facei];
1445 bool failed =
false;
1448 if (isolatedPoint[f[fp]] > 2)
1454 bool allPointsExtruded =
true;
1461 allPointsExtruded =
false;
1466 if (allPointsExtruded)
1484 str().write(pp.points()[meshPoints[f[fp]]]);
1492 reduce(nPointCounter, sumOp<label>());
1494 <<
" : Number of isolated points extrusion stopped : "<< nPointCounter
1499 void Foam::medialAxisMeshMover::smoothLambdaMuDisplacement
1501 const label nSmoothDisp,
1502 const PackedBoolList& isMeshMasterPoint,
1503 const PackedBoolList& isMeshMasterEdge,
1526 Info<< typeName <<
" : Smoothing displacement ..." <<
endl;
1528 const scalar lambda = 0.33;
1529 const scalar mu = -0.34;
1533 for (
label iter = 0; iter < nSmoothDisp; iter++)
1545 average *= invSumWeight;
1549 if (medialRatio_[i] > small && medialRatio_[i] < 1-small)
1551 displacement[i] = (1-
lambda)*displacement[i]+lambda*average[i];
1565 average *= invSumWeight;
1570 if (medialRatio_[i] > small && medialRatio_[i] < 1-small)
1572 displacement[i] = (1-
mu)*displacement[i]+mu*average[i];
1578 if ((iter % 10) == 0)
1583 mag(displacement-average)()
1585 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
1601 adaptPatchIDs_(getFixedValueBCs(pointDisplacement)),
1602 adaptPatchPtr_(getPatch(
mesh(), adaptPatchIDs_)),
1609 pointDisplacement.
db(),
1619 const_cast<polyMesh&>(
mesh()),
1634 pointDisplacement.
db(),
1648 pointDisplacement.
db(),
1662 pointDisplacement.
db(),
1676 pointDisplacement.
db(),
1697 void Foam::medialAxisMeshMover::calculateDisplacement
1705 Info<< typeName <<
" : Smoothing using Medial Axis ..." <<
endl;
1717 "nSmoothDisplacement",
1722 const scalar maxThicknessToMedialRatio =
1723 coeffDict.
lookup<scalar>(
"maxThicknessToMedialRatio");
1726 const scalar featureAngle = coeffDict.
lookup<scalar>(
"featureAngle");
1729 const scalar minCosLayerTermination =
Foam::cos 1735 const label nSmoothPatchThickness =
1748 "detectExtrusionIsland",
1787 thickness =
mag(patchDisp);
1789 forAll(thickness, patchPointi)
1793 thickness[patchPointi] = 0.0;
1797 label numThicknessRatioExclude = 0;
1809 mesh().time().path()
1810 /
"thicknessRatioExcludePoints_" 1816 <<
" : Writing points with too large an extrusion distance to " 1817 << str().name() <<
endl;
1827 mesh().time().path()
1828 /
"thicknessRatioExcludeMedialVec_" 1834 <<
" : Writing medial axis vectors on points with too large" 1835 <<
" an extrusion distance to " << medialVecStr().name() <<
endl;
1838 forAll(meshPoints, patchPointi)
1842 label pointi = meshPoints[patchPointi];
1846 scalar mDist = medialDist_[pointi];
1847 scalar thicknessRatio = thickness[patchPointi]/(mDist+vSmall);
1852 patchDisp[patchPointi]
1853 / (
mag(patchDisp[patchPointi]) + vSmall);
1855 mVec /=
mag(mVec)+vSmall;
1856 thicknessRatio *= (n&mVec);
1858 if (thicknessRatio > maxThicknessToMedialRatio)
1863 Pout<<
"truncating displacement at " 1865 <<
" from " << thickness[patchPointi]
1869 minThickness[patchPointi]
1870 +thickness[patchPointi]
1872 <<
" medial direction:" << mVec
1873 <<
" extrusion direction:" << n
1874 <<
" with thicknessRatio:" << thicknessRatio
1878 thickness[patchPointi] =
1879 0.5*(minThickness[patchPointi]+thickness[patchPointi]);
1881 patchDisp[patchPointi] = thickness[patchPointi]*
n;
1883 if (isPatchMasterPoint[patchPointi])
1885 numThicknessRatioExclude++;
1891 str().write(
linePointRef(pt, pt+patchDisp[patchPointi]));
1893 if (medialVecStr.
valid())
1896 medialVecStr().write
1910 Info<< typeName <<
" : Reducing layer thickness at " 1911 << numThicknessRatioExclude
1912 <<
" nodes where thickness to medial axis distance is large " <<
endl;
1919 minCosLayerTermination,
1920 detectExtrusionIsland,
1932 forAll(thickness, patchPointi)
1936 thickness[patchPointi] = 0.0;
1944 nSmoothPatchThickness,
1954 int dummyTrackData = 0;
1969 forAll(meshPoints, patchPointi)
1971 label pointi = meshPoints[patchPointi];
1972 wallPoints[patchPointi] = pointi;
1977 thickness[patchPointi],
1993 wallDistCalc.
iterate(nMedialAxisIter);
1998 pointField& displacement = pointDisplacement_;
2000 forAll(displacement, pointi)
2002 if (!pointWallDist[pointi].valid(dummyTrackData))
2004 displacement[pointi] =
Zero;
2013 displacement[pointi] =
2014 -medialRatio_[pointi]
2015 *pointWallDist[pointi].s()
2022 if (nSmoothDisplacement > 0)
2024 smoothLambdaMuDisplacement
2026 nSmoothDisplacement,
2035 bool Foam::medialAxisMeshMover::shrinkMesh
2038 const label nAllowableErrors,
2050 meshMover_.setDisplacementPatchFields();
2052 Info<< typeName <<
" : Moving mesh ..." <<
endl;
2053 scalar oldErrorReduction = -1;
2055 bool meshOk =
false;
2057 for (
label iter = 0; iter < 2*nSnap ; iter++)
2060 <<
" : Iteration " << iter <<
endl;
2064 <<
" : Displacement scaling for error reduction set to 0." 2066 oldErrorReduction = meshMover_.setErrorReduction(0.0);
2071 meshMover_.scaleMesh
2075 meshMover_.paramDict(),
2082 Info<< typeName <<
" : Successfully moved mesh" <<
endl;
2088 if (oldErrorReduction >= 0)
2090 meshMover_.setErrorReduction(oldErrorReduction);
2093 Info<< typeName <<
" : Finished moving mesh ..." <<
endl;
2102 const label nAllowableErrors,
2110 const word minThicknessName =
word(moveDict.
lookup(
"minThicknessName"));
2125 if (minThicknessName ==
"none")
2131 (minThicknessName ==
"none")
2139 pointDisplacement_.primitiveField(),
2148 forAll(extrudeStatus, pointi)
2150 if (
mag(patchDisp[pointi]) <= minThickness[pointi]+small)
2158 calculateDisplacement(moveDict, minThickness, extrudeStatus, patchDisp);
2175 adaptPatchPtr_().clearGeom();
2178 meshMover_.movePoints();
2181 meshMover_.correct();
Variant of pointEdgePoint with some transported additional data. WIP - should be templated on data li...
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
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.
virtual Ostream & write(const char)=0
Write character.
FvWallInfoData< WallInfo, label > 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.
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
A list of keyword definitions, which are a keyword followed by any number of values (e...
const Boundary & boundaryField() const
Return const-reference to the boundary field.
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 nTotalPoints() const
Return total number of points in decomposed mesh. Not.
label iterate(const label maxIter)
Iterate until no changes or maxIter reached. Returns actual.
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.
dimensionedScalar lambda(viscosity->lookup("lambda"))
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/any.
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Vector< scalar > vector
A scalar version of the templated Vector.
const dimensionSet dimless
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Macros for easy insertion into run-time selection tables.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
const dimensionSet dimLength
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.
A list of faces which address into the list of points.
vectorField pointField
pointField is a vectorField.
dimensionedScalar cos(const dimensionedScalar &ds)
line< point, const point & > linePointRef
Line using referred points.
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)
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
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.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual const fileName & name() const
Return the name of the stream.
const globalMeshData & globalData() const
Return parallel info.
List< label > labelList
A List of labels.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
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, &mergedCyclicPolyPatch::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]
dimensioned< scalar > magSqr(const dimensioned< Type > &)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
OFstream which keeps track of vertices.
const dimensionedScalar mu
Atomic mass unit.
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 edgeList & edges() const
Return mesh edges. Uses calcEdges.
Virtual base class for mesh movers with externally provided displacement field giving the boundary co...
void setSize(const label)
Reset size of List.
static const Vector< scalar > rootMax
static T gAverage(const PackedBoolList &isMasterElem, const UList< T > &values)
Helper: calculate average.
vector point
Point is a vector.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define WarningInFunction
Report a warning using Foam::Warning.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const Time & time() const
Return time.
labelList meshEdges(const edgeList &allEdges, const labelListList &cellEdges, const labelList &faceCells) const
Return labels of patch edges in the global edge list using.
prefixOSstream Pout(cout, "Pout")
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...
static PackedBoolList getMasterPoints(const polyMesh &mesh, const labelList &meshPoints)
Determine master point for subset of points. If coupled.
const objectRegistry & db() const
Return the local objectRegistry.
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...
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.