moab
|
00001 #ifndef SEQUENCE_MANAGER_HPP 00002 #define SEQUENCE_MANAGER_HPP 00003 00004 #include "TypeSequenceManager.hpp" 00005 #include "TagInfo.hpp" 00006 #include <vector> 00007 00008 namespace moab { 00009 00010 class HomCoord; 00011 class Error; 00012 00013 class SequenceManager 00014 { 00015 public: 00016 00017 ~SequenceManager(); 00018 00020 void clear(); 00021 00025 ErrorCode find( EntityHandle handle, EntitySequence*& sequence_out ) 00026 { 00027 return typeData[TYPE_FROM_HANDLE(handle)].find( handle, sequence_out ); 00028 } 00029 00033 ErrorCode find( EntityHandle handle, const EntitySequence*& sequence_out ) const 00034 { 00035 return typeData[TYPE_FROM_HANDLE(handle)].find( handle, sequence_out ); 00036 } 00037 00040 void get_entities( EntityType type, Range& entities_out ) const 00041 { 00042 if (type == MBMAXTYPE) 00043 get_entities( entities_out ); 00044 else 00045 typeData[type].get_entities( entities_out ); 00046 } 00047 00048 void get_entities( Range& entities_out ) const; 00049 00052 void get_entities( EntityType type, std::vector<EntityHandle>& entities_out ) const 00053 { 00054 if (type == MBMAXTYPE) 00055 get_entities( entities_out ); 00056 else 00057 typeData[type].get_entities( entities_out ); 00058 } 00059 00060 void get_entities( std::vector<EntityHandle>& entities_out ) const; 00061 00063 EntityID get_number_entities( EntityType type ) const 00064 { return type == MBMAXTYPE ? get_number_entities() : typeData[type].get_number_entities(); } 00065 00067 EntityID get_number_entities( ) const; 00068 00070 const EntitySequence* get_last_accessed_sequence( EntityType type ) const 00071 { return typeData[type].get_last_accessed(); } 00072 00081 ErrorCode replace_subsequence( EntitySequence* new_seq ); 00082 00084 ErrorCode check_valid_entities( Error* error_handler, 00085 const Range& entities ) const; 00086 00091 ErrorCode check_valid_entities( Error* error_handler, 00092 const EntityHandle entities[], 00093 size_t num_entities, 00094 bool root_set_okay = false ) const; 00095 00097 ErrorCode delete_entity( Error* error_handler, EntityHandle entity ); 00098 00100 ErrorCode delete_entities( Error* error_handler, const Range& entities ); 00101 00105 ErrorCode create_vertex( const double coords[3], 00106 EntityHandle& handle_out ); 00107 00111 ErrorCode create_element( EntityType type, 00112 const EntityHandle* conn_array, 00113 unsigned num_vertices, 00114 EntityHandle& handle_out ); 00115 00117 ErrorCode create_mesh_set( unsigned flags, 00118 EntityHandle& handle_out ); 00122 ErrorCode allocate_mesh_set( EntityHandle at_this_handle, 00123 unsigned flags ); 00124 00143 ErrorCode create_entity_sequence( EntityType type, 00144 EntityID num_entities, 00145 int nodes_per_entity, 00146 EntityID start_id_hint, 00147 EntityHandle& first_handle_out, 00148 EntitySequence*& sequence_out, 00149 int sequence_size); 00150 00168 ErrorCode create_meshset_sequence( EntityID num_sets, 00169 EntityID start_id_hint, 00170 const unsigned* flags, 00171 EntityHandle& first_handle_out, 00172 EntitySequence*& sequence_out ); 00173 00178 ErrorCode create_meshset_sequence( EntityID num_sets, 00179 EntityID start_id_hint, 00180 unsigned flags, 00181 EntityHandle& first_handle_out, 00182 EntitySequence*& sequence_out ); 00183 00185 ErrorCode create_scd_sequence( int imin, int jmin, int kmin, 00186 int imax, int jmax, int kmax, 00187 EntityType type, 00188 EntityID start_id_hint, 00189 EntityHandle& first_handle_out, 00190 EntitySequence*& sequence_out, 00191 int *is_periodic = NULL); 00192 00194 ErrorCode create_scd_sequence( const HomCoord& coord_min, 00195 const HomCoord& coord_max, 00196 EntityType type, 00197 EntityID start_id_hint, 00198 EntityHandle& first_handle_out, 00199 EntitySequence*& sequence_out, 00200 int *is_periodic = NULL); 00201 00203 ErrorCode create_sweep_sequence( int imin, int jmin, int kmin, 00204 int imax, int jmax, int kmax, 00205 int* Cq, 00206 EntityType type, 00207 EntityID start_id_hint, 00208 EntityHandle& first_handle_out, 00209 EntitySequence*& sequence_out ); 00210 00212 ErrorCode create_sweep_sequence( const HomCoord& coord_min, 00213 const HomCoord& coord_max, 00214 int* Cq, 00215 EntityType type, 00216 EntityID start_id_hint, 00217 EntityHandle& first_handle_out, 00218 EntitySequence*& sequence_out ); 00219 00222 ErrorCode add_vsequence(EntitySequence *vert_seq, 00223 EntitySequence *elem_seq, 00224 const HomCoord &p1, const HomCoord &q1, 00225 const HomCoord &p2, const HomCoord &q2, 00226 const HomCoord &p3, const HomCoord &q3, 00227 bool bb_input = false, 00228 const HomCoord *bb_min = NULL, 00229 const HomCoord *bb_max = NULL); 00230 00232 TypeSequenceManager& entity_map( EntityType type ) 00233 { return typeData[type]; } 00234 00236 const TypeSequenceManager& entity_map( EntityType type ) const 00237 { return typeData[type]; } 00238 00239 void get_memory_use( unsigned long& total_entity_storage, 00240 unsigned long& total_storage ) const; 00241 00242 void get_memory_use( EntityType type, 00243 unsigned long& total_entity_storage, 00244 unsigned long& total_storage ) const; 00245 00246 void get_memory_use( const Range& entities, 00247 unsigned long& total_entity_storage, 00248 unsigned long& total_amortized_storage ) const; 00249 00250 00251 00252 /* Dense Tag Functions */ 00253 00257 ErrorCode reserve_tag_array( Error* error_handler, int tag_size, int& array_id_out ); 00258 00261 ErrorCode release_tag_array( Error* error_handler, int id, bool release_id ); 00262 00264 static EntityID default_poly_sequence_size( int entity_connectivity_length ); 00265 00272 EntityID new_sequence_size( EntityHandle start_handle, 00273 EntityID requested_size, 00274 int sequence_size) const; 00275 00277 static const EntityID DEFAULT_VERTEX_SEQUENCE_SIZE; 00278 00280 static const EntityID DEFAULT_ELEMENT_SEQUENCE_SIZE; 00281 00283 static const EntityID DEFAULT_POLY_SEQUENCE_SIZE; 00284 00286 static const EntityID DEFAULT_MESHSET_SEQUENCE_SIZE; 00287 00288 private: 00289 00295 void trim_sequence_block( EntityHandle start_handle, 00296 EntityHandle& end_handle_in_out, 00297 unsigned maximum_sequence_size ); 00298 00299 00313 EntityHandle sequence_start_handle( EntityType type, 00314 EntityID entity_count, 00315 int values_per_entity, 00316 EntityID start_id_hint, 00317 SequenceData*& data_out, 00318 EntityID &data_size ); 00319 00320 TypeSequenceManager typeData[MBMAXTYPE]; 00321 00322 std::vector<int> tagSizes; 00323 00324 }; 00325 00326 } // namespace moab 00327 00328 #endif