mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
3
src/PLib/FILES
Executable file
3
src/PLib/FILES
Executable file
@@ -0,0 +1,3 @@
|
||||
PLib_ChangeDim.gxx
|
||||
PLib_JacobiPolynomial_0.hxx
|
||||
PLib_CMPLRS.edl
|
494
src/PLib/PLib.cdl
Executable file
494
src/PLib/PLib.cdl
Executable file
@@ -0,0 +1,494 @@
|
||||
-- File: PLib.cdl
|
||||
-- Created: Mon Aug 28 11:17:53 1995
|
||||
-- Author: Laurent BOURESCHE
|
||||
-- <lbo@phylox>
|
||||
-- Modified: 28/02/1996 by PMN : HermiteCoefficients added
|
||||
-- Modified: 19/02/1997 by JCT : EvalPoly2Var added
|
||||
|
||||
-- Modified: 05/09/97 by JPI for SSV : JacobiPolynomial --
|
||||
-- DoubleJacobiPolynomial, HermiteInterpolate, JacobiParameters
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
package PLib
|
||||
|
||||
---Purpose: PLib means Polynomial functions library. This pk
|
||||
-- provides basic computation functions for
|
||||
-- polynomial functions.
|
||||
--
|
||||
|
||||
uses Standard, math, TColStd, gp, TColgp, GeomAbs
|
||||
|
||||
is
|
||||
deferred class Base from PLib;
|
||||
class JacobiPolynomial from PLib;
|
||||
class HermitJacobi from PLib;
|
||||
class DoubleJacobiPolynomial from PLib;
|
||||
|
||||
NoWeights returns Array1OfReal from TColStd;
|
||||
---Purpose: Used as argument for a non rational functions
|
||||
--
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
|
||||
NoWeights2 returns Array2OfReal from TColStd;
|
||||
---Purpose: Used as argument for a non rational functions
|
||||
--
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
|
||||
SetPoles(Poles : Array1OfPnt from TColgp;
|
||||
FP : out Array1OfReal from TColStd);
|
||||
---Purpose: Copy in FP the coordinates of the poles.
|
||||
|
||||
SetPoles(Poles : Array1OfPnt from TColgp;
|
||||
Weights : Array1OfReal from TColStd;
|
||||
FP : out Array1OfReal from TColStd);
|
||||
---Purpose: Copy in FP the coordinates of the poles.
|
||||
|
||||
GetPoles(FP : Array1OfReal from TColStd;
|
||||
Poles : out Array1OfPnt from TColgp);
|
||||
---Purpose: Get from FP the coordinates of the poles.
|
||||
|
||||
GetPoles(FP : Array1OfReal from TColStd;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
Weights : out Array1OfReal from TColStd);
|
||||
---Purpose: Get from FP the coordinates of the poles.
|
||||
|
||||
SetPoles(Poles : Array1OfPnt2d from TColgp;
|
||||
FP : out Array1OfReal from TColStd);
|
||||
---Purpose: Copy in FP the coordinates of the poles.
|
||||
|
||||
SetPoles(Poles : Array1OfPnt2d from TColgp;
|
||||
Weights : Array1OfReal from TColStd;
|
||||
FP : out Array1OfReal from TColStd);
|
||||
---Purpose: Copy in FP the coordinates of the poles.
|
||||
|
||||
GetPoles(FP : Array1OfReal from TColStd;
|
||||
Poles : out Array1OfPnt2d from TColgp);
|
||||
---Purpose: Get from FP the coordinates of the poles.
|
||||
|
||||
GetPoles(FP : Array1OfReal from TColStd;
|
||||
Poles : out Array1OfPnt2d from TColgp;
|
||||
Weights : out Array1OfReal from TColStd);
|
||||
---Purpose: Get from FP the coordinates of the poles.
|
||||
|
||||
Bin(N,P : Integer) returns Real;
|
||||
---Purpose: Returns the Binomial Cnp , without testing anything.
|
||||
---C++: inline
|
||||
|
||||
Binomial(N : Integer);
|
||||
---Purpose: test on N > maxbinom and build the PASCAL triangle
|
||||
-- on size N if necessary.
|
||||
---C++: inline
|
||||
|
||||
InternalBinomial(N : Integer;
|
||||
maxbinom : out Integer;
|
||||
binom : out Address);
|
||||
---Purpose: only called by Binomial(N,P)
|
||||
|
||||
RationalDerivative(Degree : Integer;
|
||||
N : Integer;
|
||||
Dimension : Integer;
|
||||
Ders : in out Real;
|
||||
RDers : in out Real;
|
||||
All : Boolean = Standard_True);
|
||||
---Purpose: Computes the derivatives of a ratio at order
|
||||
-- <N> in dimension <Dimension>.
|
||||
--
|
||||
-- <Ders> is an array containing the values of the
|
||||
-- input derivatives from 0 to Min(<N>,<Degree>).
|
||||
-- For orders higher than <Degree> the inputcd /s2d1/BMDL/
|
||||
-- derivatives are assumed to be 0.
|
||||
--
|
||||
-- Content of <Ders> :
|
||||
--
|
||||
-- x(1),x(2),...,x(Dimension),w
|
||||
-- x'(1),x'(2),...,x'(Dimension),w'
|
||||
-- x''(1),x''(2),...,x''(Dimension),w''
|
||||
--
|
||||
-- If <All> is false, only the derivative at order
|
||||
-- <N> is computed. <RDers> is an array of length
|
||||
-- Dimension which will contain the result :
|
||||
--
|
||||
-- x(1)/w , x(2)/w , ... derivated <N> times
|
||||
--
|
||||
-- If <All> is true all the derivatives up to order
|
||||
-- <N> are computed. <RDers> is an array of length
|
||||
-- Dimension * (N+1) which will contains :
|
||||
--
|
||||
-- x(1)/w , x(2)/w , ...
|
||||
-- x(1)/w , x(2)/w , ... derivated <1> times
|
||||
-- x(1)/w , x(2)/w , ... derivated <2> times
|
||||
-- ...
|
||||
-- x(1)/w , x(2)/w , ... derivated <N> times
|
||||
--
|
||||
-- Warning: <RDers> must be dimensionned properly.
|
||||
|
||||
|
||||
RationalDerivatives(DerivativesRequest : Integer;
|
||||
Dimension : Integer;
|
||||
PolesDerivatives : in out Real;
|
||||
WeightsDerivatives : in out Real;
|
||||
RationalDerivates : in out Real) ;
|
||||
|
||||
---Purpose: Computes DerivativesRequest derivatives of a ratio at
|
||||
-- of a BSpline function of degree <Degree>
|
||||
-- dimension <Dimension>.
|
||||
--
|
||||
-- <PolesDerivatives> is an array containing the values
|
||||
-- of the input derivatives from 0 to <DerivativeRequest>
|
||||
-- For orders higher than <Degree> the input
|
||||
-- derivatives are assumed to be 0.
|
||||
--
|
||||
-- Content of <PoleasDerivatives> :
|
||||
--
|
||||
-- x(1),x(2),...,x(Dimension)
|
||||
-- x'(1),x'(2),...,x'(Dimension)
|
||||
-- x''(1),x''(2),...,x''(Dimension)
|
||||
--
|
||||
--
|
||||
-- WeightsDerivatives is an array that contains derivatives
|
||||
-- from 0 to <DerivativeRequest>
|
||||
-- After returning from the routine the array
|
||||
-- RationalDerivatives contains the following
|
||||
-- x(1)/w , x(2)/w , ...
|
||||
-- x(1)/w , x(2)/w , ... derivated once
|
||||
-- x(1)/w , x(2)/w , ... twice
|
||||
-- x(1)/w , x(2)/w , ... derivated <DerivativeRequest> times
|
||||
--
|
||||
-- The array RationalDerivatives and PolesDerivatives
|
||||
-- can be same since the overwrite is non destructive within
|
||||
-- the algorithm
|
||||
--
|
||||
-- Warning: <RationalDerivates> must be dimensionned properly.
|
||||
|
||||
|
||||
EvalPolynomial(U : Real;
|
||||
DerivativeOrder : Integer ;
|
||||
Degree : Integer ;
|
||||
Dimension : Integer ;
|
||||
PolynomialCoeff : in out Real ;
|
||||
Results : in out Real) ;
|
||||
|
||||
---Purpose: Performs Horner method with synthethic division
|
||||
-- for derivatives
|
||||
-- parameter <U>, with <Degree> and <Dimension>.
|
||||
-- PolynomialCoeff are stored in the following fashion
|
||||
-- c0(1) c0(2) .... c0(Dimension)
|
||||
-- c1(1) c1(2) .... c1(Dimension)
|
||||
--
|
||||
--
|
||||
-- cDegree(1) cDegree(2) .... cDegree(Dimension)
|
||||
-- where the polynomial is defined as :
|
||||
--
|
||||
-- 2 Degree
|
||||
-- c0 + c1 X + c2 X + .... cDegree X
|
||||
--
|
||||
-- Results stores the result in the following format
|
||||
--
|
||||
-- f(1) f(2) .... f(Dimension)
|
||||
-- (1) (1) (1)
|
||||
-- f (1) f (2) .... f (Dimension)
|
||||
--
|
||||
-- (DerivativeRequest) (DerivativeRequest)
|
||||
-- f (1) f (Dimension)
|
||||
--
|
||||
-- this just evaluates the point at parameter U
|
||||
--
|
||||
-- Warning: <Results> and <PolynomialCoeff> must be dimensioned properly
|
||||
--
|
||||
--
|
||||
|
||||
NoDerivativeEvalPolynomial(U : Real;
|
||||
Degree : Integer ;
|
||||
Dimension : Integer ;
|
||||
DegreeDimension : Integer ;
|
||||
PolynomialCoeff : in out Real ;
|
||||
Results : in out Real) ;
|
||||
---Purpose: Same as above with DerivativeOrder = 0;
|
||||
|
||||
EvalPoly2Var(U,V : Real;
|
||||
UDerivativeOrder,VDerivativeOrder : Integer ;
|
||||
UDegree,VDegree,Dimension : Integer ;
|
||||
PolynomialCoeff : in out Real;
|
||||
Results : in out Real) ;
|
||||
|
||||
---Purpose: Applies EvalPolynomial twice to evaluate the derivative
|
||||
-- of orders UDerivativeOrder in U, VDerivativeOrder in V
|
||||
-- at parameters U,V
|
||||
--
|
||||
--
|
||||
-- PolynomialCoeff are stored in the following fashion
|
||||
-- c00(1) .... c00(Dimension)
|
||||
-- c10(1) .... c10(Dimension)
|
||||
-- ....
|
||||
-- cm0(1) .... cm0(Dimension)
|
||||
-- ....
|
||||
-- c01(1) .... c01(Dimension)
|
||||
-- c11(1) .... c11(Dimension)
|
||||
-- ....
|
||||
-- cm1(1) .... cm1(Dimension)
|
||||
-- ....
|
||||
-- c0n(1) .... c0n(Dimension)
|
||||
-- c1n(1) .... c1n(Dimension)
|
||||
-- ....
|
||||
-- cmn(1) .... cmn(Dimension)
|
||||
--
|
||||
--
|
||||
-- where the polynomial is defined as :
|
||||
-- 2 m
|
||||
-- c00 + c10 U + c20 U + .... + cm0 U
|
||||
-- 2 m
|
||||
-- + c01 V + c11 UV + c21 U V + .... + cm1 U V
|
||||
-- n m n
|
||||
-- + .... + c0n V + .... + cmn U V
|
||||
--
|
||||
-- with m = UDegree and n = VDegree
|
||||
--
|
||||
-- Results stores the result in the following format
|
||||
--
|
||||
-- f(1) f(2) .... f(Dimension)
|
||||
--
|
||||
-- Warning: <Results> and <PolynomialCoeff> must be dimensioned properly
|
||||
--
|
||||
--
|
||||
|
||||
|
||||
EvalLagrange(U : Real ;
|
||||
DerivativeOrder : Integer ;
|
||||
Degree : Integer ;
|
||||
Dimension : Integer ;
|
||||
ValueArray : in out Real;
|
||||
ParameterArray : in out Real;
|
||||
Results : in out Real) returns Integer ;
|
||||
|
||||
---Purpose: Performs the Lagrange Interpolation of
|
||||
-- given series of points with given parameters
|
||||
-- with the requested derivative order
|
||||
-- Results will store things in the following format
|
||||
-- with d = DerivativeOrder
|
||||
--
|
||||
-- [0], [Dimension-1] : value
|
||||
-- [Dimension], [Dimension + Dimension-1] : first derivative
|
||||
--
|
||||
-- [d *Dimension], [d*Dimension + Dimension-1]: dth derivative
|
||||
|
||||
EvalCubicHermite(U : Real ;
|
||||
DerivativeOrder : Integer ;
|
||||
Dimension : Integer ;
|
||||
ValueArray : in out Real;
|
||||
DerivativeArray : in out Real;
|
||||
ParameterArray : in out Real;
|
||||
Results : in out Real) returns Integer ;
|
||||
|
||||
---Purpose: Performs the Cubic Hermite Interpolation of
|
||||
-- given series of points with given parameters
|
||||
-- with the requested derivative order.
|
||||
-- ValueArray stores the value at the first and
|
||||
-- last parameter. It has the following format :
|
||||
-- [0], [Dimension-1] : value at first param
|
||||
-- [Dimension], [Dimension + Dimension-1] : value at last param
|
||||
-- Derivative array stores the value of the derivatives
|
||||
-- at the first parameter and at the last parameter
|
||||
-- in the following format
|
||||
-- [0], [Dimension-1] : derivative at
|
||||
-- first param
|
||||
-- [Dimension], [Dimension + Dimension-1] : derivative at
|
||||
-- last param
|
||||
--
|
||||
-- ParameterArray stores the first and last parameter
|
||||
-- in the following format :
|
||||
-- [0] : first parameter
|
||||
-- [1] : last parameter
|
||||
--
|
||||
-- Results will store things in the following format
|
||||
-- with d = DerivativeOrder
|
||||
--
|
||||
-- [0], [Dimension-1] : value
|
||||
-- [Dimension], [Dimension + Dimension-1] : first derivative
|
||||
--
|
||||
-- [d *Dimension], [d*Dimension + Dimension-1]: dth derivative
|
||||
|
||||
HermiteCoefficients(FirstParameter : in Real;
|
||||
LastParameter : in Real;
|
||||
FirstOrder : in Integer;
|
||||
LastOrder : in Integer;
|
||||
MatrixCoefs : in out Matrix from math)
|
||||
|
||||
---Purpose: This build the coefficient of Hermite's polynomes on
|
||||
-- [FirstParameter, LastParameter]
|
||||
--
|
||||
-- if j <= FirstOrder+1 then
|
||||
--
|
||||
-- MatrixCoefs[i, j] = ith coefficient of the polynome H0,j-1
|
||||
--
|
||||
-- else
|
||||
--
|
||||
-- MatrixCoefs[i, j] = ith coefficient of the polynome H1,k
|
||||
-- with k = j - FirstOrder - 2
|
||||
--
|
||||
-- return false if
|
||||
-- - |FirstParameter| > 100
|
||||
-- - |LastParameter| > 100
|
||||
-- - |FirstParameter| +|LastParameter| < 1/100
|
||||
-- - |LastParameter - FirstParameter|
|
||||
-- / (|FirstParameter| +|LastParameter|) < 1/100
|
||||
returns Boolean;
|
||||
|
||||
----------------------------------------------------------------
|
||||
-- The following functions computes poles corresponding to --
|
||||
-- given coefficients. --
|
||||
-- PLib::NoWeights() must be given for non rational functions--
|
||||
----------------------------------------------------------------
|
||||
|
||||
CoefficientsPoles(Coefs : in Array1OfPnt from TColgp;
|
||||
WCoefs : in Array1OfReal from TColStd;
|
||||
Poles : in out Array1OfPnt from TColgp;
|
||||
WPoles : in out Array1OfReal from TColStd);
|
||||
|
||||
CoefficientsPoles(Coefs : in Array1OfPnt2d from TColgp;
|
||||
WCoefs : in Array1OfReal from TColStd;
|
||||
Poles : in out Array1OfPnt2d from TColgp;
|
||||
WPoles : in out Array1OfReal from TColStd);
|
||||
|
||||
CoefficientsPoles(Coefs : in Array1OfReal from TColStd;
|
||||
WCoefs : in Array1OfReal from TColStd;
|
||||
Poles : in out Array1OfReal from TColStd;
|
||||
WPoles : in out Array1OfReal from TColStd);
|
||||
|
||||
CoefficientsPoles(dim : in Integer from Standard;
|
||||
Coefs : in Array1OfReal from TColStd;
|
||||
WCoefs : in Array1OfReal from TColStd;
|
||||
Poles : in out Array1OfReal from TColStd;
|
||||
WPoles : in out Array1OfReal from TColStd);
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
-- The following functions trim the Bezier curve between two --
|
||||
-- parametric values U1, U2. --
|
||||
-- Can be used to extend the curve : --
|
||||
-- Parameters U1<0. or U2>1. can be given. --
|
||||
-- PLib::NoWeights() must be given for non rational functions--
|
||||
----------------------------------------------------------------
|
||||
|
||||
|
||||
Trimming (U1, U2 : in Real;
|
||||
Coeffs : in out Array1OfPnt from TColgp;
|
||||
WCoeffs : in out Array1OfReal from TColStd);
|
||||
|
||||
|
||||
Trimming (U1, U2 : in Real;
|
||||
Coeffs : in out Array1OfPnt2d from TColgp;
|
||||
WCoeffs : in out Array1OfReal from TColStd);
|
||||
|
||||
|
||||
Trimming (U1, U2 : in Real;
|
||||
Coeffs : in out Array1OfReal from TColStd;
|
||||
WCoeffs : in out Array1OfReal from TColStd);
|
||||
|
||||
|
||||
Trimming (U1, U2 : in Real;
|
||||
dim : in Integer;
|
||||
Coeffs : in out Array1OfReal from TColStd;
|
||||
WCoeffs : in out Array1OfReal from TColStd);
|
||||
|
||||
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
-- The following functions computes poles corresponding to --
|
||||
-- given coefficients. --
|
||||
-- PLib::NoWeights2() must be given for non rational --
|
||||
-- functions. --
|
||||
----------------------------------------------------------------
|
||||
|
||||
CoefficientsPoles(Coefs : in Array2OfPnt from TColgp;
|
||||
WCoefs : in Array2OfReal from TColStd;
|
||||
Poles : in out Array2OfPnt from TColgp;
|
||||
WPoles : in out Array2OfReal from TColStd);
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
-- The following functions trim the Bezier surface between --
|
||||
-- two parametric values. --
|
||||
-- Can be used to extend the surface : --
|
||||
-- Parameters U1(V1)<0. or U2(V2)>1. can be given. --
|
||||
-- PLib::NoWeights2() must be given for non rational --
|
||||
-- functions. --
|
||||
----------------------------------------------------------------
|
||||
|
||||
|
||||
UTrimming (U1, U2 : in Real;
|
||||
Coeffs : in out Array2OfPnt from TColgp;
|
||||
WCoeffs : in out Array2OfReal from TColStd);
|
||||
|
||||
|
||||
VTrimming (V1, V2 : in Real;
|
||||
Coeffs : in out Array2OfPnt from TColgp;
|
||||
WCoeffs : in out Array2OfReal from TColStd);
|
||||
|
||||
|
||||
HermiteInterpolate(Dimension : in Integer;
|
||||
FirstParameter,LastParameter : in Real;
|
||||
FirstOrder,LastOrder : in Integer;
|
||||
FirstConstr,LastConstr : Array2OfReal from TColStd;
|
||||
Coefficients : out Array1OfReal from TColStd)
|
||||
returns Boolean from Standard;
|
||||
---Purpose : Compute the coefficients in the canonical base of the
|
||||
-- polynomial satisfying the given constraints
|
||||
-- at the given parameters
|
||||
-- The array FirstContr(i,j) i=1,Dimension j=0,FirstOrder
|
||||
-- contains the values of the constraint at parameter FirstParameter
|
||||
-- idem for LastConstr
|
||||
|
||||
JacobiParameters (ConstraintOrder: Shape from GeomAbs;
|
||||
MaxDegree, Code: in Integer;
|
||||
NbGaussPoints: out Integer;
|
||||
WorkDegree: out Integer)
|
||||
---Purpose : Compute the number of points used for integral
|
||||
-- computations (NbGaussPoints) and the degree of Jacobi
|
||||
-- Polynomial (WorkDegree).
|
||||
-- ConstraintOrder has to be GeomAbs_C0, GeomAbs_C1 or GeomAbs_C2
|
||||
-- Code: Code d' init. des parametres de discretisation.
|
||||
-- = -5
|
||||
-- = -4
|
||||
-- = -3
|
||||
-- = -2
|
||||
-- = -1
|
||||
-- = 1 calcul rapide avec precision moyenne.
|
||||
-- = 2 calcul rapide avec meilleure precision.
|
||||
-- = 3 calcul un peu plus lent avec bonne precision.
|
||||
-- = 4 calcul lent avec la meilleure precision possible.
|
||||
|
||||
raises ConstructionError from Standard;
|
||||
-- if ConstraintOrder or Code is not valid
|
||||
-- MaxDegree < 2*NivConstr+2 or MaxDegree > 50
|
||||
--
|
||||
---------- new
|
||||
NivConstr(ConstraintOrder : Shape from GeomAbs)
|
||||
---Purpose: translates from GeomAbs_Shape to Integer
|
||||
returns Integer
|
||||
raises ConstructionError from Standard;
|
||||
|
||||
ConstraintOrder(NivConstr : Integer)
|
||||
---Purpose: translates from Integer to GeomAbs_Shape
|
||||
returns Shape from GeomAbs
|
||||
raises ConstructionError from Standard;
|
||||
|
||||
|
||||
EvalLength(Degree : Integer;
|
||||
Dimension : Integer;
|
||||
PolynomialCoeff : in out Real;
|
||||
U1, U2 : Real;
|
||||
Length : out Real);
|
||||
|
||||
EvalLength(Degree : Integer;
|
||||
Dimension : Integer;
|
||||
PolynomialCoeff : in out Real;
|
||||
U1, U2 : Real;
|
||||
Tol : Real;
|
||||
Length : out Real;
|
||||
Error : out Real);
|
||||
|
||||
end PLib;
|
2946
src/PLib/PLib.cxx
Executable file
2946
src/PLib/PLib.cxx
Executable file
File diff suppressed because it is too large
Load Diff
28
src/PLib/PLib.lxx
Executable file
28
src/PLib/PLib.lxx
Executable file
@@ -0,0 +1,28 @@
|
||||
// File: PLib.lxx
|
||||
// Created: Fri Sep 1 16:13:30 1995
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phylox>
|
||||
|
||||
static Standard_Integer maxbinom = -1;
|
||||
static Standard_Address binom;
|
||||
|
||||
inline TColStd_Array1OfReal& PLib::NoWeights()
|
||||
{
|
||||
return (*((TColStd_Array1OfReal*) NULL ));
|
||||
}
|
||||
|
||||
inline TColStd_Array2OfReal& PLib::NoWeights2()
|
||||
{
|
||||
return (*((TColStd_Array2OfReal*) NULL ));
|
||||
}
|
||||
|
||||
inline Standard_Real PLib::Bin(const Standard_Integer N,
|
||||
const Standard_Integer P)
|
||||
{
|
||||
return (Standard_Real)((Standard_Integer**)binom)[N][P];
|
||||
}
|
||||
|
||||
inline void PLib::Binomial(const Standard_Integer N)
|
||||
{
|
||||
if (N > maxbinom) PLib::InternalBinomial(N,maxbinom,binom);
|
||||
}
|
71
src/PLib/PLib_Base.cdl
Executable file
71
src/PLib/PLib_Base.cdl
Executable file
@@ -0,0 +1,71 @@
|
||||
-- File: PLib_Base.cdl
|
||||
-- Created: Wed Oct 22 10:33:35 1997
|
||||
-- Author: Philippe MANGIN / Sergey SOKOLOV
|
||||
-- <ssv@velox.nnov.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
deferred class Base from PLib inherits TShared from MMgt
|
||||
|
||||
---Purpose: To work with different polynomial's Bases
|
||||
|
||||
uses
|
||||
Array1OfReal from TColStd
|
||||
|
||||
is
|
||||
ToCoefficients (me ; Dimension, Degree : Integer;
|
||||
CoeffinBase : Array1OfReal from TColStd ;
|
||||
Coefficients : out Array1OfReal from TColStd)
|
||||
---Purpose:
|
||||
-- Convert the polynomial P(t) in the canonical base.
|
||||
is deferred;
|
||||
|
||||
D0 (me : mutable; U : Real;
|
||||
BasisValue : out Array1OfReal from TColStd)
|
||||
---Purpose: Compute the values of the basis functions in u
|
||||
--
|
||||
is deferred;
|
||||
|
||||
D1 (me : mutable; U : Real;
|
||||
BasisValue : out Array1OfReal from TColStd;
|
||||
BasisD1 : out Array1OfReal from TColStd)
|
||||
---Purpose: Compute the values and the derivatives values of
|
||||
-- the basis functions in u
|
||||
is deferred;
|
||||
|
||||
D2 (me : mutable; U : Real;
|
||||
BasisValue : out Array1OfReal from TColStd;
|
||||
BasisD1 : out Array1OfReal from TColStd;
|
||||
BasisD2 : out Array1OfReal from TColStd)
|
||||
---Purpose: Compute the values and the derivatives values of
|
||||
-- the basis functions in u
|
||||
is deferred;
|
||||
|
||||
D3 (me : mutable; U : Real;
|
||||
BasisValue : out Array1OfReal from TColStd;
|
||||
BasisD1 : out Array1OfReal from TColStd;
|
||||
BasisD2 : out Array1OfReal from TColStd;
|
||||
BasisD3 : out Array1OfReal from TColStd)
|
||||
---Purpose: Compute the values and the derivatives values of
|
||||
-- the basis functions in u
|
||||
is deferred;
|
||||
|
||||
WorkDegree (me) returns Integer
|
||||
--- Purpose: returns WorkDegree
|
||||
is deferred;
|
||||
|
||||
ReduceDegree ( me ; Dimension , MaxDegree : Integer ; Tol : Real ;
|
||||
BaseCoeff : in out Real;
|
||||
NewDegree : out Integer ;
|
||||
MaxError : out Real)
|
||||
|
||||
---Purpose:
|
||||
-- Compute NewDegree <= MaxDegree so that MaxError is lower
|
||||
-- than Tol.
|
||||
-- MaxError can be greater than Tol if it is not possible
|
||||
-- to find a NewDegree <= MaxDegree.
|
||||
-- In this case NewDegree = MaxDegree
|
||||
--
|
||||
|
||||
is deferred;
|
||||
|
||||
end Base;
|
7
src/PLib/PLib_Base.cxx
Executable file
7
src/PLib/PLib_Base.cxx
Executable file
@@ -0,0 +1,7 @@
|
||||
// File: PLib_Base.cxx
|
||||
// Created: Wed Oct 22 14:58:47 1997
|
||||
// Author: Sergey SOKOLOV
|
||||
// <ssv@velox.nnov.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <PLib_Base.ixx>
|
16
src/PLib/PLib_CMPLRS.edl
Executable file
16
src/PLib/PLib_CMPLRS.edl
Executable file
@@ -0,0 +1,16 @@
|
||||
-- File: PLib_CMPLRS.edl
|
||||
-- Author: Jean GAUTIER
|
||||
-- History: Mon Feb 19 12:04:00 1996 Jean GAUTIER Creation
|
||||
-- Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
|
||||
@if ( %Station == "sil" ) then
|
||||
|
||||
@if ( %DebugMode == "False" ) then
|
||||
@set %ModeOpt = "-O1";
|
||||
@set %CMPLRS_F77_ModeOpt = "-O1";
|
||||
@endif;
|
||||
|
||||
|
||||
@endif;
|
144
src/PLib/PLib_ChangeDim.gxx
Executable file
144
src/PLib/PLib_ChangeDim.gxx
Executable file
@@ -0,0 +1,144 @@
|
||||
// File: PLib_ChangeDim.gxx
|
||||
// Created: Fri Sep 1 15:52:10 1995
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phylox>
|
||||
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
|
||||
//=======================================================================
|
||||
//function : SetPoles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib::SetPoles(const Array1OfPoints& Poles,
|
||||
TColStd_Array1OfReal& FP)
|
||||
{
|
||||
Standard_Integer i;
|
||||
Standard_Integer j = FP .Lower();
|
||||
Standard_Integer PLower = Poles.Lower();
|
||||
Standard_Integer PUpper = Poles.Upper();
|
||||
if (Dimension_gen == 3) {
|
||||
|
||||
for (i = PLower; i <= PUpper; i++) {
|
||||
const Point& P = Poles(i);
|
||||
FP(j) = P.Coord(1); j++;
|
||||
FP(j) = P.Coord(2); j++;
|
||||
FP(j) = P.Coord(3); j++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
for (i = PLower; i <= PUpper; i++) {
|
||||
const Point& P = Poles(i);
|
||||
FP(j) = P.Coord(1); j++;
|
||||
FP(j) = P.Coord(2); j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetPoles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib::SetPoles(const Array1OfPoints& Poles,
|
||||
const TColStd_Array1OfReal& Weights,
|
||||
TColStd_Array1OfReal& FP)
|
||||
{
|
||||
Standard_Real w;
|
||||
Standard_Integer i;
|
||||
Standard_Integer j = FP .Lower();
|
||||
Standard_Integer PLower = Poles.Lower();
|
||||
Standard_Integer PUpper = Poles.Upper();
|
||||
if (Dimension_gen == 3) {
|
||||
|
||||
for (i = PLower; i <= PUpper; i++) {
|
||||
w = Weights(i);
|
||||
const Point& P = Poles(i);
|
||||
FP(j) = P.Coord(1) * w; j++;
|
||||
FP(j) = P.Coord(2) * w; j++;
|
||||
FP(j) = P.Coord(3) * w; j++;
|
||||
FP(j) = w; j++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
for (i = PLower; i <= PUpper; i++) {
|
||||
w = Weights(i);
|
||||
const Point& P = Poles(i);
|
||||
FP(j) = P.Coord(1) * w; j++;
|
||||
FP(j) = P.Coord(2) * w; j++;
|
||||
FP(j) = w; j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetPoles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib::GetPoles(const TColStd_Array1OfReal& FP,
|
||||
Array1OfPoints& Poles)
|
||||
{
|
||||
Standard_Integer i;
|
||||
Standard_Integer j = FP .Lower();
|
||||
Standard_Integer PLower = Poles.Lower();
|
||||
Standard_Integer PUpper = Poles.Upper();
|
||||
if (Dimension_gen == 3) {
|
||||
|
||||
for (i = PLower; i <= PUpper; i++) {
|
||||
Point& P = Poles(i);
|
||||
P.SetCoord(1,FP(j)); j++;
|
||||
P.SetCoord(2,FP(j)); j++;
|
||||
P.SetCoord(3,FP(j)); j++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
for (i = PLower; i <= PUpper; i++) {
|
||||
Point& P = Poles(i);
|
||||
P.SetCoord(1,FP(j)); j++;
|
||||
P.SetCoord(2,FP(j)); j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetPoles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib::GetPoles(const TColStd_Array1OfReal& FP,
|
||||
Array1OfPoints& Poles,
|
||||
TColStd_Array1OfReal& Weights)
|
||||
{
|
||||
Standard_Real w;
|
||||
Standard_Integer i;
|
||||
Standard_Integer j = FP .Lower();
|
||||
Standard_Integer PLower = Poles.Lower();
|
||||
Standard_Integer PUpper = Poles.Upper();
|
||||
if (Dimension_gen == 3) {
|
||||
|
||||
for (i = PLower; i <= PUpper; i++) {
|
||||
Weights(i) = w = FP(j + 3);
|
||||
Point& P = Poles(i);
|
||||
P.SetCoord(1,FP(j) / w); j++;
|
||||
P.SetCoord(2,FP(j) / w); j++;
|
||||
P.SetCoord(3,FP(j) / w); j++;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
for (i = PLower; i <= PUpper; i++) {
|
||||
Weights(i) = w = FP(j + 2);
|
||||
Point& P = Poles(i);
|
||||
P.SetCoord(1,FP(j) / w); j++;
|
||||
P.SetCoord(2,FP(j) / w); j++;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
70
src/PLib/PLib_DoubleJacobiPolynomial.cdl
Executable file
70
src/PLib/PLib_DoubleJacobiPolynomial.cdl
Executable file
@@ -0,0 +1,70 @@
|
||||
-- File: PLib_DoubleJacobiPolynomial.cdl
|
||||
-- Created: Tue May 27 09:44:41 1997
|
||||
-- Author: Sergey SOKOLOV
|
||||
-- <ssm@nonox.nizhny.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
|
||||
class DoubleJacobiPolynomial from PLib
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses Array1OfReal,HArray1OfReal from TColStd,
|
||||
JacobiPolynomial from PLib
|
||||
|
||||
is
|
||||
Create returns DoubleJacobiPolynomial;
|
||||
|
||||
Create ( JacPolU, JacPolV : JacobiPolynomial from PLib)
|
||||
returns DoubleJacobiPolynomial;
|
||||
|
||||
MaxErrorU ( me; Dimension, DegreeU, DegreeV, dJacCoeff : Integer;
|
||||
JacCoeff : Array1OfReal from TColStd ) returns Real;
|
||||
|
||||
MaxErrorV ( me; Dimension, DegreeU, DegreeV, dJacCoeff : Integer;
|
||||
JacCoeff : Array1OfReal from TColStd ) returns Real;
|
||||
|
||||
MaxError ( me; Dimension, MinDegreeU, MaxDegreeU,
|
||||
MinDegreeV, MaxDegreeV, dJacCoeff : Integer;
|
||||
JacCoeff : Array1OfReal from TColStd; Error : Real ) returns Real;
|
||||
|
||||
ReduceDegree ( me; Dimension, MinDegreeU, MaxDegreeU,
|
||||
MinDegreeV, MaxDegreeV, dJacCoeff : Integer;
|
||||
JacCoeff : Array1OfReal from TColStd; EpmsCut : Real;
|
||||
MaxError : in out Real; NewDegreeU, NewDegreeV : in out Integer);
|
||||
|
||||
AverageError ( me; Dimension, DegreeU, DegreeV, dJacCoeff : Integer;
|
||||
JacCoeff : Array1OfReal from TColStd ) returns Real;
|
||||
|
||||
WDoubleJacobiToCoefficients ( me; Dimension, DegreeU, DegreeV : Integer;
|
||||
JacCoeff : Array1OfReal from TColStd;
|
||||
Coefficients : out Array1OfReal from TColStd );
|
||||
|
||||
U (me)
|
||||
--- Purpose: returns myJacPolU;
|
||||
---C++: inline
|
||||
returns JacobiPolynomial from PLib;
|
||||
|
||||
V (me)
|
||||
--- Purpose: returns myJacPolV;
|
||||
---C++: inline
|
||||
returns JacobiPolynomial from PLib;
|
||||
|
||||
TabMaxU (me)
|
||||
--- Purpose: returns myTabMaxU;
|
||||
---C++: inline
|
||||
returns HArray1OfReal from TColStd;
|
||||
|
||||
TabMaxV (me)
|
||||
--- Purpose: returns myTabMaxV;
|
||||
---C++: inline
|
||||
returns HArray1OfReal from TColStd;
|
||||
|
||||
fields
|
||||
|
||||
myJacPolU : JacobiPolynomial from PLib;
|
||||
myJacPolV : JacobiPolynomial from PLib;
|
||||
myTabMaxU : HArray1OfReal from TColStd;
|
||||
myTabMaxV : HArray1OfReal from TColStd;
|
||||
|
||||
end DoubleJacobiPolynomial;
|
335
src/PLib/PLib_DoubleJacobiPolynomial.cxx
Executable file
335
src/PLib/PLib_DoubleJacobiPolynomial.cxx
Executable file
@@ -0,0 +1,335 @@
|
||||
// File: PLib_DoubleJacobiPolynomial.cxx
|
||||
// Created: Wed May 28 09:11:33 1997
|
||||
// Author: Sergey SOKOLOV
|
||||
// <ssv@nonox.nizhny.matra-dtv.fr>
|
||||
|
||||
#include <PLib_DoubleJacobiPolynomial.ixx>
|
||||
#include <PLib_JacobiPolynomial.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : PLib_DoubleJacobiPolynomial
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
PLib_DoubleJacobiPolynomial::PLib_DoubleJacobiPolynomial()
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PLib_DoubleJacobiPolynomial
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
PLib_DoubleJacobiPolynomial::PLib_DoubleJacobiPolynomial(const Handle(PLib_JacobiPolynomial)& JacPolU,
|
||||
const Handle(PLib_JacobiPolynomial)& JacPolV) :
|
||||
myJacPolU(JacPolU),
|
||||
myJacPolV(JacPolV)
|
||||
{
|
||||
Handle (TColStd_HArray1OfReal) TabMaxU =
|
||||
new TColStd_HArray1OfReal (0,JacPolU->WorkDegree()-2*(JacPolU->NivConstr()+1));
|
||||
JacPolU->MaxValue(TabMaxU->ChangeArray1());
|
||||
myTabMaxU = TabMaxU;
|
||||
|
||||
Handle (TColStd_HArray1OfReal) TabMaxV =
|
||||
new TColStd_HArray1OfReal (0,JacPolV->WorkDegree()-2*(JacPolV->NivConstr()+1));
|
||||
JacPolV->MaxValue(TabMaxV->ChangeArray1());
|
||||
myTabMaxV = TabMaxV;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxErrorU
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real
|
||||
PLib_DoubleJacobiPolynomial::MaxErrorU(const Standard_Integer Dimension,
|
||||
const Standard_Integer DegreeU,
|
||||
const Standard_Integer DegreeV,
|
||||
const Standard_Integer dJacCoeff,
|
||||
const TColStd_Array1OfReal& JacCoeff) const
|
||||
{
|
||||
Standard_Integer ii,idim,dJac,MinU,MinV,WorkDegreeU,WorkDegreeV;
|
||||
Standard_Real Bid0;
|
||||
|
||||
math_Vector MaxErrDim(1,Dimension,0.);
|
||||
|
||||
MinU = 2*(myJacPolU->NivConstr()+1);
|
||||
MinV = 2*(myJacPolV->NivConstr()+1);
|
||||
WorkDegreeU = myJacPolU->WorkDegree();
|
||||
WorkDegreeV = myJacPolV->WorkDegree();
|
||||
|
||||
Bid0 = myTabMaxV->Value(DegreeV-MinV);
|
||||
for (idim=1; idim<=Dimension; idim++) {
|
||||
dJac = dJacCoeff + (idim-1)*(WorkDegreeU+1)*(WorkDegreeV+1);
|
||||
for (ii=MinU; ii<=DegreeU; ii++) {
|
||||
MaxErrDim(idim) += (Abs(JacCoeff(ii + DegreeV*(WorkDegreeU+1) + dJac)) *
|
||||
myTabMaxU->Value(ii-MinU) * Bid0);
|
||||
}
|
||||
}
|
||||
return (MaxErrDim.Norm());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxErrorV
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real
|
||||
PLib_DoubleJacobiPolynomial::MaxErrorV(const Standard_Integer Dimension,
|
||||
const Standard_Integer DegreeU,
|
||||
const Standard_Integer DegreeV,
|
||||
const Standard_Integer dJacCoeff,
|
||||
const TColStd_Array1OfReal& JacCoeff) const
|
||||
{
|
||||
Standard_Integer jj,idim,dJac,MinU,MinV,WorkDegreeU,WorkDegreeV;
|
||||
Standard_Real Bid0;
|
||||
|
||||
math_Vector MaxErrDim(1,Dimension,0.);
|
||||
|
||||
MinU = 2*(myJacPolU->NivConstr()+1);
|
||||
MinV = 2*(myJacPolV->NivConstr()+1);
|
||||
WorkDegreeU = myJacPolU->WorkDegree();
|
||||
WorkDegreeV = myJacPolV->WorkDegree();
|
||||
|
||||
Bid0 = myTabMaxU->Value(DegreeU-MinU);
|
||||
for (idim=1; idim<=Dimension; idim++) {
|
||||
dJac = dJacCoeff + (idim-1)*(WorkDegreeU+1)*(WorkDegreeV+1);
|
||||
for (jj=MinV; jj<=DegreeV; jj++) {
|
||||
MaxErrDim(idim) += (Abs(JacCoeff(DegreeU + jj*(WorkDegreeU+1) + dJac)) *
|
||||
myTabMaxV->Value(jj-MinV) * Bid0);
|
||||
}
|
||||
}
|
||||
return (MaxErrDim.Norm());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxError
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real
|
||||
PLib_DoubleJacobiPolynomial::MaxError(const Standard_Integer Dimension,
|
||||
const Standard_Integer MinDegreeU,
|
||||
const Standard_Integer MaxDegreeU,
|
||||
const Standard_Integer MinDegreeV,
|
||||
const Standard_Integer MaxDegreeV,
|
||||
const Standard_Integer dJacCoeff,
|
||||
const TColStd_Array1OfReal& JacCoeff,
|
||||
const Standard_Real Error) const
|
||||
{
|
||||
Standard_Integer ii,jj,idim,dJac,MinU,MinV,WorkDegreeU,WorkDegreeV;
|
||||
Standard_Real Bid0,Bid1;
|
||||
|
||||
math_Vector MaxErrDim(1,Dimension,0.);
|
||||
|
||||
MinU = 2*(myJacPolU->NivConstr()+1);
|
||||
MinV = 2*(myJacPolV->NivConstr()+1);
|
||||
WorkDegreeU = myJacPolU->WorkDegree();
|
||||
WorkDegreeV = myJacPolV->WorkDegree();
|
||||
|
||||
//------------------- Calcul du majorant de l'erreur max ---------------
|
||||
//----- lorsque sont enleves les coeff. d'indices MinDegreeU a MaxDegreeU ------
|
||||
//---------------- en U et d'indices MinDegreeV a MaxDegreeV en V --------------
|
||||
|
||||
for (idim=1; idim<=Dimension; idim++) {
|
||||
dJac = dJacCoeff + (idim-1)*(WorkDegreeU+1)*(WorkDegreeV+1);
|
||||
Bid1 = 0.;
|
||||
for (jj=MinDegreeV; jj<=MaxDegreeV; jj++) {
|
||||
Bid0 = 0.;
|
||||
for (ii=MinDegreeU; ii<=MaxDegreeU; ii++) {
|
||||
Bid0 += fabs(JacCoeff(ii + jj*(WorkDegreeU+1) + dJac)) * myTabMaxU->Value(ii-MinU);
|
||||
}
|
||||
Bid1 += Bid0 * myTabMaxV->Value(jj-MinV);
|
||||
}
|
||||
MaxErrDim(idim) = Bid1;
|
||||
}
|
||||
|
||||
//----------------------- Calcul de l' erreur max ----------------------
|
||||
|
||||
math_Vector MaxErr2(1,2);
|
||||
MaxErr2(1) = Error;
|
||||
MaxErr2(2) = MaxErrDim.Norm();
|
||||
return (MaxErr2.Norm());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReduceDegree
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_DoubleJacobiPolynomial::ReduceDegree(const Standard_Integer Dimension,
|
||||
const Standard_Integer MinDegreeU,
|
||||
const Standard_Integer MaxDegreeU,
|
||||
const Standard_Integer MinDegreeV,
|
||||
const Standard_Integer MaxDegreeV,
|
||||
const Standard_Integer dJacCoeff,
|
||||
const TColStd_Array1OfReal& JacCoeff,
|
||||
const Standard_Real EpmsCut,
|
||||
Standard_Real& MaxError,
|
||||
Standard_Integer& NewDegreeU,
|
||||
Standard_Integer& NewDegreeV) const
|
||||
{
|
||||
Standard_Integer NewU,NewV;
|
||||
Standard_Real ErrU,ErrV;
|
||||
|
||||
NewU = MaxDegreeU;
|
||||
NewV = MaxDegreeV;
|
||||
math_Vector MaxErr2(1,2);
|
||||
|
||||
//**********************************************************************
|
||||
//-------------------- Coupure des coefficients ------------------------
|
||||
//**********************************************************************
|
||||
|
||||
do {
|
||||
|
||||
//------------------- Calcul du majorant de l'erreur max ---------------
|
||||
//----- lorsque sont enleves les coeff. d'indices MinU a NewU ------
|
||||
//---------------- en U, le degre en V etant fixe a NewV -----------------
|
||||
if (NewV > MinDegreeV)
|
||||
ErrV = MaxErrorU(Dimension,NewU,NewV,dJacCoeff,JacCoeff);
|
||||
else {
|
||||
ErrV = 2*EpmsCut;
|
||||
}
|
||||
|
||||
//------------------- Calcul du majorant de l'erreur max ---------------
|
||||
//----- lorsque sont enleves les coeff. d'indices MinV a NewV ------
|
||||
//---------------- en V, le degre en U etant fixe a NewU -----------------
|
||||
if (NewU > MinDegreeU)
|
||||
ErrU = MaxErrorV(Dimension,NewU,NewV,dJacCoeff,JacCoeff);
|
||||
else {
|
||||
ErrU = 2*EpmsCut;
|
||||
}
|
||||
|
||||
//----------------------- Calcul de l' erreur max ----------------------
|
||||
MaxErr2(1) = MaxError;
|
||||
MaxErr2(2) = ErrU;
|
||||
ErrU = MaxErr2.Norm();
|
||||
MaxErr2(2) = ErrV;
|
||||
ErrV = MaxErr2.Norm();
|
||||
|
||||
if (ErrU > ErrV) {
|
||||
if (ErrV < EpmsCut) {
|
||||
MaxError = ErrV;
|
||||
NewV--;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ErrU < EpmsCut) {
|
||||
MaxError = ErrU;
|
||||
NewU--;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (ErrU > ErrV && ErrV <= EpmsCut || ErrV >= ErrU && ErrU <= EpmsCut);
|
||||
|
||||
//-------------------------- Recuperation des degres -------------------
|
||||
|
||||
NewDegreeU = Max(NewU,1);
|
||||
NewDegreeV = Max(NewV,1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AverageError
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real
|
||||
PLib_DoubleJacobiPolynomial::AverageError(const Standard_Integer Dimension,
|
||||
const Standard_Integer DegreeU,
|
||||
const Standard_Integer DegreeV,
|
||||
const Standard_Integer dJacCoeff,
|
||||
const TColStd_Array1OfReal& JacCoeff) const
|
||||
{
|
||||
Standard_Integer ii,jj,idim,dJac,IDebU,IDebV,MinU,MinV,WorkDegreeU,WorkDegreeV;
|
||||
Standard_Real Bid0,Bid1,AverageErr;
|
||||
|
||||
//----------------------------- Initialisations ------------------------
|
||||
|
||||
IDebU = 2*(myJacPolU->NivConstr()+1);
|
||||
IDebV = 2*(myJacPolV->NivConstr()+1);
|
||||
MinU = Max(IDebU,DegreeU);
|
||||
MinV = Max(IDebV,DegreeV);
|
||||
WorkDegreeU = myJacPolU->WorkDegree();
|
||||
WorkDegreeV = myJacPolV->WorkDegree();
|
||||
Bid0 = 0.;
|
||||
|
||||
//------------------ Calcul du majorant de l'erreur moyenne ------------
|
||||
//----- lorsque sont enleves les coeff. d'indices DegreeU a WorkDegreeU ------
|
||||
//---------------- en U et d'indices DegreeV a WorkDegreeV en V --------------
|
||||
|
||||
for (idim=1; idim<=Dimension; idim++) {
|
||||
dJac = dJacCoeff + (idim-1)*(WorkDegreeU+1)*(WorkDegreeV+1);
|
||||
for (jj=MinV; jj<=WorkDegreeV; jj++) {
|
||||
for (ii=IDebU; ii<=WorkDegreeU; ii++) {
|
||||
Bid1 = JacCoeff(ii + jj*(WorkDegreeU+1) + dJac);
|
||||
Bid0 += Bid1*Bid1;
|
||||
}
|
||||
}
|
||||
for (jj=IDebV; jj<=MinV-1; jj++) {
|
||||
for (ii=MinU; ii<=WorkDegreeU; ii++) {
|
||||
Bid1 = JacCoeff(ii + jj*(WorkDegreeU+1) + dJac);
|
||||
Bid0 += Bid1*Bid1;
|
||||
}
|
||||
}
|
||||
}
|
||||
AverageErr = sqrt(Bid0/4);
|
||||
return (AverageErr);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WDoubleJacobiToCoefficients
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_DoubleJacobiPolynomial::WDoubleJacobiToCoefficients(const Standard_Integer Dimension,
|
||||
const Standard_Integer DegreeU,
|
||||
const Standard_Integer DegreeV,
|
||||
const TColStd_Array1OfReal& JacCoeff,
|
||||
TColStd_Array1OfReal& Coefficients) const
|
||||
{
|
||||
Standard_Integer iu,iv,idim,WorkDegreeU,WorkDegreeV;
|
||||
|
||||
Coefficients.Init(0.);
|
||||
|
||||
WorkDegreeU = myJacPolU->WorkDegree();
|
||||
WorkDegreeV = myJacPolV->WorkDegree();
|
||||
|
||||
TColStd_Array1OfReal Aux1(0, (DegreeU+1)*(DegreeV+1)*Dimension-1);
|
||||
TColStd_Array1OfReal Aux2(0, (DegreeU+1)*(DegreeV+1)*Dimension-1);
|
||||
|
||||
for (iu=0; iu<=DegreeU; iu++) {
|
||||
for (iv=0; iv<=DegreeV; iv++) {
|
||||
for (idim=1; idim<=Dimension; idim++) {
|
||||
Aux1(idim-1 + iv*Dimension + iu*Dimension*(DegreeV+1)) =
|
||||
JacCoeff(iu + iv*(WorkDegreeU+1) + (idim-1)*(WorkDegreeU+1)*(WorkDegreeV+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Passage dans canonique en u.
|
||||
myJacPolU->ToCoefficients(Dimension*(DegreeV+1),DegreeU,Aux1,Aux2);
|
||||
|
||||
// Permutation des u et des v.
|
||||
for (iu=0; iu<=DegreeU; iu++) {
|
||||
for (iv=0; iv<=DegreeV; iv++) {
|
||||
for (idim=1; idim<=Dimension; idim++) {
|
||||
Aux1(idim-1 + iu*Dimension + iv*Dimension*(DegreeU+1)) =
|
||||
Aux2(idim-1 + iv*Dimension + iu*Dimension*(DegreeV+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Passage dans canonique en v.
|
||||
myJacPolV->ToCoefficients(Dimension*(DegreeU+1),DegreeV,Aux1,Aux2);
|
||||
|
||||
// Permutation des u et des v.
|
||||
for (iu=0; iu<=DegreeU; iu++) {
|
||||
for (iv=0; iv<=DegreeV; iv++) {
|
||||
for (idim=1; idim<=Dimension; idim++) {
|
||||
Coefficients(iu + iv*(DegreeU+1) + (idim-1)*(DegreeU+1)*(DegreeV+1)) =
|
||||
Aux2(idim-1 + iu*Dimension + iv*Dimension*(DegreeU+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
29
src/PLib/PLib_DoubleJacobiPolynomial.lxx
Executable file
29
src/PLib/PLib_DoubleJacobiPolynomial.lxx
Executable file
@@ -0,0 +1,29 @@
|
||||
// File: PLib_DoubleJacobiPolynomial.lxx
|
||||
// Created: Fri Jun 6 14:34:11 1997
|
||||
// Author: Sergey SOKOLOV
|
||||
// <ssm@nonox.nizhny.matra-dtv.fr>
|
||||
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
inline Handle(PLib_JacobiPolynomial) PLib_DoubleJacobiPolynomial::U() const
|
||||
{
|
||||
return myJacPolU;
|
||||
}
|
||||
|
||||
inline Handle(PLib_JacobiPolynomial) PLib_DoubleJacobiPolynomial::V() const
|
||||
{
|
||||
return myJacPolV;
|
||||
}
|
||||
|
||||
inline Handle(TColStd_HArray1OfReal) PLib_DoubleJacobiPolynomial::TabMaxU() const
|
||||
{
|
||||
return myTabMaxU;
|
||||
}
|
||||
|
||||
inline Handle(TColStd_HArray1OfReal) PLib_DoubleJacobiPolynomial::TabMaxV() const
|
||||
{
|
||||
return myTabMaxV;
|
||||
}
|
||||
|
||||
|
160
src/PLib/PLib_HermitJacobi.cdl
Executable file
160
src/PLib/PLib_HermitJacobi.cdl
Executable file
@@ -0,0 +1,160 @@
|
||||
-- File: PLib_HermitJacobi.cdl
|
||||
-- Created: Wed Oct 22 10:52:48 1997
|
||||
-- Author: Philippe MANGIN
|
||||
-- <ssv@velox.nnov.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
class HermitJacobi from PLib
|
||||
|
||||
inherits Base from PLib
|
||||
|
||||
--- Purpose: This class provides method to work with Jacobi Polynomials
|
||||
-- relativly to an order of constraint
|
||||
-- q = myWorkDegree-2*(myNivConstr+1)
|
||||
-- Jk(t) for k=0,q compose the Jacobi Polynomial base relativly to the weigth W(t)
|
||||
-- iorder is the integer value for the constraints:
|
||||
-- iorder = 0 <=> ConstraintOrder = GeomAbs_C0
|
||||
-- iorder = 1 <=> ConstraintOrder = GeomAbs_C1
|
||||
-- iorder = 2 <=> ConstraintOrder = GeomAbs_C2
|
||||
-- P(t) = H(t) + W(t) * Q(t) Where W(t) = (1-t**2)**(2*iordre+2)
|
||||
-- the coefficients JacCoeff represents P(t) JacCoeff are stored as follow:
|
||||
--
|
||||
-- c0(1) c0(2) .... c0(Dimension)
|
||||
-- c1(1) c1(2) .... c1(Dimension)
|
||||
--
|
||||
--
|
||||
--
|
||||
-- cDegree(1) cDegree(2) .... cDegree(Dimension)
|
||||
--
|
||||
-- The coefficients
|
||||
-- c0(1) c0(2) .... c0(Dimension)
|
||||
-- c2*ordre+1(1) ... c2*ordre+1(dimension)
|
||||
--
|
||||
-- represents the part of the polynomial in the
|
||||
-- Hermit's base: H(t)
|
||||
-- H(t) = c0H00(t) + c1H01(t) + ...c(iordre)H(0 ;iorder)+ c(iordre+1)H10(t)+...
|
||||
-- The following coefficients represents the part of the
|
||||
-- polynomial in the Jacobi base ie Q(t)
|
||||
-- Q(t) = c2*iordre+2 J0(t) + ...+ cDegree JDegree-2*iordre-2
|
||||
|
||||
uses
|
||||
Array2OfReal from TColStd,
|
||||
Array1OfReal from TColStd,
|
||||
Shape from GeomAbs,
|
||||
Matrix from math,
|
||||
JacobiPolynomial from PLib
|
||||
|
||||
raises
|
||||
ConstructionError from Standard
|
||||
|
||||
is
|
||||
|
||||
Create ( WorkDegree : Integer ;
|
||||
ConstraintOrder : Shape from GeomAbs)
|
||||
returns HermitJacobi from PLib
|
||||
|
||||
|
||||
---Purpose:
|
||||
-- Initialize the polynomial class
|
||||
-- Degree has to be <= 30
|
||||
-- ConstraintOrder has to be GeomAbs_C0
|
||||
-- GeomAbs_C1
|
||||
-- GeomAbs_C2
|
||||
|
||||
raises ConstructionError from Standard;
|
||||
-- if Degree or ConstraintOrder is non valid
|
||||
|
||||
|
||||
--
|
||||
-- Work in HermitJacobi base
|
||||
|
||||
MaxError ( me ; Dimension : Integer ;
|
||||
HermJacCoeff : in out Real;
|
||||
NewDegree : Integer )
|
||||
returns Real;
|
||||
|
||||
---Purpose:
|
||||
-- This method computes the maximum error on the polynomial
|
||||
-- W(t) Q(t) obtained by missing the coefficients of JacCoeff from
|
||||
-- NewDegree +1 to Degree
|
||||
|
||||
ReduceDegree ( me ; Dimension , MaxDegree : Integer ; Tol : Real ;
|
||||
HermJacCoeff : in out Real;
|
||||
NewDegree : out Integer ;
|
||||
MaxError : out Real);
|
||||
|
||||
---Purpose:
|
||||
-- Compute NewDegree <= MaxDegree so that MaxError is lower
|
||||
-- than Tol.
|
||||
-- MaxError can be greater than Tol if it is not possible
|
||||
-- to find a NewDegree <= MaxDegree.
|
||||
-- In this case NewDegree = MaxDegree
|
||||
--
|
||||
AverageError ( me ; Dimension : Integer ;
|
||||
HermJacCoeff : in out Real;
|
||||
NewDegree : Integer )
|
||||
-- This method computes the average error on the polynomial W(t)Q(t)
|
||||
-- obtained by missing the
|
||||
-- coefficients JacCoeff from NewDegree +1 to Degree
|
||||
returns Real;
|
||||
|
||||
|
||||
ToCoefficients ( me ; Dimension, Degree : Integer ;
|
||||
HermJacCoeff : Array1OfReal from TColStd ;
|
||||
Coefficients : out Array1OfReal from TColStd );
|
||||
|
||||
---Purpose:
|
||||
-- Convert the polynomial P(t) = H(t) + W(t) Q(t) in the canonical base.
|
||||
--
|
||||
|
||||
D0123 (me : mutable; NDerive : Integer; U : Real;
|
||||
BasisValue : out Array1OfReal from TColStd;
|
||||
BasisD1 : out Array1OfReal from TColStd;
|
||||
BasisD2 : out Array1OfReal from TColStd;
|
||||
BasisD3 : out Array1OfReal from TColStd)
|
||||
---Purpose: Compute the values and the derivatives values of
|
||||
-- the basis functions in u
|
||||
is private;
|
||||
|
||||
D0 (me : mutable; U : Real;
|
||||
BasisValue : out Array1OfReal from TColStd);
|
||||
---Purpose: Compute the values of the basis functions in u
|
||||
--
|
||||
|
||||
D1 (me : mutable; U : Real;
|
||||
BasisValue : out Array1OfReal from TColStd;
|
||||
BasisD1 : out Array1OfReal from TColStd);
|
||||
---Purpose: Compute the values and the derivatives values of
|
||||
-- the basis functions in u
|
||||
|
||||
D2 (me : mutable; U : Real;
|
||||
BasisValue : out Array1OfReal from TColStd;
|
||||
BasisD1 : out Array1OfReal from TColStd;
|
||||
BasisD2 : out Array1OfReal from TColStd);
|
||||
---Purpose: Compute the values and the derivatives values of
|
||||
-- the basis functions in u
|
||||
|
||||
D3 (me : mutable; U : Real;
|
||||
BasisValue : out Array1OfReal from TColStd;
|
||||
BasisD1 : out Array1OfReal from TColStd;
|
||||
BasisD2 : out Array1OfReal from TColStd;
|
||||
BasisD3 : out Array1OfReal from TColStd);
|
||||
---Purpose: Compute the values and the derivatives values of
|
||||
-- the basis functions in u
|
||||
|
||||
WorkDegree (me)
|
||||
--- Purpose: returns WorkDegree
|
||||
---C++: inline
|
||||
returns Integer;
|
||||
|
||||
NivConstr (me)
|
||||
---Purpose: returns NivConstr
|
||||
---C++: inline
|
||||
returns Integer;
|
||||
|
||||
fields
|
||||
myH : Matrix from math;
|
||||
myJacobi : JacobiPolynomial from PLib;
|
||||
myWCoeff : Array1OfReal; -- The cannonical Coefficients of W(t).
|
||||
|
||||
end HermitJacobi;
|
296
src/PLib/PLib_HermitJacobi.cxx
Executable file
296
src/PLib/PLib_HermitJacobi.cxx
Executable file
@@ -0,0 +1,296 @@
|
||||
// File: PLib_HermitJacobi.cxx
|
||||
// Created: Wed Oct 22 11:19:36 1997
|
||||
// Author: Sergey SOKOLOV
|
||||
// <ssv@velox.nnov.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <PLib_HermitJacobi.ixx>
|
||||
#include <PLib.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : PLib_HermitJacobi
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
PLib_HermitJacobi::PLib_HermitJacobi(const Standard_Integer WorkDegree,
|
||||
const GeomAbs_Shape ConstraintOrder) :
|
||||
myH(1,2*(PLib::NivConstr(ConstraintOrder)+1),
|
||||
1,2*(PLib::NivConstr(ConstraintOrder)+1)),
|
||||
myWCoeff(1,2*(PLib::NivConstr(ConstraintOrder)+1)+1)
|
||||
{
|
||||
Standard_Integer NivConstr = PLib::NivConstr(ConstraintOrder);
|
||||
PLib::HermiteCoefficients(-1.,1.,NivConstr,NivConstr,myH);
|
||||
|
||||
myJacobi = new PLib_JacobiPolynomial (WorkDegree,ConstraintOrder);
|
||||
|
||||
myWCoeff.Init(0.);
|
||||
myWCoeff(1) = 1.;
|
||||
switch(NivConstr) {
|
||||
case 0: myWCoeff(3) = -1.; break;
|
||||
case 1: myWCoeff(3) = -2.; myWCoeff(5) = 1.; break;
|
||||
case 2: myWCoeff(3) = -3.; myWCoeff(5) = 3.; myWCoeff(7) = -1.; break;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxError
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real PLib_HermitJacobi::MaxError(const Standard_Integer Dimension,
|
||||
Standard_Real& HermJacCoeff,
|
||||
const Standard_Integer NewDegree) const
|
||||
{
|
||||
return myJacobi->MaxError(Dimension,HermJacCoeff,NewDegree);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReduceDegree
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_HermitJacobi::ReduceDegree(const Standard_Integer Dimension,
|
||||
const Standard_Integer MaxDegree,
|
||||
const Standard_Real Tol,
|
||||
Standard_Real& HermJacCoeff,
|
||||
Standard_Integer& NewDegree,
|
||||
Standard_Real& MaxError) const
|
||||
{
|
||||
myJacobi->ReduceDegree(Dimension,MaxDegree,Tol,
|
||||
HermJacCoeff,NewDegree,MaxError);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AverageError
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real PLib_HermitJacobi::AverageError(const Standard_Integer Dimension,
|
||||
Standard_Real& HermJacCoeff,
|
||||
const Standard_Integer NewDegree) const
|
||||
{
|
||||
return myJacobi->AverageError(Dimension,HermJacCoeff,NewDegree);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ToCoefficients
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_HermitJacobi::ToCoefficients(const Standard_Integer Dimension,
|
||||
const Standard_Integer Degree,
|
||||
const TColStd_Array1OfReal& HermJacCoeff,
|
||||
TColStd_Array1OfReal& Coefficients) const
|
||||
{
|
||||
Standard_Integer i,k,idim,i1,i2;
|
||||
Standard_Real h1, h2;
|
||||
Standard_Integer NivConstr = this->NivConstr(),
|
||||
DegreeH = 2*NivConstr+1;
|
||||
Standard_Integer ibegHJC = HermJacCoeff.Lower(), kdim;
|
||||
|
||||
TColStd_Array1OfReal AuxCoeff(0,(Degree+1)*Dimension-1);
|
||||
AuxCoeff.Init(0.);
|
||||
|
||||
for (k=0; k<=DegreeH; k++) {
|
||||
kdim = k*Dimension;
|
||||
for (i=0; i<=NivConstr; i++) {
|
||||
h1 = myH(i+1, k+1);
|
||||
h2 = myH(i+NivConstr+2,k+1);
|
||||
i1 = ibegHJC + i*Dimension;
|
||||
i2 = ibegHJC + (i+NivConstr+1)*Dimension;
|
||||
|
||||
for (idim=0; idim<Dimension; idim++) {
|
||||
AuxCoeff(idim + kdim) += HermJacCoeff(i1 + idim) * h1 +
|
||||
HermJacCoeff(i2 + idim) * h2;
|
||||
}
|
||||
}
|
||||
}
|
||||
kdim = (Degree+1)*Dimension;
|
||||
for (k=(DegreeH+1)*Dimension; k<kdim; k++) {
|
||||
AuxCoeff(k) = HermJacCoeff(ibegHJC + k);
|
||||
}
|
||||
|
||||
if(Degree > DegreeH)
|
||||
myJacobi->ToCoefficients(Dimension,Degree,AuxCoeff,Coefficients);
|
||||
else {
|
||||
Standard_Integer ibegC = Coefficients.Lower();
|
||||
kdim = (Degree+1)*Dimension;
|
||||
for(k=0; k < kdim; k++)
|
||||
Coefficients(ibegC+k) = AuxCoeff(k);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D0123
|
||||
//purpose : common part of D0,D1,D2,D3 (FORTRAN subroutine MPOBAS)
|
||||
//=======================================================================
|
||||
|
||||
void PLib_HermitJacobi::D0123(const Standard_Integer NDeriv,
|
||||
const Standard_Real U,
|
||||
TColStd_Array1OfReal& BasisValue,
|
||||
TColStd_Array1OfReal& BasisD1,
|
||||
TColStd_Array1OfReal& BasisD2,
|
||||
TColStd_Array1OfReal& BasisD3)
|
||||
{
|
||||
// Tableaux en static
|
||||
static Standard_Real jac0[4*20];
|
||||
static Standard_Real jac1[4*20];
|
||||
static Standard_Real jac2[4*20];
|
||||
static Standard_Real jac3[4*20];
|
||||
static Standard_Real wvalues[4];
|
||||
|
||||
|
||||
Standard_Integer i, j;
|
||||
Standard_Integer NivConstr = this->NivConstr(),
|
||||
WorkDegree = this->WorkDegree(),
|
||||
DegreeH = 2*NivConstr+1;
|
||||
Standard_Integer ibeg0 = BasisValue.Lower(),
|
||||
ibeg1 = BasisD1.Lower(),
|
||||
ibeg2 = BasisD2.Lower(),
|
||||
ibeg3 = BasisD3.Lower();
|
||||
Standard_Integer JacDegree = WorkDegree-DegreeH-1;
|
||||
Standard_Real W0;
|
||||
|
||||
TColStd_Array1OfReal JacValue0(jac0[0], 0, Max(0,JacDegree));
|
||||
TColStd_Array1OfReal WValues(wvalues[0],0,NDeriv);
|
||||
WValues.Init(0.);
|
||||
|
||||
// Evaluation des polynomes d'hermite
|
||||
math_Matrix HermitValues(0,DegreeH, 0, NDeriv, 0.);
|
||||
if(NDeriv == 0)
|
||||
for (i=0; i<=DegreeH; i++) {
|
||||
PLib::NoDerivativeEvalPolynomial(U,DegreeH,1, DegreeH,
|
||||
myH(i+1,1), HermitValues(i,0));
|
||||
}
|
||||
else
|
||||
for (i=0; i<=DegreeH; i++) {
|
||||
PLib::EvalPolynomial(U,NDeriv,DegreeH,1,
|
||||
myH(i+1,1), HermitValues(i,0));
|
||||
}
|
||||
|
||||
// Evaluation des polynomes de Jaccobi
|
||||
if(JacDegree >= 0) {
|
||||
|
||||
switch (NDeriv) {
|
||||
case 0 :
|
||||
myJacobi->D0(U,JacValue0);
|
||||
break;
|
||||
case 1 :
|
||||
{
|
||||
TColStd_Array1OfReal JacValue1(jac1[0], 0, JacDegree);
|
||||
myJacobi->D1(U,JacValue0,JacValue1);
|
||||
break;
|
||||
}
|
||||
case 2 :
|
||||
{
|
||||
TColStd_Array1OfReal JacValue1(jac1[0], 0, JacDegree);
|
||||
TColStd_Array1OfReal JacValue2(jac2[0], 0, JacDegree);
|
||||
myJacobi->D2(U,JacValue0,JacValue1,JacValue2);
|
||||
break;
|
||||
}
|
||||
case 3 :
|
||||
{
|
||||
TColStd_Array1OfReal JacValue1(jac1[0], 0, JacDegree);
|
||||
TColStd_Array1OfReal JacValue2(jac2[0], 0, JacDegree);
|
||||
TColStd_Array1OfReal JacValue3(jac3[0], 0, JacDegree);
|
||||
myJacobi->D3(U,JacValue0,JacValue1,JacValue2,JacValue3);
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluation de W(t)
|
||||
if(NDeriv == 0)
|
||||
PLib::NoDerivativeEvalPolynomial(U,DegreeH+1,1,DegreeH+1,myWCoeff(1), WValues(0));
|
||||
else
|
||||
PLib::EvalPolynomial(U,NDeriv,DegreeH+1,1,myWCoeff(1), WValues(0));
|
||||
}
|
||||
|
||||
// Evaluation a l'ordre 0
|
||||
for (i=0; i<=DegreeH; i++) {
|
||||
BasisValue(ibeg0+i) = HermitValues(i,0);
|
||||
}
|
||||
W0 = WValues(0);
|
||||
for (i=DegreeH+1, j=0; i<=WorkDegree; i++, j++) {
|
||||
BasisValue(ibeg0+i) = W0 * jac0[j];
|
||||
}
|
||||
|
||||
// Evaluation a l'ordre 1
|
||||
if (NDeriv >= 1) {
|
||||
Standard_Real W1=WValues(1);
|
||||
for (i=0; i<=DegreeH; i++) {
|
||||
BasisD1(ibeg1+i) = HermitValues(i,1);
|
||||
}
|
||||
for (i=DegreeH+1, j=0; i<=WorkDegree; i++, j++) {
|
||||
BasisD1(ibeg1+i) = W0 * jac1[j] +
|
||||
W1 * jac0[j];
|
||||
}
|
||||
// Evaluation a l'ordre 2
|
||||
if (NDeriv >= 2) {
|
||||
Standard_Real W2=WValues(2);
|
||||
for (i=0; i<=DegreeH; i++) {
|
||||
BasisD2(ibeg2+i) = HermitValues(i,2);
|
||||
}
|
||||
for (i=DegreeH+1, j=0; i<=WorkDegree; i++, j++) {
|
||||
BasisD2(ibeg2+i) =
|
||||
W0 * jac2[j] + 2 * W1 * jac1[j] + W2 * jac0[j];
|
||||
}
|
||||
|
||||
// Evaluation a l'ordre 3
|
||||
if (NDeriv == 3) {
|
||||
Standard_Real W3 = WValues(3);
|
||||
for (i=0; i<=DegreeH; i++) {
|
||||
BasisD3(ibeg3+i) = HermitValues(i,3);
|
||||
}
|
||||
for (i=DegreeH+1, j=0; i<=WorkDegree; i++,j++) {
|
||||
BasisD3(ibeg3+i) = W0*jac3[j] + W3*jac0[j]
|
||||
+ 3*(W1*jac2[j] + W2*jac1[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D0
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_HermitJacobi::D0(const Standard_Real U, TColStd_Array1OfReal& BasisValue)
|
||||
{
|
||||
D0123(0,U,BasisValue,BasisValue,BasisValue,BasisValue);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_HermitJacobi::D1(const Standard_Real U,
|
||||
TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1)
|
||||
{
|
||||
D0123(1,U,BasisValue,BasisD1,BasisD1,BasisD1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_HermitJacobi::D2(const Standard_Real U, TColStd_Array1OfReal& BasisValue,
|
||||
TColStd_Array1OfReal& BasisD1,TColStd_Array1OfReal& BasisD2)
|
||||
{
|
||||
D0123(2,U,BasisValue,BasisD1,BasisD2,BasisD2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D3
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_HermitJacobi::D3(const Standard_Real U,
|
||||
TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1,
|
||||
TColStd_Array1OfReal& BasisD2, TColStd_Array1OfReal& BasisD3)
|
||||
{
|
||||
D0123(3,U,BasisValue,BasisD1,BasisD2,BasisD3);
|
||||
}
|
||||
|
14
src/PLib/PLib_HermitJacobi.lxx
Executable file
14
src/PLib/PLib_HermitJacobi.lxx
Executable file
@@ -0,0 +1,14 @@
|
||||
// File: PLib_HermitJacobi.lxx
|
||||
// Created: Wed Oct 22 13:45:13 1997
|
||||
// Author: Sergey SOKOLOV
|
||||
// <ssv@velox.nnov.matra-dtv.fr>
|
||||
|
||||
inline Standard_Integer PLib_HermitJacobi::WorkDegree() const
|
||||
{
|
||||
return myJacobi->WorkDegree();
|
||||
}
|
||||
|
||||
inline Standard_Integer PLib_HermitJacobi::NivConstr() const
|
||||
{
|
||||
return myJacobi->NivConstr();
|
||||
}
|
214
src/PLib/PLib_JacobiPolynomial.cdl
Executable file
214
src/PLib/PLib_JacobiPolynomial.cdl
Executable file
@@ -0,0 +1,214 @@
|
||||
|
||||
|
||||
-- File: PLib_JacobiPolynomial.cdl
|
||||
-- Created: Tue Oct 8 11:03:16 1996
|
||||
-- Author: Jeannine PANTIATICI
|
||||
-- <jpi@sgi64>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
class JacobiPolynomial from PLib
|
||||
|
||||
inherits Base from PLib
|
||||
|
||||
--- Purpose: This class provides method to work with Jacobi Polynomials
|
||||
-- relativly to an order of constraint
|
||||
-- q = myWorkDegree-2*(myNivConstr+1)
|
||||
-- Jk(t) for k=0,q compose the Jacobi Polynomial base relativly to the weigth W(t)
|
||||
-- iorder is the integer value for the constraints:
|
||||
-- iorder = 0 <=> ConstraintOrder = GeomAbs_C0
|
||||
-- iorder = 1 <=> ConstraintOrder = GeomAbs_C1
|
||||
-- iorder = 2 <=> ConstraintOrder = GeomAbs_C2
|
||||
-- P(t) = R(t) + W(t) * Q(t) Where W(t) = (1-t**2)**(2*iordre+2)
|
||||
-- the coefficients JacCoeff represents P(t) JacCoeff are stored as follow:
|
||||
--
|
||||
-- c0(1) c0(2) .... c0(Dimension)
|
||||
-- c1(1) c1(2) .... c1(Dimension)
|
||||
--
|
||||
--
|
||||
--
|
||||
-- cDegree(1) cDegree(2) .... cDegree(Dimension)
|
||||
--
|
||||
-- The coefficients
|
||||
-- c0(1) c0(2) .... c0(Dimension)
|
||||
-- c2*ordre+1(1) ... c2*ordre+1(dimension)
|
||||
--
|
||||
-- represents the part of the polynomial in the
|
||||
-- canonical base: R(t)
|
||||
-- R(t) = c0 + c1 t + ...+ c2*iordre+1 t**2*iordre+1
|
||||
-- The following coefficients represents the part of the
|
||||
-- polynomial in the Jacobi base ie Q(t)
|
||||
-- Q(t) = c2*iordre+2 J0(t) + ...+ cDegree JDegree-2*iordre-2
|
||||
|
||||
uses
|
||||
|
||||
Array2OfReal from TColStd,
|
||||
Array1OfReal from TColStd,
|
||||
HArray1OfReal from TColStd,
|
||||
Shape from GeomAbs
|
||||
|
||||
raises
|
||||
ConstructionError from Standard
|
||||
|
||||
is
|
||||
|
||||
-- Create returns JacobiPolynomial from PLib;
|
||||
|
||||
Create ( WorkDegree : Integer ;
|
||||
ConstraintOrder : Shape from GeomAbs)
|
||||
returns JacobiPolynomial from PLib
|
||||
|
||||
|
||||
---Purpose:
|
||||
-- Initialize the polynomial class
|
||||
-- Degree has to be <= 30
|
||||
-- ConstraintOrder has to be GeomAbs_C0
|
||||
-- GeomAbs_C1
|
||||
-- GeomAbs_C2
|
||||
|
||||
raises ConstructionError from Standard;
|
||||
-- if Degree or ConstraintOrder is non valid
|
||||
|
||||
--
|
||||
-- Jacobi characteristics
|
||||
--
|
||||
Points ( me ; NbGaussPoints : Integer ;
|
||||
TabPoints : out Array1OfReal from TColStd )
|
||||
---Purpose:
|
||||
-- returns the Jacobi Points for Gauss integration ie
|
||||
-- the positive values of the Legendre roots by increasing values
|
||||
-- NbGaussPoints is the number of points choosen for the integral
|
||||
-- computation.
|
||||
-- TabPoints (0,NbGaussPoints/2)
|
||||
-- TabPoints (0) is loaded only for the odd values of NbGaussPoints
|
||||
-- The possible values for NbGaussPoints are : 8, 10,
|
||||
-- 15, 20, 25, 30, 35, 40, 50, 61
|
||||
-- NbGaussPoints must be greater than Degree
|
||||
|
||||
raises ConstructionError from Standard;
|
||||
-- Invalid NbGaussPoints
|
||||
|
||||
Weights (me ; NbGaussPoints : Integer ;
|
||||
TabWeights : out Array2OfReal from TColStd )
|
||||
|
||||
--- Purpose:
|
||||
-- returns the Jacobi weigths for Gauss integration only for
|
||||
-- the positive values of the Legendre roots in the order they
|
||||
--- are given by the method Points
|
||||
-- NbGaussPoints is the number of points choosen for the integral
|
||||
-- computation.
|
||||
-- TabWeights (0,NbGaussPoints/2,0,Degree)
|
||||
-- TabWeights (0,.) are only loaded for the odd values of NbGaussPoints
|
||||
-- The possible values for NbGaussPoints are : 8 , 10 , 15 ,20 ,25 , 30,
|
||||
-- 35 , 40 , 50 , 61 NbGaussPoints must be greater than Degree
|
||||
|
||||
raises ConstructionError from Standard;
|
||||
-- Invalid NbGaussPoints
|
||||
|
||||
MaxValue ( me ; TabMax : out Array1OfReal from TColStd );
|
||||
---Purpose:
|
||||
-- this method loads for k=0,q the maximum value of
|
||||
-- abs ( W(t)*Jk(t) )for t bellonging to [-1,1]
|
||||
-- This values are loaded is the array TabMax(0,myWorkDegree-2*(myNivConst+1))
|
||||
-- MaxValue ( me ; TabMaxPointer : in out Real );
|
||||
|
||||
--
|
||||
-- Work in Jacobi base
|
||||
|
||||
MaxError ( me ; Dimension : Integer ;
|
||||
JacCoeff : in out Real;
|
||||
NewDegree : Integer )
|
||||
returns Real;
|
||||
|
||||
---Purpose:
|
||||
-- This method computes the maximum error on the polynomial
|
||||
-- W(t) Q(t) obtained by missing the coefficients of JacCoeff from
|
||||
-- NewDegree +1 to Degree
|
||||
|
||||
ReduceDegree ( me ; Dimension , MaxDegree : Integer ; Tol : Real ;
|
||||
JacCoeff : in out Real;
|
||||
NewDegree : out Integer ;
|
||||
MaxError : out Real);
|
||||
|
||||
---Purpose:
|
||||
-- Compute NewDegree <= MaxDegree so that MaxError is lower
|
||||
-- than Tol.
|
||||
-- MaxError can be greater than Tol if it is not possible
|
||||
-- to find a NewDegree <= MaxDegree.
|
||||
-- In this case NewDegree = MaxDegree
|
||||
--
|
||||
AverageError ( me ; Dimension : Integer ;
|
||||
JacCoeff : in out Real;
|
||||
NewDegree : Integer )
|
||||
-- This method computes the average error on the polynomial W(t)Q(t)
|
||||
-- obtained by missing the
|
||||
-- coefficients JacCoeff from NewDegree +1 to Degree
|
||||
returns Real;
|
||||
|
||||
|
||||
ToCoefficients ( me ; Dimension, Degree : Integer ;
|
||||
JacCoeff : Array1OfReal from TColStd ;
|
||||
Coefficients : out Array1OfReal from TColStd );
|
||||
|
||||
---Purpose:
|
||||
-- Convert the polynomial P(t) = R(t) + W(t) Q(t) in the canonical base.
|
||||
--
|
||||
|
||||
D0123 (me : mutable; NDerive : Integer; U : Real;
|
||||
BasisValue : out Array1OfReal from TColStd;
|
||||
BasisD1 : out Array1OfReal from TColStd;
|
||||
BasisD2 : out Array1OfReal from TColStd;
|
||||
BasisD3 : out Array1OfReal from TColStd)
|
||||
---Purpose: Compute the values and the derivatives values of
|
||||
-- the basis functions in u
|
||||
is private;
|
||||
|
||||
D0 (me : mutable; U : Real;
|
||||
BasisValue : out Array1OfReal from TColStd);
|
||||
---Purpose: Compute the values of the basis functions in u
|
||||
--
|
||||
|
||||
D1 (me : mutable; U : Real;
|
||||
BasisValue : out Array1OfReal from TColStd;
|
||||
BasisD1 : out Array1OfReal from TColStd);
|
||||
---Purpose: Compute the values and the derivatives values of
|
||||
-- the basis functions in u
|
||||
|
||||
D2 (me : mutable; U : Real;
|
||||
BasisValue : out Array1OfReal from TColStd;
|
||||
BasisD1 : out Array1OfReal from TColStd;
|
||||
BasisD2 : out Array1OfReal from TColStd);
|
||||
---Purpose: Compute the values and the derivatives values of
|
||||
-- the basis functions in u
|
||||
|
||||
D3 (me : mutable; U : Real;
|
||||
BasisValue : out Array1OfReal from TColStd;
|
||||
BasisD1 : out Array1OfReal from TColStd;
|
||||
BasisD2 : out Array1OfReal from TColStd;
|
||||
BasisD3 : out Array1OfReal from TColStd);
|
||||
---Purpose: Compute the values and the derivatives values of
|
||||
-- the basis functions in u
|
||||
|
||||
WorkDegree (me)
|
||||
---Purpose: returns WorkDegree
|
||||
---C++: inline
|
||||
returns Integer;
|
||||
|
||||
NivConstr (me)
|
||||
---Purpose: returns NivConstr
|
||||
---C++: inline
|
||||
returns Integer;
|
||||
|
||||
fields
|
||||
myWorkDegree : Integer;
|
||||
myNivConstr : Integer;
|
||||
myDegree : Integer;
|
||||
|
||||
-- the following arrays are used for an optimization of computation in D0-D3
|
||||
myTNorm : HArray1OfReal from TColStd;
|
||||
myCofA : HArray1OfReal from TColStd;
|
||||
myCofB : HArray1OfReal from TColStd;
|
||||
myDenom : HArray1OfReal from TColStd;
|
||||
|
||||
end;
|
||||
|
||||
|
489
src/PLib/PLib_JacobiPolynomial.cxx
Executable file
489
src/PLib/PLib_JacobiPolynomial.cxx
Executable file
@@ -0,0 +1,489 @@
|
||||
#include <PLib_JacobiPolynomial.ixx>
|
||||
|
||||
#include <math.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <PLib.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
|
||||
#include <PLib_JacobiPolynomial_0.hxx>
|
||||
|
||||
// The possible values for NbGaussPoints
|
||||
const Standard_Integer NDEG8=8, NDEG10=10, NDEG15=15, NDEG20=20, NDEG25=25,
|
||||
NDEG30=30, NDEG40=40, NDEG50=50, NDEG61=61;
|
||||
|
||||
const Standard_Integer UNDEFINED=-999;
|
||||
|
||||
//=======================================================================
|
||||
//function : PLib_JacobiPolynomial
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
PLib_JacobiPolynomial::PLib_JacobiPolynomial (const Standard_Integer WorkDegree,
|
||||
const GeomAbs_Shape ConstraintOrder)
|
||||
{
|
||||
myWorkDegree = WorkDegree;
|
||||
|
||||
switch (ConstraintOrder) {
|
||||
case GeomAbs_C0: myNivConstr = 0; break;
|
||||
case GeomAbs_C1: myNivConstr = 1; break;
|
||||
case GeomAbs_C2: myNivConstr = 2; break;
|
||||
default:
|
||||
Standard_ConstructionError::Raise("Invalid ConstraintOrder");
|
||||
}
|
||||
myDegree = myWorkDegree - 2*(myNivConstr+1);
|
||||
if (myDegree > 30)
|
||||
Standard_ConstructionError::Raise("Invalid Degree");
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Points
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_JacobiPolynomial::Points(const Standard_Integer NbGaussPoints,
|
||||
TColStd_Array1OfReal& TabPoints) const
|
||||
{
|
||||
if (NbGaussPoints != NDEG8 && NbGaussPoints != NDEG10 &&
|
||||
NbGaussPoints != NDEG15 && NbGaussPoints != NDEG20 &&
|
||||
NbGaussPoints != NDEG25 && NbGaussPoints != NDEG30 &&
|
||||
NbGaussPoints != NDEG40 && NbGaussPoints != NDEG50 &&
|
||||
NbGaussPoints != NDEG61 ||
|
||||
NbGaussPoints <= myDegree)
|
||||
Standard_ConstructionError::Raise("Invalid NbGaussPoints");
|
||||
|
||||
math_Vector DecreasingPoints(1,NbGaussPoints);
|
||||
|
||||
math::GaussPoints(NbGaussPoints,DecreasingPoints);
|
||||
|
||||
// TabPoints consist of only positive increasing values
|
||||
for (Standard_Integer i=1; i<=NbGaussPoints/2; i++)
|
||||
TabPoints(i) = DecreasingPoints(NbGaussPoints/2-i+1);
|
||||
if (NbGaussPoints % 2 == 1)
|
||||
TabPoints(0) = 0.;
|
||||
else
|
||||
TabPoints(0) = UNDEFINED;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Weights
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_JacobiPolynomial::Weights(const Standard_Integer NbGaussPoints,
|
||||
TColStd_Array2OfReal& TabWeights) const
|
||||
{
|
||||
|
||||
Standard_Integer i,j;
|
||||
Standard_Real const *pdb=NULL; // the current pointer to WeightsDB
|
||||
switch (myNivConstr) {
|
||||
case 0: pdb = WeightsDB_C0; break;
|
||||
case 1: pdb = WeightsDB_C1; break;
|
||||
case 2: pdb = WeightsDB_C2; break;
|
||||
}
|
||||
Standard_Integer infdg = 2*(myNivConstr+1);
|
||||
if (NbGaussPoints > NDEG8) pdb += (NDEG8 *(NDEG8 -infdg)/2);
|
||||
if (NbGaussPoints > NDEG10) pdb += (NDEG10*(NDEG10-infdg)/2);
|
||||
if (NbGaussPoints > NDEG15) pdb += (((NDEG15-1)/2)*(NDEG15-infdg));
|
||||
if (NbGaussPoints > NDEG20) pdb += (NDEG20*(NDEG20-infdg)/2);
|
||||
if (NbGaussPoints > NDEG25) pdb += (((NDEG25-1)/2)*(NDEG25-infdg));
|
||||
if (NbGaussPoints > NDEG30) pdb += (NDEG30*(NDEG30-infdg)/2);
|
||||
if (NbGaussPoints > NDEG40) pdb += (NDEG40*(NDEG40-infdg)/2);
|
||||
if (NbGaussPoints > NDEG50) pdb += (NDEG50*(NDEG50-infdg)/2);
|
||||
|
||||
// the copy of TabWeightsDB into TabWeights
|
||||
for (j=0; j<=myDegree; j++) {
|
||||
for (i=1; i<=NbGaussPoints/2; i++) {
|
||||
TabWeights.SetValue(i,j,*pdb++);
|
||||
}
|
||||
}
|
||||
|
||||
if (NbGaussPoints % 2 == 1) {
|
||||
// NbGaussPoints is odd - the values addition for 0.
|
||||
Standard_Real const *pdb0=NULL; // the current pointer to WeightsDB0
|
||||
switch (myNivConstr) {
|
||||
case 0: pdb0 = WeightsDB0_C0; break;
|
||||
case 1: pdb0 = WeightsDB0_C1; break;
|
||||
case 2: pdb0 = WeightsDB0_C2; break;
|
||||
}
|
||||
|
||||
if (NbGaussPoints > NDEG15) pdb0 += ((NDEG15-1-infdg)/2 + 1);
|
||||
if (NbGaussPoints > NDEG25) pdb0 += ((NDEG25-1-infdg)/2 + 1);
|
||||
|
||||
// the copy of TabWeightsDB0 into TabWeights
|
||||
for (j=0; j<=myDegree; j+=2)
|
||||
TabWeights.SetValue(0,j,*pdb0++);
|
||||
for (j=1; j<=myDegree; j+=2)
|
||||
TabWeights.SetValue(0,j,0.);
|
||||
}
|
||||
else {
|
||||
for (j=0; j<=myDegree; j++) {
|
||||
TabWeights.SetValue(0,j,UNDEFINED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_JacobiPolynomial::MaxValue(TColStd_Array1OfReal& TabMax) const
|
||||
{
|
||||
Standard_Real const *pdb=NULL; // the pointer to MaxValues
|
||||
switch (myNivConstr) {
|
||||
case 0: pdb = MaxValuesDB_C0; break;
|
||||
case 1: pdb = MaxValuesDB_C1; break;
|
||||
case 2: pdb = MaxValuesDB_C2; break;
|
||||
}
|
||||
for (Standard_Integer i=TabMax.Lower(); i <= TabMax.Upper(); i++) {
|
||||
TabMax.SetValue(i,*pdb++);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxError
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real PLib_JacobiPolynomial::MaxError(const Standard_Integer Dimension,
|
||||
Standard_Real& JacCoeff,
|
||||
const Standard_Integer NewDegree) const
|
||||
{
|
||||
Standard_Integer i,idim,ibeg,icut;
|
||||
|
||||
math_Vector MaxErrDim(1,Dimension,0.);
|
||||
|
||||
TColStd_Array1OfReal TabMax(0, myDegree+1);
|
||||
MaxValue(TabMax);
|
||||
|
||||
ibeg = 2*(myNivConstr+1);
|
||||
icut = Max (ibeg, NewDegree+1);
|
||||
Standard_Real * JacArray = &JacCoeff;
|
||||
for (idim=1; idim<=Dimension; idim++) {
|
||||
for (i=icut; i<=myWorkDegree; i++) {
|
||||
MaxErrDim(idim) += Abs(JacArray[i*Dimension+idim-1]) * TabMax(i-ibeg);
|
||||
}
|
||||
}
|
||||
Standard_Real MaxErr = MaxErrDim.Norm();
|
||||
return (MaxErr);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReduceDegree
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_JacobiPolynomial::ReduceDegree(const Standard_Integer Dimension,
|
||||
const Standard_Integer MaxDegree,
|
||||
const Standard_Real Tol,
|
||||
Standard_Real& JacCoeff,
|
||||
Standard_Integer& NewDegree,
|
||||
Standard_Real& MaxError) const
|
||||
{
|
||||
Standard_Integer i,idim,icut, ia = 2*(myNivConstr+1)-1;
|
||||
Standard_Real Bid,Eps1,Error;
|
||||
|
||||
math_Vector MaxErrDim(1,Dimension,0.);
|
||||
|
||||
NewDegree = ia;
|
||||
MaxError = 0.;
|
||||
Error = 0.;
|
||||
icut=ia+1;
|
||||
|
||||
TColStd_Array1OfReal TabMax(0, myDegree+1);
|
||||
MaxValue(TabMax);
|
||||
Standard_Real * JacArray = &JacCoeff;
|
||||
for (i=myWorkDegree; i>=icut; i--) {
|
||||
for (idim=1; idim<=Dimension; idim++) {
|
||||
MaxErrDim(idim) += Abs(JacArray[i*Dimension+idim-1]) * TabMax(i-icut);
|
||||
}
|
||||
Error = MaxErrDim.Norm();
|
||||
if (Error > Tol && i <= MaxDegree) {
|
||||
NewDegree = i;
|
||||
break;
|
||||
}
|
||||
else
|
||||
MaxError = Error;
|
||||
}
|
||||
if (NewDegree==ia) {
|
||||
Eps1=0.000000001;
|
||||
NewDegree = 0;
|
||||
for (i=ia; i>=1; i--) {
|
||||
Bid = 0.;
|
||||
for (idim=1; idim<=Dimension; idim++) {
|
||||
Bid += Abs(JacArray[i*Dimension+idim-1]);
|
||||
}
|
||||
if (Bid > Eps1) {
|
||||
NewDegree = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AverageError
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real PLib_JacobiPolynomial::AverageError(const Standard_Integer Dimension,
|
||||
Standard_Real& JacCoeff,
|
||||
const Standard_Integer NewDegree)
|
||||
const
|
||||
{
|
||||
Standard_Integer i,idim, icut = Max (2*(myNivConstr+1)+1, NewDegree+1);
|
||||
Standard_Real BidJ, AverageErr = 0.;
|
||||
Standard_Real * JacArray = &JacCoeff;
|
||||
for (idim=1; idim<=Dimension; idim++) {
|
||||
for (i=icut; i<=myDegree; i++) {
|
||||
BidJ = JacArray[i*Dimension+idim-1];
|
||||
AverageErr += BidJ*BidJ;
|
||||
}
|
||||
}
|
||||
AverageErr = sqrt(AverageErr/2);
|
||||
return (AverageErr);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :ToCoefficients
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_JacobiPolynomial::ToCoefficients(const Standard_Integer Dimension,
|
||||
const Standard_Integer Degree,
|
||||
const TColStd_Array1OfReal& JacCoeff,
|
||||
TColStd_Array1OfReal& Coefficients) const
|
||||
{
|
||||
const Standard_Integer MAXM=31;
|
||||
Standard_Integer i,iptt,j,idim, ii, jj;
|
||||
Standard_Real const *pTr=NULL; // the pointer to TransMatrix
|
||||
Standard_Real Bid;
|
||||
Standard_Integer ibegJC=JacCoeff.Lower(), ibegC=Coefficients.Lower();
|
||||
|
||||
switch (myNivConstr) {
|
||||
case 0: pTr = &TransMatrix_C0[0][0]; break;
|
||||
case 1: pTr = &TransMatrix_C1[0][0]; break;
|
||||
case 2: pTr = &TransMatrix_C2[0][0]; break;
|
||||
}
|
||||
// the conversation for even elements of JacCoeff
|
||||
for (i=0; i<=Degree/2; i++) {
|
||||
iptt = i*MAXM-(i+1)*i/2;
|
||||
for (idim=1; idim<=Dimension; idim++) {
|
||||
Bid = 0.;
|
||||
for (j=i; j<=Degree/2; j++) {
|
||||
Bid += (*(pTr+iptt+j)) * JacCoeff(2*j*Dimension+idim-1);
|
||||
}
|
||||
Coefficients.SetValue(2*i*Dimension+idim-1, Bid);
|
||||
}
|
||||
}
|
||||
|
||||
if (Degree == 0) return;
|
||||
|
||||
// the conversation for odd elements of JacCoeff
|
||||
pTr += MAXM*(MAXM+1)/2;
|
||||
for (i=0; i<=(Degree-1)/2; i++) {
|
||||
iptt = i*MAXM-(i+1)*i/2;
|
||||
ii = ibegC+(2*i+1)*Dimension;
|
||||
for (idim=1; idim<=Dimension; idim++, ii++) {
|
||||
Bid = 0.;
|
||||
jj = ibegJC+(2*i+1)*Dimension+idim-1;
|
||||
for (j=i; j<=(Degree-1)/2; j++, jj+=2*Dimension) {
|
||||
Bid += (*(pTr+iptt+j)) * JacCoeff(jj);
|
||||
}
|
||||
Coefficients(ii) = Bid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D0123
|
||||
//purpose : common part of D0,D1,D2,D3 (FORTRAN subroutine MPOJAC)
|
||||
//=======================================================================
|
||||
|
||||
void PLib_JacobiPolynomial::D0123(const Standard_Integer NDeriv,
|
||||
const Standard_Real U,
|
||||
TColStd_Array1OfReal& BasisValue,
|
||||
TColStd_Array1OfReal& BasisD1,
|
||||
TColStd_Array1OfReal& BasisD2,
|
||||
TColStd_Array1OfReal& BasisD3)
|
||||
{
|
||||
Standard_Integer i,j, HermitNivConstr = 2*(myNivConstr+1);
|
||||
Standard_Real Aux1,Aux2;
|
||||
|
||||
if (myTNorm.IsNull()) {
|
||||
|
||||
// Inizialization of myTNorm,myCofA,myCofB,myDenom
|
||||
|
||||
myTNorm = new TColStd_HArray1OfReal(0,myDegree);
|
||||
for (i=0; i<=myDegree; i++) {
|
||||
Aux2 = 1.;
|
||||
for (j=1; j<=HermitNivConstr; j++) {
|
||||
Aux2 *= ((Standard_Real)(i+HermitNivConstr+j)/(Standard_Real)(i+j));
|
||||
}
|
||||
myTNorm->SetValue(i, Sqrt (Aux2 * (2*i+2*HermitNivConstr+1) /
|
||||
(Pow (2,2*HermitNivConstr+1))));
|
||||
}
|
||||
|
||||
if(myDegree >= 2) {
|
||||
myCofA = new TColStd_HArray1OfReal(0,myDegree);
|
||||
myCofB = new TColStd_HArray1OfReal(0,myDegree);
|
||||
myDenom = new TColStd_HArray1OfReal(0,myDegree);
|
||||
for (i=2; i<=myDegree; i++) {
|
||||
Aux1 = HermitNivConstr+i-1;
|
||||
Aux2 = 2 * Aux1;
|
||||
myCofA ->SetValue(i, Aux2*(Aux2+1)*(Aux2+2));
|
||||
myCofB ->SetValue(i, -2. *(Aux2+2) * Aux1* Aux1);
|
||||
myDenom->SetValue(i, 1./(2. * i * ( i-1 + 2*HermitNivConstr+1) * Aux2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Positionements triviaux -----
|
||||
Standard_Integer ibeg0 = BasisValue.Lower();
|
||||
Standard_Integer ibeg1 = BasisD1.Lower();
|
||||
Standard_Integer ibeg2 = BasisD2.Lower();
|
||||
Standard_Integer ibeg3 = BasisD3.Lower();
|
||||
Standard_Integer i0, i1, i2, i3;
|
||||
|
||||
|
||||
if (myDegree == 0) {
|
||||
BasisValue(ibeg0+0) = 1.;
|
||||
if (NDeriv >= 1) {
|
||||
BasisD1(ibeg1+0) = 0.;
|
||||
if (NDeriv >= 2) {
|
||||
BasisD2(ibeg2+0) = 0.;
|
||||
if (NDeriv == 3)
|
||||
BasisD3(ibeg3+0) = 0.;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
BasisValue(ibeg0+0) = 1.;
|
||||
Aux1 = HermitNivConstr+1;
|
||||
BasisValue(ibeg0+1) = Aux1 * U;
|
||||
if (NDeriv >= 1) {
|
||||
BasisD1(ibeg1+0) = 0.;
|
||||
BasisD1(ibeg1+1) = Aux1;
|
||||
if (NDeriv >= 2) {
|
||||
BasisD2(ibeg2+0) = 0.;
|
||||
BasisD2(ibeg2+1) = 0.;
|
||||
if (NDeriv == 3) {
|
||||
BasisD3(ibeg3+0) = 0.;
|
||||
BasisD3(ibeg3+1) = 0.;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --- Positionement par reccurence
|
||||
if (myDegree > 1) {
|
||||
if (NDeriv == 0) {
|
||||
Standard_Real * BV = &BasisValue(ibeg0);
|
||||
Standard_Real * CofA = &myCofA->ChangeValue(0);
|
||||
Standard_Real * CofB = &myCofB->ChangeValue(0);
|
||||
Standard_Real * Denom = &myDenom->ChangeValue(0);
|
||||
for (i=2; i<=myDegree; i++) {
|
||||
BV[i] = (CofA[i]*U*BV[i-1] + CofB[i]*BV[i-2])*Denom[i];
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
Standard_Real CofA, CofB, Denom;
|
||||
for (i=2; i<=myDegree; i++) {
|
||||
i0=i+ibeg0;
|
||||
i1=i+ibeg1;
|
||||
CofA = myCofA->Value(i);
|
||||
CofB = myCofB->Value(i);
|
||||
Denom = myDenom->Value(i);
|
||||
|
||||
BasisValue(i0) = (CofA * U * BasisValue(i0-1) +
|
||||
CofB * BasisValue(i0-2)) * Denom;
|
||||
BasisD1(i1) = (CofA * (U * BasisD1(i1-1) + BasisValue(i0-1)) +
|
||||
CofB * BasisD1(i1-2)) * Denom;
|
||||
if (NDeriv >= 2) {
|
||||
i2=i+ibeg2;
|
||||
BasisD2(i2) = ( CofA * (U*BasisD2(i2-1) + 2*BasisD1(i1-1)) +
|
||||
CofB*BasisD2(i2-2)) * Denom;
|
||||
if (NDeriv == 3) {
|
||||
i3=i+ibeg3;
|
||||
BasisD3(i3) = (CofA * (U*BasisD3(i3-1) + 3*BasisD2(i2-1)) +
|
||||
CofB*BasisD3(i3-2)) * Denom;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Normalization
|
||||
if (NDeriv == 0) {
|
||||
Standard_Real * BV = &BasisValue(ibeg0);
|
||||
Standard_Real * TNorm = &myTNorm->ChangeValue(0);
|
||||
for (i=0; i<=myDegree; i++)
|
||||
BV[i] *= TNorm[i];
|
||||
}
|
||||
else {
|
||||
Standard_Real TNorm;
|
||||
for (i=0; i<=myDegree; i++) {
|
||||
TNorm = myTNorm->Value(i);
|
||||
BasisValue(i+ibeg0) *= TNorm;
|
||||
BasisD1(i+ibeg1) *= TNorm;
|
||||
if (NDeriv >= 2) {
|
||||
BasisD2(i+ibeg2) *= TNorm;
|
||||
if (NDeriv >= 3) BasisD3(i+ibeg3) *= TNorm;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D0
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_JacobiPolynomial::D0(const Standard_Real U,
|
||||
TColStd_Array1OfReal& BasisValue)
|
||||
{
|
||||
D0123(0,U,BasisValue,BasisValue,BasisValue,BasisValue);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_JacobiPolynomial::D1(const Standard_Real U,
|
||||
TColStd_Array1OfReal& BasisValue,
|
||||
TColStd_Array1OfReal& BasisD1)
|
||||
{
|
||||
D0123(1,U,BasisValue,BasisD1,BasisD1,BasisD1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_JacobiPolynomial::D2(const Standard_Real U,
|
||||
TColStd_Array1OfReal& BasisValue,
|
||||
TColStd_Array1OfReal& BasisD1,
|
||||
TColStd_Array1OfReal& BasisD2)
|
||||
{
|
||||
D0123(2,U,BasisValue,BasisD1,BasisD2,BasisD2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D3
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PLib_JacobiPolynomial::D3(const Standard_Real U,
|
||||
TColStd_Array1OfReal& BasisValue,
|
||||
TColStd_Array1OfReal& BasisD1,
|
||||
TColStd_Array1OfReal& BasisD2,
|
||||
TColStd_Array1OfReal& BasisD3)
|
||||
{
|
||||
D0123(3,U,BasisValue,BasisD1,BasisD2,BasisD3);
|
||||
}
|
||||
|
14
src/PLib/PLib_JacobiPolynomial.lxx
Executable file
14
src/PLib/PLib_JacobiPolynomial.lxx
Executable file
@@ -0,0 +1,14 @@
|
||||
// File: PLib_JacobiPolynomial.lxx
|
||||
// Created: Tue Jun 3 11:15:41 1997
|
||||
// Author: Sergey SOKOLOV
|
||||
// <ssm@nonox.nizhny.matra-dtv.fr>
|
||||
|
||||
inline Standard_Integer PLib_JacobiPolynomial::WorkDegree() const
|
||||
{
|
||||
return myWorkDegree;
|
||||
}
|
||||
|
||||
inline Standard_Integer PLib_JacobiPolynomial::NivConstr() const
|
||||
{
|
||||
return myNivConstr;
|
||||
}
|
16844
src/PLib/PLib_JacobiPolynomial_0.hxx
Executable file
16844
src/PLib/PLib_JacobiPolynomial_0.hxx
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user