57 if (geometry[i].
name() == name)
64 <<
"Cannot find surface " << name <<
" in geometry" 81 void Foam::blockFaces::projectFace::calcLambdas
100 lambdaI[ij] = lambdaI[iMin1j] +
mag(points[ij]-points[iMin1j]);
103 lambdaJ[ij] = lambdaJ[ijMin1] +
mag(points[ij]-points[ijMin1]);
113 lambdaJ[ij] /= lambdaJ[ijLast];
122 lambdaI[ij] /= lambdaI[iLastj];
130 Foam::blockFaces::projectFace::projectFace
139 surface_(lookupSurface(geometry, is))
148 const label blockFacei,
153 static label fIter = 0;
163 <<
" with verts:" << desc.
vertices()
164 <<
" writing lines from start points" 165 <<
" to projected points to " << debugStr().name() <<
endl;
202 calcLambdas(n, points, lambdaI, lambdaJ);
206 const label maxIter = 10;
208 const scalar relTol = 0.1;
210 scalar initialResidual = 0.0;
211 scalar iResidual = 0.0;
212 scalar jResidual = 0.0;
214 for (
label iter = 0; iter < maxIter; iter++)
224 surface_.findNearest(points, nearestDistSqr, hits);
230 const point& hitPt = hits[i].hitPoint();
231 if (debugStr.
valid())
242 Pout<<
"Iter:" << iter <<
" initialResidual:" << initialResidual
243 <<
" iResidual+jResidual:" << iResidual+jResidual <<
endl;
247 if (iter > 0 && (iResidual+jResidual)/initialResidual < relTol)
263 projLambdas[0] = 0.0;
270 +
mag(points[ij]-points[iMin1j]);
272 projLambdas /= projLambdas.last();
280 interpolator.
valueWeights(lambdaI[ij], indices, weights);
286 predicted += weights[indexi]*points[ptIndex];
288 residual[ij] = predicted-points[ij];
292 if (debugStr.
valid())
296 const point predicted(points[i] + residual[i]);
301 iResidual =
sum(
mag(residual));
314 projLambdas[0] = 0.0;
321 +
mag(points[ij]-points[ijMin1]);
324 projLambdas /= projLambdas.last();
332 interpolator.
valueWeights(lambdaJ[ij], indices, weights);
338 predicted += weights[indexi]*points[ptIndex];
340 residual[ij] = predicted-points[ij];
344 if (debugStr.
valid())
348 const point predicted(points[i] + residual[i]);
353 jResidual =
sum(
mag(residual));
357 initialResidual = iResidual + jResidual;
#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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
const Vector< label > & density() const
Return the mesh density (number of cells) in the i,j,k directions.
A list of keyword definitions, which are a keyword followed by any number of values (e...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
defineTypeNameAndDebug(projectFace, 0)
Unit conversion functions.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Takes the description of the block and the list of curved edges and creates a list of points on edges...
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
Macros for easy insertion into run-time selection tables.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
const cellShape & blockShape() const
Return the block shape.
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const
Calculate weights and indices to calculate t from samples.
An ordered pair of two objects of type <T> with first() and second() elements.
line< point, const point & > linePointRef
Line using referred points.
A class for handling words, derived from string.
virtual void project(const blockDescriptor &, const label blockFacei, pointField &points) const
Project the given points onto the surface.
Container for searchableSurfaces.
Pair< label > labelPair
Label pair.
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
OFstream which keeps track of vertices.
word name(const complex &)
Return a string representation of a complex.
const pointField & vertices() const
Reference to point field defining the block mesh.
const Type & second() const
Return second.
void setSize(const label)
Reset size of List.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
prefixOSstream Pout(cout, "Pout")
Projects the given set of face points onto the selected surface of the geometry provided as a searcha...
dimensioned< scalar > mag(const dimensioned< Type > &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
addToRunTimeSelectionTable(blockFace, projectFace, Istream)
const Type & first() const
Return first.
static const Vector< scalar > zero