Changeset 5600
- Timestamp:
- Aug 4, 2008, 10:21:33 AM (17 years ago)
- Location:
- anuga_work/development/anugavis/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/anugavis/src/anugavis.cc
r5598 r5600 5 5 #include <iostream> 6 6 #include <string> 7 #include <boost/shared_ptr.hpp> 7 8 #ifdef HAVE_GL_GL_H 8 9 # include <GL/gl.h> … … 18 19 #include "anugavis.hh" 19 20 #include "height_quantity.hh" 21 #include "sww_file.hh" 20 22 23 using boost::shared_ptr; 21 24 using std::string; 22 25 23 26 AnugaVis::AnugaVis(const string &file_name, int width, int height): 24 screen(NULL), sww_file( file_name){27 screen(NULL), sww_file(new SWWFile(file_name)){ 25 28 init_SDL(width, height); 26 29 init_OpenGL(width, height); … … 31 34 } 32 35 33 void AnugaVis::add_HeightQuantity(HeightQuantity &height){ 34 height.set_dynamic(this->sww_file.nc_inq_varndims_by_name(height.get_name()) \ 35 == 2); 36 void AnugaVis::add_HeightQuantity(shared_ptr<HeightQuantity> &height){ 37 height->set_SWWFile(this->sww_file); 36 38 this->heights.push_back(height); 37 39 } -
anuga_work/development/anugavis/src/anugavis.hh
r5598 r5600 6 6 #include <list> 7 7 #include <string> 8 #include <boost/shared_ptr.hpp> 8 9 #include <SDL.h> 9 10 #include "height_quantity.hh" 10 11 #include "sww_file.hh" 11 12 13 using boost::shared_ptr; 12 14 using std::list; 13 15 using std::string; … … 17 19 AnugaVis(const string &sww_file, int width, int height); 18 20 ~AnugaVis(void); 19 void add_HeightQuantity( HeightQuantity&height);21 void add_HeightQuantity(shared_ptr<HeightQuantity> &height); 20 22 void run(void); 21 23 private: … … 23 25 void init_OpenGL(int width, int height); 24 26 SDL_Surface *screen; 25 SWWFilesww_file;26 list< HeightQuantity> heights;27 shared_ptr<SWWFile> sww_file; 28 list<shared_ptr<HeightQuantity> > heights; 27 29 }; 28 30 -
anuga_work/development/anugavis/src/anugavis_simple_cxx.cc
r5598 r5600 1 1 #include <iostream> 2 2 #include <sstream> 3 #include <boost/shared_ptr.hpp> 3 4 #include <SDL.h> 4 5 #include "anugavis.hh" 5 6 #include "output.hh" 6 7 8 using boost::shared_ptr; 7 9 using std::cout; 8 10 using std::endl; … … 19 21 try{ 20 22 AnugaVis anuga(argv[1], 640, 480); 21 HeightQuantity elevation("elevation", 0, 1, 0.5, 0.5, 0.5); 22 HeightQuantity stage("stage", 0, 1, 0, 0, 0.8); 23 shared_ptr<HeightQuantity> elevation(new HeightQuantity("elevation", 0, 1, 24 0.5, 0.5, 0.5)); 25 shared_ptr<HeightQuantity> stage(new HeightQuantity("stage", 0, 1, 26 0, 0, 0.8)); 23 27 anuga.add_HeightQuantity(elevation); 24 28 anuga.add_HeightQuantity(stage); -
anuga_work/development/anugavis/src/height_quantity.cc
r5598 r5600 45 45 } 46 46 47 const string &HeightQuantity::get_name(void){ 48 return this->name; 49 } 50 51 void HeightQuantity::set_dynamic(bool dynamic){ 52 this->dynamic = dynamic; 47 void HeightQuantity::set_SWWFile(const shared_ptr<SWWFile> &file){ 48 this->sww_file = file; 49 this->points = \ 50 shared_array<float>(new float[this->sww_file->number_of_points]); 51 this->dynamic = this->sww_file->nc_inq_varndims_by_name(this->name) == 2; 53 52 } 54 53 -
anuga_work/development/anugavis/src/height_quantity.hh
r5598 r5600 9 9 10 10 #include <string> 11 11 #include <boost/shared_array.hpp> 12 #include <boost/shared_ptr.hpp> 12 13 #ifdef HAVE_GL_GL_H 13 14 # include <GL/gl.h> … … 15 16 # include <OpenGL/gl.h> 16 17 #endif 18 #include "sww_file.hh" 17 19 20 using boost::shared_array; 21 using boost::shared_ptr; 18 22 using std::string; 19 23 … … 31 35 ~HeightQuantity(void); 32 36 void draw(int frame); 33 const string &get_name(void); 34 void set_dynamic(bool dynamic); 37 void set_SWWFile(const shared_ptr<SWWFile> &file); 35 38 GLdouble offset; 36 39 GLdouble scale; … … 45 48 bool dynamic; 46 49 GLuint display_list; 50 shared_array<float> points; 51 shared_ptr<SWWFile> sww_file; 47 52 }; 48 53 -
anuga_work/development/anugavis/src/sww_file.hh
r5502 r5600 18 18 19 19 class SWWFile{ 20 friend class HeightQuantity; 20 21 public: 21 22 SWWFile(const string &file_name);
Note: See TracChangeset
for help on using the changeset viewer.