00001 // Copyright (C) 2008 University of Louisiana at Lafayette 00002 // Authors: Christopher Mire 00003 00004 #ifndef CAJUN_MESH_SPLIT_FILE_WRITER_H 00005 #define CAJUN_MESH_SPLIT_FILE_WRITER_H 00006 00007 #include "mesh_writer_interface.H" 00008 #include "access_data.H" 00009 00010 #include <fstream> 00011 #include <vector> 00012 00013 namespace cajun 00014 { 00015 class mesh_split_file_writer_t : public mesh_writer_interface_t 00016 { 00017 public: 00018 mesh_split_file_writer_t (unsigned id_, size_t max_cells_); 00019 ~mesh_split_file_writer_t (); 00020 void write_mesh (const cell_t &cell1_, 00021 point_3d_t &pt1_, 00022 const cell_t &cell2_, 00023 point_3d_t &pt2_, 00024 const cell_t &cell3_, 00025 point_3d_t &pt3_); 00026 void write_point (const cell_t &cell_, point_3d_t &pt_); 00027 private: 00028 struct cell_index_t 00029 { 00030 cell_index_t () {;} 00031 cell_index_t (size_t cell_id_, size_t pt_id_, size_t index_) 00032 { 00033 cell_id = cell_id_; 00034 pt_id = pt_id_; 00035 index = index_; 00036 }; 00037 size_t cell_id; 00038 size_t pt_id; 00039 size_t index; 00040 bool operator== (const cell_index_t &cell_index_) const 00041 { 00042 return this->cell_id == cell_index_.cell_id && 00043 this->pt_id == cell_index_.pt_id; 00044 } 00045 }; 00046 00047 std::ofstream m_indices_file; 00048 std::ofstream m_vertices_file; 00049 00050 triangle_data_t m_triangle_data; 00051 00052 access_data_t *m_ad; 00053 unsigned m_qid; 00054 00055 //restriced in size, used as ring buffer 00056 std::vector<cell_index_t> m_cell_indices; 00057 //static size of m_cell_indices 00058 size_t m_index_size; 00059 //current insert position into m_cell_indices 00060 unsigned m_index_counter; 00061 size_t m_num_vertices; 00062 bool m_match_closest_pts; 00063 00064 }; 00065 }; 00066 00067 #endif