G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsPointLoads.h
Go to the documentation of this file.
1 
14 #pragma once
15 
16 namespace gismo
17 {
18 
19 
20 
26 template<class T>
27 struct point_load
28 {
29  point_load(const gsVector<T> & _point,
30  const T _value,
31  int _patch = 0,
32  bool _parametric = true)
33  :
34  patch(_patch), value(_value), point(1), parametric(_parametric)
35  {
36  point[0] = _value;
37  }
38 
39  point_load(const gsVector<T> & _point,
40  const gsVector<T> & _value,
41  int _patch = 0,
42  bool _parametric = true)
43  :
44  patch(_patch), value(_value), point(_point), parametric(_parametric)
45  { }
46 
47  int patch;
48 
49  gsVector<T> value;
50 
51  gsVector<T> point;
52 
53  bool parametric;
54 };
55 
56 
57 
63 template<class T>
65 {
66 public:
67  typedef point_load<T> pLoad;
68  typedef typename std::vector<pLoad> plContainer;
69 
70  typedef typename std::vector<pLoad>::iterator iterator;
71 
72  typedef typename std::vector<pLoad>::const_iterator const_iterator;
73 
74 public:
75 
77  std::ostream & print(std::ostream &os) const
78  {
79  os << "gsPointLoads: "<<m_pointLoads.size()<<"\n";
80  return os;
81  }
82 
83 public:
84 
87  { }
88 
89  ~gsPointLoads() // Destructor
90  { }
91 
92 public:
93 
94  void clear()
95  {
96  m_pointLoads.clear();
97  }
98 
99  inline pLoad operator [] (size_t i) const { return m_pointLoads[i]; }
100  inline pLoad & operator [] (size_t i) { return m_pointLoads[i]; }
101 
102  void addLoad(const gsVector<T> & _point,
103  const gsVector<T> & _value,
104  int _patch = 0,
105  bool _parametric = true)
106  {
107  m_pointLoads.push_back( pLoad(_point,_value,_patch,_parametric) );
108  }
109 
110  void addLoad(const gsVector<T> & _point,
111  const T _value,
112  int _patch = 0,
113  bool _parametric = true)
114  {
115  m_pointLoads.push_back( pLoad(_point,_value,_patch,_parametric) );
116  }
117 
118  size_t numLoads() const { return m_pointLoads.size(); }
119 
120 private:
121 
122  plContainer m_pointLoads;
123 
124 }; // class gsPointLoads
125 
127 template<class T>
128 std::ostream &operator<<(std::ostream &os, const gsPointLoads<T>& pls)
129 {return pls.print(os); }
130 
131 #ifdef GISMO_WITH_PYBIND11
132 
136  void pybind11_init_gsPointLoads(pybind11::module &m);
137 
138 #endif // GISMO_WITH_PYBIND11
139 
140 } // namespace gismo
141 
Struct defining a point together with a scalar or vector load.
Definition: gsPointLoads.h:27
Class containing a set of points on a multi-patch isogeometric domain, together with boundary conditi...
Definition: gsPointLoads.h:64
plContainer m_pointLoads
List of Point loads.
Definition: gsPointLoads.h:122
std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition: gsPointLoads.h:77
gsPointLoads()
Default empty constructor.
Definition: gsPointLoads.h:86