TAPs 0.7.7.3
TAPsPhysicalProperties.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsPhysicalProperties.cpp
00003 ******************************************************************************/
00007 /******************************************************************************
00008 SUKITTI PUNAK   (08/19/2010)
00009 UPDATE          (08/19/2010)
00010 ******************************************************************************/
00011 #include "TAPsPhysicalProperties.hpp"
00012 // Using Inclusion Model (i.e. definitions are included in declarations)
00013 //                       (this name.cpp is included in name.hpp)
00014 // Each friend is defined directly inside its declaration.
00015 
00016 BEGIN_NAMESPACE_TAPs
00017 //=============================================================================
00018 //-----------------------------------------------------------------------------
00019 template <typename T>
00020 PhysicalProperties<T>::PhysicalProperties ()
00021     : Elasticity( 1 )
00022     , Mass( 1 )
00023 {
00024     #ifdef  TAPs_DEBUG_MODE
00025     std::cout   << "PhysicalProperties<" << typeid(T).name() << "> default constructor\n";
00026     #endif//TAPs_DEBUG_MODE
00027 }
00028 //-----------------------------------------------------------------------------
00029 template <typename T>
00030 PhysicalProperties<T>::PhysicalProperties ( const PhysicalProperties<T> & orig )
00031     : Elasticity( orig.Elasticity )
00032     , Mass( orig.Mass )
00033     , CenterOfMass( orig.CenterOfMass )
00034     , Orientation( orig.Orientation )
00035 
00036     , MomentOfInertia( orig.MomentOfInertia )
00037     , InvMomentOfInertia( orig.InvMomentOfInertia )
00038 
00039     , LinearMomentum( orig.LinearMomentum )
00040     , AngularMomentum( orig.AngularMomentum )
00041     , LinearVelocity( orig.LinearVelocity )
00042     , AngularVelocity( orig.AngularVelocity )
00043     , LinearAcceleration( orig.LinearAcceleration )
00044     , AngularAcceleration( orig.AngularAcceleration )
00045 
00046     , TotalForce( orig.TotalForce )
00047     , TotalTorque( orig.TotalTorque )
00048 
00049 {
00050     #ifdef  TAPs_DEBUG_MODE
00051     std::cout   << "PhysicalProperties<" << typeid(T).name() << "> copy constructor\n";
00052     #endif//TAPs_DEBUG_MODE
00053 }
00054 //-----------------------------------------------------------------------------
00055 // Destructor
00056 template <typename T>
00057 PhysicalProperties<T>::~PhysicalProperties ()
00058 {
00059     #ifdef  TAPs_DEBUG_MODE
00060     std::cout   << "PhysicalProperties<" << typeid(T).name() << "> destructor\n";
00061     #endif//TAPs_DEBUG_MODE
00062 }
00063 //-----------------------------------------------------------------------------
00064 template <typename T>
00065 std::string PhysicalProperties<T>::StrInfo () const
00066 {
00067     std::stringstream ss;
00068     ss  << "PhysicalProperties<" << typeid(T).name() << "> ==> "
00069         << "\n  Elasticity          " << Elasticity
00070         << "\n  Mass:               " << Mass
00071         << "\n  Center of mass      " << CenterOfMass
00072         << "\n  Orientation         " << Orientation
00073         << "\n  LinearMomentum      " << LinearMomentum
00074         << "\n  AngularMomentum     " << AngularMomentum
00075         << "\n  LinearVelocity      " << LinearVelocity
00076         << "\n  AngularVelocity     " << AngularVelocity
00077         << "\n  LinearAcceleration  " << LinearAcceleration
00078         << "\n  AngularAcceleration " << AngularAcceleration
00079         << "\n  TotalForce          " << TotalForce
00080         << "\n  TotalTorque         " << TotalTorque
00081         << "\n  Moment of Inertia               " << MomentOfInertia
00082         << "\n  Inverse of Moment of Inertia    " << InvMomentOfInertia
00083         << "\n";
00084     return ss.str();
00085 }
00086 //-----------------------------------------------------------------------------
00087 // Assignment Operator
00088 template <typename T>
00089 inline PhysicalProperties<T> & PhysicalProperties<T>::operator= ( PhysicalProperties<T> const & orig )
00090 {   
00091     Elasticity      = orig.Elasticity;
00092     Mass            = orig.Mass;
00093     CenterOfMass    = orig.CenterOfMass;
00094     Orientation     = orig.Orientation;
00095 
00096     MomentOfInertia     = orig.MomentOfInertia;
00097     InvMomentOfInertia  = orig.InvMomentOfInertia;
00098 
00099     LinearMomentum  = orig.LinearMomentum;
00100     AngularMomentum = orig.AngularMomentum;
00101     LinearVelocity  = orig.LinearVelocity;
00102     AngularVelocity = orig.AngularVelocity;
00103     LinearAcceleration  = orig.LinearAcceleration;
00104     AngularAcceleration = orig.AngularAcceleration;
00105 
00106     TotalForce  = orig.TotalForce;
00107     TotalTorque = orig.TotalTorque;
00108 
00109     return *this;
00110 }
00111 //-----------------------------------------------------------------------------
00112 //=============================================================================
00113 END_NAMESPACE_TAPs
00114 //-----------------------------------------------------------------------------
00115 //34567890123456789012345678901234567890123456789012345678901234567890123456789
00116 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines