mesh_conv::MC_sphere_physic Class Reference

Physical particle model associated to a sphere. More...

#include <MC_sphere_physic.hpp>

Inheritance diagram for mesh_conv::MC_sphere_physic:
Inheritance graph
[legend]
Collaboration diagram for mesh_conv::MC_sphere_physic:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MC_sphere_physic ()
 empty constructor
 MC_sphere_physic (const MC_v3d &position, const double &radius)
 direct constructor
 MC_sphere_physic (const MC_v3d &position, const double &radius, const MC_v3d &speed_init)
 direct constructor
MC_v3dspeed ()
 get speed
const MC_v3dspeed () const
 get speed
MC_v3dforce ()
 get force
const MC_v3dforce () const
 get force
double & mass ()
 get mass
const double & mass () const
 get mass
double & damping_factor ()
 get damping factor
const double & damping_factor () const
 get damping factor
void evolve (const double &delta_t)
 evolve through time
void constraint_in_unit_cube ()
 ensure the particle stays in a unit cube and modify speed accordingly

Static Public Member Functions

static void constraint_no_collision_sphere (MC_sphere_physic *sphere_1, MC_sphere_physic *sphere_2)
 ensure two particles does not collide and modify speed accordingly

Private Attributes

MC_v3d speed_internal
 current speed of the particle
MC_v3d force_internal
 extrernal forces
double mass_internal
 particle mass
double damping_factor_internal
 damping factor

Detailed Description

Physical particle model associated to a sphere.

Definition at line 10 of file MC_sphere_physic.hpp.


Constructor & Destructor Documentation

mesh_conv::MC_sphere_physic::MC_sphere_physic (  ) 

empty constructor

Definition at line 7 of file MC_sphere_physic.cpp.

00008             :MC_sphere_geometry(),speed_internal(MC_v3d(0,0,0)),force_internal(MC_v3d(0,0,0)),mass_internal(1),damping_factor_internal(0.01)
00009     {}

mesh_conv::MC_sphere_physic::MC_sphere_physic ( const MC_v3d position,
const double &  radius 
)

direct constructor

Definition at line 10 of file MC_sphere_physic.cpp.

00011             :MC_sphere_geometry(position,radius),speed_internal(MC_v3d(0,0,0)),force_internal(MC_v3d(0,0,0)),mass_internal(1),damping_factor_internal(0.01)
00012     {}

mesh_conv::MC_sphere_physic::MC_sphere_physic ( const MC_v3d position,
const double &  radius,
const MC_v3d speed_init 
)

direct constructor

Definition at line 13 of file MC_sphere_physic.cpp.

00014             :MC_sphere_geometry(position,radius),speed_internal(speed_init),force_internal(MC_v3d(0,0,0)),mass_internal(1),damping_factor_internal(0.01)
00015     {}


Member Function Documentation

void mesh_conv::MC_sphere_physic::constraint_in_unit_cube (  ) 

ensure the particle stays in a unit cube and modify speed accordingly

Definition at line 45 of file MC_sphere_physic.cpp.

References mesh_conv::MC_sphere_geometry::center(), mesh_conv::MC_sphere_geometry::radius(), and speed().

Referenced by mesh_conv::MC_particle_engine::evolve().

00046     {
00047 
00048         MC_v3d& c=center();
00049         MC_v3d& s=speed();
00050 
00051         const double& r=radius();
00052 
00053         // ********************** //
00054 
00055         // TO DO :
00056 
00057         // si la sphere sort de [0,1] alors on change la vitesse s
00058 
00059         // ********************** //
00060 
00061 
00062     }

Here is the call graph for this function:

Here is the caller graph for this function:

void mesh_conv::MC_sphere_physic::constraint_no_collision_sphere ( MC_sphere_physic sphere_1,
MC_sphere_physic sphere_2 
) [static]

ensure two particles does not collide and modify speed accordingly

Definition at line 64 of file MC_sphere_physic.cpp.

References mesh_conv::MC_sphere_geometry::center(), mesh_conv::MC_sphere_geometry::is_collide(), mesh_conv::MC_sphere_geometry::radius(), and speed().

00065     {
00066 
00067         if(! (sphere_1->is_collide(*sphere_2)) )
00068             return;
00069 
00070         const MC_v3d& c1=sphere_1->center();
00071         const MC_v3d& c2=sphere_2->center();
00072 
00073         const double& r1=sphere_1->radius();
00074         const double& r2=sphere_2->radius();
00075 
00076         double L=(c1-c2).norm();
00077         MC_v3d u=(c1-c2)/L;
00078 
00079         double r_total=(r1+r2);
00080         double L_penetration=r_total-L;
00081 
00082         double epsilon=1e-5;
00083 
00084         //project on the contact surface
00085         sphere_1->center() += +(L_penetration+epsilon)/2.0 * u;
00086         sphere_2->center() += -(L_penetration+epsilon)/2.0 * u;
00087 
00088 
00089 
00090         // ********************** //
00091         // TO DO :
00092 
00093         // changer la vitesse
00094         MC_v3d nouvelle_vitesse_1=sphere_1->speed();
00095         MC_v3d nouvelle_vitesse_2=sphere_1->speed();
00096         // ********************** //
00097 
00098 
00099         sphere_1->speed()=nouvelle_vitesse_1;
00100         sphere_2->speed()=nouvelle_vitesse_2;
00101 
00102     }

Here is the call graph for this function:

const double & mesh_conv::MC_sphere_physic::damping_factor (  )  const

get damping factor

Definition at line 31 of file MC_sphere_physic.cpp.

References damping_factor_internal.

00031 {return damping_factor_internal;}

double & mesh_conv::MC_sphere_physic::damping_factor (  ) 

get damping factor

Definition at line 30 of file MC_sphere_physic.cpp.

References damping_factor_internal.

00030 {return damping_factor_internal;}

void mesh_conv::MC_sphere_physic::evolve ( const double &  delta_t  ) 

evolve through time

Definition at line 33 of file MC_sphere_physic.cpp.

References mesh_conv::MC_sphere_geometry::center(), damping_factor_internal, force_internal, mass_internal, and speed_internal.

Referenced by mesh_conv::MC_particle_engine::evolve().

00034     {
00035 
00036         MC_v3d acceleration = force_internal/mass_internal;
00037 
00038         //explicit integation
00039         speed_internal = (1-damping_factor_internal)*speed_internal + delta_t*acceleration;
00040         center() += delta_t*speed_internal;
00041 
00042         //force_internal.set_zero();
00043     }

Here is the call graph for this function:

Here is the caller graph for this function:

const MC_v3d & mesh_conv::MC_sphere_physic::force (  )  const

get force

Definition at line 24 of file MC_sphere_physic.cpp.

References force_internal.

00025     {return force_internal;}

MC_v3d & mesh_conv::MC_sphere_physic::force (  ) 

get force

Definition at line 22 of file MC_sphere_physic.cpp.

References force_internal.

Referenced by mesh_conv::MC_particle_engine::evolve().

00023     {return force_internal;}

Here is the caller graph for this function:

const double & mesh_conv::MC_sphere_physic::mass (  )  const

get mass

Definition at line 28 of file MC_sphere_physic.cpp.

References mass_internal.

00028 {return mass_internal;}

double & mesh_conv::MC_sphere_physic::mass (  ) 

get mass

Definition at line 27 of file MC_sphere_physic.cpp.

References mass_internal.

00027 {return mass_internal;}

const MC_v3d & mesh_conv::MC_sphere_physic::speed (  )  const

get speed

Definition at line 20 of file MC_sphere_physic.cpp.

References speed_internal.

00021     {return speed_internal;}

MC_v3d & mesh_conv::MC_sphere_physic::speed (  ) 

get speed

Definition at line 18 of file MC_sphere_physic.cpp.

References speed_internal.

Referenced by constraint_in_unit_cube(), and constraint_no_collision_sphere().

00019     {return speed_internal;}

Here is the caller graph for this function:


Member Data Documentation

damping factor

Definition at line 88 of file MC_sphere_physic.hpp.

Referenced by damping_factor(), and evolve().

extrernal forces

Definition at line 83 of file MC_sphere_physic.hpp.

Referenced by evolve(), and force().

particle mass

Definition at line 86 of file MC_sphere_physic.hpp.

Referenced by evolve(), and mass().

current speed of the particle

Definition at line 81 of file MC_sphere_physic.hpp.

Referenced by evolve(), and speed().


The documentation for this class was generated from the following files:

Generated on Sun Apr 18 20:24:48 2010 by  doxygen 1.6.1