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.optionalSubDict(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 internalClosenessCellSizeCoeff_
120 coeffsDict_.
lookup<scalar>(
"internalClosenessCellSizeCoeff")
122 curvatureCellSizeCoeff_
124 coeffsDict_.
lookup<scalar>(
"curvatureCellSizeCoeff")
128 coeffsDict_.
lookup<scalar>(
"maximumCellSizeCoeff")*defaultCellSize
138 <<
"Calculating cell size on surface: " << surfaceName_ <<
endl;
140 tmp<triSurfacePointScalarField> tPointCellSize
146 surfaceName_ +
".cellSize",
147 surface_.searchableSurface::time().constant(),
167 <<
"Reading curvature : " << curvatureFile_ <<
endl;
174 surface_.searchableSurface::time().constant(),
196 (1.0/curvatureCellSizeCoeff_)*
mag(curvature[pI]),
204 PrimitivePatchInterpolation
206 PrimitivePatch<::Foam::List<labelledTri>,
pointField>
210 const Map<label>& meshPointMap =
surface_.meshPointMap();
212 if (readInternalCloseness_)
215 <<
"Reading internal closeness: " << internalClosenessFile_ <<
endl;
221 internalClosenessFile_,
222 surface_.searchableSurface::time().constant(),
241 (1.0/internalClosenessCellSizeCoeff_)
242 *internalClosenessPointField[meshPointMap[pI]],
248 if (readFeatureProximity_)
251 <<
"Reading feature proximity : " << featureProximityFile_ <<
endl;
257 featureProximityFile_,
258 surface_.searchableSurface::time().constant(),
274 patchInterpolate.faceToPointInterpolate(featureProximity)
282 featureProximityPointField[meshPointMap[pI]],
290 pointCellSize.write();
298 faces[fI] =
surface_.triSurface::operator[](fI).triFaceFace();
303 surface_.searchableSurface::time().writeFormat(),
304 surface_.searchableSurface::time().writeCompression()
307 surface_.searchableSurface::time().constant()/
312 "cellSize_" + surfaceName_.lessExt().name(),
321 return tPointCellSize;
void write(Ostream &, const bool subDict=true) const
Write dictionary, normally with sub-dictionary formatting.
#define forAll(list, i)
Loop across all elements in list.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > 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.
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.
const dimensionSet dimLength
vectorField pointField
pointField is a vectorField.
stressControl lookup("compactNormalStress") >> compactNormalStress
static const word & geometryDir()
Return the geometry directory name.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
List< label > labelList
A List of labels.
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)
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.
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