G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsPlanarDomain.hpp
Go to the documentation of this file.
1 
14 #pragma once
15 
16 #include <gsCore/gsLinearAlgebra.h>
18 #include <gsCore/gsCurve.h>
19 
20 #include <gsNurbs/gsNurbsCreator.h>
21 
22 #include <gsUtils/gsMesh/gsMesh.h>
23 
25 #include <gsModeling/gsTemplate.h>
26 
27 #include <gsNurbs/gsBSpline.h>
28 #include <gsNurbs/gsKnotVector.h>
29 
30 namespace gismo
31 {
32 
33 
34 template <class T>
35 gsPlanarDomain<T>::gsPlanarDomain( std::vector< gsCurveLoop<T> *> const & loops)
36 {
37  if(!loops[0]->is_ccw())
38  loops[0]->reverse();
39  m_loops.push_back(loops[0]);
40  for(size_t i=1; i<loops.size();i++ )
41  {
42 
43  if( loops[i]->is_ccw() )
44 
45  loops[i]->reverse();
46  m_loops.push_back(loops[i]);
47  }
48  updateBoundingBox();
49 }
50 
51 /*
52 template<class T>
53 gsMatrix<T> gsPlanarDomain<T>::averageValue( std::vector<gsFunction<T>*> const &f,
54  std::vector<T> const & breaks)
55 {
56  gsMatrix<T> ngrid;
57  gsVector<T> wgrid;
58  gsMatrix<T> xev,B (f.size(),1);
59  B.setZero();
60  iteratedGaussRule(ngrid, wgrid, 2, breaks);
61  for(size_t i=0; i<f.size();i++)
62  {
63  for(int k=0; k<ngrid.cols();k++) //for all quadrature points
64  {
65  const gsMatrix<T> & uc = ngrid.col(k);
66 
67  f[i]->eval_into(uc,xev);
68  B(i,0) += wgrid[k]*xev(0,0);
69  }
70  }
71  gsDebugVar( B.transpose() );
72  return B;
73 }
74 */
75 
76 template<class T>
78 {
79  GISMO_ASSERT(u.cols() == 1, "Waiting for a single point");
80 
81  // compute intersections with line x=u(0,0);
82  std::vector<T> tmp = m_loops[0]->lineIntersections(direction, u(direction,0) );
83 
84  // gsDebug<< "intersections:\n";
85  // for( size_t i = 0; i!=tmp.size(); ++i)
86  // gsDebug<< " "<< tmp[i];
87  // gsDebug<<"\n";
88 
89  if ( tmp.empty() ) // point outside the outer loop
90  return false;
91 
92  gsAsMatrix<T> xx(tmp);
93  gsMatrix<T> e;
94  m_loops[0]->curve(0).eval_into( xx, e );
95 
96  int count = 0; // count even means out of the domain
97 
98  //checking if abscissae of intersection are greater then point's abscissa
99  for(index_t i=0; i!=e.cols(); i++)
100  {
101  if( (e( !direction, i )> u(!direction,0)) )
102  count++;
103  }
104  if ( (count % 2) == 0 ) //this means point is outside the outer loop
105  return false;
106 
107  for(index_t v = 1; v<this->numLoops(); v++)
108  {
109 
110  count=0;
111  tmp= m_loops[v]->lineIntersections( direction, u(direction,0) );
112 
113  if(tmp.size()!=0) // intersections detected with hole loop
114  {
115  gsAsMatrix<T> Ev(tmp);
116  m_loops[v]->curve(0).eval_into( Ev, e );
117 
118  for(index_t i=0; i!=e.cols(); i++)
119  {
120  // gsDebug<<"e(1,i) "<< e(1,i)<<"\n";
121  if( e(!direction,i) > u(!direction,0) )
122  count++;
123 
124  }
125  }
126  if( (count % 2) != 0 ) //this means point is inside hole v
127  return false;
128  }
129 
130  return true; // if we get here then the point is in the domain
131 }
132 
133 
134 template<class T>
135 bool gsPlanarDomain<T>::onBoundary(gsMatrix<T> const & u)
136 {
137  for(index_t v=0; v< this->numLoops();v++)
138  {
139  // true iff point u on boundary
140  T parValue;
141  if( m_loops[v]->isOn(u, parValue,1e-5 ) )
142  {
143  return true;
144  }
145  }
146  return false;
147 }
148 
149 
150 template <class T>
151 std::ostream& gsPlanarDomain<T>::print(std::ostream &os) const
152 {
153  os << "Outer boundary: " << *m_loops[0];
154  if ( m_loops.size()>1 )
155  {
156  os << "Holes: ";
157  for ( typename std::vector< gsCurveLoop<T> *>::const_iterator it =
158  m_loops.begin()+1; it != m_loops.end(); ++it)
159  os << **it;
160  }
161  os << "Bounding box: ["<< m_bbox.col(0).transpose()<< ", "
162  << m_bbox.col(1).transpose() << "]";
163  return os;
164 }
165 
166 
168 template <class T>
169 void gsPlanarDomain<T>::sampleLoop_into( int loopID, int npoints, int numEndPoints, gsMatrix<T> & u )
170 {
171  assert( (loopID>=0) && (loopID < numLoops()) );
172 
173  int np; // new number of points
174  switch (numEndPoints)
175  {
176  case (0):
177  np = npoints-2;
178  break;
179  case (1):
180  np = npoints-1;
181  break;
182  case (2):
183  np = npoints;
184  break;
185  default:
186  np = 0;
187  break;
188  }
189 
190  u.resize(2, (m_loops[loopID]->curves()).size() * np);
191  int i=0;
192  typename std::vector< gsCurve<T> *>::const_iterator it;
193  gsMatrix<T> pts;
194  gsMatrix<T> uCols;
195 
196  int firstInd=0;
197  int secondInd=np-1;
198  if (numEndPoints==0) {firstInd=1;secondInd=npoints-2;}
199 
200  for ( it= (m_loops[loopID]->curves()).begin(); it!= (m_loops[loopID]->curves()).end(); ++it )
201  {
202  //gsMatrix<T> * interval = (*it)->parameterRange();
203  //gsMatrix<T> * pts = gsPointGrid( interval->at(0), interval->at(1), npoints );
204  pts.resize(1,np);
205  for (int ii=firstInd;ii<=secondInd;ii++) pts(0,ii-firstInd)= (T)(ii)/(T)(npoints-1);
206  uCols.resize(2,np);
207  (*it)->eval_into( pts, uCols );
208  u.middleCols( i * np,np ) = uCols;
209 
210  (*it)->eval_into( pts, uCols );
211  u.middleCols( i * np,np ) = uCols;
212  ++i;
213  }
214 }
215 template <class T>
216 T getDistance(gsVertex<T>* v1,gsVertex<T>* v2) // todo: move as member of gsVertex
217 {
218  T x1=(v1->x());
219  T x2=(v2->x());
220  T y1=(v1->y());
221  T y2=(v2->y());
222  T z1=(v1->z());
223  T z2=(v2->z());
224  T dist=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1));
225  return dist;
226 }
227 
228 template <class T>
229 void gsPlanarDomain<T>::sampleCurve_into( int loopID, int curveID, int npoints, gsMatrix<T> & u )
230 {
231  assert( (loopID>=0) && (loopID < numLoops()) );
232  assert( (curveID>=0) && (curveID < loop(loopID).size() ) );
233  u.resize(2,npoints);
234  typename std::vector< gsCurve<T> *>::const_iterator it;
235  for ( it= (m_loops[loopID]->curves()).begin()+curveID; it!= (m_loops[loopID]->curves()).begin()+curveID+1 ; ++it )
236  {
237  //gsMatrix<T> * interval = (*it)->parameterRange();
238  //gsMatrix<T> * pts = gsPointGrid( interval->at(0), interval->at(1), npoints );
239  gsMatrix<T> pts(1,npoints);
240  for (int ii=0;ii<=npoints-1;ii++)
241  { pts(0,ii)= (T)(ii)/(T)(npoints-1); }; // todo: use gsPointGrid
242  (*it)->eval_into( pts, u );
243  }
244 }
245 
247 template <class T>
248 memory::unique_ptr<gsMesh<T> > gsPlanarDomain<T>::toMesh(int npoints) const // FOR NOW ONLY ONE LOOP
249 {
250  typename gsMesh<T>::uPtr m(new gsMesh<T>());
251  // Typedefs
252  typedef typename gsVertex<T>::gsVertexHandle VertexHandle;
253  //typedef std::deque<VertexHandle> VertexList;
254  //typedef typename std::deque<VertexHandle>::iterator VertexListIter;
255 
256  GISMO_ASSERT(npoints > 0, "Number of points must be positive.");
257 
258 #if FALSE
259  T h_x = (m_bbox(0,1) - m_bbox(0,0) ) / (npoints-1) ,
260  h_y = (m_bbox(1,1) - m_bbox(1,0) ) / (npoints-1) ;
261 
262  //========== 1. Compute y-parallel segments
263  VertexList x_seg_begin; // Starting points of y-parallel segments
264  VertexList x_seg_end; // Endpoints of y-parallel segments
265 
266  T xi = m_bbox(0,1);
267  std::vector<T> tmp = m_loops[0]->lineIntersections(0, xi );// segments
268  gsDebug<<"----- INTs: "<<tmp.size()<<"( "<<xi<<") \n";
269  gsAsMatrix<T> xxi(tmp);
270  gsMatrix<T> xev;
271  m_loops[0]->curve(0).eval_into(xxi, xev );// Push forward onto the curve: xev.row(1)==xi
272  gsVector<T> x_seg = xev.row(1) ;// xev.row(0)==xi
273  std::sort( x_seg.data(), x_seg.data()+x_seg.size() );
274 
275  for ( index_t j= 0; j!= x_seg.size(); j+=2 )
276  {
277  VertexHandle v = m->addVertex( xi, x_seg[j] );
278  if ( x_seg[j] < x_seg[j+1] )
279  {
280  x_seg_begin.push_back( v );
281  v = m->addVertex( xi, x_seg[j+1] );
282  x_seg_end.push_back ( v );
283  }
284  else
285  {
286  x_seg_end.push_back( v );
287  v = m->addVertex( xi, x_seg[j+1] );
288  x_seg_begin.push_back ( v );
289  }
290  }
291 
292  xi = m_bbox(0,0);
293  for ( int i = 0; i!= npoints-1; ++i )
294  {
295  tmp = m_loops[0]->lineIntersections(0, xi );
296  gsDebug<<"----- INTs: "<<tmp.size()<<"( "<<xi<<") \n";
297  //gsDebug<<"----- INTs x: "<<tmp.size()<<", i="<<i<<"\n";
298  gsAsMatrix<T> xxi(tmp);
299  m_loops[0]->curve(0).eval_into(xxi, xev );
300  x_seg = xev.row(1) ;// xev.row(0)==xi
301  std::sort( x_seg.data(), x_seg.data()+x_seg.size() );
302 
303  for ( index_t j= 0; j!= x_seg.size(); j+=2 )
304  {
305  VertexHandle v = m->addVertex( xi, x_seg[j] );
306  if ( x_seg[j] < x_seg[j+1] )
307  {
308  x_seg_begin.push_back( v );
309  v = m->addVertex( xi, x_seg[j+1] );
310  x_seg_end.push_back ( v );
311  }
312  else
313  {
314  x_seg_end.push_back( v );
315  v = m->addVertex( xi, x_seg[j+1] );
316  x_seg_begin.push_back ( v );
317  }
318  }
319  xi += h_x;
320  }
321 
322  //========== 2. Sort the segments wrt both endpoints
323  std::sort( x_seg_begin.begin(), x_seg_begin.end(), Yless<T> );
324  std::sort( x_seg_end.begin() , x_seg_end.end() , Yless<T> );
325 
326  gsDebug<<"x-segments: "<<x_seg_begin.size()<<", "<<x_seg_end.size()<<"\n";
327 
328  //========== 3. March on x-parallel segments
329  bool SegStart(false), SegEnd(false);
330  VertexList line0; // x-sorted
331 
332  VertexListIter ss = x_seg_begin.begin(),
333  es = x_seg_end.begin();
334  T yi = m_bbox(1,0);
335  VertexList Yprev;
336 
337  for ( int i = 0; i!= npoints; ++i )
338  {
339  tmp = m_loops[0]->lineIntersections(1, yi );
340  //gsDebug<<"----- INTs y: "<<tmp.size()<<"\n";
341 
342  if ( ! tmp.empty() ) // Intersection event
343  {
344  gsDebug<<"--- Intersection event "<<i<<"( "<<yi<<" )\n";
345 
346  // Compute intersections with y=yi
347  gsAsMatrix<T> yyi(tmp);
348  gsMatrix<T> yev;
349  m_loops[0]->curve(0).eval_into(yyi, yev );
350  gsVector<T> y_seg = yev.row(0) ;// yev.row(1)==yi
351  std::sort( y_seg.data(), y_seg.data()+y_seg.size() );
352  VertexHandle v;
353  VertexList line1;
354 
355  // Look for SegEnd events
356  while( es != x_seg_end.end() && (*es)->y() < yi )
357  {// Property: every line has unique points wrt x-coord
358  gsDebug<<"SegEnd: "<< **es ;
359  SegEnd=true;
360 
361  for ( VertexListIter it= line0.begin(); it!= line0.end(); ++it )
362  if ( (*it)->x() == (*es)->x() )
363  {
364  gsDebug<<"SegEnd: removed "<< **it ;
365  line0.erase( it );
366  break;
367  }
368  es++;
369  }
370 
371  // Mirror previous lines
372  for ( VertexListIter it= line0.begin(); it!= line0.end(); ++it )
373  {
374  v = m->addVertex( (*it)->x(), yi );
375  line1.push_back(v);
376  }
377 
378  // Look for SegStart events
379  while( ss != x_seg_begin.end() && (*ss)->y() < yi )
380  {
381  SegStart=true;
382  gsDebug<<"SegStart: added "<< (*ss)->x() <<".\n";
383  line0.push_back(*(ss) );
384  v = m->addVertex( (*ss)->x(), yi );
385  line1.push_back(v);
386  ss++;
387  }
388 
389  std::sort( line0.begin(), line0.end(), Xless<T> );
390  std::sort( line1.begin(), line1.end(), Xless<T> );
391 
392  gsDebug<<"line0 has "<< line0.size() <<" points\n";
393  gsDebug<<"line1 has "<< line1.size() <<" points\n";
394 
395  // add faces
396  if ( ! line1.empty() && line1.size() == line0.size() )
397  {
398  gsDebug<<"Tiling row "<<i<<".\n";
399  VertexListIter it0=line0.begin();
400  for ( VertexListIter it1= line1.begin(); it1!= line1.end()-1; ++it1, ++it0 )
401  m->addFace( *it0, *it1, *(it1+1), *(it0+1) );
402  }
403  else
404  {
405  gsDebug<<"Trouble..\n";
406  VertexListIter it0=line0.begin();
407  for ( VertexListIter it1= line1.begin(); it1!= line1.end(); ++it1, ++it0 )
408  gsDebug<< (*it0)->x() <<" - "<< (*it1)->x() <<" \n";
409  while ( it0 != line0.end() )
410  gsDebug<< (*it0++)->x() <<" - * " <<" \n";
411 
412  }
413 
414  gsDebug<<"Connecting endpoints.\n";
415 
416  VertexList Yseg;
417  // Make boundary vertices on y=yi
418  Yseg.push_back( m->addVertex( y_seg[0] , yi ) );
419  Yseg.push_back( m->addVertex( y_seg[y_seg.size()-1], yi ) );
420 
421  if (SegStart )
422  {
423  // connect x-boundary point to level 0
424  if ( Yprev.size() )
425  {
426  m->addFace( Yprev[0], line0.front(), line0[1] );
427  m->addFace( Yprev[1], line0.back() , line0[line0.size()-2] );
428  }
429  // connect x-boundary point to level 1
430  m->addFace( Yseg[0], line1.front(), line0.front() );
431  m->addFace( Yseg[1], line1.back(), line0.back() );
432  }
433  else if ( Yprev.size() )
434  {
435  // Connect y-boundary points
436  m->addFace( line1.front(), line0.front(), Yprev[0], Yseg[0] );
437  m->addFace( line1.back() , line0.back() , Yprev[1], Yseg[1] );
438  }
439 
440  Yprev = Yseg;
441  line0 = line1;
442  SegStart=SegEnd=false;
443  }
444  else // No intersection event
445  {
446  Yprev.clear();
447  line0.clear();
448  }
449 
450  // next y-line
451  yi += h_y;
452  }
453 
454  // repeat for yi=m_bbox(1,1)
455 
456  return m;
457 #endif
458  T bbox_length_y =m_bbox(1,1)-m_bbox(1,0);
459  int yPoints = cast<T,int>( (T)(npoints)*bbox_length_y) ;
460  int lb_yPoints=25;
461  if(yPoints<lb_yPoints)
462  {
463  if ( yPoints > 0 )
464  npoints *= lb_yPoints / yPoints;
465  else
466  npoints *= lb_yPoints / 2;
467 
468  yPoints = lb_yPoints;
469  }
470 
471  // vector of y-coords of npoints lines parrallel to x-axis
472  // IDEA: Also use these as x_sample_guides !!!
473  gsMatrix<T> y_samples = gsPointGrid<T>( m_bbox(1,0), m_bbox(1,1), yPoints);
474 
475  // x-coords of sampling points on the line y=yi (if any)
476  // int: yi index,
477  //gsVector *: a pointer to a vector of npoints x-coords of sample points on the line y=yi
478  //std::vector<index_t>: a vector of indices that indicate
479  //the line segments of y=yi that intesect the domain
480 
481  std::vector<std::vector< VertexHandle > >samples;
482  std::vector<std::vector< VertexHandle > >intersections;
483 
484  // std::map<int,
485  // std::pair<
486  // std::vector< VertexHandle >,
487  // std::vector<T>
488  // >
489  // > x_samples;
490  for ( int i = 0; i!= yPoints; ++i )
491  {
492  std::vector<T> x_all;
493  //gsDebug<<" --- before intersections " << i <<", y="<< y_samples(0,i) <<"\n";
494  for (size_t j=0;j<m_loops.size();j++)
495  {
496  std::vector<T> x = m_loops[j]->lineIntersections(1, y_samples(0,i) );
497  if ( ! x.empty() )
498  {
499  typename gsCurve<T>::uPtr curve = m_loops[j]->singleCurve() ; // TO BE REMOVED later
500 
501  if ( x.size() == 1 )
502  {
503  x.push_back(x[0]);
504  gsWarn<<"lineIntersection yielded a tangent"<<'\n';
505  }
506  else if (x.size()%2==1)
507  {
508  x.push_back(x[0]);
509  gsWarn<<"lineIntersection yielded a tangent and more intersections, try another number of points"<<'\n';
510  }
511 
512  gsAsMatrix<T> xx(x);
513  gsMatrix<T> e = curve->eval( xx );
514  for (size_t k=0;k<x.size();k++)
515  {
516  x_all.push_back(e(0,k));
517  }
518  }
519  }
520  std::sort(x_all.begin(), x_all.end() );
521  gsVector<int> numPoints( x_all.size() / 2 );
522  int k(0);
523  for ( typename std::vector<T>::const_iterator it = x_all.begin();
524  it < x_all.end(); it += 2 )
525  numPoints[k++] = cast<T,int>( (*(it+1) - *it)* (T)(npoints) );
526 
527  std::vector<VertexHandle> x_line;
528  std::vector<VertexHandle> intersection_vec;
529  for(index_t j=0;j<numPoints.size();j++)
530  {
531  x_line.push_back(m->addVertex(x_all[j*2],y_samples(0,i)));
532  intersection_vec.push_back(m->addVertex(x_all[j*2],y_samples(0,i)));
533 
534  for(k=0; k<numPoints[j]; k++)
535  {
536  x_line.push_back(m->addVertex(x_all[j*2]*(T)(numPoints[j]-k)/(T)(numPoints[j]+1)+x_all[j*2+1]*(T)(k+1)/(T)(numPoints[j]+1),y_samples(0,i)));
537  }
538  x_line.push_back(m->addVertex(x_all[j*2+1],y_samples(0,i)));
539  intersection_vec.push_back(m->addVertex(x_all[j*2+1],y_samples(0,i)));
540  }
541  samples.push_back(x_line);
542  intersections.push_back(intersection_vec);
543  }
544  T checkDist=(y_samples(0,1)-y_samples(0,0))*(T)(5);
545  for(size_t i=0;i<intersections.size()-1;i++)
546  {
547  size_t currentTop=0;
548  size_t currentBot=0;
549 
550  T topToBotDist=0;
551  T botToTopDist=0;
552  if(samples[i].size()>0&&samples[i+1].size()>0)
553  {
554  while (currentTop!=samples[i].size()-1||currentBot!=samples[i+1].size()-1)
555  {
556  if(currentTop==samples[i].size()-1)
557  {
558  VertexHandle v1=samples[i][currentTop];
559  VertexHandle v2=samples[i+1][currentBot];
560  VertexHandle v3=samples[i+1][currentBot+1];
561  if(getDistance(v1,v2)<checkDist&&getDistance(v1,v3)<checkDist&&getDistance(v2,v3)<checkDist)
562  m->addFace(v1,v2,v3);
563  currentBot++;
564  }
565  else if(currentBot==samples[i+1].size()-1)
566  {
567  VertexHandle v1=samples[i][currentTop];
568  VertexHandle v2=samples[i+1][currentBot];
569  VertexHandle v3=samples[i][currentTop+1];
570  if(getDistance(v1,v2)<checkDist&&getDistance(v1,v3)<checkDist&&getDistance(v2,v3)<checkDist)
571  m->addFace(v1,v2,v3);
572  currentTop++;
573  }
574  else
575  {
576  topToBotDist=getDistance(samples[i][currentTop],samples[i+1][currentBot+1]);
577  botToTopDist=getDistance(samples[i][currentTop+1],samples[i+1][currentBot]);
578  if (topToBotDist<botToTopDist)
579  {
580  VertexHandle v1=samples[i][currentTop];
581  VertexHandle v2=samples[i+1][currentBot];
582  VertexHandle v3=samples[i+1][currentBot+1];
583  if(getDistance(v1,v2)<checkDist&&getDistance(v1,v3)<checkDist&&getDistance(v2,v3)<checkDist)
584  m->addFace(v1,v2,v3);
585  currentBot++;
586  }
587  else
588  {
589  VertexHandle v1=samples[i][currentTop];
590  VertexHandle v2=samples[i+1][currentBot];
591  VertexHandle v3=samples[i][currentTop+1];
592  if(getDistance(v1,v2)<checkDist&&getDistance(v1,v3)<checkDist&&getDistance(v2,v3)<checkDist)
593  m->addFace(v1,v2,v3);
594  currentTop++;
595  }
596  }
597  }
598  }
599 
600  }
601 
602 
603  // // generate the Mesh vertices.
604  // k = npoints - x.size(); // points to distribute to the (interior of) the segments
605  // std::vector< VertexHandle > x_line;
606  // x_line.reserve(npoints);
607  // for (size_t v=0; v< x.size(); v+=2 )
608  // {
609  // x_line.push_back( m->addVertex(x[v], y_samples(0,i)) );
610  // // TO DO
611  // // ( ll[v/2] / ltotal )*k samples here
612  // for( int j = 1; j!= k+1; ++j)
613  // x_line.push_back( m->addVertex(x[v] + (T)(j) * ll[v/2] / (T)(k+1), y_samples(0,i)) );
614 
615  // x_line.push_back( m->addVertex(x[v+1], y_samples(0,i) ) );
616  // }
617  // //gsDebug<<"i: "<< i<< ", sz="<< x_line.size() <<", ints="<< x.size() <<"\n";
618  // //gsDebug<<"x= "<< x[0] <<", "<< x[1] <<"(y="<< y_samples(0,i) <<"\n";
619 
620  // x_samples.insert( make_pair(i,make_pair( x_line, x ) ) ); // i-th sample line
621 
622 
623  // }
624 
625  //gsDebug<<" --- mesh DONE "<< *m <<"\n";
626  // for ( int i = 0; i!= 25; ++i )
627  //gsDebug<<"--"<<* m->vertex[i] ;
628 
629  // Zig-zag connection
630  // for ( int i = 0; i!= npoints-1; ++i )
631  // {
632  // typename std::map<int,std::pair<std::vector<VertexHandle>, std::vector<T> > >::const_iterator
633  // it0 = x_samples.find(i);
634 
635  // if ( it0 != x_samples.end() ) // Check whether intersection with line 0 exists
636  // {
637  // typename std::map<int,std::pair<std::vector<VertexHandle>, std::vector<T> > >:: const_iterator
638  // it1 = x_samples.find(i+1);
639  // if ( it1 != x_samples.end() ) // Check whether intersection with line 1 exists
640  // {
641  // //typename std::vector<T>::const_iterator s0 = it0->second.second.begin();
642  // //typename std::vector<T>::const_iterator s1 = it1->second.second.begin();
643  // typename std::vector<VertexHandle>::const_iterator f1 = it1->second.first.begin();
644  // // Run through the sample points at line 0
645  // for ( typename std::vector<VertexHandle>::const_iterator f0 =
646  // it0->second.first.begin();
647  // f0 != it0->second.first.end()-1 ; ++f0 )
648  // {
649  // // TO DO
650  // //if ( *f0 == *s0 )// start segment level 0
651  // // if ( *f1 == *s1 )// start segment level 1
652  // m->addFace( *f0 , *f1 , *(f1+1), *(f0+1) ) ;
653  // f1++;
654  // }
655  // }
656  // }
657  // }
658  //gsDebug<<*m;
659  return m;
660 
661 }
662 
663 
664 }
Knot vector for B-splines.
Provides definition of gsTemplate class.
void sampleLoop_into(int loopID, int npoints, int numEndPoints, gsMatrix< T > &u)
linearly discriti
Definition: gsPlanarDomain.hpp:169
Creates a mapped object or data pointer to a matrix without copying data.
Definition: gsLinearAlgebra.h:126
#define gsDebug
Definition: gsDebug.h:61
memory::unique_ptr< gsMesh< T > > toMesh(int npoints=50) const
Return a triangulation of the planar domain.
Definition: gsPlanarDomain.hpp:248
Provides declaration of ConstantFunction class.
gsMatrix< T > eval(const gsMatrix< T > &u) const
Evaluate the function,.
Definition: gsFunctionSet.hpp:120
#define index_t
Definition: gsConfig.h:32
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
Class Representing a triangle mesh with 3D vertices.
Definition: gsMesh.h:31
#define gsWarn
Definition: gsDebug.h:50
GISMO_DEPRECATED index_t direction(index_t s)
Returns the parametric direction that corresponds to side s.
Definition: gsBoundary.h:1048
gsPlanarDomain()
Default empty constructor.
Definition: gsPlanarDomain.h:51
T x() const
Definition: gsVertex.h:108
Provides declaration of the Mesh class.
Represents a B-spline curve/function with one parameter.
Class representing a Planar domain with an outer boundary and a number of holes.
Definition: gsPlanarDomain.h:43
T y() const
Definition: gsVertex.h:110
memory::unique_ptr< gsCurve > uPtr
Unique pointer for gsCurve.
Definition: gsCurve.h:38
This is the main header file that collects wrappers of Eigen for linear algebra.
Provides declaration of Curve abstract interface.
A closed loop given by a collection of curves.
Definition: gsCurveLoop.h:36
Provides declaration of the NurbsCreator struct.
T z() const
Definition: gsVertex.h:112
gsVertex class that represents a 3D vertex for a gsMesh.
Definition: gsVertex.h:26
std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition: gsPlanarDomain.hpp:151
Provides functions for finding the preimage of a curve via a map.