polySplineEdge.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "polySplineEdge.H"
00028 #include "BSpline.H"
00029 #include "addToRunTimeSelectionTable.H"
00030
00031
00032
00033 namespace Foam
00034 {
00035 defineTypeNameAndDebug(polySplineEdge, 0);
00036
00037
00038 addToRunTimeSelectionTable(curvedEdge, polySplineEdge, Istream);
00039 }
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 Foam::pointField Foam::polySplineEdge::intervening
00053 (
00054 const pointField& otherknots,
00055 const label nbetweenKnots,
00056 const vector& fstend,
00057 const vector& sndend
00058 )
00059 {
00060 BSpline spl(knotlist(points_, start_, end_, otherknots), fstend, sndend);
00061
00062 label nSize(nsize(otherknots.size(), nbetweenKnots));
00063
00064 pointField ans(nSize);
00065
00066 label N = spl.nKnots();
00067 scalar init = 1.0/(N - 1);
00068 scalar interval = (N - scalar(3))/N;
00069 interval /= otherknots.size() + 1;
00070 interval /= nbetweenKnots + 1;
00071
00072 ans[0] = points_[start_];
00073
00074 register scalar index(init);
00075 for (register label i=1; i<nSize-1; i++)
00076 {
00077 index += interval;
00078 ans[i] = spl.realPosition(index);
00079 }
00080
00081 ans[nSize-1] = points_[end_];
00082
00083 return ans;
00084 }
00085
00086
00087
00088
00089 Foam::polySplineEdge::polySplineEdge
00090 (
00091 const pointField& points,
00092 const label start,
00093 const label end,
00094 const pointField& otherknots,
00095 const label nInterKnots
00096 )
00097 :
00098 curvedEdge(points, start, end),
00099 polyLine
00100 (
00101 intervening
00102 (
00103 otherknots,
00104 nInterKnots,
00105 vector::zero,
00106 vector::zero
00107 )
00108 ),
00109 otherKnots_(otherknots)
00110 {}
00111
00112
00113 Foam::polySplineEdge::polySplineEdge
00114 (
00115 const pointField& points,
00116 Istream& is
00117 )
00118 :
00119 curvedEdge(points, is),
00120 polyLine(pointField(0)),
00121 otherKnots_(is)
00122 {
00123 label nInterKnots(20);
00124 vector fstend(is);
00125 vector sndend(is);
00126
00127 controlPoints_.setSize(nsize(otherKnots_.size(), nInterKnots));
00128 distances_.setSize(controlPoints_.size());
00129
00130 controlPoints_ = intervening(otherKnots_, nInterKnots, fstend, sndend);
00131 calcDistances();
00132 Info<< polyLine::controlPoints_ << endl;
00133 }
00134
00135
00136
00137
00138 Foam::vector Foam::polySplineEdge::position(const scalar mu) const
00139 {
00140 return polyLine::position(mu);
00141 }
00142
00143
00144 Foam::scalar Foam::polySplineEdge::length() const
00145 {
00146 return polyLine::length();
00147 }
00148
00149
00150
Copyright © 2000-2009 OpenCFD Ltd