spring_mesh.hpp

Go to the documentation of this file.
00001 /*
00002 **    TP ETI5 CPE Lyon
00003 **    Copyright (C) 2010 Damien Rohmer
00004 **
00005 **    This program is free software: you can redistribute it and/or modify
00006 **    it under the terms of the GNU General Public License as published by
00007 **    the Free Software Foundation, either version 3 of the License, or
00008 **    (at your option) any later version.
00009 **
00010 **   This program is distributed in the hope that it will be useful,
00011 **    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 **    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 **    GNU General Public License for more details.
00014 **
00015 **    You should have received a copy of the GNU General Public License
00016 **    along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 #ifndef _SPRING_MESH_HPP_
00020 #define _SPRING_MESH_HPP_
00021 
00022 #include <iostream>
00023 #include <vector>
00024 
00025 namespace cpe
00026 {
00027 
00028     class mesh;
00029 
00031     class spring_mesh
00032     {
00033     public:
00034 
00035         // ********************************************* //
00036         // ********************************************* //
00037         //  CONSTRUCTORS
00038         // ********************************************* //
00039         // ********************************************* //
00040 
00042         spring_mesh(const unsigned int& N=0);
00043 
00044 
00045         // ********************************************* //
00046         // ********************************************* //
00047         //  Dynamic
00048         // ********************************************* //
00049         // ********************************************* //
00050 
00052         void compute_force();
00053 
00055         void apply_force(const double& dt);
00056 
00057 
00058         // ********************************************* //
00059         // ********************************************* //
00060         //  Init
00061         // ********************************************* //
00062         // ********************************************* //
00063 
00065         void init();
00066 
00067 
00068         // ********************************************* //
00069         // ********************************************* //
00070         //  attribute
00071         // ********************************************* //
00072         // ********************************************* //
00073 
00075         const unsigned int& size() const;
00076 
00078         const std::vector<float>& get_vertex() const;
00080         std::vector<float>& get_vertex();
00081 
00083         const std::vector<float>& get_vertex_storage() const;
00085         std::vector<float>& get_vertex_storage();
00086 
00088         float& get_K_structural();
00090         const float& get_K_structural() const;
00091 
00093         float& get_K_shear();
00095         const float& get_K_shear() const;
00096 
00098         float& get_K_bending();
00100         const float& get_K_bending() const;
00101 
00103         float& get_damping();
00105         const float& get_damping() const;
00106 
00107 
00108         // ********************************************* //
00109         // ********************************************* //
00110         //  Convertion to mesh
00111         // ********************************************* //
00112         // ********************************************* //
00113 
00115         mesh to_mesh() const;
00116 
00117 
00118 
00119 
00120 
00121         // ********************************************* //
00122         // ********************************************* //
00123         //  Storage vertices
00124         // ********************************************* //
00125         // ********************************************* //
00126 
00128         void store_vertices();
00129 
00130 
00131     private:
00132 
00134         unsigned int N;
00135 
00137         std::vector<float> vertices;
00138 
00139 
00141         std::vector<float> vertices_store;
00142 
00143 
00144 
00146         std::vector<float> forces;
00148         std::vector<float> speed;
00149 
00150 
00152         float K_structural;
00154         float K_shear;
00156         float K_bending;
00157 
00159         float damping;
00160 
00161 
00162     };
00163 }
00164 
00165 #endif
Generated on Tue Dec 28 08:43:38 2010 by  doxygen 1.6.3