moab
|
00001 00016 #ifndef AENTITY_FACTORY_HPP 00017 #define AENTITY_FACTORY_HPP 00018 00019 #ifndef IS_BUILDING_MB 00020 #error "AEntityFactory.hpp isn't supposed to be included into an application" 00021 #endif 00022 00023 #include "moab/Forward.hpp" 00024 #include <vector> 00025 00026 namespace moab { 00027 00028 typedef std::vector<EntityHandle> AdjacencyVector; 00029 class Core; 00030 00032 class AEntityFactory 00033 { 00034 public: 00035 00037 AEntityFactory(Core *mdb); 00038 00040 ~AEntityFactory(); 00041 00046 ErrorCode add_adjacency(EntityHandle from_ent, 00047 EntityHandle to_ent, 00048 const bool both_ways = false); 00049 00051 ErrorCode remove_adjacency(EntityHandle base_entity, 00052 EntityHandle adjacency_to_remove); 00053 00055 ErrorCode remove_all_adjacencies(EntityHandle base_entity, 00056 const bool delete_adj_list = false); 00057 00078 ErrorCode get_elements(EntityHandle source_entity, 00079 const unsigned int target_dimension, 00080 std::vector<EntityHandle> &target_entities, 00081 const bool create_if_missing, 00082 const int create_adjacency_option = -1); 00083 00086 ErrorCode get_polyhedron_vertices(const EntityHandle source_entity, 00087 std::vector<EntityHandle> &target_entities); 00088 00090 ErrorCode get_associated_meshsets( EntityHandle source_entity, 00091 std::vector<EntityHandle> &target_entities ); 00092 00101 ErrorCode get_element(const EntityHandle *vertex_list, 00102 const int vertex_list_size, 00103 const EntityType target_type, 00104 EntityHandle &target_entity, 00105 const bool create_if_missing, 00106 const EntityHandle source_entity = 0, 00107 const int create_adjacency_option = -1); 00108 00117 ErrorCode get_adjacencies(const EntityHandle entity, 00118 const unsigned int to_dimension, 00119 bool create_if_missing, 00120 std::vector<EntityHandle> &adjacent_entities); 00121 00123 ErrorCode get_adjacencies(EntityHandle entity, 00124 const EntityHandle *&adjacent_entities, 00125 int &num_entities) const; 00126 00127 ErrorCode get_adjacencies( EntityHandle entity, 00128 std::vector<EntityHandle>*& adj_vec_ptr_out, 00129 bool create_if_missing = false ); 00130 00132 ErrorCode get_adjacencies(EntityHandle entity, 00133 std::vector<EntityHandle>& adjacent_entities) const; 00134 00135 00137 ErrorCode create_vert_elem_adjacencies(); 00138 00140 bool vert_elem_adjacencies() const { return mVertElemAdj; } 00141 00143 ErrorCode notify_delete_entity(EntityHandle entity); 00144 00146 ErrorCode notify_create_entity(const EntityHandle entity, 00147 const EntityHandle *node_array, 00148 const int number_nodes); 00149 00151 ErrorCode notify_change_connectivity(EntityHandle entity, 00152 const EntityHandle* old_array, 00153 const EntityHandle* new_array, int number_nodes); 00154 00156 bool explicitly_adjacent(const EntityHandle ent1, 00157 const EntityHandle ent2); 00158 00163 ErrorCode merge_adjust_adjacencies(EntityHandle entity_to_keep, 00164 EntityHandle entity_to_remove); 00165 00166 void get_memory_use( unsigned long& total_entity_storage, 00167 unsigned long& total_storage ); 00168 ErrorCode get_memory_use( const Range& entities, 00169 unsigned long& total_entity_storage, 00170 unsigned long& total_amortized_storage ); 00171 00172 private: 00173 00174 ErrorCode get_adjacency_ptr( EntityHandle, std::vector<EntityHandle>*& ); 00175 ErrorCode get_adjacency_ptr( EntityHandle, const std::vector<EntityHandle>*& ) const; 00176 ErrorCode set_adjacency_ptr( EntityHandle, std::vector<EntityHandle>* ); 00177 00178 ErrorCode get_vertices( EntityHandle h, 00179 const EntityHandle*& vect_out, 00180 int& count_out, 00181 std::vector<EntityHandle>& storage ); 00182 00184 AEntityFactory(); 00185 00187 Core *thisMB; 00188 00190 bool mVertElemAdj; 00191 00194 bool entities_equivalent(const EntityHandle this_entity, 00195 const EntityHandle *vertex_list, 00196 const int vertex_list_size, 00197 const EntityType target_type); 00198 00199 ErrorCode get_zero_to_n_elements(EntityHandle source_entity, 00200 const unsigned int target_dimension, 00201 std::vector<EntityHandle> &target_entities, 00202 const bool create_if_missing, 00203 const int create_adjacency_option = -1); 00204 00205 ErrorCode get_down_adjacency_elements(EntityHandle source_entity, 00206 const unsigned int target_dimension, 00207 std::vector<EntityHandle> &target_entities, 00208 const bool create_if_missing, 00209 const int create_adjacency_option = -1); 00210 00211 ErrorCode get_down_adjacency_elements_poly(EntityHandle source_entity, 00212 const unsigned int target_dimension, 00213 std::vector<EntityHandle> &target_entities, 00214 const bool create_if_missing, 00215 const int create_adjacency_option = -1); 00216 00217 ErrorCode get_up_adjacency_elements(EntityHandle source_entity, 00218 const unsigned int target_dimension, 00219 std::vector<EntityHandle> &target_entities, 00220 const bool create_if_missing, 00221 const int create_adjacency_option = -1); 00222 00225 ErrorCode check_equiv_entities(EntityHandle entity_to_keep, 00226 EntityHandle entity_to_remove); 00227 00230 ErrorCode create_explicit_adjs(EntityHandle this_ent); 00231 00232 }; 00233 00234 } // namespace moab 00235 00236 #endif