46 externalDisplacementMeshMover,
60 DynamicList<label> adaptPatchIDs;
61 forAll(fld.boundaryField(), patchI)
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;
512 "medialAxisMeshMover::" 513 "medialAxisSmoothingInfo(..)" 514 ) <<
"Walking did not visit all points." <<
nl 515 <<
" Did not visit " << nUnvisit
517 <<
" points. This is not necessarily a problem" <<
nl 518 <<
" and might be due to faceZones splitting of part" 519 <<
" of the domain." <<
nl <<
endl;
529 List<pointData> edgeMedialDist(
mesh().nEdges());
532 DynamicList<pointData> maxInfo(meshPoints.size());
533 DynamicList<label> maxPoints(meshPoints.size());
541 const edge& e = edges[edgeI];
545 !pointWallDist[e[0]].valid(dummyTrackData)
546 || !pointWallDist[e[1]].valid(dummyTrackData)
552 label pointI = e[ep];
554 if (!pointMedialDist[pointI].valid(dummyTrackData))
556 maxPoints.append(pointI);
567 pointMedialDist[pointI] = maxInfo.last();
572 else if (isMaxEdge(pointWallDist, edgeI, minMedialAxisAngleCos))
579 vector eVec = e.vec(points);
580 scalar eMag =
mag(eVec);
586 const point& p0 = points[e[0]];
587 const point& p1 = points[e[1]];
588 scalar dist0 = (p0-pointWallDist[e[0]].origin()) & eVec;
589 scalar dist1 = (pointWallDist[e[1]].origin()-p1) & eVec;
590 scalar s = 0.5*(dist1+eMag+dist0);
597 else if (s >= dist0+eMag)
603 medialAxisPt = p0+(s-dist0)*eVec;
608 label pointI = e[ep];
610 if (!pointMedialDist[pointI].valid(dummyTrackData))
612 maxPoints.append(pointI);
618 magSqr(points[pointI]-medialAxisPt),
623 pointMedialDist[pointI] = maxInfo.last();
639 const polyPatch& pp = patches[patchI];
646 && !isA<emptyPolyPatch>(pp)
647 && !adaptPatches.found(patchI)
650 const labelList& meshPoints = pp.meshPoints();
657 if (pvf.fixesValue())
661 <<
" : Inserting all points on patch " << pp.name()
666 label pointI = meshPoints[i];
667 if (!pointMedialDist[pointI].valid(dummyTrackData))
669 maxPoints.append(pointI);
680 pointMedialDist[pointI] = maxInfo.last();
692 <<
" : Inserting points on patch " << pp.name()
693 <<
" if angle to nearest layer patch > " 694 << slipFeatureAngle <<
" degrees." <<
endl;
707 label pointI = meshPoints[i];
711 pointWallDist[pointI].valid(dummyTrackData)
712 && !pointMedialDist[pointI].valid(dummyTrackData)
718 -pointWallDist[pointI].v()
721 if (cosAngle > slipFeatureAngleCos)
726 maxPoints.append(pointI);
737 pointMedialDist[pointI] = maxInfo.last();
754 PointEdgeWave<pointData> medialDistCalc
765 medialDistCalc.iterate(2*nMedialAxisIter);
769 forAll(pointMedialDist, pointI)
771 if (pointMedialDist[pointI].valid(dummyTrackData))
775 pointMedialDist[pointI].distSqr()
777 medialVec_[pointI] = pointMedialDist[pointI].origin();
782 medialDist_[pointI] = 0.0;
783 medialVec_[pointI] =
point(1, 0, 0);
791 if (!pointWallDist[i].valid(dummyTrackData))
793 dispVec_[i] =
vector(1, 0, 0);
797 dispVec_[i] = pointWallDist[i].v();
812 forAll(medialRatio_, pointI)
814 if (!pointWallDist[pointI].valid(dummyTrackData))
816 medialRatio_[pointI] = 0.0;
820 scalar wDist2 = pointWallDist[pointI].distSqr();
821 scalar mDist = medialDist_[pointI];
823 if (wDist2 <
sqr(SMALL) && mDist < SMALL)
830 medialRatio_[pointI] = 0.0;
834 medialRatio_[pointI] = mDist / (
Foam::sqrt(wDist2) + mDist);
843 <<
" : Writing medial axis fields:" <<
nl 845 <<
"ratio of medial distance to wall distance : " 846 << medialRatio_.
name() <<
nl 847 <<
"distance to nearest medial axis : " 848 << medialDist_.name() <<
nl 849 <<
"nearest medial axis location : " 850 << medialVec_.name() <<
nl 851 <<
"normal at nearest wall : " 852 << dispVec_.name() <<
nl 857 medialRatio_.
write();
864 bool Foam::medialAxisMeshMover::unmarkExtrusion
866 const label patchPointI,
868 List<autoLayerDriver::extrudeMode>& extrudeStatus
890 void Foam::medialAxisMeshMover::syncPatchDisplacement
894 List<autoLayerDriver::extrudeMode>& extrudeStatus
898 const labelList& meshPoints = pp.meshPoints();
900 label nChangedTotal = 0;
912 minMagSqrEqOp<vector>(),
919 if (
mag(patchDisp[i]) < minThickness[i])
921 if (unmarkExtrusion(i, patchDisp, extrudeStatus))
992 nChangedTotal += nChanged;
1006 void Foam::medialAxisMeshMover::minSmoothField
1008 const label nSmoothDisp,
1009 const PackedBoolList& isPatchMasterPoint,
1010 const PackedBoolList& isPatchMasterEdge,
1016 const edgeList& edges = pp.edges();
1017 const labelList& meshPoints = pp.meshPoints();
1032 Info<< typeName <<
" : Smoothing field ..." <<
endl;
1034 for (
label iter = 0; iter < nSmoothDisp; iter++)
1047 average *= invSumWeight;
1053 average[pointI] = 0.5*(field[pointI]+average[pointI]);
1058 average[pointI] < field[pointI]
1059 && average[pointI] >= fieldMin[pointI]
1062 field[pointI] = average[pointI];
1067 if ((iter % 10) == 0)
1072 mag(field-average)()
1074 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
1081 void Foam::medialAxisMeshMover::
1082 handleFeatureAngleLayerTerminations
1084 const scalar minCos,
1085 const PackedBoolList& isPatchMasterPoint,
1087 List<autoLayerDriver::extrudeMode>& extrudeStatus,
1089 label& nPointCounter
1097 boolList extrudedFaces(pp.size(),
true);
1099 forAll(pp.localFaces(), faceI)
1101 const face& f = pp.localFaces()[faceI];
1107 extrudedFaces[faceI] =
false;
1122 List<List<point> > edgeFaceNormals(pp.nEdges());
1123 List<List<bool> > edgeFaceExtrude(pp.nEdges());
1126 const vectorField& faceNormals = pp.faceNormals();
1130 const labelList& eFaces = edgeFaces[edgeI];
1132 edgeFaceNormals[edgeI].
setSize(eFaces.size());
1133 edgeFaceExtrude[edgeI].setSize(eFaces.size());
1136 label faceI = eFaces[i];
1137 edgeFaceNormals[edgeI][i] = faceNormals[faceI];
1138 edgeFaceExtrude[edgeI][i] = extrudedFaces[faceI];
1147 globalMeshData::ListPlusEqOp<List<point> >(),
1156 globalMeshData::ListPlusEqOp<List<bool> >(),
1161 forAll(edgeFaceNormals, edgeI)
1163 const List<point>& eFaceNormals = edgeFaceNormals[edgeI];
1164 const List<bool>& eFaceExtrude = edgeFaceExtrude[edgeI];
1166 if (eFaceNormals.size() == 2)
1168 const edge& e = pp.edges()[edgeI];
1178 if (!eFaceExtrude[0] || !eFaceExtrude[1])
1180 const vector& n0 = eFaceNormals[0];
1181 const vector& n1 = eFaceNormals[1];
1183 if ((n0 & n1) < minCos)
1185 if (unmarkExtrusion(v0, patchDisp, extrudeStatus))
1187 if (isPatchMasterPoint[v0])
1192 if (unmarkExtrusion(v1, patchDisp, extrudeStatus))
1194 if (isPatchMasterPoint[v1])
1213 void Foam::medialAxisMeshMover::findIsolatedRegions
1215 const scalar minCosLayerTermination,
1216 const bool detectExtrusionIsland,
1217 const PackedBoolList& isPatchMasterPoint,
1218 const PackedBoolList& isPatchMasterEdge,
1221 List<autoLayerDriver::extrudeMode>& extrudeStatus,
1227 const labelList& meshPoints = pp.meshPoints();
1229 Info<< typeName <<
" : Removing isolated regions ..." <<
endl;
1232 label nPointCounter = 0;
1235 autoPtr<OBJstream> str;
1243 /
"islandExcludePoints_" 1249 <<
" : Writing points surrounded by non-extruded points to " 1250 << str().name() <<
endl;
1257 handleFeatureAngleLayerTerminations
1259 minCosLayerTermination,
1268 syncPatchDisplacement(minThickness, patchDisp, extrudeStatus);
1279 boolList keptPoints(pp.nPoints(),
false);
1281 if (detectExtrusionIsland)
1290 const face& f = pp.localFaces()[faceI];
1296 if (islandPoint[faceI] == -1)
1299 islandPoint[faceI] = f[fp];
1301 else if (islandPoint[faceI] != -2)
1304 islandPoint[faceI] = -2;
1316 forAll(pointFaces, patchPointI)
1324 label faceI = pFaces[i];
1325 if (islandPoint[faceI] != patchPointI)
1327 keptPoints[patchPointI] =
true;
1340 boolList extrudedFaces(pp.size(),
true);
1341 forAll(pp.localFaces(), faceI)
1343 const face& f = pp.localFaces()[faceI];
1348 extrudedFaces[faceI] =
false;
1356 forAll(keptPoints, patchPointI)
1362 label faceI = pFaces[i];
1363 if (extrudedFaces[faceI])
1365 keptPoints[patchPointI] =
true;
1384 forAll(keptPoints, patchPointI)
1386 if (!keptPoints[patchPointI])
1388 if (unmarkExtrusion(patchPointI, patchDisp, extrudeStatus))
1395 str().write(pp.points()[meshPoints[patchPointI]]);
1408 const edgeList& edges = pp.edges();
1414 labelList isolatedPoint(pp.nPoints(),0);
1418 if (isPatchMasterEdge[edgeI])
1420 const edge& e = edges[edgeI];
1427 isolatedPoint[v0] += 1;
1431 isolatedPoint[v1] += 1;
1449 const face& f = pp.localFaces()[faceI];
1450 bool failed =
false;
1453 if (isolatedPoint[f[fp]] > 2)
1459 bool allPointsExtruded =
true;
1466 allPointsExtruded =
false;
1471 if (allPointsExtruded)
1489 str().write(pp.points()[meshPoints[f[fp]]]);
1497 reduce(nPointCounter, sumOp<label>());
1499 <<
" : Number of isolated points extrusion stopped : "<< nPointCounter
1504 void Foam::medialAxisMeshMover::smoothLambdaMuDisplacement
1506 const label nSmoothDisp,
1507 const PackedBoolList& isMeshMasterPoint,
1508 const PackedBoolList& isMeshMasterEdge,
1531 Info<< typeName <<
" : Smoothing displacement ..." <<
endl;
1533 const scalar lambda = 0.33;
1534 const scalar mu = -0.34;
1538 for (
label iter = 0; iter < nSmoothDisp; iter++)
1550 average *= invSumWeight;
1554 if (medialRatio_[i] > SMALL && medialRatio_[i] < 1-SMALL)
1556 displacement[i] = (1-
lambda)*displacement[i]+lambda*average[i];
1570 average *= invSumWeight;
1575 if (medialRatio_[i] > SMALL && medialRatio_[i] < 1-SMALL)
1577 displacement[i] = (1-
mu)*displacement[i]+mu*average[i];
1583 if ((iter % 10) == 0)
1588 mag(displacement-average)()
1590 Info<<
" Iteration " << iter <<
" residual " << resid <<
endl;
1598 Foam::medialAxisMeshMover::medialAxisMeshMover
1606 adaptPatchIDs_(getFixedValueBCs(pointDisplacement)),
1607 adaptPatchPtr_(getPatch(
mesh(), adaptPatchIDs_)),
1614 pointDisplacement.
db(),
1624 const_cast<polyMesh&>(
mesh()),
1639 pointDisplacement.
db(),
1653 pointDisplacement.
db(),
1667 pointDisplacement.
db(),
1681 pointDisplacement.
db(),
1702 void Foam::medialAxisMeshMover::calculateDisplacement
1710 Info<< typeName <<
" : Smoothing using Medial Axis ..." <<
endl;
1722 "nSmoothDisplacement",
1727 const scalar maxThicknessToMedialRatio =
readScalar 1729 coeffDict.
lookup(
"maxThicknessToMedialRatio")
1736 const scalar minCosLayerTermination =
Foam::cos 1744 coeffDict.
lookup(
"nSmoothThickness")
1757 "detectExtrusionIsland",
1796 thickness =
mag(patchDisp);
1798 forAll(thickness, patchPointI)
1802 thickness[patchPointI] = 0.0;
1806 label numThicknessRatioExclude = 0;
1819 /
"thicknessRatioExcludePoints_" 1825 <<
" : Writing points with too large an extrusion distance to " 1826 << str().name() <<
endl;
1837 /
"thicknessRatioExcludeMedialVec_" 1843 <<
" : Writing medial axis vectors on points with too large" 1844 <<
" an extrusion distance to " << medialVecStr().name() <<
endl;
1847 forAll(meshPoints, patchPointI)
1851 label pointI = meshPoints[patchPointI];
1855 scalar mDist = medialDist_[pointI];
1856 scalar thicknessRatio = thickness[patchPointI]/(mDist+VSMALL);
1861 patchDisp[patchPointI]
1862 / (
mag(patchDisp[patchPointI]) + VSMALL);
1864 mVec /=
mag(mVec)+VSMALL;
1865 thicknessRatio *= (n&mVec);
1867 if (thicknessRatio > maxThicknessToMedialRatio)
1872 Pout<<
"truncating displacement at " 1874 <<
" from " << thickness[patchPointI]
1878 minThickness[patchPointI]
1879 +thickness[patchPointI]
1881 <<
" medial direction:" << mVec
1882 <<
" extrusion direction:" << n
1883 <<
" with thicknessRatio:" << thicknessRatio
1887 thickness[patchPointI] =
1888 0.5*(minThickness[patchPointI]+thickness[patchPointI]);
1890 patchDisp[patchPointI] = thickness[patchPointI]*
n;
1892 if (isPatchMasterPoint[patchPointI])
1894 numThicknessRatioExclude++;
1900 str().write(
linePointRef(pt, pt+patchDisp[patchPointI]));
1902 if (medialVecStr.
valid())
1905 medialVecStr().write
1919 Info<< typeName <<
" : Reducing layer thickness at " 1920 << numThicknessRatioExclude
1921 <<
" nodes where thickness to medial axis distance is large " <<
endl;
1928 minCosLayerTermination,
1929 detectExtrusionIsland,
1941 forAll(thickness, patchPointI)
1945 thickness[patchPointI] = 0.0;
1953 nSmoothPatchThickness,
1963 int dummyTrackData = 0;
1978 forAll(meshPoints, patchPointI)
1980 label pointI = meshPoints[patchPointI];
1981 wallPoints[patchPointI] = pointI;
1986 thickness[patchPointI],
2002 wallDistCalc.
iterate(nMedialAxisIter);
2007 pointField& displacement = pointDisplacement_;
2009 forAll(displacement, pointI)
2011 if (!pointWallDist[pointI].valid(dummyTrackData))
2022 displacement[pointI] =
2023 -medialRatio_[pointI]
2024 *pointWallDist[pointI].s()
2031 if (nSmoothDisplacement > 0)
2033 smoothLambdaMuDisplacement
2035 nSmoothDisplacement,
2044 bool Foam::medialAxisMeshMover::shrinkMesh
2047 const label nAllowableErrors,
2059 meshMover_.setDisplacementPatchFields();
2061 Info<< typeName <<
" : Moving mesh ..." <<
endl;
2062 scalar oldErrorReduction = -1;
2064 bool meshOk =
false;
2066 for (
label iter = 0; iter < 2*nSnap ; iter++)
2069 <<
" : Iteration " << iter <<
endl;
2073 <<
" : Displacement scaling for error reduction set to 0." 2075 oldErrorReduction = meshMover_.setErrorReduction(0.0);
2080 meshMover_.scaleMesh
2084 meshMover_.paramDict(),
2091 Info<< typeName <<
" : Successfully moved mesh" <<
endl;
2097 if (oldErrorReduction >= 0)
2099 meshMover_.setErrorReduction(oldErrorReduction);
2102 Info<< typeName <<
" : Finished moving mesh ..." <<
endl;
2111 const label nAllowableErrors,
2119 const word minThicknessName =
word(moveDict.
lookup(
"minThicknessName"));
2134 if (minThicknessName ==
"none")
2140 (minThicknessName ==
"none")
2148 pointDisplacement_.internalField(),
2157 forAll(extrudeStatus, pointI)
2159 if (
mag(patchDisp[pointI]) <= minThickness[pointI]+SMALL)
2167 calculateDisplacement(moveDict, minThickness, extrudeStatus, patchDisp);
2184 adaptPatchPtr_().movePoints(p);
2187 meshMover_.movePoints();
2190 meshMover_.correct();
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
dimensionedScalar sqrt(const dimensionedScalar &ds)
virtual void movePoints(const pointField &)
Update local data for geometry changes.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
OFstream which keeps track of vertices.
const pointField & points
const dimensionedScalar mu
Atomic mass unit.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
vector point
Point is a vector.
labelList meshEdges(const edgeList &allEdges, const labelListList &cellEdges, const labelList &faceCells) const
Return labels of patch edges in the global edge list using.
dimensioned< scalar > mag(const dimensioned< Type > &)
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
void reset(T *=0)
If object pointer already set, delete object and set to given.
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set).
static T gAverage(const PackedBoolList &isMasterElem, const UList< T > &values)
Helper: calculate average.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
void size(const label)
Override size to be inconsistent with allocated storage.
static PackedBoolList getMasterEdges(const polyMesh &)
Get per edge whether it is uncoupled or a master of a.
static const Vector rootMax
PrimitivePatch< face, IndirectList, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
static void syncEdgeList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh edges.
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.
static PackedBoolList getMasterPoints(const polyMesh &)
Get per point whether it is uncoupled or a master of a.
Mesh representing a set of points created from polyMesh.
A list of keyword definitions, which are a keyword followed by any number of values (e...
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Variant of pointEdgePoint with some transported additional data. WIP - should be templated on data li...
label nPoints() const
Return number of points supporting patch faces.
vectorField pointField
pointField is a vectorField.
label readLabel(Istream &is)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
void setSize(const label)
Reset size of List.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
#define WarningIn(functionName)
Report a warning using Foam::Warning.
virtual const pointField & points() const
Return raw 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.
Field< vector > vectorField
Specialisation of Field<T> for vector.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
dimensionedScalar lambda(laminarTransport.lookup("lambda"))
virtual Ostream & write(const token &)=0
Write next token to stream.
static PackedBoolList getMasterEdges(const polyMesh &mesh, const labelList &meshEdges)
Determine master edge for subset of edges. If coupled.
dimensionedScalar cos(const dimensionedScalar &ds)
static PackedBoolList getMasterPoints(const polyMesh &mesh, const labelList &meshPoints)
Determine master point for subset of points. If coupled.
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.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Unit conversion functions.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
static void syncPointList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh points.
label iterate(const label maxIter)
Iterate until no changes or maxIter reached. Returns actual.
label nTotalPoints() const
Return total number of points in decomposed mesh. Not.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
A list of faces which address into the list of points.
static tmp< pointField > pointNormals(const polyMesh &, const PrimitivePatch< Face, FaceList, PointField, PointType > &)
Return parallel consistent point normals for patches using mesh points.
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)
virtual const fileName & name() const
Return the name of the stream.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
List< label > labelList
A List of labels.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
Wave propagation of information through grid. Every iteration information goes through one layer of e...
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
const Time & time() const
Return time.
Vector< scalar > vector
A scalar version of the templated Vector.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
line< point, const point & > linePointRef
Line using referred points.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
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]
dimensionedSymmTensor sqr(const dimensionedVector &dv)
List< labelList > labelListList
A List of labelList.
virtual bool move(const dictionary &, const label nAllowableErrors, labelList &checkFaces)
Move mesh using current pointDisplacement boundary values.
const objectRegistry & db() const
Return the local objectRegistry.
bool isA(const Type &t)
Check if a dynamic_cast to typeid is possible.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Virtual base class for mesh movers with externally provided displacement field giving the boundary co...
const globalMeshData & globalData() const
Return parallel info.
defineTypeNameAndDebug(combustionModel, 0)
virtual ~medialAxisMeshMover()
prefixOSstream Pout(cout,"Pout")
List< bool > boolList
Bool container classes.
pointPatchField< vector > pointPatchVectorField