G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsBasis.hpp
Go to the documentation of this file.
1
14#pragma once
15
16#include <gsCore/gsBasisFun.h>
18#include <gsCore/gsBoundary.h>
19#include <gsCore/gsGeometry.h>
20
21namespace gismo
22{
23
24template<class T>
25gsBasis<T>::~gsBasis()
26{ }
27
28template<class T>
30{
31 return gsBasisFun<T>(*this,i);
32}
33
34
35// Evaluates a linear combination of basis functions (default implementation)
36template<class T>
38 const gsMatrix<T> & coefs,
39 gsMatrix<T>& result) const
40{
41 gsMatrix<T> B ;
42 gsMatrix<index_t> actives;
43
44 // compute function values
45 this->eval_into(u,B);
46 // compute active functions
47 this->active_into(u,actives);
48
49 // compute result as linear combination of
50 // "coefs(actives)" and B
51 linearCombination_into( coefs, actives, B, result );
52}
53
54
55// Evaluates the Jacobian of the function given by coefs (default implementation)
56// For each point, result contains a geomDim x parDim matrix block containing the Jacobian matrix
57template<class T>
58void gsBasis<T>::jacobianFunc_into(const gsMatrix<T> &u, const gsMatrix<T> & coefs, gsMatrix<T>& result) const
59{
60 const index_t n = coefs.cols();
61 const index_t numPts = u.cols(); // at how many points to evaluate the gradients
62 const index_t pardim = this->dim();
63
64 result.setZero( n, pardim * numPts );
67
68 this->deriv_into(u,B);
69 this->active_into(u,ind);
70 const index_t numAct=ind.rows();
71
72 for (index_t p = 0; p < numPts; ++p) // p = point
73 for (index_t c=0; c<n; ++c ) // c = component
74 for ( index_t a=0; a< numAct ; ++a ) // a = active function
75 {
76 result.block(c,p*pardim, 1, pardim).noalias() +=
77 coefs(ind(a,p), c) * B.block(a*pardim, p, pardim, 1).transpose();
78 }
79}
80
81// Evaluates the partial derivatives of the function given by coefs (default implementation)
82// For each point, result contains one column with stacked gradients of the components
83template<class T>
84void gsBasis<T>::derivFunc_into(const gsMatrix<T> &u, const gsMatrix<T> & coefs, gsMatrix<T>& result) const
85{
87 gsMatrix<index_t> actives;
88
89 // compute first derivatives
90 this->deriv_into(u,B);
91 // compute active functions
92 this->active_into(u,actives);
93
94 // compute result as linear combination of
95 // "coefs(actives)" and B
96 linearCombination_into( coefs, actives, B, result );
97}
98
99// Evaluates the second derivatives of the function given by coefs (default implementation)
100template<class T>
102 const gsMatrix<T> & coefs,
103 gsMatrix<T>& result) const
104{
105 gsMatrix<T> B;
106 gsMatrix<index_t> actives;
107
108 // compute second derivatives
109 this->deriv2_into(u,B);
110 // compute active functions
111 this->active_into(u,actives);
112
113 // compute result as linear combination of
114 // "coefs(actives)" and B
115 linearCombination_into( coefs, actives, B, result );
117
118template<class T>
120 const gsMatrix<T> & coefs,
121 const unsigned n,
122 std::vector< gsMatrix<T> >& result,
123 bool sameElement) const
124{
125 // resize result so that it will hold
126 // function values and up to the n-th derivatives
127 result.resize(n+1);
128 if ( 0 == u.cols() ) return;
129
130 // B will contain the derivatives up to order n
131 std::vector< gsMatrix<T> >B;
132 // actives will contain the indices of the basis functions
133 // which are active at the evaluation points
134 gsMatrix<index_t> actives;
135
136 this->evalAllDers_into(u,n,B,sameElement);
137 if (sameElement)
138 this->active_into(u.col(0), actives);
139 else
140 this->active_into(u, actives);
141
142 // for derivatives 0 to n, evaluate the function by linear combination
143 // of coefficients with the respective function values/derivatives
144 for( unsigned i = 0; i <= n; i++)
145 linearCombination_into( coefs, actives, B[i], result[i], sameElement);
146}
147
148
149template<class T>
151 const gsMatrix<index_t> & actives,
152 const gsMatrix<T> & values,
153 gsMatrix<T> & result, bool sameElement)
155 const index_t numPts = values.cols() ;
156 const index_t tarDim = coefs.cols() ;
157 const index_t stride = values.rows() / actives.rows();
158
159 GISMO_ASSERT( actives.rows() * stride == values.rows(),
160 "Number of values "<<values.rows()<< " and actives "<<actives.rows()<<" does not fit together");
161
162 result.resize( tarDim * stride, numPts );
163 result.setZero();
164
165 if (sameElement)
166 {
167 for ( index_t i = 0; i < actives.rows(); ++i ) // for all nonzero basis functions
168 for ( index_t c = 0; c < tarDim; ++c ) // for all components of the geometry
169 result.middleRows( stride * c, stride).noalias() +=
170 coefs( actives.at(i), c) * values.middleRows(stride * i, stride);
171 }
172 else
173 {
174 for ( index_t pt = 0; pt < numPts; ++pt ) // For pt, i.e., for every column of u
175 for ( index_t i = 0; i < actives.rows(); ++i ) // for all nonzero basis functions
176 for ( index_t c = 0; c < tarDim; ++c ) // for all components of the geometry
177 result.block( stride * c, pt, stride, 1).noalias() +=
178 coefs( actives(i,pt), c) * values.block( stride * i, pt, stride, 1);
179 }
180}
181
182template<class T>
184{
185 gsMatrix<T> tmp;
186 this->deriv2_into(u,tmp);
187 return tmp.colwise().sum();
188}
189
190template<class T> inline
192{
193 gsSparseMatrix<T> result( u.cols(), this->size() );
194 //gsInfo << "collocation matrix rows x cols = " << u.cols() << " x " << this->size() << "\n";
195
196 gsVector<index_t> nact( this->size() );
197 nact.setOnes(this->size());
199
200# pragma omp parallel for default(shared) private(tmp) //firstprivate(nact)
201 for (index_t k=0; k<u.cols(); k++)
203 active_into(u.col(k), tmp);
204 for (index_t t = 0; t<tmp.size(); t++)
205 {
206//# pragma omp critical (collocation_nact)
207# pragma omp atomic
208 nact[tmp(t,0)] += 1;//tmp.rows();
209 }
210 // nact[k] = tmp.rows();
211 }
212//
213// result.reserve( nact );
214
215 gsMatrix<T> ev;
217 std::vector<gsEigen::Triplet<T,index_t>> alltriplets;
218 alltriplets.reserve(nact.sum());
219# pragma omp parallel for default(shared) private(ev, act)
220 for (index_t k=0; k<u.cols(); k++)
221 {
222 eval_into (u.col(k), ev );
223 active_into(u.col(k), act);
224 std::vector<gsEigen::Triplet<T,index_t>>tripletList(act.rows());
225 for (index_t i=0; i!=act.rows(); ++i)
226 tripletList[i] = gsEigen::Triplet<T,index_t>(k,act.at(i),ev.at(i));
227
228# pragma omp critical (collocation)
229 alltriplets.insert(alltriplets.end(), tripletList.begin(), tripletList.end());
230 }
231
232 result.setFromTriplets(alltriplets.begin(), alltriplets.end());
233 result.makeCompressed();
234 return result;
235}
236
237
238
239template<class T> inline
240memory::unique_ptr<gsGeometry<T> > gsBasis<T>::interpolateData( gsMatrix<T> const& vals,
241 gsMatrix<T> const& pts) const
242{
243 GISMO_ASSERT (dim() == pts.rows() , "Wrong dimension of the points("<<
244 pts.rows()<<", expected "<<dim() <<").");
245 GISMO_ASSERT (this->size() == pts.cols() , "Expecting as many points as the basis functions." );
246 GISMO_ASSERT (this->size() == vals.cols(), "Expecting as many values as the number of points." );
247
248 gsSparseMatrix<T> Cmat = collocationMatrix(pts);
249 gsMatrix<T> x ( this->size(), vals.rows());
250
251 // typename gsSparseSolver<T>::BiCGSTABIdentity solver( Cmat );
252 // typename gsSparseSolver<T>::BiCGSTABDiagonal solver( Cmat );
253 // typename gsSparseSolver<T>::QR solver( Cmat );
254 typename gsSparseSolver<T>::BiCGSTABILUT solver( Cmat );
255
256 // Solves for many right hand side columns
257 x = solver.solve( vals.transpose() );
258
259 // gsDebug <<"gs Interpolate error : " << solver.error() << std::"\n";
260 // gsDebug <<"gs Interpolate iters : " << solver.iterations() << std::"\n";
261 // gsDebug <<"intpl sol : " << x.transpose() << std::"\n";
262
263 return makeGeometry( give(x) );
264}
265
266template<class T> inline
267memory::unique_ptr<gsGeometry<T> > gsBasis<T>::interpolateAtAnchors(gsMatrix<T> const & vals) const
268{
269 GISMO_ASSERT (this->size() == vals.cols(),
270 "Expecting as many values as the number of basis functions." );
271 gsMatrix<T> pts;
272 anchors_into(pts);
273 return interpolateData(vals, pts);
274}
275
276/*
277template<class T> inline
278gsGeometry<T> * gsBasis<T>::interpolateAtAnchors(gsFunction<T> const & func) const
279{
280 gsMatrix<T> pts, vals;
281 anchors_into(pts);
282 func.eval_into(pts, vals);
283 return interpolateData(vals, pts);
284}
285
286template<class T>
287gsGeometry<T> * gsBasis<T>::projectL2(gsFunction<T> const & func) const
288{
289
290 return NULL;
291}
292*/
293
294template<class T> inline
297
298template<class T> inline
301
302
303template<class T> inline
305{
306 gsMatrix<T> nodes = anchors();
307 nodes.transposeInPlace();// coefficient vectors have ctrl points at rows
308 connectivity(nodes, mesh);
309}
310
311template<class T>
314
315template<class T>
318
319template <class T>
322
323template<class T>
326
327template<class T>
331
332template<class T>
336
337template<class T>
341
342template<class T>
346
348template<class T>
349gsBasis<T>* gsBasis<T>::boundaryBasis_impl(boxSide const &) const
353template<class T>
355{
356 GISMO_ASSERT( b.totalDim() == this->dim(), "The dimensions do not agree." );
357
358 const short_t dim = this->dim();
359
360 uPtr result;
361 short_t d=0;
362 for (short_t i=0; i<dim; ++i)
363 {
365 if (loc)
366 {
367 if (result)
368 result = result->boundaryBasis( boxSide(loc+2*d) );
369 else
370 result = this->boundaryBasis( boxSide(loc+2*d) );
371 }
372 else
373 ++d;
374 }
375
376 if (!result)
377 result = clone();
378
379 return result;
380}
382template<class T>
384{
385 GISMO_ASSERT( b.totalDim() == this->dim(), "The dimensions do not agree." );
386 const short_t dim = this->dim();
387
388 uPtr result;
389 short_t d=0;
390 for (short_t i=0; i<dim; ++i)
391 {
393 if (loc)
394 {
395 if (result)
396 {
397 gsMatrix<index_t> tmp = result->boundary( boxSide(loc+2*d) );
398 for (index_t j=0; j<tmp.size(); ++j)
399 tmp(j,0) = indices(tmp(j,0),0);
400 tmp.swap(indices);
401 result = result->boundaryBasis( boxSide(loc+2*d) );
402 }
403 else
404 {
405 indices = this->boundary( boxSide(loc+2*d) );
406 result = this->boundaryBasis( boxSide(loc+2*d) );
407 }
408 }
409 else
410 ++d;
411 }
412
413 if (!result)
414 {
415 result = clone();
416 const index_t sz = this->size();
417 indices.resize(sz,1);
418 for (index_t i=0;i<sz;++i)
419 indices(i,0) = i;
420 }
421
422 if (noBoundary && d > 0)
423 {
424
425 gsMatrix<index_t> bdy_indices = result->allBoundary();
426
427 const index_t indices_sz = indices.rows();
428 const index_t bdy_indices_sz = bdy_indices.rows();
429
430 // Copy all entries from indices to indices_cleaned except
431 // those with indices in bdy_indices
432
433 gsMatrix<index_t> indices_cleaned(indices_sz - bdy_indices_sz, 1);
434 index_t j = 0, t = 0;
435 for (index_t i = 0; i < indices_sz; ++i)
436 {
437 if (util::greater(i, bdy_indices(j, 0)) && j < bdy_indices_sz)
438 ++j;
439 if (util::less(i, bdy_indices(j, 0)) || j == bdy_indices_sz)
440 {
441 indices_cleaned(t, 0) = indices(i, 0);
442 ++t;
443 }
444 }
445 GISMO_ASSERT(t == indices_cleaned.rows(), "Internal error.");
446 indices.swap(indices_cleaned);
447 }
448
449 return result;
450
451}
452
453template<class T>
456
457template<class T>
460
461template<class T>
463{ return support().row(dir); }
465template<class T>
469template<class T>
473template<class T>
476
477template<class T>
482
483template<class T>
487template<class T>
489 const gsMatrix<T> &,
490 gsMatrix<T>&) const
492
493template<class T>
495 std::vector<gsMatrix<T> >& result) const
496{
497 result.resize(n+1);
498
499 switch(n)
500 {
501 case 0:
502 evalSingle_into(i,u, result[0]);
503 break;
504 case 1:
505 evalSingle_into (i,u, result[0]);
506 derivSingle_into(i,u, result[1]);
507 break;
508 case 2:
509 evalSingle_into (i,u, result[0]);
510 derivSingle_into (i,u, result[1]);
511 deriv2Single_into(i,u, result[2]);
512 break;
513 default:
514 GISMO_ERROR("evalAllDers implemented for order up to 2<"<<n<< " for "<<*this);
515 break;
516 }
518
519template<class T>
523
524template<class T>
529
530
531template<class T>
534
535
536template<class T>
539
540template<class T>
541typename gsBasis<T>::domainIter
544
545template<class T>
546typename gsBasis<T>::domainIter
549
550template<class T>
553
554template<class T>
557
558template<class T>
561
562template<class T>
565
566template<class T>
568{ return const_cast<gsBasis<T>&>(const_cast<const gsBasis<T>*>(this)->component(i));}
569
570template<class T>
571std::vector<index_t> gsBasis<T>::asElements(gsMatrix<T> const &, int) const
573
574template<class T>
575std::vector<index_t> gsBasis<T>::asElementsUnrefine(gsMatrix<T> const &, int) const
577
578template<class T>
581
582template<class T>
583void gsBasis<T>::unrefine(gsMatrix<T> const &, int)
585
586template<class T>
587void gsBasis<T>::refineElements(std::vector<index_t> const &)
589
590template<class T>
591void gsBasis<T>::unrefineElements(std::vector<index_t> const &)
593
594template<class T>
597
598template<class T>
599void gsBasis<T>::unrefineElements_withCoefs(gsMatrix<T> &,std::vector<index_t> const &)
601
602template<class T>
605
606template<class T>
609
610template<class T>
614
615template<class T>
619template<class T>
622
623template<class T>
627
628template<class T>
631
632template<class T>
635
636template<class T>
639
640template<class T>
643
644template<class T>
646{
647 const short_t dm = this->dim();
648 for (short_t k = 0; k!=dm; ++k)
649 {
650 const short_t p = this->degree(k);
651 if ( i > p )
652 {
653 this->degreeElevate(i-p, k);
654 }
655 else if ( i < p )
656 {
657 this->degreeReduce(p-i, k);
658 }
659 }
660}
661
662template<class T>
665 for ( short_t d = 0; d < dim(); ++ d )
666 {
667 if ( i > degree(d) )
668 degreeIncrease(i-degree(d),d);
669 else if ( i < degree(d) )
670 degreeDecrease(-i+degree(d),d);
671 }
672}
673
674template<class T>
677
678template<class T>
682template<class T>
685
686template<class T>
689
690template<class T>
693
694template<class T>
697
698template<class T>
701
702template<class T>
705
706template<class T>
710
711template<class T>
713{
714 const domainIter it = this->makeDomainIterator();
715 T h = 0;
716 for (; it->good(); it->next() )
717 {
718 const T sz = it->getMinCellLength();
719 if ( sz < h || h == 0 ) h = sz;
720 }
721 return h;
723
724template<class T>
726{
727 const domainIter it = this->makeDomainIterator();
728 T h = 0;
729 for (; it->good(); it->next() )
730 {
731 const T sz = it->getMaxCellLength();
732 if ( sz > h ) h = sz;
733 }
734 return h;
735}
736
737
738template<class T> inline
739std::vector<gsSparseMatrix<T> >
740gsBasis<T>::collocationMatrixWithDeriv(const gsMatrix<T> & u) const
741{
742 return this->collocationMatrixWithDeriv(*this,u);
743}
744
745template<class T> inline
746std::vector<gsSparseMatrix<T> >
748{
749 int dim = b.domainDim();
750 std::vector<gsSparseMatrix<T>> result(dim+1, gsSparseMatrix<T>( u.cols(), b.size() ));
751
752 //gsVector<index_t> nact(u.cols());
754 nact.setOnes();
756# pragma omp parallel for default(shared) private(tmp)
757 for (index_t k=0; k<u.cols(); k++)
758 {
759 b.active_into(u.col(k), tmp);
760 for (index_t t = 0; t<tmp.size(); t++)
762# pragma omp atomic
763 nact[tmp(t,0)] += 1;//tmp.rows();
764 }
765 // active_into(u.col(k), tmp);
766 // nact[k] = tmp.rows();
767 }
768
769 std::vector<std::vector<gsEigen::Triplet<T,index_t>>> alltriplets(2+(dim==2));
770
771 for (index_t d=0; d!=2+(dim==2); d++)
772 {
773 //result[d].reserve( nact );
774 alltriplets[d].reserve(nact.sum());
775 }
776
777# pragma omp parallel for
778 for (index_t k=0; k<u.cols(); ++k)
779 {
780 std::vector<gsMatrix<T>> ev;
781 gsMatrix<index_t> act;
782 b.evalAllDers_into (u.col(k), 1, ev );
783 b.active_into(u.col(k), act);
784 std::vector<std::vector<gsEigen::Triplet<T,index_t>>> tripletLists(2+(dim==2));
785 for (index_t d=0; d!=2+(dim==2); d++)
786 tripletLists[d].resize(act.rows());
787
788 for (index_t i=0; i!=act.rows(); ++i)
789 {
790 tripletLists[0][i] = gsEigen::Triplet<T,index_t>(k,act.at(i),ev[0].at(i));
791 tripletLists[1][i] = gsEigen::Triplet<T,index_t>(k,act.at(i),ev[1].at(dim*i));
792 if (dim==2)
793 tripletLists[2][i] = gsEigen::Triplet<T,index_t>(k,act.at(i),ev[1].at(dim*i+1));
794 }
795
796# pragma omp critical (collocation)
797 {
798 for (index_t d=0; d!=2+(dim==2); d++)
799 alltriplets[d].insert(alltriplets[d].end(), tripletLists[d].begin(), tripletLists[d].end());
800 }
801 }
802
803
804 for (index_t d=0; d!=2+(dim==2); d++)
805 {
806 result[d].setFromTriplets(alltriplets[d].begin(), alltriplets[d].end());
807 result[d].makeCompressed();
808 }
810 return result;
811}
812
813// gsBasis<T>::linearComb(active, evals, m_tmpCoefs, result);
814// gsBasis<T>::jacobianFromGradients(active, grads, m_tmpCoefs, result);
815
816/*
817template<class T>
818void gsBasis<T>::linearComb(const gsMatrix<index_t> & actives,
819 const gsMatrix<T> & basisVals,
820 const gsMatrix<T> & coefs,
821 gsMatrix<T>& result )
822{
823 // basisVals.rows()==1 (or else basisVals.rows() == coefs.cols() and .cwiseProd)
824 result.resize(coefs.cols(), basisVals.cols()) ;
825
826 for ( index_t j=0; j!=basisVals.cols() ; j++ ) // for all basis function values
827 {
828 //todo grab result.col(j)
829 result.col(j) = basisVals(0,j) * coefs.row( actives(0,j) ) ;//transpose ?
830 for ( index_t i=1; i< actives.rows() ; i++ )
831 result.col(j) += basisVals(i,j) * coefs.row( actives(i,j) ) ;
832 }
834*/
835
836}; // namespace gismo
Struct which represents a certain side of a box.
Definition gsBoundary.h:85
Represents an individual function in a function set, or a certain component of a vector-valued functi...
Definition gsBasisFun.h:37
A basis represents a family of scalar basis functions defined over a common parameter domain.
Definition gsBasis.h:79
virtual void activeCoefs_into(const gsVector< T > &u, const gsMatrix< T > &coefs, gsMatrix< T > &result) const
Returns the matrix result of active coefficients at points u, each row being one coefficient....
Definition gsBasis.hpp:328
virtual void deriv2_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate the second derivatives of all active basis function at points u.
Definition gsBasis.hpp:484
virtual gsMatrix< T > laplacian(const gsMatrix< T > &u) const
Compute the Laplacian of all nonzero basis functions at points u.
Definition gsBasis.hpp:183
virtual void uniformRefine(int numKnots=1, int mul=1, short_t dir=-1)
Refine the basis uniformly by inserting numKnots new knots with multiplicity mul on each knot span.
Definition gsBasis.hpp:603
virtual gsBasis::uPtr tensorize(const gsBasis &other) const
Return a tensor basis of this and other.
Definition gsBasis.hpp:537
virtual void uniformCoarsen_withTransfer(gsSparseMatrix< T, RowMajor > &transfer, int numKnots=1)
Coarsen the basis uniformly and produce a sparse matrix which maps coarse coefficient vectors to refi...
Definition gsBasis.hpp:624
virtual void anchors_into(gsMatrix< T > &result) const
Returns the anchor points that represent the members of the basis in result. There is exactly one anc...
Definition gsBasis.hpp:295
virtual void evalFunc_into(const gsMatrix< T > &u, const gsMatrix< T > &coefs, gsMatrix< T > &result) const
Evaluate the function described by coefs at points u, i.e., evaluates a linear combination of coefs x...
Definition gsBasis.hpp:37
virtual T getMaxCellLength() const
Get the maximum mesh size, as expected for approximation error estimates.
Definition gsBasis.hpp:725
virtual short_t maxDegree() const
If the basis is of polynomial or piecewise polynomial type, then this function returns the maximum po...
Definition gsBasis.hpp:687
virtual void uniformCoarsen(int numKnots=1)
Coarsen the basis uniformly by removing groups of numKnots consecutive knots, each knot removed mul t...
Definition gsBasis.hpp:616
gsSparseMatrix< T > collocationMatrix(gsMatrix< T > const &u) const
Computes the collocation matrix w.r.t. points u.
Definition gsBasis.hpp:191
virtual void numActive_into(const gsMatrix< T > &u, gsVector< index_t > &result) const
Returns the number of active (nonzero) basis functions at points u in result.
Definition gsBasis.hpp:324
virtual void reduceContinuity(int const &i=1)
Reduces the continuity of the basis along element boundaries.
Definition gsBasis.hpp:679
virtual void reverse()
Reverse the basis.
Definition gsBasis.hpp:703
virtual void uniformRefine_withTransfer(gsSparseMatrix< T, RowMajor > &transfer, int numKnots=1, int mul=1)
Refine the basis uniformly.
Definition gsBasis.hpp:611
virtual gsMatrix< index_t > allBoundary() const
Returns the indices of the basis functions that are nonzero at the domain boundary.
Definition gsBasis.hpp:334
virtual void evalAllDersSingle_into(index_t i, const gsMatrix< T > &u, int n, std::vector< gsMatrix< T > > &result) const
Evaluate the basis function i and its derivatives up to order n at points u into result.
Definition gsBasis.hpp:494
static void linearCombination_into(const gsMatrix< T > &coefs, const gsMatrix< index_t > &actives, const gsMatrix< T > &values, gsMatrix< T > &result, bool sameElement=false)
Computes the linear combination coefs * values( actives )
Definition gsBasis.hpp:150
virtual void evalSingle_into(index_t i, const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate the i-th basis function at points u into result.
Definition gsBasis.hpp:470
virtual void matchWith(const boundaryInterface &bi, const gsBasis< T > &other, gsMatrix< index_t > &bndThis, gsMatrix< index_t > &bndOther, index_t offset=0) const
Computes the indices of DoFs that match on the interface bi. The interface is assumed to be a common ...
Definition gsBasis.hpp:707
virtual void elevateContinuity(int const &i=1)
Elevates the continuity of the basis along element boundaries.
Definition gsBasis.hpp:675
gsBasisFun< T > function(index_t i) const
Returns the i-th basis function as a gsFunction.
Definition gsBasis.hpp:29
virtual void connectivity(const gsMatrix< T > &nodes, gsMesh< T > &mesh) const
Definition gsBasis.hpp:312
virtual gsBasis::uPtr create() const
Create an empty basis of the derived type and return a pointer to it.
Definition gsBasis.hpp:532
virtual void degreeDecrease(short_t const &i=1, short_t const dir=-1)
Lower the degree of the basis by the given amount, preserving knots multiplicity.
Definition gsBasis.hpp:641
virtual domainIter makeDomainIterator() const
Create a domain iterator for the computational mesh of this basis, that points to the first element o...
Definition gsBasis.hpp:542
memory::unique_ptr< gsGeometry< T > > interpolateData(gsMatrix< T > const &vals, gsMatrix< T > const &pts) const
Applies interpolation given the parameter values pts and values vals.
Definition gsBasis.hpp:240
virtual uPtr componentBasis_withIndices(boxComponent b, gsMatrix< index_t > &indices, bool noBoundary=true) const
Returns the basis that corresponds to the component.
Definition gsBasis.hpp:383
virtual short_t totalDegree() const
If the basis is of polynomial or piecewise polynomial type, then this function returns the total poly...
Definition gsBasis.hpp:695
virtual void uniformRefine_withCoefs(gsMatrix< T > &coefs, int numKnots=1, int mul=1, short_t const dir=-1)
Refine the basis uniformly.
Definition gsBasis.hpp:607
virtual void degreeReduce(short_t const &i=1, short_t const dir=-1)
Reduce the degree of the basis by the given amount, preserve smoothness.
Definition gsBasis.hpp:633
virtual short_t degree(short_t i) const
Degree with respect to the i-th variable. If the basis is a tensor product of (piecewise) polynomial ...
Definition gsBasis.hpp:699
virtual void degreeIncrease(short_t const &i=1, short_t const dir=-1)
Elevate the degree of the basis by the given amount, preserve knots multiplicity.
Definition gsBasis.hpp:637
virtual void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates nonzero basis functions at point u into result.
Definition gsBasis.hpp:466
virtual void active_into(const gsMatrix< T > &u, gsMatrix< index_t > &result) const
Returns the indices of active basis functions at points u, as a list of indices, in result....
Definition gsBasis.hpp:316
virtual void derivFunc_into(const gsMatrix< T > &u, const gsMatrix< T > &coefs, gsMatrix< T > &result) const
Evaluate the derivatives of the function described by coefs at points u.
Definition gsBasis.hpp:84
virtual void deriv2Func_into(const gsMatrix< T > &u, const gsMatrix< T > &coefs, gsMatrix< T > &result) const
Evaluates the second derivatives of the function described by coefs at points u.
Definition gsBasis.hpp:101
virtual void jacobianFunc_into(const gsMatrix< T > &u, const gsMatrix< T > &coefs, gsMatrix< T > &result) const
Evaluate the Jacobian of the function described by coefs at points u. Jacobian matrices are stacked i...
Definition gsBasis.hpp:58
void setDegree(short_t const &i)
Set the degree of the basis (either elevate or reduce) in order to have degree equal to i wrt to each...
Definition gsBasis.hpp:645
memory::unique_ptr< gsBasis > uPtr
Unique pointer for gsBasis.
Definition gsBasis.h:89
virtual memory::unique_ptr< gsGeometry< T > > interpolateAtAnchors(gsMatrix< T > const &vals) const
Applies interpolation of values pts using the anchors as parameter points. May be reimplemented in de...
Definition gsBasis.hpp:267
virtual gsMatrix< index_t > boundaryOffset(boxSide const &s, index_t offset) const
Definition gsBasis.hpp:339
virtual void uniformCoarsen_withCoefs(gsMatrix< T > &coefs, int numKnots=1)
Coarsen the basis uniformly.
Definition gsBasis.hpp:620
virtual void anchor_into(index_t i, gsMatrix< T > &result) const
Returns the anchor point for member i of the basis.
Definition gsBasis.hpp:299
virtual bool isActive(const index_t i, const gsVector< T > &u) const
Returns true if there the point u with non-zero value or derivatives when evaluated at the basis func...
Definition gsBasis.hpp:320
virtual void evalAllDersFunc_into(const gsMatrix< T > &u, const gsMatrix< T > &coefs, const unsigned n, std::vector< gsMatrix< T > > &result, bool sameElement=false) const
Evaluates all derivatives up to order n of the function described by coefs at points u.
Definition gsBasis.hpp:119
virtual void degreeElevate(short_t const &i=1, short_t const dir=-1)
Elevate the degree of the basis by the given amount, preserve smoothness.
Definition gsBasis.hpp:629
virtual void deriv_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the first partial derivatives of the nonzero basis function.
Definition gsBasis.hpp:474
virtual T getMinCellLength() const
Get the minimum mesh size, as expected for inverse inequalities.
Definition gsBasis.hpp:712
gsMatrix< T > supportInterval(index_t dir) const
Returns an interval that contains the parameter values in direction dir.
Definition gsBasis.hpp:462
virtual gsMatrix< T > support() const
Returns (a bounding box for) the domain of the whole basis.
Definition gsBasis.hpp:454
virtual void refineElements_withCoefs(gsMatrix< T > &coefs, std::vector< index_t > const &boxes)
Refine basis and geometry coefficients to levels.
Definition gsBasis.hpp:595
virtual gsDomain< T > * domain() const
Definition gsBasis.hpp:683
virtual size_t numElements(boxSide const &s=0) const
The number of elements on side s.
Definition gsBasis.hpp:551
virtual const gsBasis< T > & component(short_t i) const
For a tensor product basis, return the (const) 1-d basis for the i-th parameter component.
Definition gsBasis.hpp:563
virtual short_t minDegree() const
If the basis is of polynomial or piecewise polynomial type, then this function returns the minimum po...
Definition gsBasis.hpp:691
void setDegreePreservingMultiplicity(short_t const &i)
Set the degree of the basis (either increase or decrecee) in order to have degree equal to i.
Definition gsBasis.hpp:663
virtual gsMatrix< T > elementInSupportOf(index_t j) const
Returns (the coordinates of) an element in the support of basis function j.
Definition gsBasis.hpp:559
virtual void deriv2Single_into(index_t i, const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate the (partial) derivatives of the i-th basis function at points u into result.
Definition gsBasis.hpp:488
virtual void refine(gsMatrix< T > const &boxes, int refExt=0)
Refine the basis on the area defined by the matrix boxes.
Definition gsBasis.hpp:579
virtual void refineElements(std::vector< index_t > const &boxes)
Refinement function, with different sytax for different basis.
Definition gsBasis.hpp:587
virtual size_t elementIndex(const gsVector< T > &u) const
Returns an index for the element which contains point u.
Definition gsBasis.hpp:555
virtual domainIter makeDomainIterator(const boxSide &s) const
Create a boundary domain iterator for the computational mesh this basis, that points to the first ele...
Definition gsBasis.hpp:547
virtual uPtr componentBasis(boxComponent b) const
Returns the basis that corresponds to the component.
Definition gsBasis.hpp:354
virtual void connectivityAtAnchors(gsMesh< T > &mesh) const
Definition gsBasis.hpp:304
virtual void evalDerSingle_into(index_t i, const gsMatrix< T > &u, int n, gsMatrix< T > &result) const
Evaluate the (partial) derivative(s) of order n the i-th basis function at points u into result.
Definition gsBasis.hpp:525
virtual void derivSingle_into(index_t i, const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the (partial) derivatives of the i-th basis function at points u into result.
Definition gsBasis.hpp:478
Class representing a domain. i.e. a collection of elements (triangles, rectangles,...
Definition gsDomain.h:32
virtual short_t domainDim() const =0
Dimension of the (source) domain.
virtual index_t size() const
size
Definition gsFunctionSet.h:613
virtual void evalAllDers_into(const gsMatrix< T > &u, int n, std::vector< gsMatrix< T > > &result, bool sameElement=false) const
Evaluate the nonzero functions and their derivatives up to order n at points u into result.
Definition gsFunctionSet.hpp:81
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
T at(index_t i) const
Returns the i-th element of the vectorization of the matrix.
Definition gsMatrix.h:211
Class Representing a triangle mesh with 3D vertices.
Definition gsMesh.h:32
Sparse matrix class, based on gsEigen::SparseMatrix.
Definition gsSparseMatrix.h:139
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
Provides definition of the BasisFun class.
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_NO_IMPLEMENTATION
Definition gsDebug.h:129
#define GISMO_ERROR(message)
Definition gsDebug.h:118
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
Provides declaration of DomainIterator abstract interface.
Provides declaration of Geometry abstract interface.
bool less(T1 t1, T2 t2)
Definition gsTemplateTools.h:247
bool greater(T1 t1, T2 t2)
Definition gsTemplateTools.h:313
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
Struct that defines the boundary sides and corners and types of a geometric object.
Definition gsBoundary.h:56
Struct which represents a certain component (interior, face, egde, corner).
Definition gsBoundary.h:445
location
Represents a location.
Definition gsBoundary.h:530
location locationForDirection(index_t direction) const
Definition gsBoundary.cpp:154
short_t totalDim() const
Dimension of the computational domain (the box itself)
Definition gsBoundary.h:506
Struct which represents a certain corner of a hyper-cube.
Definition gsBoundary.h:292