47void Foam::automatic::smoothField(triSurfaceScalarField& surf)
49 label nSmoothingIterations = 10;
51 for (label iter = 0; iter < nSmoothingIterations; ++iter)
59 const point& fC = faceCentres[sI];
60 const scalar value = surf[sI];
69 const label faceLabel = faceFaces[fI];
70 const point& faceCentre = faceCentres[faceLabel];
72 const scalar faceValue = surf[faceLabel];
75 newValue += faceValue/(
distance + SMALL);
79 if (value < faceValue)
91 surf[sI] = newValue/totalDist;
101 const dictionary& cellSizeCalcTypeDict,
102 const triSurfaceMesh& surface,
103 const scalar defaultCellSize
106 cellSizeCalculationType
109 cellSizeCalcTypeDict,
113 coeffsDict_(cellSizeCalcTypeDict.optionalSubDict(typeName +
"Coeffs")),
116 readCurvature_(coeffsDict_.
get<
bool>(
"curvature")),
117 readFeatureProximity_(coeffsDict_.
get<
bool>(
"featureProximity")),
118 readInternalCloseness_(coeffsDict_.
get<
bool>(
"internalCloseness")),
120 curvatureFile_(coeffsDict_.
get<word>(
"curvatureFile")),
121 featureProximityFile_(coeffsDict_.
get<word>(
"featureProximityFile")),
122 internalClosenessFile_(coeffsDict_.
get<word>(
"internalClosenessFile")),
124 curvatureCellSizeCoeff_
126 coeffsDict_.
get<scalar>(
"curvatureCellSizeCoeff")
130 coeffsDict_.
get<scalar>(
"maximumCellSizeCoeff") * defaultCellSize
140 <<
"Calculating cell size on surface: " << surfaceName_ <<
endl;
142 tmp<triSurfacePointScalarField> tPointCellSize
148 surfaceName_ +
".cellSize",
149 surface_.searchableSurface::time().constant(),
166 <<
"Reading curvature : " << curvatureFile_ <<
endl;
173 surface_.searchableSurface::time().constant(),
192 (1.0/curvatureCellSizeCoeff_)*
mag(curvature[pI]),
200 PrimitivePatchInterpolation
202 PrimitivePatch<::Foam::List<labelledTri>,
pointField>
207 if (readInternalCloseness_)
210 <<
"Reading internal closeness: " << internalClosenessFile_ <<
endl;
216 internalClosenessFile_,
217 surface_.searchableSurface::time().constant(),
230 patchInterpolate.faceToPointInterpolate(internalCloseness)
238 internalClosenessPointField[meshPointMap[pI]],
244 if (readFeatureProximity_)
247 <<
"Reading feature proximity : " << featureProximityFile_ <<
endl;
253 featureProximityFile_,
254 surface_.searchableSurface::time().constant(),
267 patchInterpolate.faceToPointInterpolate(featureProximity)
275 featureProximityPointField[meshPointMap[pI]],
283 pointCellSize.write();
291 faces[fI] =
surface_.triSurface::operator[](fI);
294 vtk::surfaceWriter vtkWriter
299 surface_.searchableSurface::time().constant()
306 vtkWriter.writeGeometry();
308 vtkWriter.beginPointData(1);
310 vtkWriter.write(
"cellSize", pointCellSize);
313 return tPointCellSize;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
label nPoints() const
Number of points supporting patch faces.
const Map< label > & meshPointMap() const
Mesh point map.
const Field< point_type > & faceCentres() const
Return face centres for patch.
const labelListList & faceFaces() const
Return face-face addressing.
void size(const label n)
Older name for setAddressableSize.
virtual tmp< triSurfacePointScalarField > load()
Load the cell size field.
const triSurfaceMesh & surface_
Reference to the triSurfaceMesh.
static std::string nameLessExt(const std::string &str)
Return basename, without extension.
A class for managing temporary objects.
virtual label size() const
Range of local indices that can be returned.
virtual tmp< pointField > points() const
Get the points that define the surface.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const labelList nFaces(UPstream::listGatherValues< label >(aMesh.nFaces()))
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
const wordList surface
Standard surface field types (scalar, vector, tensor, etc)
scalar distance(const vector &p1, const vector &p2)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< label > labelList
A List of labels.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::DimensionedField< scalar, triSurfacePointGeoMesh > triSurfacePointScalarField
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Foam::DimensionedField< scalar, triSurfaceGeoMesh > triSurfaceScalarField
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
List< face > faceList
A List of faces.
#define forAll(list, i)
Loop across all elements in list.