G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsBoundaryConditions.h
Go to the documentation of this file.
1 
14 #pragma once
15 
16 #include <gsCore/gsBoundary.h>
17 
18 
19 namespace gismo
20 {
21 
26 {
28  enum type
29  {
30  unknownType = -1,
31  dirichlet = 0,
33  neumann = 1,
34  robin = 2,
35  clamped = 3,
36  weak_clamped = 30,
37  collapsed = 4,
38  laplace = 5
39  //mixed BD means: there are both dirichlet and neumann sides
40  //robin: a linear combination of value and derivative
41  //cauchy: there are 2 conditions (value+deriv) defined on the same side
42  };
43 
44 };
45 
46 // Print (as string) a boundary type
47 inline std::ostream &operator<<(std::ostream &os, const condition_type::type& o)
48 {
49  switch (o)
50  {
52  {
53  os<< "Dirichlet";
54  break;
55  }
57  {
58  os<< "Weak Dirichlet";
59  break;
60  }
62  {
63  os<< "Neumann";
64  break;
65  }
67  {
68  os<< "Robin";
69  break;
70  }
72  {
73  os<< "Clamped";
74  break;
75  }
76  case condition_type::weak_clamped:
77  {
78  os<< "Weak Clamped";
79  break;
80  }
81  case condition_type::collapsed:
82  {
83  os<< "Collapsed";
84  break;
85  }
87  {
88  os<< "Laplace";
89  break;
90  }
91  default:
92  os<< "condition type not known.\n";
93  };
94  return os;
95 }
96 
105 template<class T>
107 {
108  typedef typename gsFunctionSet<T>::Ptr function_ptr;
109 
110  boundary_condition( int p, boxSide s, const function_ptr & f_shptr,
111  const std::string & label, short_t unknown,
112  short_t unkcomp, bool parametric)
113  : ps(p, s),
114  m_function(f_shptr),
115  m_label(label),
116  m_unknown(unknown),
117  m_unkcomp(unkcomp),
118  m_parametric(parametric)
119  {
120  if (m_label == "Dirichlet") m_type = condition_type::dirichlet;
121  else if (m_label == "Weak Dirichlet") m_type = condition_type::weak_dirichlet;
122  else if (m_label == "Neumann") m_type = condition_type::neumann;
123  else if (m_label == "Robin") m_type = condition_type::robin;
124  else if (m_label == "Clamped") m_type = condition_type::clamped;
125  else if (m_label == "Weak Clamped") m_type = condition_type::weak_clamped;
126  else if (m_label == "Collapsed") m_type = condition_type::collapsed;
127  else if (m_label == "Laplace") m_type = condition_type::laplace;
128  else m_type = condition_type::unknownType;
129  }
130 
131  boundary_condition( int p, boxSide s, const function_ptr & f_shptr,
132  condition_type::type t, short_t unknown, bool parametric)
133  : ps(p, s),
134  m_function(f_shptr),
135  m_type(t),
136  m_unknown(unknown),
137  m_unkcomp(-1),
138  m_parametric(parametric)
139  {
140  switch (t)
141  {
143  {
144  GISMO_ASSERT(!m_function || m_function->targetDim()==1,"Expecting scalar function");
145  m_label = "Dirichlet";
146  break;
147  }
149  {
150  GISMO_ASSERT(!m_function || m_function->targetDim()==1,"Expecting scalar function");
151  m_label = "Weak Dirichlet";
152  break;
153  }
155  {
156  m_label = "Neumann";
157  break;
158  }
160  {
161  m_label = "Robin";
162  break;
163  }
165  {
166  m_label = "Clamped";
167  break;
168  }
169  case condition_type::weak_clamped:
170  {
171  m_label = "weak Clamped";
172  break;
173  }
174  case condition_type::collapsed:
175  {
176  m_label = "Collapsed";
177  break;
178  }
180  {
181  m_label = "Laplace";
182  break;
183  }
184  default:
185  m_label = "Unknown";
186  break;
187  };
188  }
189 
190  boundary_condition( int p, boxSide s, const function_ptr & f_shptr,
191  condition_type::type t, int unknown, int unkcomp, bool parametric)
192  : ps(p, s),
193  m_function(f_shptr),
194  m_type(t),
195  m_unknown(unknown),
196  m_unkcomp(unkcomp),
197  m_parametric(parametric)
198  {
199  switch (t)
200  {
202  {
203  GISMO_ASSERT(!m_function || m_function->targetDim()==1,"Expecting scalar function");
204  m_label = "Dirichlet";
205  break;
206  }
208  {
209  // GISMO_ASSERT(!m_function || m_function->targetDim()==1,"Expecting scalar function");
210  m_label = "Weak Dirichlet";
211  break;
212  }
214  {
215  m_label = "Neumann";
216  break;
217  }
219  {
220  m_label = "Robin";
221  break;
222  }
224  {
225  m_label = "Clamped";
226  break;
227  }
228  case condition_type::weak_clamped:
229  {
230  m_label = "Weak Clamped";
231  break;
232  }
233  case condition_type::collapsed:
234  {
235  m_label = "Collapsed";
236  break;
237  }
239  {
240  m_label = "Laplace";
241  break;
242  }
243  default:
244  gsWarn<<"gsBoundaryConditions: Unknown boundary condition.\n";
245  m_label = "Unknown";
246  break;
247  };
248  }
249 
251  bool isHomogeneous() const { return m_function.get() == NULL; }
252 
254  function_ptr function() const { return m_function; }
255 
256  // Returns a reference to the function data
257  //const gsFunctionSet<T> & function() const { return *m_function; }
258 
260  condition_type::type type() const { return m_type; }
261 
263  const std::string & ctype() const { return m_label; }
264 
266  index_t patch() const { return ps.patch; }
267 
269  boxSide side() const { return ps.side(); }
270 
272  short_t unknown() const { return m_unknown; }
273 
275  short_t unkComponent() const { return m_unkcomp; }
276 
279  bool parametric() const { return m_parametric; }
280 
282  bool isSame(const boundary_condition & other) {return ((other.ps == ps) && (other.unknown() == unknown()) && (other.unkComponent() == unkComponent())) ;}
283 
285 
286  function_ptr m_function;
287 
288  // TO DO : robin coefficients?
289 
290  condition_type::type m_type;// todo: remove
291 
292  std::string m_label;
293 
295 
297 
298  bool m_parametric;
299 };
300 
304  template<class T>
306  {
307  corner_value(index_t p, boxCorner c, T v, short_t unk = 0, int comp = -1)
308  : patch(p), corner(c), value(v), unknown(unk), component(comp) { }
309 
312  T value;
314  int component;
315  };
316 
320  template<class T>
322  {
323  coupled_boundary(index_t p1, boxSide s1, index_t p2, boxSide s2, short_t dim, short_t unk = 0, int comp = -1)
324  : ifc(patchSide(p1,s1), patchSide(p2,s2), dim), unknown(unk), component(comp)
325  {}
326 
327  boundaryInterface ifc;
329  int component;
330  };
331 
340 template<class T>
341 class GISMO_EXPORT gsBoundaryConditions
342 {
343 
344 public:
345 
346  typedef typename std::deque<boundary_condition<T> > bcContainer;
347  typedef typename bcContainer::iterator iterator;
348  typedef typename bcContainer::const_iterator const_iterator;
349 
350  typedef typename std::deque<corner_value<T> > cornerContainer;
351  typedef typename cornerContainer::iterator citerator;
352  typedef typename cornerContainer::const_iterator const_citerator;
353 
354  typedef typename std::deque<coupled_boundary<T>> cplContainer;
355  typedef typename cplContainer::iterator cpliterator;
356  typedef typename cplContainer::const_iterator const_cpliterator;
357 
358  typedef typename std::deque<boundaryInterface> ppContainer;
359  typedef typename ppContainer::iterator ppiterator;
360  typedef typename ppContainer::const_iterator const_ppiterator;
361 
362  // Format: std::pair<type,bcContainer>
363  typedef std::map<std::string,bcContainer> bcData;
364  typedef typename bcData::iterator bciterator;
365  typedef typename bcData::const_iterator const_bciterator;
366 
367  typedef memory::shared_ptr<gsBoundaryConditions> Ptr;
368  typedef memory::unique_ptr<gsBoundaryConditions> uPtr;
369 
370  typedef typename boundary_condition<T>::function_ptr function_ptr;
371 
372  typedef std::list<util::reference_wrapper<const boundary_condition<T> > > bcRefList;
373 public:
374 
375  gsBoundaryConditions() : m_patches(nullptr) { }
376 
377  /*
378  gsBoundaryConditions & operator= (uPtr other)
379  {
380  if ( other.get() != NULL )
381  {
382  this->swap(*other);
383  other.reset();
384  }
385  return *this;
386  }
387  */
388 
389  void swap(gsBoundaryConditions & other)
390  {
391  m_bc.swap(other.m_bc);
392  corner_values.swap(other.corner_values);
393  m_periodicPairs.swap(other.m_periodicPairs);
394  coupled_boundaries.swap(other.coupled_boundaries);
395  }
396 
397 public:
398 
399  void clear()
400  {
401  m_bc.clear();
402  corner_values.clear();
403  m_periodicPairs.clear();
404  coupled_boundaries.clear();
405  }
406 
407  size_t size() const
408  {
409  size_t sz = 0;
410  for (typename bcData::const_iterator it = m_bc.begin(); it != m_bc.end(); ++it)
411  sz += it->second.size();
412  return sz + corner_values.size() + coupled_boundaries.size();
413  }
414 
416  const bcContainer & container(const std::string & label) const {return m_bc[label]; }
417 
420  bcRefList get(const std::string & label, const short_t unk = 0, int comp = -1) const
421  {
422  bcRefList result;
423  const const_bciterator it = m_bc.find(label);
424  if ( it != m_bc.end() )
425  for (const_iterator c = it->second.begin(); c!= it->second.end(); ++c)
426  if ( c->m_unknown == unk )
427  if ( c->m_unkcomp == comp || comp == -1 )
428  result.push_back(*c);
429  return result;
430  }
431 
433  const bcContainer & dirichletSides() const {return m_bc["Dirichlet"]; }
434 
436  const bcContainer & weakDirichletSides() const {return m_bc["Weak Dirichlet"]; }
437 
439  const bcContainer & neumannSides() const {return m_bc["Neumann"]; }
440 
442  const bcContainer & robinSides() const {return m_bc["Robin"]; }
443 
444  const cornerContainer & cornerValues() const {return corner_values; }
445 
446  const cplContainer & coupledBoundaries() const {return coupled_boundaries; }
447 
449  bcContainer reducedContainer(const bcContainer & container, short_t unknown) const
450  {
451  bcContainer red;
452  //red.reserve(container.size());
453  for(typename bcContainer::const_iterator iter=container.begin(); iter!=container.end();++iter)
454  {
455  if(iter->unknown()==unknown)
456  red.push_back(*iter);
457  }
458  return red;
459  }
460 
461  bcContainer allConditions() const
462  {
463  bcContainer all;
464  //all.reserve( size() - corner_values.size() );
465  for (typename bcData::const_iterator it = m_bc.begin(); it != m_bc.end(); ++it)
466  all.insert( all.end(), it->second.begin(), it->second.end() );
467  return all;
468  }
469 
471  const_iterator begin(const std::string & label) const {return m_bc[label].begin(); }
472 
474  iterator begin(const std::string & label) { return m_bc[label].begin(); }
475 
477  const_iterator end(const std::string & label) const {return m_bc[label].end(); }
478 
480  iterator end(const std::string & label) { return m_bc[label].end(); }
481 
482  const_bciterator beginAll() const {return m_bc.begin(); }
483  bciterator beginAll() {return m_bc.begin(); }
484 
485  const_bciterator endAll() const {return m_bc.end(); }
486  bciterator endAll() {return m_bc.end(); }
487 
490  const_iterator dirichletBegin() const
491  { return m_bc["Dirichlet"].begin(); }
492 
495  const_iterator dirichletEnd() const
496  { return m_bc["Dirichlet"].end(); }
497 
500  iterator dirichletBegin()
501  { return m_bc["Dirichlet"].begin(); }
502 
505  iterator dirichletEnd()
506  { return m_bc["Dirichlet"].end(); }
507 
510  const_iterator weakDirichletBegin() const
511  { return m_bc["Weak Dirichlet"].begin(); }
512 
515  const_iterator weakDirichletEnd() const
516  { return m_bc["Weak Dirichlet"].end(); }
517 
521  { return m_bc["Weak Dirichlet"].begin(); }
522 
525  iterator weakDirichletEnd()
526  { return m_bc["Weak Dirichlet"].end(); }
527 
528 
531  const_iterator neumannBegin() const
532  { return m_bc["Neumann"].begin(); }
533 
536  const_iterator neumannEnd() const
537  { return m_bc["Neumann"].end(); }
538 
541  iterator neumannBegin()
542  { return m_bc["Neumann"].begin(); }
543 
546  iterator neumannEnd()
547  { return m_bc["Neumann"].end(); }
548 
551  const_iterator robinBegin() const
552  { return m_bc["Robin"].begin(); }
553 
556  const_iterator robinEnd() const
557  { return m_bc["Robin"].end(); }
558 
561  const_citerator cornerBegin() const
562  { return corner_values.begin(); }
563 
566  const_citerator cornerEnd() const
567  { return corner_values.end(); }
568 
571  const_cpliterator coupledBegin() const
572  { return coupled_boundaries.begin(); }
573 
576  const_cpliterator coupledEnd() const
577  { return coupled_boundaries.end(); }
578 
581  iterator robinBegin()
582  { return m_bc["Robin"].begin(); }
583 
586  iterator robinEnd()
587  { return m_bc["Robin"].end(); }
588 
591  citerator cornerBegin()
592  { return corner_values.begin(); }
593 
596  citerator cornerEnd()
597  { return corner_values.end(); }
598 
601  cpliterator coupledBegin()
602  { return coupled_boundaries.begin(); }
603 
606  cpliterator coupledEnd()
607  { return coupled_boundaries.end(); }
608 
609 
610  void add(int p, boxSide s, const std::string & label,
611  const function_ptr & f_ptr, short_t unknown = 0,
612  int comp = -1, bool parametric = false)
613  {
614  m_bc[label].push_back(
615  boundary_condition<T>(p, s, f_ptr, label, unknown, comp, parametric) );
616  }
617 
618  void add(int p, boxSide s, const std::string & label,
619  gsFunctionSet<T> * f, short_t unknown = 0,
620  int comp = -1, bool parametric = false)
621  {
622  function_ptr f_ptr = memory::make_shared_not_owned(f);
623  m_bc[label].push_back(
624  boundary_condition<T>(p, s, f_ptr, label, unknown, comp, parametric) );
625  }
626 
627  void add(int p, boxSide s, const std::string & label,
628  const gsFunctionSet<T> & f, short_t unknown = 0,
629  int comp = -1, bool parametric = false)
630  {
631  function_ptr fun = memory::make_shared(f.clone().release());
632  add(p,s,label,fun,unknown,comp,parametric);
633  }
634 
651  gsFunctionSet<T> * f, short_t unknown = 0, bool parametric = false, int comp = -1)
652  {
653  function_ptr fun = memory::make_shared_not_owned(f);
654  addCondition(p,s,t,fun,unknown,parametric,comp);
655  }
656 
657  void addConditions(const bcRefList & bcrf)
658  {
659  for (auto bc : bcrf)
660  m_bc[bc.get().ctype()].push_back(bc);
661  }
662 
663  void addCondition(int p, boxSide s, condition_type::type t,
664  const function_ptr & f_shptr, short_t unknown = 0,
665  bool parametric = false, int comp = -1)
666  {
667  auto bc = boundary_condition<T>(p,s,f_shptr,t,unknown,comp,parametric);
668  // Every condition type can only be applied once
669  const auto & c = m_bc[bc.ctype()];
670  auto it = std::find_if(c.begin(), c.end(), [&bc](const boundary_condition<T> & b){ return bc.isSame(b); });
671  if (it==c.end())
672  m_bc[bc.ctype()].push_back(bc);
673  else // bc of this type is already defined on patch p and side s
674  gsWarn<<"Condition of type "<<bc.ctype()<<" on patch "<<bc.patch()<<" side "<<bc.side()<<" of unknown "<<bc.unknown()<<" with component "<<bc.unkComponent()<<" ignored, because it has already been defined\n";
675  }
676 
677  void addCondition(int p, boxSide s, condition_type::type t,
678  const gsFunctionSet<T> & func, short_t unknown = 0,
679  bool parametric = false, int comp = -1)
680  {
681  function_ptr fun(func.clone().release());
682  addCondition(p,s,t,fun,unknown,parametric,comp);
683  }
684 
685  void addCondition( boxSide s, condition_type::type t,
686  gsFunctionSet<T> * f, short_t unknown = 0, bool parametric = false, int comp = -1)
687  {
688  // for single-patch only
689  addCondition(0,s,t,f,unknown,parametric,comp);
690  }
691 
692  void addCondition(const patchSide& ps, condition_type::type t,
693  gsFunctionSet<T> * f, short_t unknown = 0, bool parametric = false, int comp = -1)
694  {
695  addCondition(ps.patch, ps.side(), t, f, unknown,parametric,comp);
696  }
697 
698  void addCondition(const patchSide& ps, condition_type::type t,
699  const function_ptr & f_shptr, short_t unknown = 0, bool parametric = false, int comp = -1)
700  {
701  addCondition(ps.patch, ps.side(), t, f_shptr, unknown,parametric,comp);
702  }
703 
704  void addCondition(const patchSide& ps, condition_type::type t,
705  const gsFunctionSet<T> & func, short_t unknown = 0, bool parametric = false, int comp = -1)
706  {
707  addCondition(ps.patch, ps.side(), t, func, unknown,parametric,comp);
708  }
709 
710  void addCondition(int p, boundary::side s, condition_type::type t,
711  const gsFunctionSet<T> & func, short_t unknown = 0,
712  bool parametric = false, int comp = -1)
713  {
714  function_ptr fun(func.clone().release());
715  addCondition(p,boxSide(s),t,fun,unknown,parametric,comp);
716  }
717 
718  void addCondition(int p, boundary::side s, condition_type::type t,
719  gsFunctionSet<T> * func, short_t unknown = 0,
720  bool parametric = false, int comp = -1)
721  {
722  addCondition(p,boxSide(s),t,func,unknown,parametric,comp);
723  }
724 
726  void addCornerValue(boxCorner c, T value, int p = 0, short_t unknown = 0, int component = -1)
727  {
728  corner_values.push_back( corner_value<T>(p,c,value,unknown,component) );
729  }
730 
732  void addCornerValue(boundary::corner c, T value, int p = 0, short_t unknown = 0, int component = -1)
733  {
734  corner_values.push_back( corner_value<T>(p,boxCorner(c),value,unknown,component) );
735  }
736 
738  void addCoupled(int p1, boundary::side s1, int p2, boundary::side s2, index_t dim,
739  short_t unknown = 0, int comp = -1)
740  {
741  coupled_boundaries.push_back( coupled_boundary<T>(p1,boxSide(s1),p2,boxSide(s2),dim,unknown,comp));
742  }
743 
745  void addCoupled(int p1, boxSide s1, int p2, boxSide s2, index_t dim,
746  short_t unknown = 0, int comp = -1)
747  {
748  coupled_boundaries.push_back( coupled_boundary<T>(p1,s1,p2,s2,dim,unknown,comp));
749  }
750 
752  std::ostream &print(std::ostream &os, const bool verbose = false) const {
753  // os << "gsBoundaryConditions :\n";
754  for (typename bcData::const_iterator it = m_bc.begin(); it != m_bc.end();
755  ++it)
756  os << "* " << std::setw(13) << std::left << it->first << " : "
757  << it->second.size() << "\n";
758 
759  if (!corner_values.empty())
760  os << "* Corner values : " << corner_values.size() << "\n";
761 
762  // This block prints out all boundary conditions with more information
763  if (verbose) {
764  os << "*\n* Summary\n*\n* " << std::right << std::setw(15) << "Type"
765  << std::setw(8) << "Patch" << std::setw(7) << "Side" << std::setw(9)
766  << "Unknown" << std::setw(13) << "Components" << std::setw(11)
767  << "Function" << std::endl;
768  for (auto a = beginAll(); a != endAll(); a++) {
769  for (const auto &element : a->second) {
770  os << "* " << std::right << std::setw(15) << element.ctype()
771  << std::setw(8) << element.patch() << std::setw(7)
772  << element.side().index() << std::setw(9) << element.unknown();
773 
774  const auto &component = element.unkComponent();
775  if (component == -1) {
776  os << std::setw(13) << "all";
777  } else {
778  os << std::setw(13) << (element.unkComponent());
779  }
780  if (element.function()) {
781  os << " " << *element.function();
782  } else {
783  os << " Homogeneous";
784  }
785  os << "\n";
786  }
787  }
788  os << "*" << std::endl;
789  }
790 
791  return os;
792  }
793 
809  {
810  const_iterator beg, end, cur;
811  patchSideComparison psRef(ps);
812  for (auto & bcc : m_bc)
813  {
814  beg = bcc.second.begin();
815  end = bcc.second.end();
816  cur = std::find_if(beg,end,psRef);
817  if (cur != end)
818  return &(*cur);
819  }
820  return nullptr;
821  }
822 
829  void getConditionFromSide (patchSide ps, bcContainer& result) const
830  {
831  result.clear();
832  const_iterator beg, end, cur;
833  for (auto & bcc : m_bc)
834  {
835  beg = bcc.second.begin();
836  end = bcc.second.end();
837  for(cur=beg; cur!=end; ++cur)
838  if (cur->ps == ps)
839  result.push_back(*cur);
840  }
841  }
842 
848  void getConditionsForPatch(const index_t np, gsBoundaryConditions& result) const
849  {
850  result.clear();
851  bcContainer bc_all = allConditions(); //inefficient, but fewer code
852  for(const_iterator it = bc_all.begin(); it!= bc_all.end();it++)
853  {
854  if((*it).patch()==np)
855  result.add(0,(*it).side(),it->ctype(),(*it).function(),(*it).unknown());
856  }
857 
858  for(const_citerator it = cornerBegin(); it!= cornerEnd();it++)
859  {
860  if((*it).patch==np)
861  result.addCornerValue( (*it).corner, (*it).value, 0, (*it).unknown);
862  }
863  }
864 
865  // Periodic conditions
866 
868  size_t numPeriodic() const { return m_periodicPairs.size(); }
869 
871  const ppContainer & periodicPairs() const {return m_periodicPairs; }
872 
875  const_ppiterator periodicBegin() const
876  { return m_periodicPairs.begin(); }
877 
880  const_ppiterator periodicEnd() const
881  { return m_periodicPairs.end(); }
882 
885  ppiterator periodicBegin()
886  { return m_periodicPairs.begin(); }
887 
890  ppiterator periodicEnd()
891  { return m_periodicPairs.end(); }
892 
894  void addPeriodic(int p1, boxSide s1, int p2, boxSide s2, short_t dim)
895  { m_periodicPairs.push_back( boundaryInterface(patchSide(p1,s1), patchSide(p2,s2), dim) ); }
896 
898  void clearPeriodicPairs() { m_periodicPairs.clear(); }
899 
902  { m_trMatrix = trMatrix; }
903 
906  { m_trMatrix = gsMatrix<T>::Identity(dim, dim); }
907 
910  {
911  GISMO_ASSERT(m_trMatrix.rows() > 0, "Transformation matrix for periodic conditions not set!");
912  return m_trMatrix;
913  }
914 
916  void setGeoMap(const gsFunctionSet<T> & gm)
917  {
918  m_patches = &gm;
919  }
920 
922  bool hasGeoMap() const
923  {
924  return nullptr!=m_patches;
925  }
926 
928  const gsFunctionSet<T> & geoMap() const
929  {
930  GISMO_ASSERT(nullptr!=m_patches, "Geometry map was not provided in BC.");
931  return *m_patches;
932  }
933 
934 private: // Data members
935  struct patchSideComparison
936  {
937  const patchSide m_ps;
938  patchSideComparison(patchSide ps)
939  : m_ps(ps)
940  {}
941 
942  bool operator() (const boundary_condition<T> &bc) const
943  {
944  return bc.ps==m_ps;
945  }
946  };
947 
948  cornerContainer corner_values;
949 
950  cplContainer coupled_boundaries;
951 
952  mutable bcData m_bc;
953 
954  ppContainer m_periodicPairs; // TODO: add read from xml
955  gsMatrix<T> m_trMatrix;
956 
957  // Pointer to associated multipatch domain
958  const gsFunctionSet<T> * m_patches;
959 
960 }; // class gsBoundaryConditions
961 
963 template<class T>
964 std::ostream &operator<<(std::ostream &os, const gsBoundaryConditions<T>& bvp)
965 {return bvp.print(os); }
966 
967 #ifdef GISMO_WITH_PYBIND11
968 
972  void pybind11_init_gsBoundaryConditions(pybind11::module &m);
973  void pybind11_enum_gsBoundaryConditions(pybind11::module &m);
974 
975 #endif
976 
977 } // namespace gismo
978 
979 #ifndef GISMO_BUILD_LIB
980 #include GISMO_HPP_HEADER(gsBoundaryConditions.hpp)
981 #endif
Robin type.
Definition: gsBoundaryConditions.h:34
const ppContainer & periodicPairs() const
Return a reference to the periodic sides.
Definition: gsBoundaryConditions.h:871
Neumann type.
Definition: gsBoundaryConditions.h:33
void clearPeriodicPairs()
Removes all periodic pairs.
Definition: gsBoundaryConditions.h:898
virtual std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition: gsFunctionSet.h:587
short_t unknown() const
Returns the unknown to which this boundary condition refers to.
Definition: gsBoundaryConditions.h:272
shared_ptr< T > make_shared_not_owned(const T *x)
Creates a shared pointer which does not eventually delete the underlying raw pointer. Usefull to refer to objects which should not be destroyed.
Definition: gsMemory.h:189
const_citerator cornerBegin() const
Definition: gsBoundaryConditions.h:561
const_iterator dirichletBegin() const
Definition: gsBoundaryConditions.h:490
bool parametric() const
Definition: gsBoundaryConditions.h:279
const bcContainer & dirichletSides() const
Return a reference to the Dirichlet sides.
Definition: gsBoundaryConditions.h:433
Laplace type, e.g. u = g.
Definition: gsBoundaryConditions.h:38
Struct which represents a certain side of a patch.
Definition: gsBoundary.h:231
Dirichlet type.
Definition: gsBoundaryConditions.h:31
const bcContainer & weakDirichletSides() const
Return a reference to the Weak Dirichlet sides.
Definition: gsBoundaryConditions.h:436
std::ostream & print(std::ostream &os, const bool verbose=false) const
Prints the object as a string.
Definition: gsBoundaryConditions.h:752
void addCornerValue(boxCorner c, T value, int p=0, short_t unknown=0, int component=-1)
Adds a boundary condition with value on a corner c of patch p for unknown component.
Definition: gsBoundaryConditions.h:726
short_t m_unknown
Unknown to which this boundary condition refers to.
Definition: gsBoundaryConditions.h:294
#define short_t
Definition: gsConfig.h:35
Provides structs and classes related to interfaces and boundaries.
Dirichlet type.
Definition: gsBoundaryConditions.h:32
const_iterator begin(const std::string &label) const
Returns a const-iterator to the beginning of the Bc container of type label.
Definition: gsBoundaryConditions.h:471
iterator weakDirichletEnd()
Definition: gsBoundaryConditions.h:525
boxSide side() const
Returns the side to which this boundary condition refers to.
Definition: gsBoundaryConditions.h:269
const_cpliterator coupledBegin() const
Definition: gsBoundaryConditions.h:571
iterator robinEnd()
Definition: gsBoundaryConditions.h:586
iterator neumannBegin()
Definition: gsBoundaryConditions.h:541
const boundary_condition< T > * getConditionFromSide(patchSide ps) const
getSideCondition
Definition: gsBoundaryConditions.h:808
const_ppiterator periodicBegin() const
Definition: gsBoundaryConditions.h:875
T value
The value.
Definition: gsBoundaryConditions.h:312
const_iterator weakDirichletEnd() const
Definition: gsBoundaryConditions.h:515
int component
The component of the unknown.
Definition: gsBoundaryConditions.h:314
side
Identifiers for topological sides.
Definition: gsBoundary.h:58
bcContainer reducedContainer(const bcContainer &container, short_t unknown) const
Extracts the BC, comming from a certain component.
Definition: gsBoundaryConditions.h:449
ppiterator periodicEnd()
Definition: gsBoundaryConditions.h:890
const_iterator neumannBegin() const
Definition: gsBoundaryConditions.h:531
const_iterator robinBegin() const
Definition: gsBoundaryConditions.h:551
#define index_t
Definition: gsConfig.h:32
bool isSame(const boundary_condition &other)
Checks if this is the same as apart from the function data.
Definition: gsBoundaryConditions.h:282
void addCornerValue(boundary::corner c, T value, int p=0, short_t unknown=0, int component=-1)
Adds a boundary condition with value on a corner c of patch p for unknown component.
Definition: gsBoundaryConditions.h:732
const gsFunctionSet< T > & geoMap() const
Returns the geometry map.
Definition: gsBoundaryConditions.h:928
Class prescribing a value related to a corner of a patch.
Definition: gsBoundaryConditions.h:305
iterator weakDirichletBegin()
Definition: gsBoundaryConditions.h:520
citerator cornerBegin()
Definition: gsBoundaryConditions.h:591
ppiterator periodicBegin()
Definition: gsBoundaryConditions.h:885
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
Robin type.
Definition: gsBoundaryConditions.h:35
const_cpliterator coupledEnd() const
Definition: gsBoundaryConditions.h:576
index_t patch() const
Returns the patch to which this boundary condition refers to.
Definition: gsBoundaryConditions.h:266
gsMatrix< T > getTransformMatrix() const
Get transformation matrix for the periodic pairs of sides.
Definition: gsBoundaryConditions.h:909
const std::string & ctype() const
Returns the type of the boundary condition.
Definition: gsBoundaryConditions.h:263
memory::shared_ptr< gsFunctionSet > Ptr
Shared pointer for gsFunctionSet.
Definition: gsFunctionSet.h:223
corner
Identifiers for topological corners.
Definition: gsBoundary.h:65
const_iterator weakDirichletBegin() const
Definition: gsBoundaryConditions.h:510
const_iterator neumannEnd() const
Definition: gsBoundaryConditions.h:536
iterator dirichletBegin()
Definition: gsBoundaryConditions.h:500
cpliterator coupledBegin()
Definition: gsBoundaryConditions.h:601
cplContainer coupled_boundaries
List of boundaries that are coupled.
Definition: gsBoundaryConditions.h:950
Specifies the type of boundary condition.
Definition: gsBoundaryConditions.h:25
#define gsWarn
Definition: gsDebug.h:50
void setTransformMatrix(gsMatrix< T > trMatrix)
Set transformation matrix for the periodic pairs of sides.
Definition: gsBoundaryConditions.h:901
int component
The component of the unknown.
Definition: gsBoundaryConditions.h:329
const_iterator end(const std::string &label) const
Returns a const-iterator to the end of the Bc container of type label.
Definition: gsBoundaryConditions.h:477
void addPeriodic(int p1, boxSide s1, int p2, boxSide s2, short_t dim)
Add a periodic condition between side s1 of box p1 and side s2 of box p2.
Definition: gsBoundaryConditions.h:894
Interface for the set of functions defined on a domain (the total number of functions in the set equa...
Definition: gsFuncData.h:23
boxCorner corner
The corner.
Definition: gsBoundaryConditions.h:311
void getConditionsForPatch(const index_t np, gsBoundaryConditions &result) const
returns the set of all boundary conditions which refer to patch np
Definition: gsBoundaryConditions.h:848
short_t unkComponent() const
Returns the component of the unknown which this boundary condition refers to.
Definition: gsBoundaryConditions.h:275
cornerContainer corner_values
List of corners with fixed value.
Definition: gsBoundaryConditions.h:948
void setIdentityMatrix(short_t dim)
Set identity transformation matrix for the periodic pairs of sides.
Definition: gsBoundaryConditions.h:905
const bcContainer & container(const std::string &label) const
Return a reference to boundary conditions of certain type.
Definition: gsBoundaryConditions.h:416
iterator dirichletEnd()
Definition: gsBoundaryConditions.h:505
citerator cornerEnd()
Definition: gsBoundaryConditions.h:596
Struct which represents a certain side of a box.
Definition: gsBoundary.h:84
size_t numPeriodic() const
Get number of periodic pairs.
Definition: gsBoundaryConditions.h:868
const_iterator robinEnd() const
Definition: gsBoundaryConditions.h:556
const_citerator cornerEnd() const
Definition: gsBoundaryConditions.h:566
short_t unknown
Unknown to which this boundary condition refers to.
Definition: gsBoundaryConditions.h:313
void addCoupled(int p1, boxSide s1, int p2, boxSide s2, index_t dim, short_t unknown=0, int comp=-1)
Couples the degrees of freedom on patch p1 side s1 and patch p2 side s2 for unknown and component com...
Definition: gsBoundaryConditions.h:745
const bcContainer & robinSides() const
Return a reference to the Robin sides.
Definition: gsBoundaryConditions.h:442
Class that defines a boundary condition for a side of a patch for some unknown variable of a PDE...
Definition: gsBoundaryConditions.h:106
void addCoupled(int p1, boundary::side s1, int p2, boundary::side s2, index_t dim, short_t unknown=0, int comp=-1)
Couples the degrees of freedom on patch p1 side s1 and patch p2 side s2 for unknown and component com...
Definition: gsBoundaryConditions.h:738
const_ppiterator periodicEnd() const
Definition: gsBoundaryConditions.h:880
void getConditionFromSide(patchSide ps, bcContainer &result) const
getConditionFromSide returns the boundary conditions associated to the given patch side ...
Definition: gsBoundaryConditions.h:829
condition_type::type type() const
Returns the type of the boundary condition.
Definition: gsBoundaryConditions.h:260
Class containing a set of boundary conditions.
Definition: gsBoundaryConditions.h:341
void addCondition(int p, boxSide s, condition_type::type t, gsFunctionSet< T > *f, short_t unknown=0, bool parametric=false, int comp=-1)
Adds another boundary condition.
Definition: gsBoundaryConditions.h:650
type
Specifies the type of boundary condition.
Definition: gsBoundaryConditions.h:28
index_t patch
The index of the patch.
Definition: gsBoundaryConditions.h:310
std::string m_label
Description of type of the boundary condition.
Definition: gsBoundaryConditions.h:292
cpliterator coupledEnd()
Definition: gsBoundaryConditions.h:606
bool hasGeoMap() const
Checks if a geometry map is stored in the boundary conditions.
Definition: gsBoundaryConditions.h:922
bcData m_bc
Containers for BCs of various types.
Definition: gsBoundaryConditions.h:952
patchSide ps
Side of a patch for this boundary condition.
Definition: gsBoundaryConditions.h:284
void setGeoMap(const gsFunctionSet< T > &gm)
Set the geometry map to evaluate boundary conditions.
Definition: gsBoundaryConditions.h:916
Struct which represents an interface between two patches.
Definition: gsBoundary.h:649
const bcContainer & neumannSides() const
Return a reference to the Neumann sides.
Definition: gsBoundaryConditions.h:439
short_t m_unkcomp
Component of unknown to which this boundary condition refers to.
Definition: gsBoundaryConditions.h:296
iterator robinBegin()
Definition: gsBoundaryConditions.h:581
iterator neumannEnd()
Definition: gsBoundaryConditions.h:546
short_t unknown
Unknown to which this boundary condition refers to.
Definition: gsBoundaryConditions.h:328
iterator begin(const std::string &label)
Returns an iterator to the beginning of the Bc container of type label.
Definition: gsBoundaryConditions.h:474
const_iterator dirichletEnd() const
Definition: gsBoundaryConditions.h:495
index_t patch
The index of the patch.
Definition: gsBoundary.h:234
bool isHomogeneous() const
Returns true if there is no function data (homogeneous condition)
Definition: gsBoundaryConditions.h:251
Struct which represents a certain corner of a hyper-cube.
Definition: gsBoundary.h:291
Class prescribing a value related to a corner of a patch.
Definition: gsBoundaryConditions.h:321
function_ptr m_function
Function data for this boundary condition.
Definition: gsBoundaryConditions.h:286
shared_ptr< T > make_shared(T *x)
Definition: gsMemory.h:181
iterator end(const std::string &label)
Returns an iterator to the end of the Bc container of type label.
Definition: gsBoundaryConditions.h:480