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();
363 coeffDict.lookup(
"nSmoothSurfaceNormals")
367 word angleKey =
"minMedialAxisAngle";
368 if (!coeffDict.found(angleKey))
371 angleKey =
"minMedianAxisAngle";
379 const scalar featureAngle =
readScalar(coeffDict.lookup(
"featureAngle"));
382 const scalar slipFeatureAngle =
384 coeffDict.found(
"slipFeatureAngle")
385 ?
readScalar(coeffDict.lookup(
"slipFeatureAngle"))
392 coeffDict.lookup(
"nSmoothNormals")
396 const label nMedialAxisIter = coeffDict.lookupOrDefault<
label>
420 const PackedBoolList isPatchMasterPoint
428 const PackedBoolList isPatchMasterEdge
445 nSmoothSurfaceNormals,
459 int dummyTrackData = 0;
465 List<pointData> wallInfo(meshPoints.size());
467 forAll(meshPoints, patchPointi)
469 label pointi = meshPoints[patchPointi];
470 wallInfo[patchPointi] = pointData
475 pointNormals[patchPointi]
480 List<pointData> edgeWallDist(
mesh().nEdges());
481 PointEdgeWave<pointData> wallDistCalc
491 wallDistCalc.iterate(nMedialAxisIter);
495 wallDistCalc.getUnsetPoints(),
501 if (nMedialAxisIter > 0)
504 <<
" : Limited walk to " << nMedialAxisIter
505 <<
" steps. Not visited " << nUnvisit
507 <<
" points" <<
endl;
512 <<
"Walking did not visit all points." <<
nl 513 <<
" Did not visit " << nUnvisit
515 <<
" points. This is not necessarily a problem" <<
nl 516 <<
" and might be due to faceZones splitting of part" 517 <<
" of the domain." <<
nl <<
endl;
527 List<pointData> edgeMedialDist(
mesh().nEdges());
530 DynamicList<pointData> maxInfo(meshPoints.size());
531 DynamicList<label> maxPoints(meshPoints.size());
539 const edge& e = edges[edgeI];
543 !pointWallDist[e[0]].valid(dummyTrackData)
544 || !pointWallDist[e[1]].valid(dummyTrackData)
550 label pointi = e[ep];
552 if (!pointMedialDist[pointi].valid(dummyTrackData))
554 maxPoints.append(pointi);
565 pointMedialDist[pointi] = maxInfo.last();
570 else if (isMaxEdge(pointWallDist, edgeI, minMedialAxisAngleCos))
577 vector eVec = e.vec(points);
578 scalar eMag =
mag(eVec);
584 const point& p0 = points[e[0]];
585 const point& p1 = points[e[1]];
586 scalar dist0 = (p0-pointWallDist[e[0]].origin()) & eVec;
587 scalar dist1 = (pointWallDist[e[1]].origin()-p1) & eVec;
588 scalar s = 0.5*(dist1+eMag+dist0);
595 else if (s >= dist0+eMag)
601 medialAxisPt = p0+(s-dist0)*eVec;
606 label pointi = e[ep];
608 if (!pointMedialDist[pointi].valid(dummyTrackData))
610 maxPoints.append(pointi);
616 magSqr(points[pointi]-medialAxisPt),
621 pointMedialDist[pointi] = maxInfo.last();
637 const polyPatch& pp = patches[
patchi];
644 && !isA<emptyPolyPatch>(pp)
645 && !adaptPatches.found(
patchi)
648 const labelList& meshPoints = pp.meshPoints();
655 if (pvf.fixesValue())
659 <<
" : Inserting all points on patch " << pp.name()
664 label pointi = meshPoints[i];
665 if (!pointMedialDist[pointi].valid(dummyTrackData))
667 maxPoints.append(pointi);
678 pointMedialDist[pointi] = maxInfo.last();
690 <<
" : Inserting points on patch " << pp.name()
691 <<
" if angle to nearest layer patch > " 692 << slipFeatureAngle <<
" degrees." <<
endl;
705 label pointi = meshPoints[i];
709 pointWallDist[pointi].valid(dummyTrackData)
710 && !pointMedialDist[pointi].valid(dummyTrackData)
716 -pointWallDist[pointi].v()
719 if (cosAngle > slipFeatureAngleCos)
724 maxPoints.append(pointi);
735 pointMedialDist[pointi] = maxInfo.last();
752 PointEdgeWave<pointData> medialDistCalc
763 medialDistCalc.iterate(2*nMedialAxisIter);
767 forAll(pointMedialDist, pointi)
769 if (pointMedialDist[pointi].valid(dummyTrackData))
773 pointMedialDist[pointi].distSqr()
775 medialVec_[pointi] = pointMedialDist[pointi].origin();
780 medialDist_[pointi] = 0.0;
781 medialVec_[pointi] =
point(1, 0, 0);
789 if (!pointWallDist[i].valid(dummyTrackData))
791 dispVec_[i] =
vector(1, 0, 0);
795 dispVec_[i] = pointWallDist[i].v();
810 forAll(medialRatio_, pointi)
812 if (!pointWallDist[pointi].valid(dummyTrackData))
814 medialRatio_[pointi] = 0.0;
818 scalar wDist2 = pointWallDist[pointi].distSqr();
819 scalar mDist = medialDist_[pointi];
821 if (wDist2 <
sqr(small) && mDist < small)
828 medialRatio_[pointi] = 0.0;
832 medialRatio_[pointi] = mDist / (
Foam::sqrt(wDist2) + mDist);
841 <<
" : Writing medial axis fields:" <<
nl 843 <<
"ratio of medial distance to wall distance : " 844 << medialRatio_.
name() <<
nl 845 <<
"distance to nearest medial axis : " 846 << medialDist_.name() <<
nl 847 <<
"nearest medial axis location : " 848 << medialVec_.name() <<
nl 849 <<
"normal at nearest wall : " 850 << dispVec_.name() <<
nl 855 medialRatio_.
write();
862 bool Foam::medialAxisMeshMover::unmarkExtrusion
864 const label patchPointi,
866 List<snappyLayerDriver::extrudeMode>& extrudeStatus
872 patchDisp[patchPointi] =
Zero;
878 patchDisp[patchPointi] =
Zero;
888 void Foam::medialAxisMeshMover::syncPatchDisplacement
892 List<snappyLayerDriver::extrudeMode>& extrudeStatus
896 const labelList& meshPoints = pp.meshPoints();
898 label nChangedTotal = 0;
910 minMagSqrEqOp<vector>(),
917 if (
mag(patchDisp[i]) < minThickness[i])
919 if (unmarkExtrusion(i, patchDisp, extrudeStatus))
990 nChangedTotal += nChanged;
1004 void Foam::medialAxisMeshMover::minSmoothField
1006 const label nSmoothDisp,
1007 const PackedBoolList& isPatchMasterPoint,
1008 const PackedBoolList& isPatchMasterEdge,
1014 const edgeList& edges = pp.edges();
1015 const labelList& meshPoints = pp.meshPoints();
1030 Info<< typeName <<
" : Smoothing field ..." <<
endl;
1032 for (
label iter = 0; iter < nSmoothDisp; iter++)
1045 average *= invSumWeight;
1051 average[pointi] = 0.5*(field[pointi]+average[pointi]);
1056 average[pointi] < field[pointi]
1057 && average[pointi] >= fieldMin[pointi]
1060 field[pointi] = average[pointi];
1065 if ((iter % 10) == 0)
1070 mag(field-average)()
1072 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
1079 void Foam::medialAxisMeshMover::
1080 handleFeatureAngleLayerTerminations
1082 const scalar minCos,
1083 const PackedBoolList& isPatchMasterPoint,
1085 List<snappyLayerDriver::extrudeMode>& extrudeStatus,
1087 label& nPointCounter
1095 boolList extrudedFaces(pp.size(),
true);
1097 forAll(pp.localFaces(), facei)
1099 const face& f = pp.localFaces()[facei];
1105 extrudedFaces[facei] =
false;
1120 List<List<point>> edgeFaceNormals(pp.nEdges());
1121 List<List<bool>> edgeFaceExtrude(pp.nEdges());
1124 const vectorField& faceNormals = pp.faceNormals();
1128 const labelList& eFaces = edgeFaces[edgeI];
1130 edgeFaceNormals[edgeI].
setSize(eFaces.size());
1131 edgeFaceExtrude[edgeI].setSize(eFaces.size());
1134 label facei = eFaces[i];
1135 edgeFaceNormals[edgeI][i] = faceNormals[facei];
1136 edgeFaceExtrude[edgeI][i] = extrudedFaces[facei];
1145 globalMeshData::ListPlusEqOp<List<point>>(),
1154 globalMeshData::ListPlusEqOp<List<bool>>(),
1159 forAll(edgeFaceNormals, edgeI)
1161 const List<point>& eFaceNormals = edgeFaceNormals[edgeI];
1162 const List<bool>& eFaceExtrude = edgeFaceExtrude[edgeI];
1164 if (eFaceNormals.size() == 2)
1166 const edge& e = pp.edges()[edgeI];
1176 if (!eFaceExtrude[0] || !eFaceExtrude[1])
1178 const vector& n0 = eFaceNormals[0];
1179 const vector& n1 = eFaceNormals[1];
1181 if ((n0 & n1) < minCos)
1183 if (unmarkExtrusion(v0, patchDisp, extrudeStatus))
1185 if (isPatchMasterPoint[v0])
1190 if (unmarkExtrusion(v1, patchDisp, extrudeStatus))
1192 if (isPatchMasterPoint[v1])
1211 void Foam::medialAxisMeshMover::findIsolatedRegions
1213 const scalar minCosLayerTermination,
1214 const bool detectExtrusionIsland,
1215 const PackedBoolList& isPatchMasterPoint,
1216 const PackedBoolList& isPatchMasterEdge,
1219 List<snappyLayerDriver::extrudeMode>& extrudeStatus,
1225 const labelList& meshPoints = pp.meshPoints();
1227 Info<< typeName <<
" : Removing isolated regions ..." <<
endl;
1230 label nPointCounter = 0;
1233 autoPtr<OBJstream> str;
1241 /
"islandExcludePoints_" 1247 <<
" : Writing points surrounded by non-extruded points to " 1248 << str().name() <<
endl;
1255 handleFeatureAngleLayerTerminations
1257 minCosLayerTermination,
1266 syncPatchDisplacement(minThickness, patchDisp, extrudeStatus);
1277 boolList keptPoints(pp.nPoints(),
false);
1279 if (detectExtrusionIsland)
1288 const face& f = pp.localFaces()[facei];
1294 if (islandPoint[facei] == -1)
1297 islandPoint[facei] = f[fp];
1299 else if (islandPoint[facei] != -2)
1302 islandPoint[facei] = -2;
1314 forAll(pointFaces, patchPointi)
1322 label facei = pFaces[i];
1323 if (islandPoint[facei] != patchPointi)
1325 keptPoints[patchPointi] =
true;
1338 boolList extrudedFaces(pp.size(),
true);
1339 forAll(pp.localFaces(), facei)
1341 const face& f = pp.localFaces()[facei];
1346 extrudedFaces[facei] =
false;
1354 forAll(keptPoints, patchPointi)
1360 label facei = pFaces[i];
1361 if (extrudedFaces[facei])
1363 keptPoints[patchPointi] =
true;
1382 forAll(keptPoints, patchPointi)
1384 if (!keptPoints[patchPointi])
1386 if (unmarkExtrusion(patchPointi, patchDisp, extrudeStatus))
1393 str().write(pp.points()[meshPoints[patchPointi]]);
1406 const edgeList& edges = pp.edges();
1412 labelList isolatedPoint(pp.nPoints(),0);
1416 if (isPatchMasterEdge[edgeI])
1418 const edge& e = edges[edgeI];
1425 isolatedPoint[v0] += 1;
1429 isolatedPoint[v1] += 1;
1447 const face& f = pp.localFaces()[facei];
1448 bool failed =
false;
1451 if (isolatedPoint[f[fp]] > 2)
1457 bool allPointsExtruded =
true;
1464 allPointsExtruded =
false;
1469 if (allPointsExtruded)
1487 str().write(pp.points()[meshPoints[f[fp]]]);
1495 reduce(nPointCounter, sumOp<label>());
1497 <<
" : Number of isolated points extrusion stopped : "<< nPointCounter
1502 void Foam::medialAxisMeshMover::smoothLambdaMuDisplacement
1504 const label nSmoothDisp,
1505 const PackedBoolList& isMeshMasterPoint,
1506 const PackedBoolList& isMeshMasterEdge,
1529 Info<< typeName <<
" : Smoothing displacement ..." <<
endl;
1531 const scalar lambda = 0.33;
1532 const scalar mu = -0.34;
1536 for (
label iter = 0; iter < nSmoothDisp; iter++)
1548 average *= invSumWeight;
1552 if (medialRatio_[i] > small && medialRatio_[i] < 1-small)
1554 displacement[i] = (1-
lambda)*displacement[i]+lambda*average[i];
1568 average *= invSumWeight;
1573 if (medialRatio_[i] > small && medialRatio_[i] < 1-small)
1575 displacement[i] = (1-
mu)*displacement[i]+mu*average[i];
1581 if ((iter % 10) == 0)
1586 mag(displacement-average)()
1588 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
1604 adaptPatchIDs_(getFixedValueBCs(pointDisplacement)),
1605 adaptPatchPtr_(getPatch(
mesh(), adaptPatchIDs_)),
1612 pointDisplacement.
db(),
1622 const_cast<polyMesh&>(
mesh()),
1637 pointDisplacement.
db(),
1651 pointDisplacement.
db(),
1665 pointDisplacement.
db(),
1679 pointDisplacement.
db(),
1700 void Foam::medialAxisMeshMover::calculateDisplacement
1708 Info<< typeName <<
" : Smoothing using Medial Axis ..." <<
endl;
1720 "nSmoothDisplacement",
1725 const scalar maxThicknessToMedialRatio =
readScalar 1727 coeffDict.
lookup(
"maxThicknessToMedialRatio")
1734 const scalar minCosLayerTermination =
Foam::cos 1742 coeffDict.
lookup(
"nSmoothThickness")
1755 "detectExtrusionIsland",
1794 thickness =
mag(patchDisp);
1796 forAll(thickness, patchPointi)
1800 thickness[patchPointi] = 0.0;
1804 label numThicknessRatioExclude = 0;
1817 /
"thicknessRatioExcludePoints_" 1823 <<
" : Writing points with too large an extrusion distance to " 1824 << str().name() <<
endl;
1835 /
"thicknessRatioExcludeMedialVec_" 1841 <<
" : Writing medial axis vectors on points with too large" 1842 <<
" an extrusion distance to " << medialVecStr().name() <<
endl;
1845 forAll(meshPoints, patchPointi)
1849 label pointi = meshPoints[patchPointi];
1853 scalar mDist = medialDist_[pointi];
1854 scalar thicknessRatio = thickness[patchPointi]/(mDist+vSmall);
1859 patchDisp[patchPointi]
1860 / (
mag(patchDisp[patchPointi]) + vSmall);
1862 mVec /=
mag(mVec)+vSmall;
1863 thicknessRatio *= (n&mVec);
1865 if (thicknessRatio > maxThicknessToMedialRatio)
1870 Pout<<
"truncating displacement at " 1872 <<
" from " << thickness[patchPointi]
1876 minThickness[patchPointi]
1877 +thickness[patchPointi]
1879 <<
" medial direction:" << mVec
1880 <<
" extrusion direction:" << n
1881 <<
" with thicknessRatio:" << thicknessRatio
1885 thickness[patchPointi] =
1886 0.5*(minThickness[patchPointi]+thickness[patchPointi]);
1888 patchDisp[patchPointi] = thickness[patchPointi]*
n;
1890 if (isPatchMasterPoint[patchPointi])
1892 numThicknessRatioExclude++;
1898 str().write(
linePointRef(pt, pt+patchDisp[patchPointi]));
1900 if (medialVecStr.
valid())
1903 medialVecStr().write
1917 Info<< typeName <<
" : Reducing layer thickness at " 1918 << numThicknessRatioExclude
1919 <<
" nodes where thickness to medial axis distance is large " <<
endl;
1926 minCosLayerTermination,
1927 detectExtrusionIsland,
1939 forAll(thickness, patchPointi)
1943 thickness[patchPointi] = 0.0;
1951 nSmoothPatchThickness,
1961 int dummyTrackData = 0;
1976 forAll(meshPoints, patchPointi)
1978 label pointi = meshPoints[patchPointi];
1979 wallPoints[patchPointi] = pointi;
1984 thickness[patchPointi],
2000 wallDistCalc.
iterate(nMedialAxisIter);
2005 pointField& displacement = pointDisplacement_;
2007 forAll(displacement, pointi)
2009 if (!pointWallDist[pointi].valid(dummyTrackData))
2011 displacement[pointi] =
Zero;
2020 displacement[pointi] =
2021 -medialRatio_[pointi]
2022 *pointWallDist[pointi].s()
2029 if (nSmoothDisplacement > 0)
2031 smoothLambdaMuDisplacement
2033 nSmoothDisplacement,
2042 bool Foam::medialAxisMeshMover::shrinkMesh
2045 const label nAllowableErrors,
2057 meshMover_.setDisplacementPatchFields();
2059 Info<< typeName <<
" : Moving mesh ..." <<
endl;
2060 scalar oldErrorReduction = -1;
2062 bool meshOk =
false;
2064 for (
label iter = 0; iter < 2*nSnap ; iter++)
2067 <<
" : Iteration " << iter <<
endl;
2071 <<
" : Displacement scaling for error reduction set to 0." 2073 oldErrorReduction = meshMover_.setErrorReduction(0.0);
2078 meshMover_.scaleMesh
2082 meshMover_.paramDict(),
2089 Info<< typeName <<
" : Successfully moved mesh" <<
endl;
2095 if (oldErrorReduction >= 0)
2097 meshMover_.setErrorReduction(oldErrorReduction);
2100 Info<< typeName <<
" : Finished moving mesh ..." <<
endl;
2109 const label nAllowableErrors,
2117 const word minThicknessName =
word(moveDict.
lookup(
"minThicknessName"));
2132 if (minThicknessName ==
"none")
2138 (minThicknessName ==
"none")
2146 pointDisplacement_.primitiveField(),
2155 forAll(extrudeStatus, pointi)
2157 if (
mag(patchDisp[pointi]) <= minThickness[pointi]+small)
2165 calculateDisplacement(moveDict, minThickness, extrudeStatus, patchDisp);
2182 adaptPatchPtr_().movePoints(p);
2185 meshMover_.movePoints();
2188 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.
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.
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.
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.
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< 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.
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)
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 readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
label readLabel(Istream &is)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
OFstream which keeps track of vertices.
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.
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.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
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.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
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")
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.
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.
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]
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.
fileName path(UMean.rootPath()/UMean.caseName()/functionObjects::writeFile::outputPrefix/"graphs"/UMean.instance())