Go to the documentation of this file.
52 const searchableSurfaces& geometry,
58 for (
const searchableSurface& geom : geometry)
60 if (geom.name() ==
name)
67 <<
"Cannot find surface " <<
name <<
" in geometry"
74 Foam::label Foam::blockFaces::projectFace::index
80 return coord.first() + coord.second()*
n.first();
84 void Foam::blockFaces::projectFace::calcLambdas
92 lambdaI.setSize(
points.size());
94 lambdaJ.setSize(
points.size());
97 for (label i = 1; i <
n.first(); i++)
99 for (label j = 1; j <
n.second(); j++)
110 for (label i = 1; i <
n.first(); i++)
112 label ijLast = index(
n,
labelPair(i,
n.second()-1));
113 for (label j = 1; j <
n.second(); j++)
116 lambdaJ[ij] /= lambdaJ[ijLast];
119 for (label j = 1; j <
n.second(); j++)
121 label iLastj = index(
n,
labelPair(
n.first()-1, j));
122 for (label i = 1; i <
n.first(); i++)
125 lambdaI[ij] /= lambdaI[iLastj];
133 Foam::blockFaces::projectFace::projectFace
142 surface_(lookupSurface(geometry, is))
151 const label blockFacei,
156 static label fIter = 0;
166 <<
" with verts:" << desc.
vertices()
167 <<
" writing lines from start points"
168 <<
" to projected points to " << debugStr().name() <<
endl;
205 calcLambdas(
n,
points, lambdaI, lambdaJ);
209 const label maxIter = 10;
211 const scalar relTol = 0.1;
213 scalar initialResidual = 0.0;
214 scalar iResidual = 0.0;
215 scalar jResidual = 0.0;
217 for (label iter = 0; iter < maxIter; iter++)
227 surface_.findNearest(
points, nearestDistSqr, hits);
233 const point& hitPt = hits[i].hitPoint();
234 if (debugStr.
valid())
245 Pout<<
"Iter:" << iter <<
" initialResidual:" << initialResidual
246 <<
" iResidual+jResidual:" << iResidual+jResidual <<
endl;
254 initialResidual < ROOTVSMALL
255 || ((iResidual+jResidual)/initialResidual < relTol)
269 for (label j = 1; j <
n.second()-1; j++)
273 projLambdas[0] = 0.0;
274 for (label i = 1; i <
n.first(); i++)
282 projLambdas /= projLambdas.last();
286 for (label i = 1; i <
n.first()-1; i++)
290 interpolator.
valueWeights(lambdaI[ij], indices, weights);
295 label ptIndex = index(
n,
labelPair(indices[indexi], j));
296 predicted += weights[indexi]*
points[ptIndex];
298 residual[ij] = predicted-
points[ij];
302 if (debugStr.
valid())
311 iResidual =
sum(
mag(residual));
320 for (label i = 1; i <
n.first()-1; i++)
324 projLambdas[0] = 0.0;
325 for (label j = 1; j <
n.second(); j++)
334 projLambdas /= projLambdas.last();
338 for (label j = 1; j <
n.second()-1; j++)
342 interpolator.
valueWeights(lambdaJ[ij], indices, weights);
347 label ptIndex = index(
n,
labelPair(i, indices[indexi]));
348 predicted += weights[indexi]*
points[ptIndex];
350 residual[ij] = predicted-
points[ij];
354 if (debugStr.
valid())
363 jResidual =
sum(
mag(residual));
367 initialResidual = iResidual + jResidual;
int debug
Static debugging option.
vectorField pointField
pointField is a vectorField.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const Cmpt & x() const
Access to the vector x component.
const pointField & vertices() const
Reference to point field defining the block mesh.
OFstream that keeps track of vertices.
static constexpr const zero Zero
Global zero (0)
const cellShape & blockShape() const
Return the block shape.
Unit conversion functions.
bool valid() const noexcept
True if the managed pointer is non-null.
Ostream & endl(Ostream &os)
Add newline and flush stream.
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
const Cmpt & z() const
Access to the vector z component.
#define forAll(list, i)
Loop across all elements in list.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Pair< label > labelPair
A pair of labels.
addToRunTimeSelectionTable(blockFace, projectFace, Istream)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
messageStream Info
Information stream (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const
Calculate weights and indices to calculate t from samples.
Macros for easy insertion into run-time selection tables.
defineTypeNameAndDebug(projectFace, 0)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Projects the given set of face points onto the selected surface of the geometry provided as a searcha...
virtual void project(const blockDescriptor &, const label blockFacei, pointField &points) const
Project the given points onto the surface.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
const Cmpt & y() const
Access to the vector y component.
line< point, const point & > linePointRef
Line using referred points.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
static const Vector< scalar > zero
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
const labelVector & density() const
Return the mesh density (number of cells) in the i,j,k directions.
Takes the description of the block and the list of curved edges and creates a list of points on edges...