56 if (geometry[i].
name() == name)
63 <<
"Cannot find surface " << name <<
" in geometry" 80 void Foam::blockFaces::projectFace::calcLambdas
99 lambdaI[ij] = lambdaI[iMin1j] +
mag(points[ij]-points[iMin1j]);
102 lambdaJ[ij] = lambdaJ[ijMin1] +
mag(points[ij]-points[ijMin1]);
112 lambdaJ[ij] /= lambdaJ[ijLast];
121 lambdaI[ij] /= lambdaI[iLastj];
138 surface_(lookupSurface(geometry, is))
147 const label blockFacei,
152 static label fIter = 0;
162 <<
" with verts:" << desc.
vertices()
163 <<
" writing lines from start points" 164 <<
" to projected points to " << debugStr().name() <<
endl;
201 calcLambdas(n, points, lambdaI, lambdaJ);
205 const label maxIter = 10;
208 const scalar relTol = 0.1;
210 scalar initialResidual = 0;
211 scalar iResidual = 0;
212 scalar jResidual = 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;
251 initialResidual < small
252 || (iResidual + jResidual)/initialResidual < relTol
277 +
mag(points[ij]-points[iMin1j]);
279 projLambdas /= projLambdas.last();
287 interpolator.
valueWeights(lambdaI[ij], indices, weights);
292 const label ptIndex =
294 predicted += weights[indexi]*points[ptIndex];
296 residual[ij] = predicted-points[ij];
300 if (debugStr.
valid())
304 const point predicted(points[i] + residual[i]);
309 iResidual =
sum(
mag(residual));
329 +
mag(points[ij] - points[ijMin1]);
332 projLambdas /= projLambdas.last();
340 interpolator.
valueWeights(lambdaJ[ij], indices, weights);
345 const label ptIndex =
347 predicted += weights[indexi]*points[ptIndex];
349 residual[ij] = predicted-points[ij];
353 if (debugStr.
valid())
357 const point predicted(points[i] + residual[i]);
362 jResidual =
sum(
mag(residual));
366 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)
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.
projectFace(const dictionary &dict, const label index, const searchableSurfaces &geometry, Istream &)
Construct from Istream setting pointsList.
static const Vector< scalar > zero