48 const dictionary& initialPointsDict,
49 const searchableSurface& surface,
50 const scalar& defaultCellSize,
51 const labelList regionIndices
64 coeffsDict().
get<scalar>(
"distanceCellSizeCoeff") * defaultCellSize
68 coeffsDict().
get<scalar>(
"distanceCoeff") * defaultCellSize
70 distanceSqr_(
sqr(distance_))
76Foam::scalar Foam::linearDistance::sizeFunction
83 const scalar interpolatedSize
87 = (distanceCellSize_ - interpolatedSize)
90 scalar size = gradient*d + interpolatedSize;
108 if (sideMode_ == rmBothsides)
111 shapeSizes.resize(2);
113 shapePts[0] = pt -
n*distance_;
114 shapePts[1] = pt +
n*distance_;
116 shapeSizes[0] = distanceCellSize_;
117 shapeSizes[1] = distanceCellSize_;
119 else if (sideMode_ == smInside)
122 shapeSizes.resize(1);
124 shapePts[0] = pt -
n*distance_;
125 shapeSizes[0] = distanceCellSize_;
127 else if (sideMode_ == smOutside)
130 shapeSizes.resize(1);
132 shapePts[0] = pt +
n*distance_;
133 shapeSizes[0] = distanceCellSize_;
144 List<pointIndexHit> hits;
158 const point& hitPt = hitInfo.hitPoint();
159 const label hitIndex = hitInfo.index();
161 const scalar dist =
mag(pt - hitPt);
163 if (sideMode_ == rmBothsides)
165 size = sizeFunction(hitPt, dist, hitIndex);
172 if (dist < snapToSurfaceTol_)
174 size = sizeFunction(hitPt, 0, hitIndex);
180 List<volumeType> vTL;
182 surface_.getVolumeType(ptF, vTL);
184 bool functionApplied =
false;
188 sideMode_ == smInside
192 size = sizeFunction(hitPt, dist, hitIndex);
194 functionApplied =
true;
198 sideMode_ == smOutside
202 size = sizeFunction(hitPt, dist, hitIndex);
204 functionApplied =
true;
207 return functionApplied;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
autoPtr< surfaceCellSizeFunction > surfaceCellSizeFunction_
virtual bool sizeLocations(const pointIndexHit &hitPt, const vector &n, pointField &shapePts, scalarField &shapeSizes) const
virtual bool cellSize(const point &pt, scalar &size) const
Modify scalar argument to the cell size specified by function.
virtual bool setCellSize(const pointField &pts)
Adapt local cell size. Return true if anything changed.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
@ OUTSIDE
A location outside the volume.
@ INSIDE
A location inside the volume.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
const wordList surface
Standard surface field types (scalar, vector, tensor, etc)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
A PointIndexHit for 3D points.
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)