![]() |
IgANet
IGAnets - Isogeometric Analysis Networks
|
Tensor-product non-uniform B-spline (core functionality). More...
#include </home/runner/work/iganet/iganet/include/iganet/splines/bspline.hpp>
Public Types | |
| template<typename other_t , short_t GeoDim_, short_t... Degrees_> | |
| using | derived_self_type = NonUniformBSplineCore< other_t, GeoDim_, Degrees_... > |
Deduces the derived self-type when exposed to different class template parameters real_t and GeoDim, and the Degrees parameter pack. | |
| template<template< typename, short_t, short_t... > class BSpline, std::make_signed_t< short_t > degree_elevate = 0> | |
| using | derived_type = BSpline< real_t, GeoDim,(Degrees+degree_elevate)... > |
Deduces the type of the template template parameter BSpline when exposed to the class template parameters real_t and GeoDim, and the Degrees parameter pack. The optional template parameter degree_elevate can be used to (de-)elevate the degrees by an additive constant. | |
| template<typename other_t > | |
| using | real_derived_self_type = NonUniformBSplineCore< other_t, GeoDim, Degrees... > |
Deduces the derived self-type when exposed to a different class template parameter real_t. | |
| template<std::make_signed_t< short_t > degree_elevate = 0> | |
| using | self_type = Base::template derived_type< NonUniformBSplineCore, degree_elevate > |
Deduces the self-type possibly degrees (de-)elevated by the additive constant degree_elevate. | |
| using | value_type = real_t |
| Value type. | |
Public Types inherited from iganet::UniformBSplineCore< real_t, GeoDim, Degrees... > | |
| using | derived_self_type = UniformBSplineCore< other_t, GeoDim_, Degrees_... > |
Deduces the derived self-type when exposed to different class template parameters real_t and GeoDim, and the Degrees parameter pack. | |
| using | derived_type = BSpline< real_t, GeoDim,(Degrees+degree_elevate)... > |
Deduces the type of the template parameter BSpline when exposed to the class template parameters real_t and GeoDim, and the Degrees parameter pack. The optional template parameter degree_elevate can be used to (de-)elevate the degrees by an additive constant. | |
| using | real_derived_self_type = UniformBSplineCore< other_t, GeoDim, Degrees... > |
Deduces the derived self-type when exposed to a different class template parameter real_t. | |
| using | self_type = derived_type< UniformBSplineCore, degree_elevate > |
Deduces the self-type possibly degrees (de-)elevated by the additive constant degree_elevate. | |
| using | value_type = real_t |
| Value type. | |
Public Types inherited from iganet::BSplinePatch< real_t, GeoDim, sizeof...(Degrees)> | |
| using | value_type = real_t |
| Scalar type. | |
Public Member Functions | |
| NonUniformBSplineCore (Base &&other) noexcept | |
| Constructs a non-uniform B-spline by consuming a uniform one. | |
| NonUniformBSplineCore (const std::array< std::vector< typename Base::value_type >, Base::parDim_ > &kv, const utils::TensorArray< Base::geoDim_ > &coeffs, bool clone=false, Options< real_t > options=Options< real_t >{}) | |
| Constructor for non-equidistant knot vectors. | |
| NonUniformBSplineCore (const std::array< std::vector< typename Base::value_type >, Base::parDim_ > &kv, enum init init=init::greville, Options< real_t > options=Options< real_t >{}) | |
| Constructor for non-equidistant knot vectors. | |
| template<typename BSpline > | |
| auto & | from_gismo (BSpline &bspline, bool updateCoeffs, bool updateKnotVector) |
Provides the from_gismo operation. | |
| NonUniformBSplineCore & | insert_knots (const utils::TensorArray< Base::parDim_ > &knots) |
| Returns the B-spline object with refined knot and coefficient vectors. | |
| NonUniformBSplineCore & | reduce_continuity (int numReduce=1, int dim=-1) |
| Returns the B-spline object with updated knot and coefficient vectors with reduced continuity. | |
| NonUniformBSplineCore & | uniform_refine (int numRefine=1, int dim=-1) |
| Returns the B-spline object with uniformly refined knot and coefficient vectors. | |
Public Member Functions inherited from iganet::UniformBSplineCore< real_t, GeoDim, Degrees... > | |
| UniformBSplineCore (const std::array< int64_t, parDim_ > &ncoeffs, const utils::TensorArray< geoDim_ > &coeffs, bool clone=false, Options< real_t > options=Options< real_t >{}) | |
| Constructor for equidistant knot vectors. | |
| UniformBSplineCore (const std::array< int64_t, parDim_ > &ncoeffs, enum init init=init::greville, Options< real_t > options=Options< real_t >{}) | |
| Constructor for equidistant knot vectors. | |
| UniformBSplineCore (const std::array< int64_t, parDim_ > &ncoeffs, utils::TensorArray< geoDim_ > &&coeffs, Options< real_t > options=Options< real_t >{}) | |
| Constructor for equidistant knot vectors. | |
| UniformBSplineCore (const UniformBSplineCore &)=default | |
| Copy constructor. | |
| UniformBSplineCore (const UniformBSplineCore< other_t, GeoDim, Degrees... > &other, Options< real_t > options=Options< real_t >{}) | |
| Copy constructor. | |
| UniformBSplineCore (Options< real_t > options=Options< real_t >{}) | |
| Default constructor. | |
| UniformBSplineCore (UniformBSplineCore &&) noexcept=default | |
| Move constructor. | |
| ~UniformBSplineCore () override=default | |
| Destructor. | |
| torch::Tensor | as_tensor () const noexcept override |
| Returns all coefficients as a single tensor. | |
| int64_t | as_tensor_size () const noexcept override |
| Returns the size of the single tensor representation of all coefficients. | |
| const utils::TensorArray< geoDim_ > & | coeffs () const noexcept |
| Returns a constant reference to the array of coefficient vectors. | |
| utils::TensorArray< geoDim_ > & | coeffs () noexcept |
| Returns a non-constant reference to the array of coefficient vectors. | |
| const torch::Tensor & | coeffs (short_t i) const noexcept |
| Returns a constant reference to the coefficient vector in the \(i\)-th dimension. | |
| torch::Tensor & | coeffs (short_t i) noexcept |
| Returns a non-constant reference to the coefficient vector in the \(i\)-th dimension. | |
| nlohmann::json | coeffs_to_json () const |
| Returns the B-spline object's coefficients as JSON object. | |
| utils::TensorArray< geoDim_ > | coeffs_view () const noexcept |
| Returns an array of views to the coefficient vectors. | |
| const auto | coeffs_view (short_t i) const noexcept |
| Returns a view to the coefficient vector in the. \(i\)-th dimension. | |
| torch::Device | device () const noexcept override |
Returns the device property. | |
| int32_t | device_index () const noexcept override |
Returns the device_index property. | |
| torch::Dtype | dtype () const noexcept override |
Returns the dtype property. | |
| auto | eval (const utils::TensorArray< parDim_ > &xi, const utils::TensorArray< parDim_ > &knot_indices) const |
Returns the value of the univariate B-spline object in the points xi. | |
| auto | eval (const utils::TensorArray< parDim_ > &xi, const utils::TensorArray< parDim_ > &knot_indices, const torch::Tensor &coeff_indices) const |
Returns the value of the univariate B-spline object in the points xi. | |
| auto | eval_tr (const utils::TensorArray< parDim_ > &xi, const utils::TensorArray< parDim_ > &knot_indices) const |
Provides the eval_tr operation. | |
| auto | eval_tr (const utils::TensorArray< parDim_ > &xi, const utils::TensorArray< parDim_ > &knot_indices, const torch::Tensor &coeff_indices) const |
Provides the eval_tr operation. | |
| auto & | from_gismo (BSpline &bspline, bool updateCoeffs, bool updateKnotVector) |
Provides the from_gismo operation. | |
| UniformBSplineCore & | from_json (const nlohmann::json &json) override |
| Updates the B-spline object from JSON object. | |
| UniformBSplineCore & | from_tensor (const torch::Tensor &tensor) noexcept override |
| Sets all coefficients from a single tensor. | |
| UniformBSplineCore & | from_xml (const pugi::xml_document &doc, int id=0, const std::string &label="", int index=-1) override |
| Updates the B-spline object from XML object. | |
| UniformBSplineCore & | from_xml (const pugi::xml_node &root, int id=0, const std::string &label="", int index=-1) override |
| Updates the B-spline object from XML node. | |
| auto | greville (bool interior=false) const |
| Returns the Greville abscissae. | |
| void | init_coeffs (enum init init) |
| Initializes the B-spline coefficients. | |
| void | init_knots () |
| Initializes the B-spline knots. | |
| bool | is_sparse () const noexcept override |
| Returns true if the layout is sparse. | |
| bool | isclose (const UniformBSplineCore< other_t, GeoDim_, Degrees_... > &other, real_t rtol=real_t{1e-5}, real_t atol=real_t{1e-8}) const |
| Returns true if both B-spline objects are close up to the given tolerances. | |
| const utils::TensorArray< parDim_ > & | knots () const noexcept |
| Returns a constant reference to the array of knot vectors. | |
| utils::TensorArray< parDim_ > & | knots () noexcept |
| Returns a non-constant reference to the array of knot vectors. | |
| const torch::Tensor & | knots (short_t i) const noexcept |
| Returns a constant reference to the knot vector in the. \(i\)-th dimension. | |
| torch::Tensor & | knots (short_t i) noexcept |
| Returns a non-constant reference to the knot vector in the \(i\)-th dimension. | |
| nlohmann::json | knots_to_json () const |
| Returns the B-spline object's knots as JSON object. | |
| torch::Layout | layout () const noexcept override |
Returns the layout property. | |
| void | load (const std::string &filename, const std::string &key="bspline") |
| Loads the B-spline from file. | |
| const std::array< int64_t, parDim_ > & | ncoeffs () const noexcept |
| Returns a constant reference to the array of coefficient vector dimensions. | |
| int64_t | ncoeffs (short_t i) const noexcept |
| Returns the total number of coefficients in the. \(i\)-th direction. | |
| int64_t | ncumcoeffs () const noexcept |
| Returns the total number of coefficients. | |
| const std::array< int64_t, parDim_ > & | nknots () const noexcept |
| Returns a constant reference to the array of knot vector dimensions. | |
| int64_t | nknots (short_t i) const noexcept |
| Returns the dimension of the knot vector in the. \(i\)-th dimension. | |
| bool | operator!= (const UniformBSplineCore< other_t, GeoDim_, Degrees_... > &other) const |
| Returns true if both B-spline objects are different. | |
| UniformBSplineCore & | operator= (const UniformBSplineCore &)=default |
| Copy assignment operator. | |
| UniformBSplineCore & | operator= (UniformBSplineCore &&) noexcept=default |
| Move assignment operator. | |
| bool | operator== (const UniformBSplineCore< other_t, GeoDim_, Degrees_... > &other) const |
| Returns true if both B-spline objects are the same. | |
| const Options< real_t > & | options () const noexcept |
| Returns a constant reference to the B-spline object's options. | |
| bool | pinned_memory () const noexcept override |
Returns the pinned_memory property. | |
| torch::serialize::InputArchive & | read (torch::serialize::InputArchive &archive, const std::string &key="bspline") |
| Reads the B-spline from a torch::serialize::InputArchive object. | |
| bool | requires_grad () const noexcept override |
Returns the requires_grad property. | |
| void | save (const std::string &filename, const std::string &key="bspline") const |
| Saves the B-spline to file. | |
| UniformBSplineCore & | set_requires_grad (bool requires_grad) noexcept override |
Sets the B-spline object's requires_grad property. | |
| auto | to_gismo () const |
| Converts the B-spline object into a gsBSpline object of the parametric dimension is one and a gsTensorBSpline object otherwise. | |
| BSpline & | to_gismo (BSpline &bspline, bool updateKnotVector, bool updateCoeffs) const |
Provides the to_gismo operation. | |
| nlohmann::json | to_json () const override |
| Returns the B-spline object as JSON object. | |
| pugi::xml_document | to_xml (int id=0, const std::string &label="", int index=-1) const override |
| Returns the B-spline object as XML object. | |
| pugi::xml_node & | to_xml (pugi::xml_node &root, int id=0, const std::string &label="", int index=-1) const override |
| Returns the B-spline object as XML node. | |
| UniformBSplineCore & | transform (const std::function< std::array< real_t, geoDim_ >(const std::array< real_t, parDim_ > &)> mapping) |
| Transforms the coefficients based on the given mapping. | |
| UniformBSplineCore & | transform (const std::function< std::array< real_t, N >(const std::array< real_t, parDim_ > &)> mapping, std::array< short_t, N > dims) |
| Transforms the coefficients based on the given mapping. | |
| UniformBSplineCore & | uniform_refine (int numRefine=1, int dim=-1) |
| Returns the B-spline object with uniformly refined knot and coefficient vectors. | |
| torch::serialize::OutputArchive & | write (torch::serialize::OutputArchive &archive, const std::string &key="bspline") const |
| Writes the B-spline into a torch::serialize::OutputArchive object. | |
Public Member Functions inherited from iganet::utils::Serializable | |
| virtual | ~Serializable ()=default |
| Destructor. | |
| virtual void | pretty_print (std::ostream &os=Log(log::info)) const =0 |
| Returns a string representation of the object. | |
Public Member Functions inherited from iganet::BSplinePatch< real_t, GeoDim, sizeof...(Degrees)> | |
| virtual | ~BSplinePatch ()=default |
| Destructor. | |
| virtual void | pretty_print (std::ostream &os=Log(log::info)) const noexcept=0 |
| Returns a string representation. | |
Static Public Member Functions | |
| static constexpr bool | is_nonuniform () |
| Returns true if the B-spline is non-uniform. | |
| static constexpr bool | is_uniform () |
| Returns true if the B-spline is uniform. | |
Static Public Member Functions inherited from iganet::UniformBSplineCore< real_t, GeoDim, Degrees... > | |
| static constexpr short_t | degree (short_t i) noexcept |
| Returns a constant reference to the degree in the. \(i\)-th dimension. | |
| static constexpr const std::array< short_t, parDim_ > & | degrees () noexcept |
| Returns a constant reference to the array of degrees. | |
| static constexpr short_t | geoDim () noexcept |
| Returns the geometric dimension. | |
| static constexpr bool | is_nonuniform () noexcept |
| Returns true if the B-spline is non-uniform. | |
| static constexpr bool | is_uniform () noexcept |
| Returns true if the B-spline is uniform. | |
| static constexpr short_t | parDim () noexcept |
| Returns the parametric dimension. | |
Static Public Member Functions inherited from iganet::BSplinePatch< real_t, GeoDim, sizeof...(Degrees)> | |
| static constexpr short_t | geoDim () noexcept |
| Dimension of the physical space. | |
| static constexpr short_t | parDim () noexcept |
| Dimension of the parametric space. | |
Private Types | |
| using | Base = UniformBSplineCore< real_t, GeoDim, Degrees... > |
| Base type. | |
Private Member Functions | |
| void | init_knots (const std::array< std::vector< typename Base::value_type >, Base::parDim_ > &kv) |
| Initializes the B-spline knots. | |
Additional Inherited Members | |
Protected Member Functions inherited from iganet::UniformBSplineCore< real_t, GeoDim, Degrees... > | |
| auto | eval_basfunc_univariate (const torch::Tensor &xi, const torch::Tensor &knot_indices) const |
Returns the vector of univariate B-spline basis functions (or their derivatives) evaluated in the point xi. | |
| auto | eval_basfunc_univariate_tr (const torch::Tensor &xi, const torch::Tensor &knot_indices) const |
Provides the eval_basfunc_univariate_tr operation. | |
| void | update_coeffs (const utils::TensorArray< parDim_ > &knots, const utils::TensorArray< parDim_ > &knot_indices) |
| Updates the B-spline coefficients after knot insertion. | |
| auto | update_coeffs_univariate (const torch::Tensor &knots, const torch::Tensor &knot_indices) const |
| Returns the knot insertion matrix. | |
Protected Attributes inherited from iganet::UniformBSplineCore< real_t, GeoDim, Degrees... > | |
| utils::TensorArray< geoDim_ > | coeffs_ |
| Array storing the coefficients of the control net. \(\left(\mathbf{c}_{i_d}\right)_{i_d=1}^{n_d}\), \(\mathbf{c}_{i_d}\in\mathbb{R}^{d_\text{geo}}\). | |
| utils::TensorArray< parDim_ > | knots_ |
| Array storing the knot vectors. \(\left(\left(t_{i_d}\right)_{i_d=1}^{n_d+p_d+1}\right)_{d=1}^{d_\text{par}}\). | |
| std::array< int64_t, parDim_ > | ncoeffs_ |
| Array storing the sizes of the coefficients of the control net \(\left(n_d\right)_{d=1}^{d_\text{par}}\). | |
| std::array< int64_t, parDim_ > | ncoeffs_reverse_ |
| Array storing the sizes of the coefficients of the control net \(\left(n_d\right)_{d=1}^{d_\text{par}}\) in reverse order (needed for coeffs_view). | |
| std::array< int64_t, parDim_ > | nknots_ |
| Array storing the sizes of the knot vectors. \(\left(n_d+p_d+1\right)_{d=1}^{d_\text{par}}\). | |
| Options< real_t > | options_ |
| Options. | |
Static Protected Attributes inherited from iganet::UniformBSplineCore< real_t, GeoDim, Degrees... > | |
| static constexpr const std::array< short_t, parDim_ > | degrees_ |
| Array storing the degrees. \(\left(p_d\right)_{d=1}^{d_\text{par}}\). | |
| static constexpr const short_t | geoDim_ |
| Dimension of the geometric space. \(\Omega\subset\mathbb{R}^{d_\text{geo}}\). | |
| static constexpr const short_t | parDim_ |
| Dimension of the parametric space. \(\hat\Omega=[0,1]^{d_\text{par}}\). | |
Tensor-product non-uniform B-spline (core functionality).
This class extends the base class UniformBSplineCore to non-uniform B-splines. Like its base class it only implements the core functionality of non-uniform B-splines.
|
private |
Base type.
| using iganet::NonUniformBSplineCore< real_t, GeoDim, Degrees >::derived_self_type = NonUniformBSplineCore<other_t, GeoDim_, Degrees_...> |
Deduces the derived self-type when exposed to different class template parameters real_t and GeoDim, and the Degrees parameter pack.
| using iganet::NonUniformBSplineCore< real_t, GeoDim, Degrees >::derived_type = BSpline<real_t, GeoDim, (Degrees + degree_elevate)...> |
Deduces the type of the template template parameter BSpline when exposed to the class template parameters real_t and GeoDim, and the Degrees parameter pack. The optional template parameter degree_elevate can be used to (de-)elevate the degrees by an additive constant.
| using iganet::NonUniformBSplineCore< real_t, GeoDim, Degrees >::real_derived_self_type = NonUniformBSplineCore<other_t, GeoDim, Degrees...> |
Deduces the derived self-type when exposed to a different class template parameter real_t.
| using iganet::NonUniformBSplineCore< real_t, GeoDim, Degrees >::self_type = Base::template derived_type<NonUniformBSplineCore, degree_elevate> |
Deduces the self-type possibly degrees (de-)elevated by the additive constant degree_elevate.
| using iganet::NonUniformBSplineCore< real_t, GeoDim, Degrees >::value_type = real_t |
Value type.
|
inlineexplicitnoexcept |
Constructs a non-uniform B-spline by consuming a uniform one.
| other | Second input value. |
|
inlineexplicit |
Constructor for non-equidistant knot vectors.
| [in] | kv | Knot vectors. |
| [in] | init | Type of initialization. |
| [in] | options | Options configuration. |
|
inline |
Constructor for non-equidistant knot vectors.
| [in] | kv | Knot vectors. |
| [in] | coeffs | Vectors of coefficients per parametric dimension. |
| [in] | clone | If true, coefficients will be cloned. Otherwise, coefficients will be aliased. |
| [in] | options | Options configuration. |
|
inline |
Returns the value of the multivariate B-spline object in the point xi
| deriv | Template parameter deriv. |
| memory_optimized | Template parameter memory_optimized. |
| xi | Parametric coordinates. |
|
inline |
Provides the eval operation.
| deriv | Template parameter deriv. |
| memory_optimized | Template parameter memory_optimized. |
| deriv | Template parameter deriv. |
| memory_optimized | Template parameter memory_optimized. |
| xi | Parametric coordinates. |
|
inline |
Provides the eval operation.
| deriv | Template parameter deriv. |
| memory_optimized | Template parameter memory_optimized. |
| xi | Parametric coordinates. |
| knot_indices | Value of knot_indices. |
|
inline |
Provides the eval operation.
| deriv | Template parameter deriv. |
| memory_optimized | Template parameter memory_optimized. |
| xi | Parametric coordinates. |
| knot_indices | Value of knot_indices. |
| coeff_indices | Value of coeff_indices. |
|
inline |
Returns the indices of knot spans containing xi.
This function returns the indices. \((i_d)_{d=1}^{d_\text{par}}\) of the knot spans such that
\[ \boldsymbol{\xi} \in [t_{i_1}, t_{i_1+1}) \times [t_{i_2}, t_{i_2+1}) \times \dots \times [t_{i_{d_\text{par}}}, t_{i_{d_\text{par}}+1}). \]
The indices are returned as utils::TensorArray<parDim_> in the same order as provided in xi
| xi | Parametric coordinates. |
|
inline |
Provides the find_knot_indices operation.
| xi | Parametric coordinates. |
|
inline |
Provides the from_gismo operation.
| BSpline | Template parameter BSpline. |
| bspline | Value of bspline. |
| updateCoeffs | Whether to update the coefficients. |
| updateKnotVector | Whether to update the knot vectors. |
|
inlineprivate |
Initializes the B-spline knots.
|
inline |
Returns the B-spline object with refined knot and coefficient vectors.
| knots | Value of knots. |
|
inlinestaticconstexpr |
Returns true if the B-spline is non-uniform.
|
inlinestaticconstexpr |
Returns true if the B-spline is uniform.
| other_t | Template parameter other_t. |
|
inline |
Returns the B-spline object with updated knot and coefficient vectors with reduced continuity.
| numReduce | Value of numReduce. |
| dim | Value of dim. |
|
inline |
Returns the B-spline object with uniformly refined knot and coefficient vectors.
If dim = -1, new knot values are inserted uniformly in each knot span in all spatial dimensions. Otherwise, i.e., dim != -1 new knots are only inserted in the specified dimension.
| numRefine | Value of numRefine. |
| dim | Value of dim. |