mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Migrated pointToPointPlanarInterpolation updates from old development line
This commit is contained in:
@ -272,6 +272,10 @@ void Foam::pointToPointPlanarInterpolation::calcWeights
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OBJstream str("stencil.obj");
|
||||||
|
Pout<< "pointToPointPlanarInterpolation::calcWeights :"
|
||||||
|
<< " Dumping stencil to " << str.name() << endl;
|
||||||
|
|
||||||
forAll(destPoints, i)
|
forAll(destPoints, i)
|
||||||
{
|
{
|
||||||
label v0 = nearestVertex_[i][0];
|
label v0 = nearestVertex_[i][0];
|
||||||
@ -285,17 +289,21 @@ void Foam::pointToPointPlanarInterpolation::calcWeights
|
|||||||
<< " at:" << sourcePoints[v0]
|
<< " at:" << sourcePoints[v0]
|
||||||
<< " weight:" << nearestVertexWeight_[i][0] << nl;
|
<< " weight:" << nearestVertexWeight_[i][0] << nl;
|
||||||
|
|
||||||
|
str.write(linePointRef(destPoints[i], sourcePoints[v0]));
|
||||||
|
|
||||||
if (v1 != -1)
|
if (v1 != -1)
|
||||||
{
|
{
|
||||||
Pout<< " " << v1
|
Pout<< " " << v1
|
||||||
<< " at:" << sourcePoints[v1]
|
<< " at:" << sourcePoints[v1]
|
||||||
<< " weight:" << nearestVertexWeight_[i][1] << nl;
|
<< " weight:" << nearestVertexWeight_[i][1] << nl;
|
||||||
|
str.write(linePointRef(destPoints[i], sourcePoints[v1]));
|
||||||
}
|
}
|
||||||
if (v2 != -1)
|
if (v2 != -1)
|
||||||
{
|
{
|
||||||
Pout<< " " << v2
|
Pout<< " " << v2
|
||||||
<< " at:" << sourcePoints[v2]
|
<< " at:" << sourcePoints[v2]
|
||||||
<< " weight:" << nearestVertexWeight_[i][2] << nl;
|
<< " weight:" << nearestVertexWeight_[i][2] << nl;
|
||||||
|
str.write(linePointRef(destPoints[i], sourcePoints[v2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
Pout<< endl;
|
Pout<< endl;
|
||||||
@ -317,7 +325,10 @@ Foam::pointToPointPlanarInterpolation::pointToPointPlanarInterpolation
|
|||||||
:
|
:
|
||||||
perturb_(perturb),
|
perturb_(perturb),
|
||||||
nearestOnly_(nearestOnly),
|
nearestOnly_(nearestOnly),
|
||||||
referenceCS_(calcCoordinateSystem(sourcePoints)),
|
referenceCS_
|
||||||
|
(
|
||||||
|
nearestOnly ? coordinateSystem() : calcCoordinateSystem(sourcePoints)
|
||||||
|
),
|
||||||
nPoints_(sourcePoints.size())
|
nPoints_(sourcePoints.size())
|
||||||
{
|
{
|
||||||
calcWeights(sourcePoints, destPoints);
|
calcWeights(sourcePoints, destPoints);
|
||||||
@ -341,6 +352,43 @@ Foam::pointToPointPlanarInterpolation::pointToPointPlanarInterpolation
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::pointToPointPlanarInterpolation::pointToPointPlanarInterpolation
|
||||||
|
(
|
||||||
|
const scalar perturb,
|
||||||
|
const bool nearestOnly,
|
||||||
|
const coordinateSystem& referenceCS,
|
||||||
|
const label sourceSize,
|
||||||
|
const List<FixedList<label, 3> >& nearestVertex,
|
||||||
|
const List<FixedList<scalar, 3> >& nearestVertexWeight
|
||||||
|
)
|
||||||
|
:
|
||||||
|
perturb_(perturb),
|
||||||
|
nearestOnly_(nearestOnly),
|
||||||
|
referenceCS_(referenceCS),
|
||||||
|
nPoints_(sourceSize),
|
||||||
|
nearestVertex_(nearestVertex),
|
||||||
|
nearestVertexWeight_(nearestVertexWeight)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::pointToPointPlanarInterpolation>
|
||||||
|
Foam::pointToPointPlanarInterpolation::clone() const
|
||||||
|
{
|
||||||
|
return autoPtr<pointToPointPlanarInterpolation>
|
||||||
|
(
|
||||||
|
new pointToPointPlanarInterpolation
|
||||||
|
(
|
||||||
|
perturb_,
|
||||||
|
nearestOnly_,
|
||||||
|
referenceCS_,
|
||||||
|
nPoints_,
|
||||||
|
nearestVertex_,
|
||||||
|
nearestVertexWeight_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::wordList Foam::pointToPointPlanarInterpolation::timeNames
|
Foam::wordList Foam::pointToPointPlanarInterpolation::timeNames
|
||||||
|
|||||||
@ -73,6 +73,7 @@ class pointToPointPlanarInterpolation
|
|||||||
// patch
|
// patch
|
||||||
List<FixedList<scalar, 3>> nearestVertexWeight_;
|
List<FixedList<scalar, 3>> nearestVertexWeight_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Calculate a local coordinate system from set of points
|
//- Calculate a local coordinate system from set of points
|
||||||
@ -85,6 +86,7 @@ class pointToPointPlanarInterpolation
|
|||||||
const pointField& destPoints
|
const pointField& destPoints
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Declare name of the class and its debug switch
|
// Declare name of the class and its debug switch
|
||||||
@ -114,9 +116,35 @@ public:
|
|||||||
const scalar perturb
|
const scalar perturb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
pointToPointPlanarInterpolation
|
||||||
|
(
|
||||||
|
const scalar perturb,
|
||||||
|
const bool nearestOnly,
|
||||||
|
const coordinateSystem& referenceCS,
|
||||||
|
const label sourceSize,
|
||||||
|
const List<FixedList<label, 3> >& nearestVertex,
|
||||||
|
const List<FixedList<scalar, 3> >& nearestVertexWeight
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
autoPtr<pointToPointPlanarInterpolation> clone() const;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Perturbation factor (for triangulation)
|
||||||
|
scalar perturb() const
|
||||||
|
{
|
||||||
|
return perturb_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Whether to use nearest point only (avoids triangulation, projection)
|
||||||
|
bool nearestOnly() const
|
||||||
|
{
|
||||||
|
return nearestOnly_;
|
||||||
|
}
|
||||||
|
|
||||||
//- Return the coordinateSystem
|
//- Return the coordinateSystem
|
||||||
const coordinateSystem& referenceCS() const
|
const coordinateSystem& referenceCS() const
|
||||||
{
|
{
|
||||||
@ -158,7 +186,6 @@ public:
|
|||||||
//- Interpolate from field on source points to dest points
|
//- Interpolate from field on source points to dest points
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<Field<Type>> interpolate(const Field<Type>& sourceFld) const;
|
tmp<Field<Type>> interpolate(const Field<Type>& sourceFld) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user