mbsimflexiblebody  4.0.0
MBSim Flexible Body Module
calculix_body.h
1 /* Copyright (C) 2004-2019 MBSim Development Team
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Contact: martin.o.foerg@googlemail.com
18  */
19 
20 #ifndef _CALCULIX_BODY_H_
21 #define _CALCULIX_BODY_H_
22 
23 #include "mbsimFlexibleBody/flexible_body/generic_flexible_ffr_body.h"
24 #include "mbsim/utils/boost_parameters.h"
25 
26 namespace MBSim {
27 
28  BOOST_PARAMETER_NAME(visualization)
29 }
30 
31 namespace MBSimFlexibleBody {
32 
38 
39  public:
40  enum Formalism {
41  consistentMass=0,
42  lumpedMass,
43  unknown
44  };
45 
46  CalculixBody(const std::string &name="") : GenericFlexibleFfrBody(name) { }
47  void init(InitStage stage, const MBSim::InitConfigSet &config) override;
48  void initializeUsingXML(xercesc::DOMElement *element) override;
49  void setResultFileName(const std::string &resultFileName_) { resultFileName = resultFileName_; }
50  void setFormalism(Formalism formalism_) { formalism = formalism_; }
51  void setProportionalDamping(const fmatvec::Vec2 &beta_) { beta = beta_; }
52  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBV, MBSim::tag, (optional (visualization,(OpenMBVCalculixBody::Visualization),OpenMBVCalculixBody::faces)(colorRepresentation,(OpenMBVFlexibleBody::ColorRepresentation),OpenMBVFlexibleBody::none)(minimalColorValue,(double),0)(maximalColorValue,(double),1)(diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0)(pointSize,(double),0)(lineWidth,(double),0))) {
53  ombvBody = std::shared_ptr<OpenMBVCalculixBody>(new OpenMBVCalculixBody(visualization,colorRepresentation,minimalColorValue,maximalColorValue,diffuseColor,transparency,pointSize,lineWidth));
54  }
55  void setPlotNodeNumbers(const fmatvec::VecVI &plotNodes_) { plotNodes <<= plotNodes_; }
56 
57  protected:
58  std::string resultFileName;
59 
60  private:
61  void readDisplacements();
62  void readStresses();
63  void readNodes();
64  void readElements();
65  void readModes();
66  void readDOF();
67  void readStiffMatrix();
68  void readMassMatrix();
69  void importData();
70  std::ifstream isRes, isStiff, isMass, isDOF;
71  size_t nn{0}, ne{0}, nm{1000};
72  Formalism formalism{lumpedMass};
73  fmatvec::VecV u0;
75  fmatvec::SymMatV M, K;
76  std::vector<std::pair<size_t,size_t>> dof;
77  std::vector<fmatvec::VecV> disp;
78  std::vector<fmatvec::VecV> stress;
79  std::vector<MBSim::Index> ombvIndices;
80  std::shared_ptr<OpenMBVCalculixBody> ombvBody;
81  };
82 
83 }
84 
85 #endif
Flexible body using data from CalculiX.
Definition: calculix_body.h:37
std::string name
Generic flexible body using a floating frame of reference formulation.
Definition: generic_flexible_ffr_body.h:62
Definition: openmbv_utils.h:51