Go to the documentation of this file.
48 Foam::projectCurveEdge::projectCurveEdge
61 surfaces_.setSize(names.size());
64 surfaces_[i] = geometry_.findSurfaceID(names[i]);
66 if (surfaces_[i] == -1)
69 <<
"Cannot find surface " << names[i] <<
" in geometry"
73 if (isA<searchableExtrudedCircle>(geometry_[surfaces_[i]]))
75 Info<<
type() <<
" : Using curved surface "
76 << geometry_[surfaces_[i]].name()
77 <<
" to predict starting points." <<
endl;
89 static label eIter = 0;
98 Info<<
"Writing lines from straight-line start points"
99 <<
" to projected points to " << debugStr().name() <<
endl;
108 const vector d = endPt-startPt;
113 points[i] = startPt+lambdas[i]*d;
120 if (isA<searchableExtrudedCircle>(geometry_[surfaces_[i]]))
123 refCast<const searchableExtrudedCircle>
125 geometry_[surfaces_[i]]
128 s.findParametricNearest
151 const label maxIter = 10;
153 const scalar relTol = 0.1;
154 const scalar absTol = 1
e-4;
156 scalar initialResidual = 0.0;
158 for (label iter = 0; iter < maxIter; iter++)
175 if (lambdas[0] < SMALL)
179 if (lambdas.last() > 1.0-SMALL)
184 if (debugStr.
valid())
196 projLambdas[0] = 0.0;
197 for (label i = 1; i <
points.size(); i++)
201 projLambdas /= projLambdas.last();
210 for (label i = 1; i <
points.size() - 1; i++)
212 interpolator.
valueWeights(lambdas[i], indices, weights);
217 predicted += weights[indexi]*
points[indices[indexi]];
219 residual[i] = predicted-
points[i];
222 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())
int debug
Static debugging option.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
vectorField pointField
pointField is a vectorField.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
virtual point position(const scalar) const
Return the point positions corresponding to the curve parameters.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
OFstream that keeps track of vertices.
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
Searching on edgeMesh with constant radius.
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.
Define a curved edge that is parameterized for 0<lambda<1 between the start and end point.
#define forAll(list, i)
Loop across all elements in list.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Tuple2< scalar, label > nearInfo
Private class for finding nearest.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
const pointField & points_
messageStream Info
Information stream (uses stdout - output is on the master only)
label start() const
Return label of start point.
word name(const complex &c)
Return string representation of complex.
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
line< point, const point & > linePointRef
Line using referred points.
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const dimensionedScalar e
Elementary charge.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
defineTypeNameAndDebug(combustionModel, 0)
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.