23template <
typename T> 
class gsFunctionSet;
 
   45template <
typename Derived>
 
   50    auto ders = secDers.reshaped(sz, secDers.size() / sz );
 
   56        hessian = secDers.transpose();
 
   59        hessian.row(0)=ders.row(0);
 
   61        hessian.row(2)=ders.row(2);
 
   62        hessian.row(3)=ders.row(1);
 
   65        hessian.row(0)=ders.row(0);
 
   67        hessian.row(1)=ders.row(3);
 
   69        hessian.row(2)=ders.row(4);
 
   70        hessian.row(4)=ders.row(1);
 
   72        hessian.row(5)=ders.row(5);
 
   73        hessian.row(8)=ders.row(2);
 
   79            hessian.row((dim+1)*k) = ders.row(k);
 
   80            for (
index_t l=k+1; l<dim; ++l ) 
 
   81                hessian.row(dim*k+l) =
 
   82                hessian.row(dim*l+k) = ders.row(dim + sz++);
 
   89template <
typename Derived>
 
   90void hessianToSecDer (
const gsEigen::DenseBase<Derived> &  hessian,
 
   94    GISMO_ASSERT(hessian.cols() == dim, 
"single Hessian implemented");
 
   95    secDers.resize(dim*(dim+1)/2, hessian.cols() / dim );
 
   99        secDers=hessian.transpose();
 
  102        secDers.
at(0)=hessian(0,0);
 
  103        secDers.
at(1)=hessian(1,1);
 
  104        secDers.
at(2)=hessian(1,0);
 
  107        secDers.
at(0)=hessian(0,0);
 
  108        secDers.
at(1)=hessian(1,1);
 
  109        secDers.
at(2)=hessian(2,2);
 
  110        secDers.
at(3)=hessian(0,1);
 
  111        secDers.
at(4)=hessian(0,2);
 
  112        secDers.
at(5)=hessian(1,2);
 
 
  128    typedef typename gsMatrix<T>::constColumn constColumn;
 
  131    typedef gsEigen::Transpose<typename matrixView::Base> matrixTransposeView;
 
  134    mutable unsigned flags;
 
  142    std::vector<gsMatrix<T> > values;
 
  151    std::pair<short_t, short_t> dim;
 
  159    explicit gsFuncData(
unsigned flags = 0, 
int patch = 0)
 
  160    : flags(flags), patchId(patch)
 
  170    void addFlags (
unsigned newFlags)
 
  171    { flags = flags|newFlags; }
 
  189    unsigned bytesUsed()
 const 
  208    void swap(gsFuncData & other)
 
  210        std::swap(flags  , other.flags  );
 
  211        std::swap(patchId, other.patchId);
 
  212        std::swap(dim, other.dim);
 
  213        actives   .swap(other.actives   );
 
  214        values    .swap(other.values    );
 
  215        curls     .swap(other.curls     );
 
  216        divs      .swap(other.divs      );
 
  217        laplacians.swap(other.laplacians);
 
  222    inline const gsMatrix<index_t> & allActives()
 const 
  225                   "actives are not computed unless the NEED_ACTIVE flag is set.");
 
  226        GISMO_ASSERT(0!=actives.size(), 
"actives were not computed.");
 
  230    inline const gsMatrix<T> & allValues()
 const 
  233                     "values are not computed unless the NEED_ACTIVE flag is set.");
 
  234        GISMO_ASSERT(0!=values.size(), 
"values were not computed.");
 
  235        return values.front();
 
  238    inline gsMatrix<index_t>::constColumn active(
index_t point = 0)
 const 
  241                   "actives are not computed unless the NEED_ACTIVE flag is set.");
 
  242        return actives.col(point);
 
  245    inline matrixView eval (
index_t point)
 const 
  248                   "values are not computed unless the NEED_VALUE flag is set.");
 
  249        return values[0].reshapeCol(point, dim.second, values[0].rows()/dim.second);
 
  252    inline matrixView deriv (
index_t point)
 const 
  255                   "derivs are not computed unless the NEED_DERIV flag is set.");
 
  256        return values[1].reshapeCol(point, derivSize(), values[1].rows()/derivSize());
 
  259    inline matrixView deriv2 (
index_t point)
 const 
  262                   "deriv2s are not computed unless the NEED_DERIV2 flag is set.");
 
  263        return values[2].reshapeCol(point, deriv2Size(), values[2].rows()/deriv2Size());
 
  266    static inline void deriv2lex_inplace(gsMatrix<T> & der2, 
index_t d)
 
  270        gsVector<index_t> prm(sz);
 
  277                prm[m] = d + m - k - 1;
 
  283        const index_t nr = der2.rows();
 
  284        der2.resize(sz, der2.size()/sz);
 
  285        gsMatrix<T> tmp = der2(prm,gsEigen::all);
 
  286        tmp.resize(nr, der2.size()/nr);
 
  293                   "curls are not computed unless the NEED_CURL flag is set.");
 
  294        return curls.
reshapeCol(point, dim.second, curls.rows()/dim.second );
 
  297    inline matrixView div (
index_t point)
 const 
  300                   "divs are not computed unless the NEED_DIV flag is set.");
 
  301        return divs.
reshapeCol(point, divSize(), divs.rows()/divSize() );
 
  304    inline matrixView laplacian (
index_t point)
 const 
  307                   "laplacians are not computed unless the NEED_LAPLACIAN flag is set.");
 
  308        return laplacians.
reshapeCol(point, dim.second, laplacians.rows()/dim.second );
 
  312    inline matrixTransposeView jacobian(
index_t point, 
index_t func = 0)
 const 
  315                  "jacobian access needs the computation of derivs: set the NEED_JACOBIAN flag.");
 
  316        return gsAsConstMatrix<T, Dynamic, Dynamic>(&values[1].coeffRef(func*derivSize(),point),dim.first,dim.second).transpose();
 
  322                  "hessian access needs the computation of 2nd derivs: set the NEED_HESSIAN flag.");
 
  323       gsMatrix<T> res(dim.first,dim.first);
 
  324       const index_t dsz = dim.first*(dim.first+1) / 2;
 
  325       res = util::secDerToHessian(values[2].block(func*dsz,point,dsz,1), dim.first);
 
  326       res.resize(dim.first,dim.first);
 
  333    int  derivSize ()
 const {
return dim.first*dim.second;}
 
  335    int  deriv2Size()
 const {
return dim.second*dim.first*(dim.first+1) / 2; }
 
  337    int  divSize   ()
 const {
return dim.second/dim.first;}
 
  351    typedef gsFuncData<T> Base;
 
  352    typedef typename Base::constColumn         constColumn;
 
  353    typedef typename Base::matrixView          matrixView;
 
  354    typedef typename Base::matrixTransposeView matrixTransposeView;
 
  381    inline constColumn point(
const index_t point)
 const { 
return points.col(point);}
 
  383    inline T measure(
const index_t point)
 const 
  386                   "measures are not computed unless the NEED_MEASURE flag is set.");
 
  387        return measures(0,point);
 
  390    inline matrixView fundForm(
const index_t point)
 const 
  393                   "fundForms are not computed unless the NEED_2ND_FFORM flag is set.");
 
  397    inline constColumn normal(
const index_t point)
 const 
  400                   "normals are not computed unless the NEED_NORMAL flag is set.");
 
  401        return normals.col(point);
 
  404    inline constColumn outNormal(
const index_t point)
 const 
  407                   "normals are not computed unless the NEED_NORMAL flag is set.");
 
  408        return outNormals.col(point);
 
  411    inline matrixTransposeView jacobians()
 const 
  414                    "jacobian access needs the computation of derivs: set the NEED_DERIV flag." << this->maxDeriv() );
 
  415       return gsAsConstMatrix<T, Dynamic, Dynamic>(&values[1].coeffRef(0,0), dim.first,dim.second*values[1].cols()).transpose();
 
 
  426void swap(gismo::gsFuncData<T> & f1, gismo::gsFuncData<T> & f2)
 
Struct which represents a certain side of a box.
Definition gsBoundary.h:85
Creates a mapped object or data pointer to a const matrix without copying data.
Definition gsAsMatrix.h:141
Interface for the set of functions defined on a domain (the total number of functions in the set equa...
Definition gsFunctionSet.h:219
the gsMapData is a cache of pre-computed function (map) values.
Definition gsFuncData.h:349
gsMatrix< T > points
input (parametric) points
Definition gsFuncData.h:372
gsMapData(unsigned flags=0)
Main constructor.
Definition gsFuncData.h:361
gsMatrix< T > jacInvTr
Inverse of the Jacobian matrix (transposed)
Definition gsFuncData.h:376
gsMatrix< T > fundForms
Second fundumental forms.
Definition gsFuncData.h:375
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
gsAsMatrix< T, Dynamic, Dynamic > reshapeCol(index_t c, index_t n, index_t m)
Returns column c of the matrix resized to n x m matrix This function assumes that the matrix is size ...
Definition gsMatrix.h:231
T at(index_t i) const
Returns the i-th element of the vectorization of the matrix.
Definition gsMatrix.h:211
Provides structs and classes related to interfaces and boundaries.
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
#define GISMO_ERROR(message)
Definition gsDebug.h:118
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
This is the main header file that collects wrappers of Eigen for linear algebra.
EIGEN_STRONG_INLINE curl_expr< T > curl(const gsFeVariable< T > &u)
The curl of a finite element variable.
Definition gsExpressions.h:4498
The G+Smo namespace, containing all definitions for the library.
@ NEED_LAPLACIAN
Laplacian.
Definition gsForwardDeclarations.h:83
@ NEED_CURL
Curl operator.
Definition gsForwardDeclarations.h:79
@ NEED_HESSIAN
Hessian matrix.
Definition gsForwardDeclarations.h:82
@ NEED_VALUE
Value of the object.
Definition gsForwardDeclarations.h:72
@ NEED_DERIV2
Second derivatives.
Definition gsForwardDeclarations.h:80
@ NEED_DERIV
Gradient of the object.
Definition gsForwardDeclarations.h:73
@ NEED_GRAD_TRANSFORM
Gradient transformation matrix.
Definition gsForwardDeclarations.h:77
@ NEED_DIV
Div operator.
Definition gsForwardDeclarations.h:78
@ NEED_NORMAL
Normal vector of the object.
Definition gsForwardDeclarations.h:85
@ NEED_MEASURE
The density of the measure pull back.
Definition gsForwardDeclarations.h:76
@ NEED_OUTER_NORMAL
Outward normal on the boundary.
Definition gsForwardDeclarations.h:86
@ NEED_ACTIVE
Active function ids.
Definition gsForwardDeclarations.h:84
@ NEED_2ND_FFORM
Second fundamental form.
Definition gsForwardDeclarations.h:87
This namespace gathers several utility functions for miscellaneous tasks.
Struct that defines the boundary sides and corners and types of a geometric object.
Definition gsBoundary.h:56