16 #include <gsIO/gsBase64.h>
30 class gsXml< gsKnotVector<T> >
36 GSXML_COMMON_FUNCTIONS(gsKnotVector<T>)
37 GSXML_GET_POINTER(gsKnotVector<T>)
38 static std::
string tag () {
return "KnotVector"; }
39 static std::string type() {
return ""; }
41 static void get_into(gsXmlNode * node, gsKnotVector<T> & result)
44 int p = atoi(node->first_attribute(
"degree")->value() );
46 typename gsKnotVector<T>::knotContainer knotValues;
48 gsXmlAttribute * mode = node->first_attribute(
"mode");
54 if ( !strcmp( mode->value(),
"uniform") )
56 gsXmlAttribute * szc = node->first_attribute(
"csize");
57 GISMO_ENSURE(szc,
"size of knot-vector coefficients is missing (csize attribute).");
58 index_t sz = atoi(szc->value());
63 result = gsKnotVector<T>(0.0, 1.0, sz-p-1, p+1, 1, p);
69 gsXmlAttribute* format = node->first_attribute(
"format");
70 std::string format_flag = format ? format->value() :
"ascii";
71 std::transform(format_flag.cbegin(), format_flag.cend(),
73 [](
unsigned char c) {
return std::tolower(c); });
75 if (format_flag ==
"ascii") {
77 std::istringstream str;
78 str.str(node->value());
79 for (T knot; gsGetReal(str, knot);) knotValues.push_back(knot);
83 result = gsKnotVector<T>(
give(knotValues), p);
86 static gsXmlNode * put (
const gsKnotVector<T> & obj, gsXmlTree & data)
89 std::ostringstream str;
90 str << std::setprecision(REAL_DIG+1);
92 for (
typename gsKnotVector<T>::iterator it = obj.begin();
93 it != obj.end(); ++it )
101 str.str(std::string());
103 tmp->append_attribute(
makeAttribute(
"degree", str.str(),data) );
119 return m_repKnots.begin();
126 return m_repKnots.end();
133 upos += numLeftGhosts();
134 return m_repKnots.begin() + (0 == upos ? 0 : m_multSum[upos-1]);
141 upos += numLeftGhosts();
142 return m_repKnots.begin() + m_multSum[upos];
149 return std::reverse_iterator<iterator>(end());
155 return std::includes(begin(), end(), other.
begin(), other.
end() );
160 std::vector<T>& result)
const
163 const int sz = other.
size() - size();
166 std::set_difference(begin(), end(),
168 std::back_inserter(result));
173 std::vector<T>& result)
const
178 const int sz = other.
size() - size();
181 std::set_symmetric_difference(begin(), end(),
183 std::back_inserter(result));
191 kv.reserve( (std::max)(a.
size(),b.
size()) );
192 std::set_union(a.m_repKnots.begin(), a.m_repKnots.end(),
193 b.m_repKnots.begin(), b.m_repKnots.end(), std::back_inserter(kv) );
205 kv.reserve( (std::min)(a.
size(),b.
size()) );
206 std::set_intersection(a.m_repKnots.begin(), a.m_repKnots.end(),
207 b.m_repKnots.begin(), b.m_repKnots.begin(), std::back_inserter(kv) );
231 return std::reverse_iterator<iterator>(begin());
237 return uiterator(*
this,0,numLeftGhosts());
243 return uiterator::End(*
this);
249 return reverse_uiterator(uend());
255 return reverse_uiterator(ubegin());
267 return smart_iterator::End(*
this);
273 return reverse_smart_iterator(send());
279 return reverse_smart_iterator(sbegin());
291 knots.swap(m_repKnots);
294 m_deg = (degree == - 1 ? deduceDegree() : degree);
296 GISMO_ASSERT( check(),
"Unsorted knots or invalid multiplicities." );
304 m_repKnots.swap( other.m_repKnots );
305 m_multSum.swap( other.m_multSum );
306 std::swap( m_deg, other.m_deg );
308 GISMO_ASSERT(check(),
"Unsorted knots or invalid multiplicities.");
331 uiterator uit = std::lower_bound(ubegin(), uend(), knot);
332 const mult_t fa = uit.firstAppearance();
335 nonConstMultIterator upos = m_multSum.begin() + uit.uCardinalIndex();
336 if (upos==m_multSum.end() || *uit != knot)
337 upos = m_multSum.insert(upos, fa );
338 std::transform(upos, m_multSum.end(), upos, GS_BIND1ST(std::plus<mult_t>(), mult));
341 m_repKnots.insert(m_repKnots.begin() + fa, mult, knot);
343 GISMO_ASSERT( check(),
"Unsorted knots or invalid multiplicities." );
350 "The iterator is invalid for this knot vector." );
352 mult_t knotMult = uit.multiplicity();
353 mult_t toRemove = (std::min<mult_t>)(mult, knotMult);
354 nonConstMultIterator upos = m_multSum.begin() + uit.uCardinalIndex();
356 nonConstIterator pos = m_repKnots.begin() + uit.firstAppearance();
357 m_repKnots.erase(pos, pos+toRemove);
359 if( toRemove == knotMult )
360 upos = m_multSum.erase( upos );
362 std::transform(upos, m_multSum.end(), upos, GS_BIND2ND(std::minus<mult_t>(),toRemove));
368 uiterator uit = std::lower_bound( ubegin(), uend(), knot );
369 if( uit != uend() && *uit == knot )
378 m_repKnots.erase(m_repKnots.begin()+first, m_repKnots.begin()+last);
379 nonConstMultIterator fpos =
380 std::lower_bound(m_multSum.begin(), m_multSum.end(), first);
381 nonConstMultIterator lpos =
382 std::upper_bound(m_multSum.begin(), m_multSum.end(), last);
383 const mult_t numKnots = last - first;
384 *fpos = m_multSum.back() - numKnots;
385 lpos = m_multSum.erase(fpos + 1, lpos);
386 std::transform(lpos, m_multSum.end(), lpos, GS_BIND2ND(std::minus<mult_t>(),numKnots));
395 m_repKnots.erase(m_repKnots.begin(), m_repKnots.begin()+numKnots);
396 nonConstMultIterator upos =
397 std::upper_bound(m_multSum.begin(), m_multSum.end(), numKnots);
398 upos = m_multSum.erase(m_multSum.begin(), upos);
399 std::transform(upos, m_multSum.end(), upos, GS_BIND2ND(std::minus<mult_t>(),numKnots));
408 m_repKnots.resize(m_repKnots.size()-numKnots);
409 const mult_t newSum = m_multSum.back()-numKnots;
410 nonConstMultIterator upos =
411 std::lower_bound(m_multSum.begin(), m_multSum.end(), newSum) + 1;
412 m_multSum.erase(upos, m_multSum.end() );
413 m_multSum.back() = newSum;
423 uiterator uit = std::lower_bound( ubegin(), uend(), u );
424 if( uit != uend() && *uit == u )
425 return uit.multiplicity();
432 GISMO_ASSERT( knotIndex>=0 && static_cast<size_t>(knotIndex)<m_repKnots.size(),
433 "knotIndex " << knotIndex <<
"out of bounds [0,"
434 << m_repKnots.size() <<
")." );
437 iterator L = std::find_if(it,end(),GS_BIND1ST(std::not_equal_to<T>(),*it));
438 reverse_iterator F = std::find_if(reverse_iterator(it),rend(),
439 GS_BIND1ST(std::not_equal_to<T>(),*it));
453 "Cannot transform the knot-vector to invalid interval ["<<newBeg<<
","<<newEnd<<
"].\n");
455 const T beg = m_repKnots.front();
456 const T rr = (newEnd - newBeg) / (m_repKnots.back() - beg);
458 uit.setValue(newBeg);
460 for (; uit != uend()-1; ++uit)
461 uit.setValue(newBeg + (*uit - beg) * rr);
462 uit.setValue(newEnd);
464 GISMO_ASSERT( check(),
"affineTransformTo() has produced an invalid knot vector.");
474 std::reverse (m_multSum.begin(), m_multSum.end()-1);
475 std::transform(m_multSum.begin(), m_multSum.end()-1, m_multSum.begin(),
476 GS_BIND1ST(std::minus<mult_t>(), m_multSum.back() ) );
479 std::reverse(m_repKnots.begin(), m_repKnots.end());
480 const T ab = m_repKnots.back() + m_repKnots.front();
481 for (
uiterator uit = ubegin(); uit != uend(); ++uit)
482 uit.setValue( ab - uit.value() );
484 GISMO_ASSERT( check(),
"reverse() produced an invalid knot vector.");
492 template <
typename T>
496 if ( size() > static_cast<size_t>(2*m_deg+8) )
498 for (
iterator itr = begin(); itr != begin()+m_deg+3; ++itr)
501 for (
iterator itr = end()-m_deg-3; itr != end(); ++itr)
506 for (
iterator itr = begin(); itr != end(); ++itr)
509 os <<
"] (deg=" << degree()
510 <<
", size=" << size()
511 <<
", minSpan=" << minIntervalLength()
512 <<
", maxSpan=" << maxIntervalLength()
521 for (
uiterator it = ubegin(); it + 1 < uend(); ++it)
522 hmax = math::max(hmax, *(it+1) - *it );
529 T hmin = std::numeric_limits<T>::max();
530 for (
uiterator it = ubegin(); it + 1 < uend(); ++it)
531 hmin = math::min(hmin, *(it+1) - *it );
538 return isConsistent(m_repKnots,m_multSum);
543 const multContainer & multSum )
546 if (repKnots.size()==0)
548 if(multSum.size()==0)
553 if (repKnots.size()!=
static_cast<size_t>(multSum.back()) )
556 T prev = repKnots.front();
558 for(
typename knotContainer::const_iterator kit = repKnots.begin();
559 kit != repKnots.end();
564 else if( *kit > prev )
566 if( multSum[uniqPos] != static_cast<mult_t>(kit - repKnots.begin()) )
586 it = std::find_if(it,ee,GS_BIND1ST(std::not_equal_to<T>(),*it));
587 m_multSum.push_back(it-bb);
596 mult_t mult_interior,
599 initUniform( first, last, interior, mult_ends, mult_interior, degree );
609 "The first element in uknots has to be smaller than the last one." );
611 mult_t mult_ends = degree + 1;
612 mult_t mult_interior = degree - regularity;
615 const size_t nKnots = uKnots.size() * mult_interior + 2 * (mult_ends-mult_interior);
618 m_repKnots.reserve( nKnots );
620 m_multSum.reserve( uKnots.size() );
622 m_repKnots.insert( m_repKnots.end(), mult_ends, uKnots.front() );
623 m_multSum.push_back( mult_ends );
626 typename knotContainer::const_iterator it = uKnots.begin();
627 for( it += 1; it != uKnots.end() - 1; ++it)
629 m_repKnots.insert( m_repKnots.end(), mult_interior, *it );
630 m_multSum.push_back( mult_interior + m_multSum.back() );
633 m_repKnots.insert( m_repKnots.end(), mult_ends, uKnots.back() );
634 m_multSum.push_back( mult_ends + m_multSum.back() );
639 m_deg = (degree == - 1 ? deduceDegree() : degree);
642 template <
typename T>
647 unsigned mult_interior,
650 m_deg = (degree == - 1 ? mult_ends-1 : degree);
652 const size_t nKnots = 2 * mult_ends + interior*mult_interior;
656 "The variable first has to be smaller than the variable last." );
659 m_repKnots.reserve( nKnots );
661 m_multSum .reserve(interior+2);
663 const T h = (last-first) / (T)(interior+1);
665 for(
unsigned i = m_deg - mult_ends + 1, j=1; i!= 0; --i, ++j)
667 m_repKnots.push_back(first-(T)(i)*h);
668 m_multSum .push_back(j);
671 m_repKnots.insert(m_repKnots.end(), mult_ends, first);
672 m_multSum .push_back(mult_ends + (m_multSum.empty() ? 0 : m_multSum.back()));
674 for(
unsigned i=1; i<=interior; ++i)
676 m_repKnots.insert( m_repKnots.end(), mult_interior, first + (T)(i)*h );
677 m_multSum .push_back( mult_interior + m_multSum.back() );
680 m_repKnots.insert( m_repKnots.end(), mult_ends, last );
681 m_multSum .push_back( mult_ends + m_multSum.back() );
683 for(
unsigned i = 1; i!=m_deg - mult_ends + 2; ++i)
685 m_repKnots.push_back(last+(T)(i)*h);
686 m_multSum .push_back(m_multSum.back() + 1);
689 GISMO_ASSERT( check(),
"Unsorted knots or invalid multiplicities." );
696 initUniform(0.0, 1.0, numKnots - 2, degree + 1, mult_interior, degree );
708 return uSize() == 0 ? -1 :
709 (std::max)(( ubegin() ).multiplicity(),
710 ( uend()-1 ).multiplicity()) - 1;
716 multContainer result;
717 result.reserve(uSize());
718 for(
uiterator uit = ubegin(); uit != uend(); ++uit )
719 result.push_back( uit.multiplicity() );
727 for(
uiterator uit = std::next(ubegin()); uit != std::prev(uend()); ++uit )
728 result = std::max(result,uit.multiplicity());
739 mult_t result = m_deg+2;
740 for(
uiterator uit = std::next(ubegin()); uit != std::prev(uend()); ++uit )
741 result = std::min(result,uit.multiplicity());
750 GISMO_ASSERT(inDomain(u),
"Point "<< u <<
" outside active area of the knot vector");
758 return std::upper_bound( domainUBegin(), dend, u ) - 1;
765 GISMO_ASSERT(inDomain(u),
"Point outside active area of the knot vector");
766 return std::upper_bound( ubegin(), uend(), u );
773 GISMO_ASSERT(inDomain(u),
"Point outside active area of the knot vector");
774 return std::lower_bound( ubegin(), uend(), u );
782 return begin() + uFind(u).lastAppearance();
796 refineSpans(spanIndices.begin(), spanIndices.end(), knotsPerSpan);
799 template <
typename T>
802 std::stringstream osk, osm;
805 for (
uiterator itr = ubegin(); itr != uend(); ++itr)
807 osk << itr.value() <<
" ";
808 osm << itr.multiplicity() <<
" ";
812 osm <<
"deg="<<m_deg<<
", size="<<size() <<
", uSize="<< uSize()
813 <<
", minSpan="<< minIntervalLength()
814 <<
", maxSpan="<< maxIntervalLength() <<
"\n";
816 return osk.str() + osm.str();
823 if( numKnots <= 0 )
return;
825 const mult_t l = ( domainUBegin() - ubegin() ) * numKnots * mult;
826 const mult_t r = (uend() - domainUEnd() - 1 ) * numKnots * mult;
828 knotContainer newKnots;
829 getUniformRefinementKnots(numKnots,newKnots,mult);
830 insert(newKnots.begin(),newKnots.end());
832 if (0!=l) trimLeft (l);
833 if (0!=r) trimRight(r);
845 std::transform( m_repKnots.begin(), m_repKnots.end(), m_repKnots.begin(),
846 GS_BIND1ST(std::plus<T>(),amount) );
852 typename std::vector<T>::iterator beg = m_repKnots.begin();
863 for (; uit != uend(); ++uit)
864 uit.setValue(*uit + amount);
867 dend.setValue(*dend + amount);
870 GISMO_ASSERT( check(),
"addConstant() has produced an invalid knot vector.");
877 size_t newSize = size() + i*(uSize()-2);
879 tmp.reserve(newSize);
882 tmp.insert(tmp.end(), m_multSum.front() + (boundary ? i : 0),
887 for (; uit != uend()-1; ++uit)
888 tmp.insert(tmp.end(), i + uit.multiplicity(), *uit);
891 tmp.insert(tmp.end(), uit.multiplicity() + (boundary ? i : 0) , *uit);
893 m_repKnots.swap(tmp);
896 mult_t r = ( boundary ? 1 : 0 );
897 for (nonConstMultIterator m = m_multSum.begin(); m != m_multSum.end()-1; ++m)
899 m_multSum.back() += i * (boundary ? r : r-1 );
908 ktmp.reserve(size());
909 ktmp.reserve(uSize());
912 mult_t bm = boundary ? (std::max<mult_t>)(1,m_multSum.front()-i) : m_multSum.front();
914 ktmp.insert(ktmp.end(), bm, m_repKnots.front());
917 for (; uit != uend()-1; ++uit)
919 const mult_t m = uit.multiplicity() - i;
922 mtmp.push_back( m + mtmp.back() );
923 ktmp.insert(ktmp.end(), m, *uit);
928 bm = boundary ? (std::max<mult_t>)(1,uit.multiplicity()-i) : uit.multiplicity();
929 mtmp.push_back( bm + mtmp.back() );
930 ktmp.insert(ktmp.end(), bm, *uit);
932 m_multSum .swap(mtmp);
933 m_repKnots.swap(ktmp);
939 increaseMultiplicity(i,
true);
946 reduceMultiplicity(i,
true);
950 template <
typename T>
954 GISMO_ASSERT(knotRemove>=0 && knotSkip>0,
"Invalid parameters to knot-coarsening.");
957 if (-1==mul) mul = m_deg+1;
959 std::vector<T> coarseKnots, removedKnots;
960 if (0==knotRemove)
return removedKnots;
963 removedKnots.reserve( knotRemove * this->uSize() / (knotRemove+knotSkip) );
968 for(; it<last; it += knotSkip)
969 for(
index_t c = 0; it!=last && c!=knotRemove; ++c, ++it)
972 (std::min<mult_t>)( mul, it.multiplicity() ),
977 coarseKnots.reserve(m_repKnots.size()-removedKnots.size());
978 std::set_difference( m_repKnots.begin(), m_repKnots.end(),
979 removedKnots.begin(), removedKnots.end(),
980 std::back_inserter(coarseKnots) );
982 coarseKnots.swap(m_repKnots);
985 GISMO_ASSERT( check(),
"Unsorted knots or invalid multiplicities." );
994 result.resize(1, size()-m_deg-1 ) ;
999 result(0,0) = std::accumulate( itr, itr+m_deg, (T)(0.0) ) / (T)(m_deg) ;
1001 if ( result(0,0) < *(itr-1) )
1002 result(0,0) = *(itr-1);
1004 for (++itr; itr != end()-m_deg; ++itr, ++i )
1006 result(0,i) = std::accumulate( itr, itr+m_deg, (T)(0.0) ) / (T)(m_deg) ;
1007 if ( result(0,i) == result(0,i-1) )
1010 result(0,i-1) -= (T)(1)/(T)(1000000000);
1017 if ( result(0,i) > *(itr) )
1018 result(0,i) = *(itr);
1021 copy_n(m_repKnots.data(), result.size(), result.data() );
1024 template<
typename T>
1027 result.resize(1, numElements());
1029 for (
uiterator it = domainUBegin(); it != domainUEnd(); ++it, ++i)
1030 result.
at(i) = (*(it+1) + *it) / (T)(2);
1037 GISMO_ASSERT(i>=0 && static_cast<size_t>(i) < size()-m_deg-1,
1038 "Index of Greville point is out of range.");
1040 return ( m_deg==0 ? *(itr+i-1) :
1041 std::accumulate( itr+i, itr+i+m_deg, (T)(0.0) ) / (T)(m_deg)
1043 - (*(itr+i) == *(itr+i+m_deg) ? 1e-10 : 0 )
1053 result.reserve( (uSize()-1) * knotsPerSpan * mult );
1055 T prev = m_repKnots.front();
1056 for(
uiterator uit = ubegin()+1; uit != uend(); ++uit )
1058 const T step = (*uit - prev)/(T)(knotsPerSpan+1);
1059 for( mult_t i = 1; i <= knotsPerSpan; ++ i)
1060 result.insert( result.end(), mult, prev + (T)(i)*step );
1065 template<
typename T>
1071 result.
at(0) = it.uIndex();
1073 result.
at(1) = it.uIndex();
reverse_iterator rbegin() const
Returns reverse iterator pointing past the end of the repeated knots.
Definition: gsKnotVector.hpp:147
internal::gsUKnotIterator< T > uiterator
Definition: gsKnotVector.h:102
static bool isConsistent(const knotContainer &repKnots, const multContainer &multSums)
Sanity check.
Definition: gsKnotVector.hpp:542
gsKnotVector knotIntersection(const gsKnotVector &b) const
Computes the intersection of knot-vectors this and b.
Definition: gsKnotVector.hpp:201
Knot vector for B-splines.
multContainer multiplicities() const
Returns vector of multiplicities of the knots.
Definition: gsKnotVector.hpp:714
void affineTransformTo(T newBeg, T newEnd)
Definition: gsKnotVector.hpp:450
void refineSpans(iterType begin, iterType end, mult_t knotsPerSpan)
Inserts knotsPerSpan knots between each two knots between begin and end.
Definition: gsKnotVector.h:647
int deduceDegree() const
Definition: gsKnotVector.hpp:706
gsMatrix< T > greville() const
Definition: gsKnotVector.h:540
std::string detail() const
Return a string with detailed information on the knot vector.
Definition: gsKnotVector.hpp:800
void trimLeft(const mult_t numKnots)
Removes the left-most numKnots from the knot-vector.
Definition: gsKnotVector.hpp:390
smart_iterator sbegin() const
Returns the smart iterator pointing to the beginning of the repeated knots.
Definition: gsKnotVector.hpp:259
void initClamped(int degree, unsigned numKnots=2, unsigned mult_interior=1)
Definition: gsKnotVector.hpp:693
reverse_uiterator urbegin() const
Returns reverse unique iterator pointing past the end of the unique knots.
Definition: gsKnotVector.hpp:247
mult_t maxInteriorMultiplicity() const
Returns the maximum multiplicity in the interior.
Definition: gsKnotVector.hpp:724
#define short_t
Definition: gsConfig.h:35
reverse_uiterator urend() const
Returns reverse unique iterator pointing to the beginning of the unique knots.
Definition: gsKnotVector.hpp:253
void addConstant(T amount)
Adds amount to all the knots.
Definition: gsKnotVector.hpp:839
void trimRight(const mult_t numKnots)
Removes the right-most numKnots from the knot-vector.
Definition: gsKnotVector.hpp:403
void erase(const mult_t first, const mult_t last)
Removes the knots in the range [first,last)
Definition: gsKnotVector.hpp:376
reverse_smart_iterator rsend() const
Returns the reverse smart iterator pointing to the beginning of the repeated knots.
Definition: gsKnotVector.hpp:277
Struct that defines the boundary sides and corners and types of a geometric object.
Definition: gsBoundary.h:55
mult_t multiplicity(T u) const
Definition: gsKnotVector.hpp:421
void centers_into(gsMatrix< T > &result) const
Definition: gsKnotVector.hpp:1025
void supportIndex_into(const mult_t &i, gsMatrix< index_t > &result) const
Definition: gsKnotVector.hpp:1066
static void DecodeIntoGsType(const std::string &base64_string, const std::string &base_type_flag_, gsMatrix< ScalarType > &result)
Decode a string and copy into requested gismo Type.
Definition: gsBase64.h:355
S give(S &x)
Definition: gsMemory.h:266
size_t size() const
Number of knots (including repetitions).
Definition: gsKnotVector.h:242
#define index_t
Definition: gsConfig.h:32
#define GISMO_ENSURE(cond, message)
Definition: gsDebug.h:102
internal::gsKnotIterator< T > smart_iterator
Definition: gsKnotVector.h:107
std::vector< T >::const_iterator iterator
Definition: gsKnotVector.h:97
void greville_into(gsMatrix< T > &result) const
Definition: gsKnotVector.hpp:991
void insert(T knot, mult_t mult=1)
Inserts knot knot into the knot vector with multiplicity mult.
Definition: gsKnotVector.hpp:325
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
iterator iFind(const T u) const
Returns an iterator to the last occurrence of the knot at the beginning of the knot interval containi...
Definition: gsKnotVector.hpp:779
uiterator uFind(const T u) const
Returns the uiterator pointing to the knot at the beginning of the knot interval containing u...
Definition: gsKnotVector.hpp:747
void getUniformRefinementKnots(mult_t knotsPerSpan, knotContainer &result, mult_t mult=1) const
Definition: gsKnotVector.hpp:1048
T minIntervalLength() const
Returns the minimum interval length of the knot sequence.
Definition: gsKnotVector.hpp:527
gsKnotVector()
Empty constructor sets the degree to -1 and leaves the knots empty.
Definition: gsKnotVector.h:157
T at(index_t i) const
Returns the i-th element of the vectorization of the matrix.
Definition: gsMatrix.h:211
void degreeReduce(const short_t &i)
Converse to degreeElevate.
Definition: gsKnotVector.hpp:944
std::vector< T > coarsen(index_t knotRemove=1, index_t knotSkip=1, mult_t mul=-1)
Definition: gsKnotVector.hpp:952
mult_t minInteriorMultiplicity() const
Returns the minimum multiplicity in the interior.
Definition: gsKnotVector.hpp:733
std::ostream & print(std::ostream &os=gsInfo) const
Definition: gsKnotVector.hpp:493
void increaseMultiplicity(const mult_t i=1, bool boundary=false)
Definition: gsKnotVector.hpp:874
void uniformRefine(mult_t numKnots=1, mult_t mult=1)
Definition: gsKnotVector.hpp:820
uiterator ubegin() const
Returns unique iterator pointing to the beginning of the unique knots.
Definition: gsKnotVector.hpp:235
gsXmlAttribute * makeAttribute(const std::string &name, const std::string &value, gsXmlTree &data)
Helper to allocate XML attribute.
Definition: gsXml.cpp:37
uiterator uLowerBound(const T u) const
Returns a uiterator pointing to the first knot which does not compare less than u.
Definition: gsKnotVector.hpp:771
void copy_n(T begin, const size_t n, U *result)
Small wrapper for std::copy mimicking memcpy (or std::copy_n) for a raw pointer destination, copies n positions starting from begin into result. The latter is expected to have been allocated in advance.
Definition: gsMemory.h:368
void symDifference(const gsKnotVector< T > &other, std::vector< T > &result) const
Computes the symmetric difference between this knot-vector and other.
Definition: gsKnotVector.hpp:172
T maxIntervalLength() const
Returns the maximum interval length of the knot sequence.
Definition: gsKnotVector.hpp:518
bool check() const
Checks whether the knot vector is in a consistent state.
Definition: gsKnotVector.hpp:536
gsXmlNode * makeNode(const std::string &name, gsXmlTree &data)
Helper to allocate XML node.
Definition: gsXml.cpp:54
iterator beginAt(mult_t upos) const
Definition: gsKnotVector.hpp:131
void difference(const gsKnotVector< T > &other, std::vector< T > &result) const
Computes the difference between this knot-vector and other.
Definition: gsKnotVector.hpp:159
uiterator uUpperBound(const T u) const
Returns an iterator pointing to the first knot which compares greater than u.
Definition: gsKnotVector.hpp:763
void degreeElevate(const short_t &i=1)
Definition: gsKnotVector.hpp:937
uiterator uend() const
Returns unique iterator pointing past the end of the unique knots.
Definition: gsKnotVector.hpp:241
void reduceMultiplicity(const mult_t i=1, bool boundary=false)
Definition: gsKnotVector.hpp:903
void swap(gsKnotVector &other)
Swaps with other knot vector.
Definition: gsKnotVector.hpp:302
iterator end() const
Returns iterator pointing past the end of the repeated knots.
Definition: gsKnotVector.hpp:124
void reverse()
Better directly use affineTransformTo.
Definition: gsKnotVector.hpp:468
Class for representing a knot vector.
Definition: gsKnotVector.h:79
EIGEN_STRONG_INLINE abs_expr< E > abs(const E &u)
Absolute value.
Definition: gsExpressions.h:4486
mult_t multiplicityIndex(mult_t i) const
Definition: gsKnotVector.hpp:430
iterator begin() const
Returns iterator pointing to the beginning of the repeated knots.
Definition: gsKnotVector.hpp:117
void remove(uiterator uit, mult_t mult=1)
Definition: gsKnotVector.hpp:347
gsKnotVector * clone() const
Returns a pointer to a copy.
Definition: gsKnotVector.hpp:312
reverse_smart_iterator rsbegin() const
Returns the reverse smart iterator pointing past the end of the repeated knots.
Definition: gsKnotVector.hpp:271
smart_iterator send() const
Returns the smart iterator pointing past the end of the repeated knots.
Definition: gsKnotVector.hpp:265
gsKnotVector knotUnion(const gsKnotVector &b) const
Computes the union of knot-vectors this and b.
Definition: gsKnotVector.hpp:187
reverse_iterator rend() const
Returns reverse iterator pointing to the beginning of the repeated knots.
Definition: gsKnotVector.hpp:229
int degree() const
Returns the degree of the knot vector.
Definition: gsKnotVector.hpp:700
iterator endAt(mult_t upos) const
Definition: gsKnotVector.hpp:139
Provides declaration of input/output XML utilities struct.
bool includes(const gsKnotVector< T > &other) const
Returns true if every knot of other (counted with repetitions) is found within this knot-vector...
Definition: gsKnotVector.hpp:153
void initUniform(T first, T last, unsigned interior, unsigned mult_ends, unsigned mult_interior, short_t degree=-1)
Definition: gsKnotVector.hpp:643