simulation.h

Go to the documentation of this file.
00001 
00008 #ifndef SIMULATION_H
00009 #define SIMULATION_H
00010 
00011 class BezierMesh;
00012 class BoundaryMesh;
00013 class DataStore;
00014 class PersistantStore;
00015 #include "util.h" // LinearData, ControlPoint
00016 
00040 class Simulation {
00041 private:
00042     /* Define copy and assignment constructors as private to prevent their use*/
00043     Simulation( const Simulation &o);
00044     const Simulation& operator=( const Simulation &o);
00045 
00046 
00047     void initialize_structures();
00048 
00049     const LinearData& get_data(const ControlPoint&) const;
00050 
00051     PersistantStore *persistant_store;
00052     DataStore *data_store; 
00053     BoundaryMesh *bdry_mesh; 
00054     BezierMesh *bezier_mesh; 
00056 public:
00057 
00058     Simulation( char *filename );
00059     Simulation();
00060 
00061     BezierMesh* get_bezier_mesh();
00062     BoundaryMesh* get_boundary_mesh();
00063     DataStore* get_data_store();
00064 
00065     // Methods "move_" put the new position into the data string
00066 
00067     // 5 arguments, t, vx, vy, x1, y1
00068     void move_(double time_step, unsigned vx_pos, unsigned vy_pos, unsigned newx_pos, unsigned newy_pos);
00069     // 7 arguments, t, v0x, v0y, v1x, v1y, x1, y1
00070     void move_(double time_step, unsigned vx1_pos, unsigned vy1_pos, unsigned vx0_pos, unsigned vy0_pos,  unsigned newx_pos, unsigned newy_pos);
00071     
00072     // Shorthands, assume y index is always x+1
00073     // 3 arguments, t, vxy, xy1
00074     void move_(double time_step, unsigned vx_pos, unsigned newx_pos);
00075 
00076     // 4 arguments, t, v1xy, v0xy, xy1
00077     void move_(double time_step, unsigned vx1_pos, unsigned vx0_pos, unsigned newx_pos);
00078 
00079 
00080     // Methods "move" stores position in XposIndex and swaps the new position into the geometry
00081     unsigned XposIndex;
00082     unsigned YposIndex;
00083     bool positions_set;
00084 
00085     void set_positions(unsigned xPosI,unsigned yPosI);
00086     
00087     // 3 arguments, t, vx, vy
00088     void move(double time_step, unsigned vx_pos, unsigned vy_pos);
00089     // 5 arguments, t, v0x, v0y, v1x, v1y
00090     void move(double time_step, unsigned vx1_pos, unsigned vy1_pos, unsigned vx0_pos, unsigned vy0_pos);
00091     // Shorthands, assume y index is always x+1
00092     // 2 arguments, t, vxy
00093     void move(double time_step, unsigned vx_pos);
00094 
00095     // 3 arguments, t, vx, vy
00096     double move_safe(double time_step, unsigned vx_pos, unsigned vy_pos);
00097     // 5 arguments, t, v0x, v0y, v1x, v1y
00098     double move_safe(double time_step, unsigned vx1_pos, unsigned vy1_pos, unsigned vx0_pos, unsigned vy0_pos);
00099     // Shorthands, assume y index is always x+1
00100     // 2 arguments, t, vxy
00101     double move_safe(double time_step, unsigned vx_pos);
00102 
00103     void store_state(unsigned vIndexFrom, unsigned vIndexTo, unsigned xIndexTo);
00104     void restore_state(unsigned vIndexFrom, unsigned vIndexTo, unsigned xIndexFrom);
00105 
00106     /* Read in a text file, and use it to initialize bdry_mesh and bezier_mesh
00107      * never read in more than one file to a simulation.  There are 4 seperate
00108      * files for text file I/O.  see meshio.h
00109      */
00110     int read_from_text_file( char *filename );
00111 
00112     /* Same as the text file version, except this function loads from a binary
00113      * file.  This preserves state much better between runs as floating point
00114      * roundoff is minimized.
00115      *
00116      * this function requires filename end in ".geo"
00117      */
00118     int read_from_binary_file( char *filename );
00119 
00120     /* write the current state of the meshes to a text file, using the 4
00121      * filenames specified in meshio.C
00122      */
00123     int to_text_file( char *filename );
00124 
00125     /* write the current state of the meshes to a binary file.  This is much more
00126      * accurate as it doesn't cause as much roundoff of floating point values.
00127      * filename must end in ".geo"
00128      */
00129     int to_binary_file( char *filename);
00130 
00131     /* write the current state to an EPS file.  This is done according to the default
00132      * EPSWriter values.
00133      * epsfile should end in ".eps"
00134      */
00135     int to_eps(char *epsfile);
00136 
00137     /* Print out data for both bezier and boundary meshes */
00138     void print();
00139 
00140     /* Print out size statistics for both meshes */
00141     void print_statistics();
00142 
00143 
00144 
00145 };
00146 
00147 #endif /* SIMULATION_H */
00148 

Generated on Mon May 24 09:53:30 2010 for TUMBLE by  doxygen 1.5.2