spring_mesh.hpp

Go to the documentation of this file.
00001 #ifndef _SPRING_MESH_HPP_
00002 #define _SPRING_MESH_HPP_
00003 
00004 #include <iostream>
00005 #include <vector>
00006 
00007 namespace cpe
00008 {
00009 
00010     class mesh;
00011 
00013     class spring_mesh
00014     {
00015     public:
00016 
00017         // ********************************************* //
00018         // ********************************************* //
00019         //  CONSTRUCTORS
00020         // ********************************************* //
00021         // ********************************************* //
00022 
00024         spring_mesh(const unsigned int& N=0,const double& K_structural=1.0,const double& K_shear=1.0,const double& K_bending=1.0,const double& damping=0.1);
00025 
00026 
00027         // ********************************************* //
00028         // ********************************************* //
00029         //  Dynamic
00030         // ********************************************* //
00031         // ********************************************* //
00032 
00034         void compute_force();
00035 
00037         void apply_force(const double& dt);
00038 
00039 
00040         // ********************************************* //
00041         // ********************************************* //
00042         //  Init
00043         // ********************************************* //
00044         // ********************************************* //
00045 
00047         void init();
00048 
00049 
00050         // ********************************************* //
00051         // ********************************************* //
00052         //  attribute
00053         // ********************************************* //
00054         // ********************************************* //
00055 
00057         const unsigned int& size() const;
00058 
00060         const std::vector<float>& get_vertex() const;
00062         std::vector<float>& get_vertex();
00063 
00065         const std::vector<float>& get_vertex_storage() const;
00067         std::vector<float>& get_vertex_storage();
00068 
00070         float& get_K_structural();
00072         const float& get_K_structural() const;
00073 
00075         float& get_K_shear();
00077         const float& get_K_shear() const;
00078 
00080         float& get_K_bending();
00082         const float& get_K_bending() const;
00083 
00085         float& get_damping();
00087         const float& get_damping() const;
00088 
00089 
00090         // ********************************************* //
00091         // ********************************************* //
00092         //  Convertion to mesh
00093         // ********************************************* //
00094         // ********************************************* //
00095 
00097         mesh to_mesh() const;
00098 
00099 
00100 
00101 
00102 
00103         // ********************************************* //
00104         // ********************************************* //
00105         //  Storage vertices
00106         // ********************************************* //
00107         // ********************************************* //
00108 
00110         void store_vertices();
00111 
00112 
00113     private:
00114 
00116         unsigned int N;
00117 
00119         std::vector<float> vertices;
00120 
00121 
00123         std::vector<float> vertices_store;
00124 
00125 
00126 
00128         std::vector<float> forces;
00130         std::vector<float> speed;
00131 
00132 
00134         float K_structural;
00136         float K_shear;
00138         float K_bending;
00139 
00141         float damping;
00142 
00143 
00144     };
00145 }
00146 
00147 #endif
Generated on Thu Nov 17 16:15:16 2011 by  doxygen 1.6.3