64 if (surfaces_[i] == -1)
67 <<
"Cannot find surface " << names[i] <<
" in geometry"
71 if (isA<searchableExtrudedCircle>(geometry_[surfaces_[i]]))
73 Info<<
type() <<
" : Using curved surface "
74 << geometry_[surfaces_[i]].name()
75 <<
" to predict starting points." <<
endl;
87 static label eIter = 0;
96 Info<<
"Writing lines from straight-line start points"
97 <<
" to projected points to " << debugStr().name() <<
endl;
104 const point& startPt = points_[start_];
105 const point& endPt = points_[end_];
106 const vector d = endPt-startPt;
111 points[i] = startPt+lambdas[i]*d;
118 if (isA<searchableExtrudedCircle>(geometry_[surfaces_[i]]))
121 refCast<const searchableExtrudedCircle>
123 geometry_[surfaces_[i]]
126 s.findParametricNearest
149 const label maxIter = 10;
152 const scalar relTol = 0.1;
153 const scalar absTol = 1
e-4;
155 scalar initialResidual = 0;
157 for (
label iter = 0; iter < maxIter; iter++)
174 if (lambdas[0] < small)
178 if (lambdas.
last() > 1 - small)
183 if (debugStr.
valid())
201 projLambdas /= projLambdas.
last();
212 interpolator.
valueWeights(lambdas[i], indices, weights);
217 predicted += weights[indexi]*
points[indices[indexi]];
219 residual[i] = predicted -
points[i];
222 const scalar scalarResidual =
sum(
mag(residual));
226 Pout<<
"Iter:" << iter <<
" initialResidual:" << initialResidual
227 <<
" residual:" << scalarResidual <<
endl;
230 if (scalarResidual < absTol*0.5*lambdas.
size())
236 initialResidual = scalarResidual;
238 else if (scalarResidual/initialResidual < relTol)
244 if (debugStr.
valid())
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
OFstream which keeps track of vertices.
T & last()
Return the last element of the list.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
Define a curved edge that is parameterised for 0<lambda<1 between the start and end point.
A list of keyword definitions, which are a keyword followed by any number of values (e....
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const
Calculate weights and indices to calculate t from samples.
Defines the edge from the projection onto a surface (single surface) or intersection of two surfaces.
projectCurveEdge(const dictionary &dict, const label index, const searchableSurfaces &geometry, const pointField &points, Istream &)
Construct from Istream setting pointsList.
virtual point position(const scalar) const
Return the point positions corresponding to the curve parameters.
Surface geometry with a tube shape, which can be used with snappyHexMesh. The geometry is formed from...
static void findNearest(const PtrList< searchableSurface > &, const labelList &surfacesToTest, const pointField &, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &)
Find nearest. Return -1 (and a miss()) or surface and nearest.
Container for searchableSurfaces.
label findSurfaceID(const word &name) const
Find index of surface. Return -1 if not found.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Tuple2< scalar, label > nearInfo
Private class for finding nearest.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
line< point, const point & > linePointRef
Line using referred points.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
vectorField pointField
pointField is a vectorField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout, "Pout")
word name(const complex &)
Return a string representation of a complex.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Unit conversion functions.