52 const searchableSurfaces& geometry,
58 for (
const searchableSurface& geom : geometry)
60 if (geom.name() ==
name)
67 <<
"Cannot find surface " <<
name <<
" in geometry"
80 return coord.first() + coord.second()*
n.first();
84void 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];
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();
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];
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];
363 jResidual =
sum(
mag(residual));
367 initialResidual = iResidual + jResidual;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
OFstream that keeps track of vertices.
T & last()
Return the last element of the list.
const Cmpt & z() const
Access to the vector z component.
const Cmpt & y() const
Access to the vector y component.
const Cmpt & x() const
Access to the vector x component.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void reset(autoPtr< T > &&other) noexcept
Delete managed object and set to new given pointer.
Takes the description of the block and the list of curved edges and creates a list of points on edges...
const pointField & vertices() const noexcept
Reference to point field defining the block mesh.
const cellShape & blockShape() const noexcept
Return the block shape.
const labelVector & density() const noexcept
The mesh density (number of cells) in the i,j,k directions.
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.
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.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Pair< label > labelPair
A pair of labels.
line< point, const point & > linePointRef
A line using referred points.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
messageStream Info
Information stream (stdout output on master, null elsewhere)
vectorField pointField
pointField is a vectorField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
#define forAll(list, i)
Loop across all elements in list.
A non-counting (dummy) refCount.
Unit conversion functions.