50Foam::PatchFunction1Types::FilterField::RBF_typeNames_
52 { RBF_type::RBF_linear,
"linear" },
53 { RBF_type::RBF_quadratic,
"quadratic" },
54 { RBF_type::RBF_linear,
"default" },
68 const scalar radiusSqr
71 return (1 -
::sqrt(
p.distSqr(
p0) / radiusSqr));
80 const scalar radiusSqr
83 return (1 -
p.distSqr(
p0) / radiusSqr);
95 const int debug = PatchFunction1Types::FilterField::debug;
97 const int oldDebug = indexedOctreeBase::debug;
101 indexedOctreeBase::debug = 1;
113 indexedOctreeBase::debug = oldDebug;
117 const auto&
tree = treePtr();
122 Info<<
"have " <<
tree.nodes().size() <<
" nodes" <<
nl;
138 class BasisFunctionOp,
139 class PointWeightFieldType
141void Foam::PatchFunction1Types::FilterField::buildWeightsImpl
143 const TreeType&
tree,
144 const RadiusSqrOp& radiusSqrOp,
145 const BasisFunctionOp& basisFuncOp,
146 const PointWeightFieldType& pointWeightFld
149 tmp<pointField> tpoints =
tree.shapes().centres();
151 const auto&
points = tpoints();
164 bool usesNeighbours =
false;
166 for (label pointi = 0; pointi <
nPoints; ++pointi)
169 auto& currAddr = addressing_[pointi];
170 auto& currWeight = weights_[pointi];
173 const scalar radiusSqr = radiusSqrOp(pointi);
175 tree.findSphere(
p0, radiusSqr, neighbours);
178 if (neighbours.size() < 2)
180 currAddr.resize(1, pointi);
181 currWeight.resize(1, scalar(1));
185 usesNeighbours =
true;
187 currAddr = neighbours.sortedToc();
188 currWeight.resize_nocopy(currAddr.size());
190 scalar sumWeight = 0;
196 currWeight[i] = basisFuncOp(
p,
p0, radiusSqr);
200 currWeight[i] *=
static_cast<scalar
>(pointWeightFld[i]);
201 sumWeight += currWeight[i];
204 for (
auto& w : currWeight)
216 if (debug && !addressing_.empty())
222 for (
const labelList& addr : addressing_)
224 const label
n = addr.size();
230 Pout<<
"Weight neighbours: min=" <<
limits.min()
231 <<
" avg=" << (total / addressing_.size())
258 reset(geom, radius, relative, interp);
282 Pout<<
"Apply " << RBF_typeNames_[interp] <<
" filter,"
283 <<
" radius=" << radius <<
nl
284 <<
"Create tree..." <<
endl;
290 const scalar radiusSqr =
sqr(radius);
304 [=](label index) -> scalar {
return radiusSqr; },
328 Pout<<
"Apply " << RBF_typeNames_[interp] <<
" filter,"
329 << (relative ?
" relative" :
"") <<
" radius=" << radius <<
nl
330 <<
"Create tree..." <<
endl;
336 const scalar radiusSqr =
sqr(radius);
352 [&](label index) -> scalar
354 return (radiusSqr * geom.
sphere(index));
366 [=](label index) -> scalar {
return radiusSqr; },
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
const scalarField & magSf() const
Face area magnitudes.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
The FilterField helper class provides a multi-sweep median filter for a Field of data associated with...
FilterField() noexcept=default
Default construct.
void reset()
Reset to unweighted (pass-through).
label nFaces() const noexcept
Number of faces in the patch.
const Field< point_type > & points() const noexcept
Return reference to global points.
scalar sphere(const label facei) const
The enclosing (bounding) sphere radius^2 for specified face.
const Field< point_type > & faceCentres() const
Return face centres for patch.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void grow(const scalar delta)
Expand box by adjusting min/max by specified amount in each dimension.
A class representing the concept of a field of 1 used to avoid unnecessary manipulations for objects ...
Standard boundBox with extra functionality for use in octree.
Holds (reference to) pointField. Encapsulation of data needed for octree searches....
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
limits reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL))
const volScalarField & p0
OBJstream os(runTime.globalPath()/outputName)
Namespace for handling debugging switches.
static scalar linearWeight(const point &p, const point &p0, const scalar radiusSqr)
Linear basis function: 1 - (r/r0).
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
List< label > labelList
A List of labels.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
static autoPtr< indexedOctree< treeDataPoint > > createTree(const pointField &points)
Construct search tree for points.
messageStream Info
Information stream (stdout output on master, null elsewhere).
MinMax< label > labelMinMax
A label min/max range.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar sqrt(const dimensionedScalar &ds)
static scalar quadraticWeight(const point &p, const point &p0, const scalar radiusSqr)
Quadratic basis function: 1 - (r/r0)^2.
MeshedSurface< face > meshedSurface
vector point
Point is a vector.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
constexpr char nl
The newline '\n' character (0x0a).
Tree tree(triangles.begin(), triangles.end())
#define forAll(list, i)
Loop across all elements in list.