FEDEM Model Database  R8.0
Source code of the FEDEM model database
FmLoad.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
8 #ifndef FM_LOAD_H
9 #define FM_LOAD_H
10 
12 #include "vpmDB/FmTriad.H"
14 
15 
16 class FmLoad : public FmIsControlledBase
17 {
19 
20 public:
21  FmLoad();
22 
23  bool connect(FmTriad* tr,
24  FmIsPositionedBase* from, const FaVec3& fromPo,
25  FmIsPositionedBase* to, const FaVec3& toPo);
26  bool connect(FmBase* parent);
28 
29  virtual bool disconnect();
30 
31  double getInitLoad() const { return itsLoad.getValue(); }
32  bool setInitLoad(double load) { return itsLoad.setValue(load); }
33 
34  enum LoadType { FORCE = 0, TORQUE = 1 };
35 
36  LoadType getLoadType() const { return itsLoadType.getValue(); }
37  bool setLoadType(LoadType type) { return itsLoadType.setValue(type); }
38 
41 
42  FmIsPositionedBase* getFromRef() const { return itsPos[0].getPointer(); }
43  FmIsPositionedBase* getToRef() const { return itsPos[1].getPointer(); }
44  void setFromRef(FmIsPositionedBase* p) { this->setRefPoint(p,0); }
45  void setToRef(FmIsPositionedBase* p) { this->setRefPoint(p,1); }
46 
47  const FaVec3& getLocalFromPoint() const { return itsPoint[0].getValue(); }
48  const FaVec3& getLocalToPoint() const { return itsPoint[1].getValue(); }
49  void setLocalFromPoint(const FaVec3& pt) { this->setLocalPoint(pt,0); }
50  void setLocalToPoint(const FaVec3& pt) { this->setLocalPoint(pt,1); }
51 
52  FaVec3 getGlobalFromPoint() const { return this->getGlbPoint(0); }
53  FaVec3 getGlobalToPoint() const { return this->getGlbPoint(1); }
54  void setGlobalFromPoint(const FaVec3& pt) { this->setGlbPoint(pt,0); }
55  void setGlobalToPoint(const FaVec3& pt) { this->setGlbPoint(pt,1); }
56 
57  void moveAttackPoint(const FaVec3& pos, bool global,
58  FmIsPositionedBase* attackObj = NULL);
59 
60  static void changeAttackPt(FmIsPositionedBase* p, const FaVec3& pt);
61  static void changeFromPt(FmIsPositionedBase* p, const FaVec3& pt);
62  static void changeToPt(FmIsPositionedBase* p, const FaVec3& pt);
63 
64  static bool readAndConnect(std::istream& is, std::ostream& os = std::cout);
65  virtual std::ostream& writeFMF(std::ostream& os = std::cout);
66  virtual int printSolverEntry(FILE* fd);
67 
68  virtual bool clone(FmBase* obj, int depth);
69  virtual bool detach();
70 
71  virtual const char* getUITypeName() const;
72 
73 private:
74  void setRefPoint(FmIsPositionedBase* p, int idx);
75  void setLocalPoint(const FaVec3& pt, int idx);
76  FaVec3 getGlbPoint(int idx) const;
77  void setGlbPoint(const FaVec3& pt, int idx);
78 
79  void changeAttackPoint(const FaVec3& localPos, FmIsPositionedBase* obj);
80 
81 protected:
82  virtual ~FmLoad();
83 
84  virtual bool cloneLocal(FmBase* obj, int depth);
85 
86 private:
88  FFaEnumEntry(FORCE, "FORCE");
89  FFaEnumEntry(TORQUE, "TORQUE");
91  };
92 
96 
99 
102 
103 public:
104  static FmLoad* editedLoad; // Used by load point editing commands
105 };
106 
107 #endif
Enum variables with text representations.
#define FFaEnumEntryEnd
Defines the end of an enum mapping definition.
Definition: FFaEnum.H:237
#define FFaEnumEntry(Value, Text)
Adds one entry to the current enum mapping definition.
Definition: FFaEnum.H:234
bool setValue(const ValueT &newData, bool checkChanged=true)
Assigns a new value to the field.
Definition: FFaField.H:66
const ValueT & getValue() const
Returns a const reference to myData.
Definition: FFaField.H:56
bool setRef(FFaFieldContainer *ptr)
Sets the pointer value from a FFaFieldContainer pointer directly.
Definition: FFaReference.C:78
Type * getPointer() const
Returns the type-casted pointer this reference points to.
Definition: FFaReference.H:234
Class for point vectors in 3D space.
Definition: FFaVec3.H:40
Base parent class for the model data structure entries.
Definition: FmBase.H:37
virtual bool connect()
Inserts this object into the model database.
Definition: FmBase.H:92
Definition: FmIsControlledBase.H:27
Definition: FmIsPositionedBase.H:31
Definition: FmLoad.H:17
static void changeAttackPt(FmIsPositionedBase *p, const FaVec3 &pt)
Definition: FmLoad.C:205
static bool readAndConnect(std::istream &is, std::ostream &os=std::cout)
Definition: FmLoad.C:302
FFaReference< FmTriad > itsOwnerTriad
Definition: FmLoad.H:97
FmTriad * getOwnerTriad() const
Definition: FmLoad.H:39
FaVec3 getGlbPoint(int idx) const
Definition: FmLoad.C:185
LoadType
Definition: FmLoad.H:34
@ TORQUE
Definition: FmLoad.H:34
@ FORCE
Definition: FmLoad.H:34
FFaField< FaVec3 > itsPoint[2]
Definition: FmLoad.H:95
bool setLoadType(LoadType type)
Definition: FmLoad.H:37
FFaField< FFaReferenceBase * > itsOwnerField
Definition: FmLoad.H:98
FmLoad()
Definition: FmLoad.C:35
void moveAttackPoint(const FaVec3 &pos, bool global, FmIsPositionedBase *attackObj=NULL)
Definition: FmLoad.C:114
void changeAttackPoint(const FaVec3 &localPos, FmIsPositionedBase *obj)
Definition: FmLoad.C:129
const FaVec3 & getLocalFromPoint() const
Definition: FmLoad.H:47
virtual bool cloneLocal(FmBase *obj, int depth)
Clones the data fields of *obj into *this.
Definition: FmLoad.C:238
virtual std::ostream & writeFMF(std::ostream &os=std::cout)
Writes out this object in the model database file format.
Definition: FmLoad.C:293
void setOwnerTriad(FmTriad *tr)
Definition: FmLoad.H:40
FFaField< FFaReferenceBase * > itsPosField[2]
Definition: FmLoad.H:101
Fmd_DB_HEADER_INIT()
virtual int printSolverEntry(FILE *fd)
Hoook for printing the solver input file entry for this object.
Definition: FmLoad.C:335
FaVec3 getGlobalToPoint() const
Definition: FmLoad.H:53
const FaVec3 & getLocalToPoint() const
Definition: FmLoad.H:48
static void changeFromPt(FmIsPositionedBase *p, const FaVec3 &pt)
Definition: FmLoad.C:212
void setFromRef(FmIsPositionedBase *p)
Definition: FmLoad.H:44
void setToRef(FmIsPositionedBase *p)
Definition: FmLoad.H:45
void setGlbPoint(const FaVec3 &pt, int idx)
Definition: FmLoad.C:194
void setGlobalFromPoint(const FaVec3 &pt)
Definition: FmLoad.H:54
static void changeToPt(FmIsPositionedBase *p, const FaVec3 &pt)
Definition: FmLoad.C:222
double getInitLoad() const
Definition: FmLoad.H:31
virtual ~FmLoad()
Definition: FmLoad.C:55
void setLocalFromPoint(const FaVec3 &pt)
Definition: FmLoad.H:49
FmIsPositionedBase * getFromRef() const
Definition: FmLoad.H:42
FFaReference< FmIsPositionedBase > itsPos[2]
Definition: FmLoad.H:100
FFaField< LoadTypeEnum > itsLoadType
Definition: FmLoad.H:94
void setGlobalToPoint(const FaVec3 &pt)
Definition: FmLoad.H:55
void setRefPoint(FmIsPositionedBase *p, int idx)
Definition: FmLoad.C:105
FmIsPositionedBase * getToRef() const
Definition: FmLoad.H:43
LoadType getLoadType() const
Definition: FmLoad.H:36
FFaEnumMapping(LoadType)
Definition: FmLoad.H:87
static FmLoad * editedLoad
Definition: FmLoad.H:104
void setLocalToPoint(const FaVec3 &pt)
Definition: FmLoad.H:50
virtual bool disconnect()
Removes this object from the model database.
Definition: FmLoad.C:96
FaVec3 getGlobalFromPoint() const
Definition: FmLoad.H:52
FFaField< double > itsLoad
Definition: FmLoad.H:91
void setLocalPoint(const FaVec3 &pt, int idx)
Definition: FmLoad.C:178
bool setInitLoad(double load)
Definition: FmLoad.H:32
virtual const char * getUITypeName() const
Returns the type name of this object for use in the GUI.
Definition: FmLoad.C:281
virtual bool detach()
Definition: FmLoad.C:259
virtual bool clone(FmBase *, int)
Copies the fields of another object into *this.
Definition: FmBase.H:109
Definition: FmTriad.H:48