46 label nSmoothingIterations = 10;
48 for (
label iter = 0; iter < nSmoothingIterations; ++iter)
50 const pointField& faceCentres = surface_.faceCentres();
54 const labelList& faceFaces = surface_.faceFaces()[sI];
56 const point& fC = faceCentres[sI];
57 const scalar value = surf[sI];
66 const label faceLabel = faceFaces[fI];
67 const point& faceCentre = faceCentres[faceLabel];
69 const scalar faceValue = surf[faceLabel];
72 newValue += faceValue/(distance + SMALL);
74 totalDist += 1.0/(distance + SMALL);
76 if (value < faceValue)
83 if (nFaces == faceFaces.size())
88 surf[sI] = newValue/totalDist;
98 const dictionary& cellSizeCalcTypeDict,
99 const triSurfaceMesh& surface,
100 const scalar& defaultCellSize
103 cellSizeCalculationType
106 cellSizeCalcTypeDict,
110 coeffsDict_(cellSizeCalcTypeDict.subDict(typeName +
"Coeffs")),
111 surfaceName_(surface.searchableSurface::
name()),
112 readCurvature_(Switch(coeffsDict_.
lookup(
"curvature"))),
113 curvatureFile_(coeffsDict_.
lookup(
"curvatureFile")),
114 readFeatureProximity_(Switch(coeffsDict_.
lookup(
"featureProximity"))),
115 featureProximityFile_(coeffsDict_.
lookup(
"featureProximityFile")),
116 readInternalCloseness_(Switch(coeffsDict_.
lookup(
"internalCloseness"))),
117 internalClosenessFile_(coeffsDict_.
lookup(
"internalClosenessFile")),
118 curvatureCellSizeCoeff_
134 <<
"Calculating cell size on surface: " << surfaceName_ <<
endl;
136 tmp<triSurfacePointScalarField> tPointCellSize
142 surfaceName_ +
".cellSize",
143 surface_.searchableSurface::time().constant(),
160 <<
"Reading curvature : " << curvatureFile_ <<
endl;
167 surface_.searchableSurface::time().constant(),
186 (1.0/curvatureCellSizeCoeff_)*
mag(curvature[pI]),
194 PrimitivePatchInterpolation
196 PrimitivePatch<labelledTri, ::Foam::List, pointField, point>
199 const Map<label>& meshPointMap =
surface_.meshPointMap();
201 if (readInternalCloseness_)
204 <<
"Reading internal closeness: " << internalClosenessFile_ <<
endl;
210 internalClosenessFile_,
211 surface_.searchableSurface::time().constant(),
224 patchInterpolate.faceToPointInterpolate(internalCloseness)
232 internalClosenessPointField[meshPointMap[pI]],
238 if (readFeatureProximity_)
241 <<
"Reading feature proximity : " << featureProximityFile_ <<
endl;
247 featureProximityFile_,
248 surface_.searchableSurface::time().constant(),
261 patchInterpolate.faceToPointInterpolate(featureProximity)
269 featureProximityPointField[meshPointMap[pI]],
277 pointCellSize.write();
285 faces[fI] =
surface_.triSurface::operator[](fI).triFaceFace();
288 vtkSurfaceWriter().
write 290 surface_.searchableSurface::time().constant()/
"triSurface",
291 surfaceName_.lessExt().
name(),
301 return tPointCellSize;
#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.
Ostream & indent(Ostream &os)
Indent stream.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Ostream & endl(Ostream &os)
Add newline and flush stream.
scalar distance(const vector &p1, const vector &p2)
Macros for easy insertion into run-time selection tables.
vectorField pointField
pointField is a vectorField.
stressControl lookup("compactNormalStress") >> compactNormalStress
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
List< label > labelList
A List of labels.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
virtual tmp< triSurfacePointScalarField > load()
Load the cell size field.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
virtual tmp< pointField > points() const =0
Get the points that define the surface.
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
automatic(const dictionary &cellSizeCalcTypeDict, const triSurfaceMesh &surface, const scalar &defaultCellSize)
Construct from components.
vector point
Point is a vector.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
virtual bool write() const
Write using setting from DB.
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::DimensionedField< scalar, triSurfacePointGeoMesh > triSurfacePointScalarField
virtual label size() const =0
Range of local indices that can be returned.
A class for managing temporary objects.
const searchableSurface & surface_
Reference to the searchableSurface that cellSizeFunction.
Foam::DimensionedField< scalar, triSurfaceGeoMesh > triSurfaceScalarField
const word & name() const
Return name.