36template<
short_t d, 
class T>
 
   43    typedef memory::unique_ptr<gsGeometry<T> > gsGeoPtr;
 
   67    typedef memory::shared_ptr< gsTensorNurbsBasis > 
Ptr;
 
   70    typedef memory::unique_ptr< gsTensorNurbsBasis > 
uPtr;
 
   89    gsTensorNurbsBasis(
const gsTensorNurbsBasis & o) : 
Base(o) { }
 
   91    GISMO_CLONE_FUNCTION(gsTensorNurbsBasis)
 
   93    gsGeoPtr makeGeometry( gsMatrix<T> coefs ) 
const;
 
   98    std::ostream &
print(std::ostream &os)
 const 
  100        os << 
"TensorNurbsBasis: dim=" << this->dim()<< 
", size="<< this->
size() << 
".";
 
  101        for ( 
unsigned i = 0; i!=d; ++i )
 
  102            os << 
"\n  Direction "<< i <<
": "<< this->m_src->component(i).knots() <<
" ";
 
 
  108    { 
return m_src->knots(i); }
 
  110    const gsKnotVector<T> & knots (
int i)
 const 
  111    { 
return m_src->knots(i); }
 
  114    T knot(
int i, 
int k)
 const 
  115    { 
return m_src->knot(i, k); }
 
  121        m_src->size_cwise(result);
 
 
  128        m_src->stride_cwise(result);
 
 
  131    void swapDirections(
const unsigned i, 
const unsigned j)
 
  140        m_src->swapDirections(i, j);
 
  143    void uniformRefine_withCoefs(gsMatrix<T>& coefs, 
int numKnots = 1, 
int mul = 1, 
short_t const dir = -1)
 
  145        GISMO_ASSERT( coefs.rows() == this->size() && m_weights.rows() == this->size(),
 
  146                      "Invalid dimensions" );
 
  148        gsSparseMatrix<T, RowMajor> transfer;
 
  151            m_src->uniformRefine_withTransfer(transfer, numKnots, mul);
 
  153            coefs     = transfer * ( m_weights.asDiagonal() * coefs);
 
  154            m_weights = transfer * m_weights;
 
  162            coefs.array().colwise() /= m_weights.col(0).array();
 
  169            GISMO_ASSERT( dir >= 0 && 
static_cast<unsigned>(dir) < d,
 
  170                          "Invalid basis component "<< dir <<
" requested for degree elevation" );
 
  172            gsVector<index_t,d> sz;
 
  173            m_src->size_cwise(sz);
 
  174            m_src->component(dir).uniformRefine_withTransfer( transfer, numKnots, mul );
 
  176            const index_t coefs_cols = coefs.cols();
 
  177            const index_t weights_cols = m_weights.cols();
 
  179            coefs = m_weights.asDiagonal() * coefs; 
 
  181            coefs.resize( sz[0], coefs_cols * sz.template tail<
static_cast<short_t>(d-1)>().prod() );
 
  182            coefs     = transfer * coefs;
 
  185            m_weights.resize( sz[0], weights_cols * sz.template tail<
static_cast<short_t>(d-1)>().prod() );
 
  186            m_weights = transfer * m_weights;
 
  188            sz[0] = coefs.rows();
 
  190            coefs.resize( sz.prod(), coefs_cols );
 
  191            m_weights.resize( sz.prod(), weights_cols );
 
  195            coefs.array().colwise() /= m_weights.col(0).array();
 
  210        for ( 
index_t i=0; i<ind.size(); ++i)
 
  211            ww(i,0) = m_weights( (ind)(i,0), 0);
 
  219        this->matchWith(bi,other,bndThis,bndOther,0);
 
  223    void matchWith(
const boundaryInterface & bi, 
const gsBasis<T> & other,
 
  224                   gsMatrix<index_t> & bndThis, gsMatrix<index_t> & bndOther, 
index_t offset)
 const 
  226        if ( 
const gsTensorNurbsBasis<d,T> * _other = 
dynamic_cast<const gsTensorNurbsBasis<d,T> *
>(&other) )
 
  227            m_src->matchWith(bi,_other->source(),bndThis,bndOther,offset);
 
  228        else if ( 
const gsTensorBasis<d,T> * __other = 
dynamic_cast<const gsTensorBasis<d,T> *
>(&other) )
 
  229            m_src->matchWith(bi,*__other,bndThis,bndOther,offset);
 
  231            gsWarn<<
"Cannot match with "<<other<<
"\n";
 
  237    using Base::m_weights;
 
 
  245#ifndef GISMO_BUILD_LIB 
  246#include GISMO_HPP_HEADER(gsTensorNurbsBasis.hpp) 
  248#ifdef gsTensorNurbsBasis_EXPORT 
  249#include GISMO_HPP_HEADER(gsTensorNurbsBasis.hpp) 
  250#undef  EXTERN_CLASS_TEMPLATE 
  251#define EXTERN_CLASS_TEMPLATE CLASS_TEMPLATE_INST 
  255EXTERN_CLASS_TEMPLATE gsTensorNurbsBasis<2,real_t>;
 
  256EXTERN_CLASS_TEMPLATE gsTensorNurbsBasis<3,real_t>;
 
  257EXTERN_CLASS_TEMPLATE gsTensorNurbsBasis<4,real_t>;
 
Struct which represents a certain side of a box.
Definition gsBoundary.h:85
A univariate B-spline basis.
Definition gsBSplineBasis.h:700
A basis represents a family of scalar basis functions defined over a common parameter domain.
Definition gsBasis.h:79
const gsBasis< T > & basis(const index_t k) const
Helper which casts and returns the k-th piece of this function set as a gsBasis.
Definition gsFunctionSet.hpp:33
Class for representing a knot vector.
Definition gsKnotVector.h:80
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Class that creates a rational counterpart for a given basis.
Definition gsRationalBasis.h:48
index_t size() const
Definition gsRationalBasis.h:137
A tensor product B-spline basis.
Definition gsTensorBSplineBasis.h:37
memory::unique_ptr< Self_t > uPtr
Smart pointer for gsTensorBSplineBasis.
Definition gsTensorBSplineBasis.h:69
A tensor product Non-Uniform Rational B-spline (NURBS) basis.
Definition gsTensorNurbsBasis.h:38
void size_cwise(gsVector< index_t, d > &result) const
The number of basis functions in the direction of the k-th parameter component.
Definition gsTensorNurbsBasis.h:118
gsBSplineTraits< d, T >::Basis Src_t
Source basis type.
Definition gsTensorNurbsBasis.h:52
Src_t::Basis_t Basis_t
Coordinate basis type.
Definition gsTensorNurbsBasis.h:55
gsRationalBasis< typename gsBSplineTraits< d, T >::Basis > Base
Base type.
Definition gsTensorNurbsBasis.h:46
void stride_cwise(gsVector< index_t, d > &result) const
Returns the strides for all dimensions.
Definition gsTensorNurbsBasis.h:125
T Scalar_t
Coefficient type.
Definition gsTensorNurbsBasis.h:58
memory::shared_ptr< gsTensorNurbsBasis > Ptr
Shared pointer for gsTensorNurbsBasis.
Definition gsTensorNurbsBasis.h:67
BoundaryBasisType::uPtr boundaryBasis(boxSide const &s)
Gives back the boundary basis at boxSide s.
memory::unique_ptr< gsTensorNurbsBasis > uPtr
Unique pointer for gsTensorNurbsBasis.
Definition gsTensorNurbsBasis.h:70
gsBSplineTraits< static_cast< short_t >(d-1), T >::RatBasis BoundaryBasisType
Associated Boundary basis type.
Definition gsTensorNurbsBasis.h:64
gsBSplineTraits< d, T >::RatGeometry GeometryType
Associated geometry type.
Definition gsTensorNurbsBasis.h:61
gsBSplineBasis< T > Family_t
Family type.
Definition gsTensorNurbsBasis.h:49
std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition gsTensorNurbsBasis.h:98
A tensor product Non-Uniform Rational B-spline function (NURBS) of parametric dimension d,...
Definition gsTensorNurbs.h:41
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
void swapTensorDirection(int k1, int k2, gsVector< index_t, d > &sz, gsMatrix< T > &coefs)
Definition gsTensorTools.h:129
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
#define gsWarn
Definition gsDebug.h:50
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
Represents a NURBS basis with one parameter.
Provides declaration of RationalBasis class.
Provides declaration of TensorBSplineBasis abstract interface.
The G+Smo namespace, containing all definitions for the library.
S give(S &x)
Definition gsMemory.h:266
Struct which represents an interface between two patches.
Definition gsBoundary.h:650
Traits for BSplineBasis in more dimensions.
Definition gsBSplineBasis.h:32