OpenBeam
C++ library for static analysis of mechanical structures
loads.h
1 /* +---------------------------------------------------------------------------+
2  | OpenBeam - C++ Finite Element Analysis library |
3  | |
4  | Copyright (C) 2010-2021 Jose Luis Blanco Claraco |
5  | University of Malaga |
6  | |
7  | OpenBeam is free software: you can redistribute it and/or modify |
8  | it under the terms of the GNU General Public License as published by |
9  | the Free Software Foundation, either version 3 of the License, or |
10  | (at your option) any later version. |
11  | |
12  | OpenBeam is distributed in the hope that it will be useful, |
13  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15  | GNU General Public License for more details. |
16  | |
17  | You should have received a copy of the GNU General Public License |
18  | along with OpenBeam. If not, see <http://www.gnu.org/licenses/>. |
19  | |
20  +---------------------------------------------------------------------------+
21  */
22 
23 #pragma once
24 
25 #include <openbeam/CElement.h>
26 #include <openbeam/types.h>
27 
28 #include <memory>
29 
30 namespace openbeam
31 {
35 {
36  CLoadOnBeam() = default;
37  virtual ~CLoadOnBeam() = default;
38 
39  using Ptr = std::shared_ptr<CLoadOnBeam>;
40  using ConstPtr = std::shared_ptr<const CLoadOnBeam>;
41 
42  virtual void computeStressAndEquivalentLoads(
43  const CElement* el, ElementStress& stress,
44  std::vector<array6>& loads) = 0;
45 
53  static CLoadOnBeam::Ptr createLoadByName(const std::string& sName);
54 
59  virtual void loadParamsFromSet(
60  const mrpt::containers::yaml& p, const EvaluationContext& ctx) = 0;
61 
64  virtual void meshLoad(
65  CStructureProblem& meshed_fem,
66  const std::vector<size_t>& meshed_element_idxs,
67  const size_t original_bar_idx,
68  const CStructureProblem& original_fem) const = 0;
69 
70  virtual mrpt::opengl::CSetOfObjects::Ptr getVisualization(
71  const CFiniteElementProblem& fem, const DrawStructureOptions& options,
72  const DrawElementExtraParams& draw_el_params,
73  const MeshOutputInfo* meshing_info) const = 0;
74 
75  virtual void getVisualization_init(
76  const CFiniteElementProblem& fem, const DrawStructureOptions& options,
77  const DrawElementExtraParams& draw_el_params,
78  const MeshOutputInfo* meshing_info) const
79  {
80  }
81  virtual void getVisualization_pre(
82  const CFiniteElementProblem& fem, const DrawStructureOptions& options,
83  const DrawElementExtraParams& draw_el_params,
84  const MeshOutputInfo* meshing_info) const
85  {
86  }
87 };
88 
94 {
95  CLoadConstTemperature(const num_t inc_temp) : m_incr_temp(inc_temp) {}
96 
97  CLoadConstTemperature() = default;
98 
99  void computeStressAndEquivalentLoads(
100  const CElement* el, ElementStress& stress,
101  std::vector<array6>& loads) override;
104  const mrpt::containers::yaml& p, const EvaluationContext& ctx) override;
105 
108  void meshLoad(
109  CStructureProblem& meshed_fem,
110  const std::vector<size_t>& meshed_element_idxs,
111  const size_t original_bar_idx,
112  const CStructureProblem& original_fem) const override;
113 
114  mrpt::opengl::CSetOfObjects::Ptr getVisualization(
115  const CFiniteElementProblem& fem, const DrawStructureOptions& options,
116  const DrawElementExtraParams& draw_el_params,
117  const MeshOutputInfo* meshing_info) const override;
118 
120  num_t m_incr_temp = UNINITIALIZED_VALUE;
121 };
122 
129 {
130  CLoadDistributedUniform(num_t q_, num_t vx, num_t vy, num_t vz) : q(q_)
131  {
132  dir[0] = vx;
133  dir[1] = vy;
134  dir[2] = vz;
135  }
136 
137  CLoadDistributedUniform() : q(UNINITIALIZED_VALUE)
138  {
139  dir[0] = dir[1] = dir[2] = UNINITIALIZED_VALUE;
140  }
141 
142  void computeStressAndEquivalentLoads(
143  const CElement* el, ElementStress& stress,
144  std::vector<array6>& loads) override;
147  const mrpt::containers::yaml& p, const EvaluationContext& ctx) override;
148 
151  void meshLoad(
152  CStructureProblem& meshed_fem,
153  const std::vector<size_t>& meshed_element_idxs,
154  const size_t original_bar_idx,
155  const CStructureProblem& original_fem) const override;
156 
157  mrpt::opengl::CSetOfObjects::Ptr getVisualization(
158  const CFiniteElementProblem& fem, const DrawStructureOptions& options,
159  const DrawElementExtraParams& draw_el_params,
160  const MeshOutputInfo* meshing_info) const override;
161 
162  void getVisualization_init(
163  const CFiniteElementProblem& fem, const DrawStructureOptions& options,
164  const DrawElementExtraParams& draw_el_params,
165  const MeshOutputInfo* meshing_info) const override;
166 
167  void getVisualization_pre(
168  const CFiniteElementProblem& fem, const DrawStructureOptions& options,
169  const DrawElementExtraParams& draw_el_params,
170  const MeshOutputInfo* meshing_info) const override;
171 
172  num_t q;
173  num_t dir[3];
174 };
175 
184 {
186  num_t q_ini_, num_t q_end_, num_t vx, num_t vy, num_t vz)
187  : q_ini(q_ini_), q_end(q_end_)
188  {
189  dir[0] = vx;
190  dir[1] = vy;
191  dir[2] = vz;
192  }
193 
195  : q_ini(UNINITIALIZED_VALUE), q_end(UNINITIALIZED_VALUE)
196  {
197  dir[0] = dir[1] = dir[2] = UNINITIALIZED_VALUE;
198  }
199 
200  void computeStressAndEquivalentLoads(
201  const CElement* el, ElementStress& stress,
202  std::vector<array6>& loads) override;
205  const mrpt::containers::yaml& p, const EvaluationContext& ctx) override;
206 
209  void meshLoad(
210  CStructureProblem& meshed_fem,
211  const std::vector<size_t>& meshed_element_idxs,
212  const size_t original_bar_idx,
213  const CStructureProblem& original_fem) const override;
214 
215  mrpt::opengl::CSetOfObjects::Ptr getVisualization(
216  const CFiniteElementProblem& fem, const DrawStructureOptions& options,
217  const DrawElementExtraParams& draw_el_params,
218  const MeshOutputInfo* meshing_info) const override;
219 
221  num_t q_ini, q_end;
222  num_t dir[3] = {0, 0, 0};
223 };
224 
233 {
239  CLoadConcentratedForce(num_t P_, num_t dist_, num_t vx, num_t vy, num_t vz)
240  : P(P_), dist(dist_)
241  {
242  dir[0] = vx;
243  dir[1] = vy;
244  dir[2] = vz;
245  }
246 
247  CLoadConcentratedForce() : P(UNINITIALIZED_VALUE), dist(UNINITIALIZED_VALUE)
248  {
249  dir[0] = dir[1] = dir[2] = UNINITIALIZED_VALUE;
250  }
251 
252  void computeStressAndEquivalentLoads(
253  const CElement* el, ElementStress& stress,
254  std::vector<array6>& loads) override;
257  const mrpt::containers::yaml& p, const EvaluationContext& ctx) override;
258 
261  void meshLoad(
262  CStructureProblem& meshed_fem,
263  const std::vector<size_t>& meshed_element_idxs,
264  const size_t original_bar_idx,
265  const CStructureProblem& original_fem) const override;
266 
267  mrpt::opengl::CSetOfObjects::Ptr getVisualization(
268  const CFiniteElementProblem& fem, const DrawStructureOptions& options,
269  const DrawElementExtraParams& draw_el_params,
270  const MeshOutputInfo* meshing_info) const override;
271 
272  num_t P;
273  num_t dist;
274  num_t dir[3];
275 };
276 
277 } // namespace openbeam
Definition: CElement.h:49
Definition: CFiniteElementProblem.h:196
Definition: CStructureProblem.h:36
Definition: loads.h:233
num_t P
Load modulus (N)
Definition: loads.h:272
num_t dist
Load modulus (N)
Definition: loads.h:273
num_t dir[3]
Director vector, in GLOBAL coordinates.
Definition: loads.h:274
CLoadConcentratedForce(num_t P_, num_t dist_, num_t vx, num_t vy, num_t vz)
Definition: loads.h:239
void meshLoad(CStructureProblem &meshed_fem, const std::vector< size_t > &meshed_element_idxs, const size_t original_bar_idx, const CStructureProblem &original_fem) const override
void loadParamsFromSet(const mrpt::containers::yaml &p, const EvaluationContext &ctx) override
Definition: loads.h:94
void loadParamsFromSet(const mrpt::containers::yaml &p, const EvaluationContext &ctx) override
void meshLoad(CStructureProblem &meshed_fem, const std::vector< size_t > &meshed_element_idxs, const size_t original_bar_idx, const CStructureProblem &original_fem) const override
mrpt::opengl::CSetOfObjects::Ptr getVisualization(const CFiniteElementProblem &fem, const DrawStructureOptions &options, const DrawElementExtraParams &draw_el_params, const MeshOutputInfo *meshing_info) const override
Temperature increment value (in C)
num_t q_ini
Load density at the start and end points of the beam (N/m)
Definition: loads.h:221
void loadParamsFromSet(const mrpt::containers::yaml &p, const EvaluationContext &ctx) override
num_t dir[3]
Unit director vector, in GLOBAL coordinates.
Definition: loads.h:222
void meshLoad(CStructureProblem &meshed_fem, const std::vector< size_t > &meshed_element_idxs, const size_t original_bar_idx, const CStructureProblem &original_fem) const override
Definition: loads.h:129
num_t q
Load density (N/m)
Definition: loads.h:172
num_t dir[3]
Director vector, in GLOBAL coordinates.
Definition: loads.h:173
void meshLoad(CStructureProblem &meshed_fem, const std::vector< size_t > &meshed_element_idxs, const size_t original_bar_idx, const CStructureProblem &original_fem) const override
void loadParamsFromSet(const mrpt::containers::yaml &p, const EvaluationContext &ctx) override
Definition: loads.h:35
virtual void loadParamsFromSet(const mrpt::containers::yaml &p, const EvaluationContext &ctx)=0
virtual void meshLoad(CStructureProblem &meshed_fem, const std::vector< size_t > &meshed_element_idxs, const size_t original_bar_idx, const CStructureProblem &original_fem) const =0
static CLoadOnBeam::Ptr createLoadByName(const std::string &sName)
Definition: DrawStructureOptions.h:103
Definition: DrawStructureOptions.h:34
Definition: types.h:161
Definition: CFiniteElementProblem.h:138