IFEM 90A354
SplineUtils.h
Go to the documentation of this file.
1// $Id$
2//==============================================================================
12//==============================================================================
13
14#ifndef _SPLINE_UTILS_H
15#define _SPLINE_UTILS_H
16
17#include "MatVec.h"
18
19class FunctionBase;
20class Vec4;
21class Vec3;
22
23namespace Go {
24 class Point;
25 struct BasisDerivsSf;
26 struct BasisDerivsSf2;
27 struct BasisDerivsSf3;
28 struct BasisDerivs;
29 struct BasisDerivs2;
30 class BsplineBasis;
31 class SplineCurve;
32 class SplineSurface;
33 class SplineVolume;
34}
35
36
37namespace SplineUtils
38{
40 Vec3 toVec3(const Go::Point& X, int nsd = 3);
42 Vec4 toVec4(const Go::Point& X, Real time = Real(0),
43 const double* u = nullptr);
44
46 void point(Vec3& X, double u, const Go::SplineCurve* curve);
48 void point(Vec3& X, double u, double v, const Go::SplineSurface* surf);
50 void point(Vec3& X, double u, double v, double w, const Go::SplineVolume* vol);
51
53 void extractBasis(const Go::BasisDerivsSf& spline,
54 Vector& N, Matrix& dNdu);
56 void extractBasis(const Go::BasisDerivsSf2& spline,
57 Vector& N, Matrix& dNdu, Matrix3D& d2Ndu2);
60 void extractBasis(const Go::BasisDerivsSf3& spline,
61 Vector& N, Matrix& dNdu,
62 Matrix3D& d2Ndu2, Matrix4D& d3Ndu3);
63
65 void extractBasis(const Go::BasisDerivs& spline,
66 Vector& N, Matrix& dNdu);
68 void extractBasis(const Go::BasisDerivs2& spline,
69 Vector& N, Matrix& dNdu, Matrix3D& d2Ndu2);
70
77 void getGaussParameters(RealArray& uGP, int nGP, const double* xi,
78 const Go::BsplineBasis& basis,
79 bool skipNullSpans = false);
80
82 Go::SplineCurve* project(const Go::SplineCurve* curve,
83 const FunctionBase& f,
84 int nComp = 1, Real time = Real(0),
85 bool tangent = false);
86
88 Go::SplineSurface* project(const Go::SplineSurface* surface,
89 const FunctionBase& f,
90 int nComp = 1, Real time = Real(0),
91 bool tangent = false);
92
94 Go::SplineVolume* project(const Go::SplineVolume* volume,
95 const FunctionBase& f,
96 int nComp = 1, Real time = Real(0),
97 bool tangent = false);
98
100 enum class AdjustOp {
101 Lower,
102 Original,
103 Raise,
104 };
105
107 Go::BsplineBasis adjustBasis(const Go::BsplineBasis& basis,
108 AdjustOp adjust);
109
111 std::vector<double> buildKnotVector(int p, const std::vector<double>& simple_knots,
112 const std::vector<int>& continuities);
113}
114
115#endif
#define Real
The floating point type to use.
Definition ImmersedBoundaries.h:18
std::vector< Real > RealArray
A real-valued array without algebraic operations.
Definition ImmersedBoundaries.h:32
Global algebraic operations on index 1-based matrices and vectors.
Base class for unary spatial functions of arbitrary result type.
Definition Function.h:147
Simple class for representing a point in 3D space.
Definition Vec3.h:27
Simple class for representing a point in 3D space and time.
Definition Vec3.h:209
A vector class with some added algebraic operations.
Definition matrix.h:64
Various utility functions on spline objects.
Definition ASMmxBase.h:25
AdjustOp
Enumeration of basis adjustment operations.
Definition SplineUtils.h:100
@ Original
Keep original.
@ Raise
Raise order by one.
@ Lower
Lower order by one.
Go::SplineCurve * project(const Go::SplineCurve *curve, const FunctionBase &f, int nComp=1, Real time=Real(0), bool tangent=false)
Projects a spatial function onto a spline curve.
Definition SplineUtils.C:223
void point(Vec3 &X, double u, const Go::SplineCurve *curve)
Evaluates given spline curve at a parametric point.
Definition SplineUtils.C:64
void extractBasis(const Go::BasisDerivsSf &spline, Vector &N, Matrix &dNdu)
Establishes matrices with basis functions and 1st derivatives.
Definition SplineUtils.C:92
Go::BsplineBasis adjustBasis(const Go::BsplineBasis &basis, AdjustOp adjust)
Returns a basis adjusted according to the given operation.
Definition SplineUtils.C:357
Vec4 toVec4(const Go::Point &X, Real time=Real(0), const double *u=nullptr)
Helper method for casting a Go::Point and time object to Vec4.
Definition SplineUtils.C:53
std::vector< double > buildKnotVector(int p, const std::vector< double > &simple_knots, const std::vector< int > &continuities)
Builds a knot vector from a given polynomial order, knots and continuities.
Definition SplineUtils.C:381
void getGaussParameters(RealArray &uGP, int nGP, const double *xi, const Go::BsplineBasis &basis, bool skipNullSpans=false)
Extracts parameter values of the Gauss points for a spline basis.
Definition SplineUtils.C:200
Vec3 toVec3(const Go::Point &X, int nsd=3)
Helper method for casting a Go::Point object to Vec3.
Definition SplineUtils.C:45