moab
|
00001 00018 #ifndef MOAB_SKINNER_HPP 00019 #define MOAB_SKINNER_HPP 00020 00021 #include "moab/Forward.hpp" 00022 #include "moab/Range.hpp" 00023 #include <vector> 00024 00025 namespace moab { 00026 00027 class ScdBox; 00028 00037 class Skinner 00038 { 00039 00040 enum direction{FORWARD=1, REVERSE=-1}; 00041 protected: 00043 Interface* thisMB; 00044 00045 Tag mDeletableMBTag; 00046 Tag mAdjTag; 00047 int mTargetDim; 00048 00049 public: 00051 Skinner(Interface* mdb) 00052 : thisMB(mdb), mDeletableMBTag(0), mAdjTag(0){} 00053 00055 ~Skinner(); 00056 00057 ErrorCode find_geometric_skin(const EntityHandle meshset, Range &forward_target_entities); 00058 00075 ErrorCode find_skin( const EntityHandle meshset, 00076 const Range &entities, 00077 bool get_vertices, 00078 Range &output_handles, 00079 Range *output_reverse_handles = 0, 00080 bool create_vert_elem_adjs = false, 00081 bool create_skin_elements = true, 00082 bool look_for_scd = false); 00083 00101 ErrorCode find_skin( const EntityHandle this_set, 00102 const EntityHandle *entities, 00103 int num_entities, 00104 bool get_vertices, 00105 Range &output_handles, 00106 Range *output_reverse_handles = 0, 00107 bool create_vert_elem_adjs = false, 00108 bool create_skin_elements = true, 00109 bool look_for_scd = false); 00110 00118 ErrorCode find_skin(const EntityHandle this_set, 00119 const Range &entities, 00120 int dim, 00121 Range &skin_entities, 00122 bool create_vert_elem_adjs = false, 00123 bool create_skin_elements = true); 00124 00125 ErrorCode classify_2d_boundary( const Range &boundary, 00126 const Range &bar_elements, 00127 EntityHandle boundary_edges, 00128 EntityHandle inferred_edges, 00129 EntityHandle non_manifold_edges, 00130 EntityHandle other_edges, 00131 int &number_boundary_nodes); 00132 00135 ErrorCode classify_2d_boundary( const Range &boundary, 00136 const Range &mesh_1d_elements, 00137 Range &boundary_edges, 00138 Range &inferred_edges, 00139 Range &non_manifold_edges, 00140 Range &other_edges, 00141 int &number_boundary_nodes); 00142 00143 protected: 00144 00145 ErrorCode initialize(); 00146 00147 ErrorCode deinitialize(); 00148 00149 ErrorCode find_skin_noadj( const Range &source_entities, 00150 Range &forward_target_entities, 00151 Range &reverse_target_entities ); 00152 00153 ErrorCode add_adjacency(EntityHandle entity); 00154 00155 void add_adjacency(EntityHandle entity, const EntityHandle *conn, 00156 const int num_nodes); 00157 00158 ErrorCode remove_adjacency(EntityHandle entity); 00159 00160 bool entity_deletable(EntityHandle entity); 00161 00162 void find_match( EntityType type, 00163 const EntityHandle *conn, 00164 const int num_nodes, 00165 EntityHandle& match, 00166 Skinner::direction &direct); 00167 00168 bool connectivity_match(const EntityHandle *conn1, 00169 const EntityHandle *conn2, 00170 const int num_verts, 00171 Skinner::direction &direct); 00172 00173 void find_inferred_edges(Range &skin_boundary, 00174 Range &candidate_edges, 00175 Range &inferred_edges, 00176 double reference_angle_degrees); 00177 00178 bool has_larger_angle(EntityHandle &entity1, 00179 EntityHandle &entity2, 00180 double reference_angle_cosine); 00181 00182 00196 ErrorCode find_skin_vertices( const EntityHandle this_set, 00197 const Range& entities, 00198 Range* skin_verts = 0, 00199 Range* skin_elems = 0, 00200 Range* rev_elems = 0, 00201 bool create_if_missing = true, 00202 bool corners_only = false ); 00203 00208 ErrorCode find_skin_vertices_1D( Tag tag, 00209 const Range& edges, 00210 Range& skin_verts ); 00211 00232 ErrorCode find_skin_vertices_2D( Tag tag, 00233 const Range& faces, 00234 Range* skin_verts = 0, 00235 Range* skin_edges = 0, 00236 Range* reverse_edges = 0, 00237 bool create_edges = false, 00238 bool corners_only = false ); 00239 00260 ErrorCode find_skin_vertices_3D( Tag tag, 00261 const Range& entities, 00262 Range* skin_verts = 0, 00263 Range* skin_faces = 0, 00264 Range* reverse_faces = 0, 00265 bool create_faces = false, 00266 bool corners_only = false ); 00267 00268 ErrorCode create_side( EntityHandle element, 00269 EntityType side_type, 00270 const EntityHandle* side_corners, 00271 EntityHandle& side_elem_handle_out ); 00272 00273 bool edge_reversed( EntityHandle face, const EntityHandle edge_ends[2] ); 00274 bool face_reversed( EntityHandle region, const EntityHandle* face_conn, 00275 EntityType face_type ); 00276 00279 ErrorCode find_skin_scd(const Range& source_entities, 00280 bool get_vertices, 00281 Range& output_handles, 00282 bool create_skin_elements); 00283 00285 ErrorCode skin_box(ScdBox *box, bool get_vertices, Range &output_handles, 00286 bool create_skin_elements); 00287 }; 00288 00289 inline ErrorCode Skinner::find_skin( const EntityHandle this_set, 00290 const EntityHandle *entities, 00291 int num_entities, 00292 bool get_vertices, 00293 Range &output_handles, 00294 Range *output_reverse_handles, 00295 bool create_vert_elem_adjs, 00296 bool create_skin_elements, 00297 bool look_for_scd) 00298 { 00299 Range ents; 00300 std::copy(entities, entities+num_entities, range_inserter(ents)); 00301 return find_skin(this_set, ents, get_vertices, output_handles, output_reverse_handles, 00302 create_vert_elem_adjs, create_skin_elements, look_for_scd); 00303 } 00304 00305 } // namespace moab 00306 00307 #endif 00308