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 
19 class FunctionBase;
20 class Vec4;
21 class Vec3;
22 
23 namespace 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 
37 namespace 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 
87  Go::SplineSurface* project(const Go::SplineSurface* surface,
88  const FunctionBase& f,
89  int nComp = 1, Real time = Real(0));
90 
92  Go::SplineVolume* project(const Go::SplineVolume* volume,
93  const FunctionBase& f,
94  int nComp = 1, Real time = Real(0));
95 
97  enum class AdjustOp {
98  Lower,
99  Original,
100  Raise,
101  };
102 
104  Go::BsplineBasis adjustBasis(const Go::BsplineBasis& basis,
105  AdjustOp adjust);
106 
108  std::vector<double> buildKnotVector(int p, const std::vector<double>& simple_knots,
109  const std::vector<int>& continuities);
110 }
111 
112 #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:29
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:97
@ Original
Keep original.
@ Raise
Raise order by one.
@ Lower
Lower order by one.
void point(Vec3 &X, double u, const Go::SplineCurve *curve)
Evaluates given spline curve at a parametric point.
Definition: SplineUtils.C:45
void extractBasis(const Go::BasisDerivsSf &spline, Vector &N, Matrix &dNdu)
Establishes matrices with basis functions and 1st derivatives.
Definition: SplineUtils.C:73
Go::BsplineBasis adjustBasis(const Go::BsplineBasis &basis, AdjustOp adjust)
Returns a basis adjusted according to the given operation.
Definition: SplineUtils.C:335
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:34
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:359
Go::SplineCurve * project(const Go::SplineCurve *curve, const FunctionBase &f, int nComp=1, Real time=Real(0))
Projects a spatial function onto a spline curve.
Definition: SplineUtils.C:204
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:181
Vec3 toVec3(const Go::Point &X, int nsd=3)
Helper method for casting a Go::Point object to Vec3.
Definition: SplineUtils.C:26