![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsForces.hpp 00003 ******************************************************************************/ 00007 /****************************************************************************** 00008 SUKITTI PUNAK (04/07/2010) 00009 UPDATE (05/01/2010) 00010 ******************************************************************************/ 00011 #ifndef TAPs_FORCES_HPP 00012 #define TAPs_FORCES_HPP 00013 00014 #include "../Core/TAPsStdLib.hpp" 00015 00016 BEGIN_NAMESPACE_TAPs 00017 //============================================================================= 00018 00019 00020 00021 00022 00023 00024 00025 00026 //============================================================================= 00030 template <typename T> 00031 class PointForce { 00032 //============================================================================= 00033 public: 00034 // Member Functions ------------------------------------------------------- 00036 friend std::ostream & operator<< ( std::ostream &output, PointForce<T> const &obj ) 00037 { 00038 output << obj.StrInfo(); 00039 return output; 00040 } 00041 //------------------------------------------------------------------------- 00043 PointForce (); 00045 PointForce ( T x, T y, T z, T fx, T fy, T fz, int id = -1 ); 00047 PointForce ( Vector3<T> const & position, Vector3<T> const & force, int id = -1 ); 00049 PointForce ( PointForce<T> const & orig ); 00051 virtual ~PointForce (); 00052 //------------------------------------------------------------------------- 00054 virtual std::string StrInfo () const; 00055 //------------------------------------------------------------------------- 00057 inline PointForce<T> & operator= ( PointForce<T> const &orig ); 00058 //------------------------------------------------------------------------- 00060 inline Vector3<T> const & RefToPosition () const { return m_Pos; } 00062 inline Vector3<T> & RefToPosition () { return m_Pos; } 00064 inline Vector3<T> const & RefToForce () const { return m_Force; } 00066 inline Vector3<T> & RefToForce () { return m_Force; } 00068 inline int GetID () const { return m_ID; } 00070 inline void SetID ( int id ) { m_ID = id; } 00071 // Data Members ----------------------------------------------------------- 00072 //============================================================================= 00073 protected: 00074 // Member Functions ------------------------------------------------------- 00075 // Data Members ----------------------------------------------------------- 00076 int m_ID; 00077 Vector3<T> m_Pos; 00078 Vector3<T> m_Force; 00079 //============================================================================= 00080 private: 00081 // Member Functions ------------------------------------------------------- 00082 // Data Members ----------------------------------------------------------- 00083 //============================================================================= 00084 00085 #if defined(__gl_h_) || defined(__GL_H__) 00086 public: 00087 virtual void Draw () const; 00088 #endif 00089 00090 //============================================================================= 00091 }; // END CLASS Forces 00092 //============================================================================= 00093 00094 00095 00096 00097 //============================================================================= 00103 template <typename T> 00104 class ForceLists { 00105 //============================================================================= 00106 public: 00107 typedef std::list< PointForce<T> > TypeDef_PointForces; 00108 00109 TypeDef_PointForces PointForces; 00110 00111 TypeDef_PointForces CDForces; 00112 00113 TypeDef_PointForces ConnectionForces; 00114 00116 inline void ClearAllPointForces (); 00117 00119 inline void ClearAllCDForces (); 00120 00122 inline void ClearAllConnectionForces (); 00123 00125 inline void ClearAllForces (); 00126 00127 //----------------------------------------------------------------------------- 00128 #if defined(__gl_h_) || defined(__GL_H__) 00129 public: 00131 virtual void Draw () const; 00133 virtual void DrawPointForces () const; 00135 virtual void DrawCDForces () const; 00137 virtual void DrawConnectionForces () const; 00138 #endif 00139 //============================================================================= 00140 }; // END CLASS ForceLists 00141 //============================================================================= 00142 00143 00144 //============================================================================= 00150 template <typename T> 00151 class ForceListsPtr { 00152 //============================================================================= 00153 public: 00154 typedef std::list< PointForce<T> * > TypeDef_PointForces; 00155 00156 TypeDef_PointForces PointForces; 00157 00158 TypeDef_PointForces CDForces; 00159 00160 TypeDef_PointForces ConnectionForces; 00161 00163 inline void ClearAllPointForces (); 00164 00166 inline void ClearAllCDForces (); 00167 00169 inline void ClearAllConnectionForces (); 00170 00172 inline void ClearAllForces (); 00173 00174 //----------------------------------------------------------------------------- 00175 #if defined(__gl_h_) || defined(__GL_H__) 00176 public: 00178 virtual void Draw () const; 00180 virtual void DrawPointForces () const; 00182 virtual void DrawCDForces () const; 00184 virtual void DrawConnectionForces () const; 00185 #endif 00186 //============================================================================= 00187 }; // END CLASS ForceListsPtr 00188 //============================================================================= 00189 00190 00191 //============================================================================= 00192 END_NAMESPACE_TAPs 00193 //----------------------------------------------------------------------------- 00195 #include "TAPsForces.cpp" 00196 00198 // Include definition if TAPs_USE_EXPORT is not defined 00199 //#if !defined( TAPs_USE_EXPORT ) 00200 // #include "TAPsForces.cpp" 00201 //#endif 00202 //----------------------------------------------------------------------------- 00203 #endif 00204 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00205 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----