![]() |
Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
00001 /**
00002 * MOAB, a Mesh-Oriented datABase, is a software component for creating,
00003 * storing and accessing finite element mesh data.
00004 *
00005 * Copyright 2004 Sandia Corporation. Under the terms of Contract
00006 * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
00007 * retains certain rights in this software.
00008 *
00009 * This library is free software; you can redistribute it and/or
00010 * modify it under the terms of the GNU Lesser General Public
00011 * License as published by the Free Software Foundation; either
00012 * version 2.1 of the License, or (at your option) any later version.
00013 *
00014 */
00015
00016 #ifndef MOAB_HALF_FACET_REP_HPP
00017 #define MOAB_HALF_FACET_REP_HPP
00018
00019 #include "moab/Core.hpp"
00020 #include "moab/Range.hpp"
00021 #include "moab/CN.hpp"
00022
00023 namespace moab
00024 {
00025
00026 /*!
00027 * \brief HalfFacetRep class implements the Array-Based Half-Facet(AHF) Mesh data structure on
00028 * top of MOAB. \ It is based on a generalized notion of a half-facet derived from that a
00029 * half-edge/half-face data structure for 2D/3D. \ The core construct of AHF are its two
00030 * maps: sibling-half-facets(SIBHFS) and vertex-to-half-facet(V2HF) \ 1. SIBHFS: Maps every
00031 * half-facet in the mesh to its sibling half-facets, \ 2. V2HF: Maps each vertex to an
00032 * incident half-facet \ Using these two maps, a range of adjacency queries is performed. The
00033 * maps are stored in dense tags over entities and vertices.
00034 * \
00035 * \ Adjacency functions:
00036 * \ 1. upward-incidence queries: vertex -> edge, edge -> faces, edge -> cells, face ->cells
00037 * \ 2. neighborhood (same-dimensional) adjacency queries: edge -> edges, face -> faces,
00038 * cell -> cells, etc. \ 3. downward adjacency queries: face -> edges, cell -> edges, etc.
00039 * \
00040 * \ Mesh types supported:
00041 * \ 1D(edges), 2D(triangles, quads), 3D(tet, pyramid, prism, hex), Mixed dimensional meshes
00042 * \
00043 * \ CURRENTLY NOT SUPPORTED:
00044 * \ 1. Meshes with mixed entity types of same dimension. Ex. a volume mesh with both tets
00045 * and prisms. \ 2. create_if_missing = true \ 3. Modified meshes
00046 * \
00047 */
00048
00049 typedef EntityHandle HFacet;
00050
00051 const int MAXSIZE = 200;
00052
00053 //! ENUM for the type of input mesh.
00054 enum MESHTYPE
00055 {
00056 CURVE = 0, // Homogeneous curve mesh
00057 SURFACE, // Homogeneous surface mesh
00058 SURFACE_MIXED, // Mixed surface with embedded curves
00059 VOLUME, // Homogeneous volume mesh
00060 VOLUME_MIXED_1, // Volume mesh with embedded curves
00061 VOLUME_MIXED_2, // Volume mesh with embedded surface
00062 VOLUME_MIXED // Volume mesh with embedded curves and surfaces
00063 };
00064
00065 enum
00066 {
00067 MAX_VERTICES = 8,
00068 MAX_EDGES = 12,
00069 MAX_FACES = 6,
00070 MAX_VERTS_HF = 4,
00071 MAX_INCIDENT_HF = 4
00072 };
00073
00074 class Core;
00075 class ParallelComm;
00076 class HalfFacetRep
00077 {
00078
00079 public:
00080 HalfFacetRep( Core* impl, ParallelComm* comm = 0, moab::EntityHandle rset = 0, bool filter_ghosts = true );
00081
00082 ~HalfFacetRep();
00083
00084 bool check_mixed_entity_type();
00085
00086 // User interface functions
00087
00088 //! Constructs the sibling-half-facet and vertex-to-incident-half-facet maps for each dimension
00089 //! present in the input. This routine should be called before any calls for adjacency is made.
00090 ErrorCode initialize();
00091
00092 //! Deinitialize
00093 ErrorCode deinitialize();
00094
00095 //! Prints the tag values.
00096 ErrorCode print_tags( int dim );
00097
00098 //! Get the adjacencies associated with an entity.
00099 /** Given an entity of dimension d, gather all the adjacent D dimensional
00100 * entities where D >, = , < d .
00101 *
00102 * \param source_entity EntityHandle to which adjacent entities have to be found.
00103 * \param target_dimension Int Dimension of the desired adjacent entities.
00104 * \param target_entities Vector in which the adjacent EntityHandle are returned.
00105 */
00106
00107 ErrorCode get_adjacencies( const EntityHandle source_entity,
00108 const unsigned int target_dimension,
00109 std::vector< EntityHandle >& target_entities );
00110
00111 //! Get the upward incidences associated with an entity.
00112 /** Given an entity of dimension d, gather all the incident D(>d) dimensional
00113 * entities.
00114 * :
00115 * \param ent EntityHandle to which incident entities have to be found.
00116 * \param out_dim Dimension of the desired incidence information.
00117 * \param adjents Vector in which the incident entities are returned.
00118 * \param local_id Set to false by default. If true, returns the local id's of the half-facets
00119 * \param lids Vector in which the local id's are returned.
00120 */
00121
00122 ErrorCode get_up_adjacencies( EntityHandle ent,
00123 int out_dim,
00124 std::vector< EntityHandle >& adjents,
00125 std::vector< int >* lids = NULL );
00126
00127 //! Get the same-dimensional entities connected with an entity.
00128 /** Given an entity of dimension d, gather all the entities connected via d-1
00129 * dimensional entities. Same as bridge_adjacencies in MOAB.
00130 *
00131 * \param ent EntityHandle to which neighbor entities have to be found.
00132 * \param adjents Vector in which the neighbor entities are returned.
00133 */
00134
00135 ErrorCode get_neighbor_adjacencies( EntityHandle ent, std::vector< EntityHandle >& adjents );
00136
00137 //! Get the downward adjacent entities connected with an entity.
00138 /** Given an entity of dimension d, gather all the d-1 dimensional entities.
00139 *
00140 * \param ent EntityHandle to which neighbor entities have to be found.
00141 * \param out_dim Dimension of the desired downward adjacency.
00142 * \param adjents Vector in which the neighbor entities are returned.
00143 */
00144
00145 ErrorCode get_down_adjacencies( EntityHandle ent, int out_dim, std::vector< EntityHandle >& adjents );
00146
00147 // 1D Maps and queries
00148
00149 //! Given a range of edges, determines the map for sibling half-verts and stores them into
00150 //! SIBHVS_EID, SIBHVS_LVID tags.
00151 /** Compute all sibling half-vertices for all half-vertices in the given curve. The sibling
00152 * half-verts is defined in terms of the containing edge and the local id of the vertex w.r.t
00153 * that edge. That is, the map consists of two pieces of information:
00155 *
00156 * \param edges Range of edges.
00157 */
00158
00159 ErrorCode determine_sibling_halfverts( Range& verts, Range& edges );
00160
00161 //! Given a range of edges, determines the map for incident half-verts and stores them into
00162 //! V2HV_EID, V2HV_LVID tags.
00163 /** Compute a map between a vertex and an incident half-vertex. This map is not always required,
00164 * but is essential for local neighborhood searching as it acts like an anchor to start the
00165 * search.
00166 *
00167 * \param edges Range of edges
00168 */
00169
00170 ErrorCode determine_incident_halfverts( Range& edges );
00171
00172 //! Given a vertex, finds the edges incident on it.
00173 /** Given a vertex handle, it starts by first finding an incident half-vert by using the
00174 * incident half-vert map, and then obtaining all the sibling half-verts of the corresponding
00175 * half-vertex.
00176 *
00177 * \param vid EntityHandle of the query vertex
00178 * \param adjents Vector returning the incident edges
00179 * \param local_id False by default. If true, returns the local vertex id's corresponding to vid
00180 * \param lvids Vector returning the local vertex id's
00181 */
00182
00183 ErrorCode get_up_adjacencies_1d( EntityHandle vid,
00184 std::vector< EntityHandle >& adjents,
00185 std::vector< int >* lvids = NULL );
00186
00187 //! Given an edge, finds vertex-connected neighbor edges
00188 /** Given an edge, it gathers all the incident edges of each vertex of the edge.
00189 *
00190 * \param eid EntityHandle of the query edge
00191 * \param adjents Vector returning neighbor edges
00192 */
00193
00194 ErrorCode get_neighbor_adjacencies_1d( EntityHandle eid, std::vector< EntityHandle >& adjents );
00195
00196 // 2D Maps and queries
00197
00198 //! Given a range of faces, determines the sibling half-edges and stores them into SIBHES_FID,
00199 //! SIBHES_LEID tags.
00200 /** Compute all sibling half-edges for all half-edges in the given surface.
00201 * The sibling half-edges is defined in terms of the containing face and the local id of the
00202 * edge w.r.t that entity. That is, the map consists of two pieces of information:
00204 *
00205 * \param faces Range of faces
00206 */
00207
00208 ErrorCode determine_sibling_halfedges( Range& faces );
00209
00210 //! Given a range of faces, determines the incident half-edges and stores them into V2HE_FID,
00211 //! V2HE_LEID tags.
00212 /** Compute a map between a vertex and an incident half-edge.
00213 * This map is not always required, but is essential for local neighborhood searching as it acts
00214 * like an anchor to start the search.
00215 *
00216 * \param faces Range of faces
00217 */
00218
00219 ErrorCode determine_incident_halfedges( Range& faces );
00220
00221 //! Given a vertex, finds the faces incident on it.
00222 /** Given a vertex, it first finds an incident half-edge via v2he map, and then
00223 * collects all the incident half-edges/faces via the sibhes map.
00224 *
00225 * \param vid EntityHandle of the query vertex
00226 * \param adjents Vector returning the incident faces
00227 */
00228
00229 ErrorCode get_up_adjacencies_vert_2d( EntityHandle vid, std::vector< EntityHandle >& adjents );
00230
00231 //! Given an edge, finds the faces incident on it.
00232 /** Given an edge, it first finds a matching half-edge corresponding to eid, and then
00233 * collects all the incident half-edges/faces via the sibhes map.
00234 *
00235 * \param eid EntityHandle of the query edge
00236 * \param adjents Vector returning the incident faces
00237 * \param local_id By default false. If true, returns the local edge id's corresponding to the
00238 * input edge \param leids Vector returning local edge ids
00239 */
00240
00241 ErrorCode get_up_adjacencies_2d( EntityHandle eid,
00242 std::vector< EntityHandle >& adjents,
00243 std::vector< int >* leids = NULL );
00244
00245 //! Given a half-edge , finds the faces incident on it.
00246 /**
00247 *
00248 * \param fid EntityHandle of the containing face
00249 * \param leid local id of the edge w.r.t to the face
00250 * \param add_inent If true, adds the input fid into the returning vector of adjents.
00251 * \param adjents Vector returning the incident faces
00252 * \param local_id By default false. If true, returns the local edge id's as well.
00253 * \param leids Vector returning local edge ids
00254 */
00255
00256 ErrorCode get_up_adjacencies_2d( EntityHandle fid,
00257 int leid,
00258 bool add_inent,
00259 std::vector< EntityHandle >& adj_ents,
00260 std::vector< int >* adj_leids = NULL,
00261 std::vector< int >* adj_orients = NULL );
00262
00263 //! Given an edge, finds edge-connected neighbor face
00264 /** Given an face, it gathers all the neighbor faces of each local edge of the face.
00265 *
00266 * \param fid EntityHandle of the query face
00267 * \param adjents Vector returning neighbor faces
00268 */
00269
00270 ErrorCode get_neighbor_adjacencies_2d( EntityHandle fid, std::vector< EntityHandle >& adjents );
00271
00272 //! Given a face, finds its edges.
00273 /** Given a face, it first finds incident edges on each vertex of the face, and then
00274 * it performs a set intersection to gather all the edges of the given face.
00275 *
00276 * \param fid EntityHandle of the query face
00277 * \param adjents Vector returning its edges
00278 */
00279
00280 ErrorCode get_down_adjacencies_2d( EntityHandle fid, std::vector< EntityHandle >& adjents );
00281
00282 //! Given a range of faces, finds the total number of edges.
00283
00284 int find_total_edges_2d( Range& faces );
00285
00286 ErrorCode get_face_edges( EntityHandle fid, std::vector< EntityHandle >& edges );
00287
00288 // 3D Maps and queries
00289
00290 //! Given a range of cells, determines the sibling half-faces and stores them into SIBHFS_CID,
00291 //! SIBHFS_LFID tags.
00292 /** Compute all sibling half-faces for all half-faces in the given volume.
00293 * The sibling half-faces is defined in terms of the containing cell and the local id of the
00294 * face w.r.t that cell. That is, the map consists of two pieces of information:
00296 *
00297 * \param faces Range of cells
00298 */
00299
00300 ErrorCode determine_sibling_halffaces( Range& cells );
00301
00302 //! Given a range of cells, determines the incident half-faces and stores them into V2HF_CID,
00303 //! V2HF_LFID tags.
00304 /** Compute a map between a vertex and an incident half-face.
00305 * This map is not always required, but is essential for local neighborhood searching as it acts
00306 * like an anchor to start the search.
00307 *
00308 * \param faces Range of cells
00309 */
00310
00311 ErrorCode determine_incident_halffaces( Range& cells );
00312
00313 //! Given a range of cells, tags all border vertices with a true value.
00314 /** Tag border vertices by using the sibhf_cid map. All vertices on half-faces with no sibling
00315 * half-faces are considered as border vertices.
00316 *
00317 * \param cells Range of cells
00318 * \param isborder: A dense tag over all vertices of size 1. Value is true for a border vertex,
00319 * otherwise is false.
00320 */
00321
00322 ErrorCode determine_border_vertices( Range& cells, Tag isborder );
00323
00324 //! Given a vertex, finds the cells incident on it.
00325 /** Given a vertex, it first finds an incident half-face via v2hf map, and then
00326 * collects all the incident half-faces via the sibhfs map.
00327 *
00328 * \param vid EntityHandle of the query vertex
00329 * \param adjents Vector returning the incident cells
00330 */
00331
00332 ErrorCode get_up_adjacencies_vert_3d( EntityHandle vid, std::vector< EntityHandle >& adjents );
00333
00334 //! Given an edge, finds the cells incident on it.
00335 /** Given an edge, it first finds a matching local edge in a cell corresponding to eid, and then
00336 * collects all the incident cells via the sibhfs map.
00337 *
00338 * \param eid EntityHandle of the query edge
00339 * \param adjents Vector returning the incident cells
00340 * \param local_id By default false. If true, returns the local edge id's corresponding to the
00341 * input edge \param leids Vector returning local edge ids
00342 */
00343
00344 ErrorCode get_up_adjacencies_edg_3d( EntityHandle eid,
00345 std::vector< EntityHandle >& adjents,
00346 std::vector< int >* leids = NULL );
00347
00348 //! Given a local edge , finds the cells incident on it.
00349 /** Given a local edge, it gathers all the incident cells via the sibhfs map.
00350 *
00351 * \param cid EntityHandle of the cell containing the local edge
00352 * \param leid local edge id w.r.t the cell
00353 * \param adjents Vector returning the incident cells
00354 * \param local_id By default false. If true, returns the local edge id's corresponding to the
00355 * input edge \param leids Vector returning local edge ids
00356 */
00357
00358 ErrorCode get_up_adjacencies_edg_3d( EntityHandle cid,
00359 int leid,
00360 std::vector< EntityHandle >& adjents,
00361 std::vector< int >* leids = NULL,
00362 std::vector< int >* adj_orients = NULL );
00363
00364 ErrorCode get_up_adjacencies_edg_3d_comp( EntityHandle cid,
00365 int leid,
00366 std::vector< EntityHandle >& adjents,
00367 std::vector< int >* leids = NULL,
00368 std::vector< int >* adj_orients = NULL );
00369
00370 //! Given an face, finds the cells incident on it.
00371 /** Given an face, it first finds a matching half-face in a cell corresponding to face, and then
00372 * collects all the incident cells via the sibhfs map.
00373 *
00374 * \param fid EntityHandle of the query face
00375 * \param adjents Vector returning the incident cells
00376 * \param local_id By default false. If true, returns the local face id's corresponding to the
00377 * input face \param leids Vector returning local face ids
00378 */
00379
00380 ErrorCode get_up_adjacencies_face_3d( EntityHandle fid,
00381 std::vector< EntityHandle >& adjents,
00382 std::vector< int >* lfids = NULL );
00383
00384 //! Given a local face , finds the cells incident on it.
00385 /** Given a local face, it gathers all the incident cells via the sibhfs map.
00386 *
00387 * \param cid EntityHandle of the cell containing the local edge
00388 * \param lfid local face id w.r.t the cell
00389 * \param adjents Vector returning the incident cells
00390 * \param local_id By default false. If true, returns the local face id's corresponding to the
00391 * input face \param lfids Vector returning local face ids
00392 */
00393
00394 ErrorCode get_up_adjacencies_face_3d( EntityHandle cid,
00395 int lfid,
00396 std::vector< EntityHandle >& adjents,
00397 std::vector< int >* lfids = NULL );
00398
00399 //! Given a cell, finds face-connected neighbor cells
00400 /** Given a cell, it gathers all the neighbor cells of each local face of the cell.
00401 *
00402 * \param cid EntityHandle of the query cell
00403 * \param adjents Vector returning neighbor cells
00404 */
00405
00406 ErrorCode get_neighbor_adjacencies_3d( EntityHandle cid, std::vector< EntityHandle >& adjents );
00407
00408 //! Given a cell, finds its edges.
00409 /** Given a cell, it first finds incident edges on each vertex of the cell, and then
00410 * it performs a set intersection to gather all the edges of the given cell.
00411 *
00412 * \param cid EntityHandle of the query cell
00413 * \param adjents Vector returning its edges
00414 */
00415
00416 ErrorCode get_down_adjacencies_edg_3d( EntityHandle cid, std::vector< EntityHandle >& adjents );
00417
00418 //! Given a cell, finds its faces.
00419 /** Given a cell, it first finds incident faces on each vertex of the cell, and then
00420 * performs a set intersection to gather all the faces of the given cell.
00421 *
00422 * \param cid EntityHandle of the query cell
00423 * \param adjents Vector returning its faces
00424 */
00425
00426 ErrorCode get_down_adjacencies_face_3d( EntityHandle cid, std::vector< EntityHandle >& adjents );
00427
00428 /* Find the number of edges and faces of given range of cells
00429 * */
00430 ErrorCode find_total_edges_faces_3d( const Range& cells, int* nedges, int* nfaces );
00431
00432 ErrorCode count_subentities( Range& edges, Range& faces, Range& cells, int* nedges, int* nfaces );
00433
00434 void get_memory_use( unsigned long long& entity_total, unsigned long long& memory_total );
00435
00436 ErrorCode get_half_facet_in_comp( EntityHandle cid,
00437 int leid,
00438 std::vector< EntityHandle >& ents,
00439 std::vector< int >& lids,
00440 std::vector< int >& lfids );
00441
00442 /**************************
00443 * Interface to AHF maps *
00444 **************************/
00445 HFacet create_halffacet( EntityHandle handle, int lid );
00446
00447 EntityHandle fid_from_halfacet( const HFacet facet, EntityType type );
00448
00449 int lid_from_halffacet( const HFacet facet );
00450
00451 ErrorCode update_entity_ranges( EntityHandle fileset );
00452
00453 ErrorCode resize_hf_maps( EntityHandle start_vert,
00454 int nverts,
00455 EntityHandle start_edge,
00456 int nedges,
00457 EntityHandle start_face,
00458 int nfaces,
00459 EntityHandle start_cell,
00460 int ncells );
00461
00462 ErrorCode get_sibling_map( EntityType type,
00463 EntityHandle ent,
00464 EntityHandle* sib_entids,
00465 int* sib_lids,
00466 int num_halffacets );
00467
00468 ErrorCode get_sibling_map( EntityType type, EntityHandle ent, int lid, EntityHandle& sib_entid, int& sib_lid );
00469
00470 ErrorCode set_sibling_map( EntityType type,
00471 EntityHandle ent,
00472 EntityHandle* set_entids,
00473 int* set_lids,
00474 int num_halffacets );
00475
00476 ErrorCode set_sibling_map( EntityType type, EntityHandle ent, int lid, EntityHandle& set_entid, int& set_lid );
00477
00478 ErrorCode get_incident_map( EntityType type,
00479 EntityHandle vid,
00480 std::vector< EntityHandle >& inci_entid,
00481 std::vector< int >& inci_lid );
00482
00483 ErrorCode set_incident_map( EntityType type,
00484 EntityHandle vid,
00485 std::vector< EntityHandle >& set_entid,
00486 std::vector< int >& set_lid );
00487
00488 bool check_nonmanifold_vertices( EntityType type, EntityHandle vid );
00489
00490 /**********************
00491 * Local Maps
00492 * ********************/
00493 //! 2D local maps
00494 struct LocalMaps2D
00495 {
00496 //! Number of vertices in a face
00497 short int num_verts_in_face;
00498 //! Local ids of the next half-edge
00499 int next[MAX_INCIDENT_HF];
00500 //! Local ids of the previous half-edge
00501 int prev[MAX_INCIDENT_HF];
00502 };
00503 static const LocalMaps2D lConnMap2D[2];
00504
00505 //! 3D local maps
00506 struct LocalMaps3D
00507 {
00508 //! Number of vertices in cell
00509 short int num_verts_in_cell;
00510 //! Number of edges in cell
00511 short int num_edges_in_cell;
00512 // Number of faces in cell
00513 short int num_faces_in_cell;
00514 //! Number of vertices in each half-face
00515 int hf2v_num[MAX_FACES];
00516 //! Map: Half-face to local vertex ids
00517 int hf2v[MAX_FACES][MAX_VERTS_HF];
00518 //! Number of incident half-faces on each vertex
00519 int v2hf_num[MAX_VERTICES];
00520 //! Map: Local vertices to incident half-facets
00521 int v2hf[MAX_VERTICES][MAX_INCIDENT_HF];
00522 //! Map: Local edges to local vertices
00523 int e2v[MAX_EDGES][2];
00524 //! Map: Local edges to incident half-faces
00525 int e2hf[MAX_EDGES][2];
00526 //! Map: Half-faces to local edges
00527 int f2leid[MAX_FACES][MAX_VERTS_HF];
00528 //! Map: local vertices to local edges
00529 int lookup_leids[MAX_VERTICES][MAX_VERTICES];
00530 //! Search edge verts:
00531 int search_everts[5];
00532 int search_fverts[2];
00533 int v2le[4][5];
00534 };
00535 static const LocalMaps3D lConnMap3D[4];
00536 MESHTYPE thismeshtype;
00537
00538 std::map< EntityType, int > cell_index;
00539
00540 int get_index_in_lmap( EntityHandle cid );
00541 ErrorCode get_entity_ranges( Range& verts, Range& edges, Range& faces, Range& cells );
00542 MESHTYPE get_mesh_type( int nverts, int nedges, int nfaces, int ncells );
00543
00544 EntityHandle* get_rset()
00545 {
00546 return &_rset;
00547 }
00548
00549 protected:
00550 HalfFacetRep();
00551
00552 Core* mb;
00553 ParallelComm* pcomm;
00554 EntityHandle _rset;
00555 bool _filterghost;
00556 bool mInitAHFmaps;
00557
00558 Range _verts, _edges, _faces, _cells;
00559
00560 // AHF map storage containers for 1D, 2D, 3D
00561 std::vector< HFacet > sibhvs, v2hv;
00562 std::vector< HFacet > sibhes, v2he;
00563 std::vector< HFacet > sibhfs, v2hf;
00564
00565 // AHF maps for non-manifold vertices 2D, 3D
00566 std::multimap< EntityHandle, HFacet > v2hes, v2hfs;
00567
00568 // Auxiliary storage for local searches.
00569 EntityHandle queue_fid[MAXSIZE], Stkcells[MAXSIZE], cellq[MAXSIZE];
00570 EntityHandle trackfaces[MAXSIZE], trackcells[MAXSIZE];
00571 int queue_lid[MAXSIZE];
00572
00573 struct adj_matrix
00574 {
00575 int val[4][4];
00576 };
00577
00578 static const adj_matrix adjMatrix[7];
00579 int get_index_for_meshtype( MESHTYPE mesh_type );
00580
00581 // These two flags are for checking mixed entity type meshes
00582 bool is_mixed;
00583 bool chk_mixed;
00584
00585 ErrorCode init_curve();
00586 ErrorCode init_surface();
00587 ErrorCode init_volume();
00588
00589 //! Contains the local information for 2D entities
00590 /** Given a face, find the face type specific information
00591 *
00592 * \param face EntityHandle. Used to gather info about the type of face for which local info is
00593 * required \param nepf: Returns the number of vertices/edges for given face type.
00594 */
00595
00596 //! Contains the local information for 2D entities
00597 /** Given number of edges, returns local indices of next and previous local edges.
00598 *
00599 * \param nepf: The number of vertices/edges for given face type.
00600 * \param next, prev: Local ids of next and previous edges w.r.t to the face
00601 *
00602 * Note: For 2D entities, the number of vertices and edges are same and each local edge is
00603 outgoing
00604 * corresponding to the local vertex, i.e,
00605
00606 v2 v3 __e2__v2
00607 /\ | |
00608 e2 / \ e1 e3| |e1
00609 /____\ |______|
00610 v0 e0 v1 v0 e0 v1
00611 */
00612
00613 //! Given a half-edge as , finds the half-edges incident on it and adds them
00614 // to an input queue if it not already added.
00615 /** Given an half-edge, obtain all the incident half-edges via the sibhes map and add them to a
00616 * given queue of half-edges, if they do not already exist in the queue. This function is used
00617 * to increment the search space for finding a matching half-edge.
00618 *
00619 * \param he_fid EntityHandle of query half-edge
00620 * \param he_lid Local id of query half-edge
00621 */
00622
00623 ErrorCode get_up_adjacencies_2d( EntityHandle he_fid, int he_lid, int* qsize, int* count );
00624
00625 //! Given an edge, finds a matching half-edge in the surface.
00626 /** Given an edge eid, it first collects few half-edges belonging to one-ring neighborhood of
00627 * the starting vertex of the given edge, and then simultaneously searches and adds to the local
00628 * list of half-edges for searching, till it finds a matching half-edge.
00629 *
00630 * \param eid EntityHandle of the query edge
00631 * \param hefid, helid: Returns the matching half-edge corresponding to the query edge.
00632 */
00633
00634 bool find_matching_halfedge( EntityHandle eid, EntityHandle* hefid, int* helid );
00635
00636 //! Gather half-edges to a queue of half-edges.
00637 /** Given a vertex vid, and a half-edge , add another half-edge in the same face
00638 * sharing the vertex
00639 */
00640
00641 ErrorCode gather_halfedges( EntityHandle vid, EntityHandle he_fid, int he_lid, int* qsize, int* count );
00642
00643 //! Obtains another half-edge belonging to the same face as the input half-edge
00644 /** It uses the local maps to find another half-edge that is either incident or outgoing
00645 * depending on vid and input half-edge
00646 */
00647
00648 ErrorCode another_halfedge( EntityHandle vid,
00649 EntityHandle he_fid,
00650 int he_lid,
00651 EntityHandle* he2_fid,
00652 int* he2_lid );
00653
00654 ErrorCode mark_halfedges( EntityHandle vid,
00655 EntityHandle he_fid,
00656 int he_lid,
00657 Range& faces,
00658 std::vector< char >& markHEdgs,
00659 HFacet& bnd_hf );
00660
00661 //! Collect and compare to find a matching half-edge with the given edge connectivity.
00662 /** Given edge connectivity, compare to an input list of half-edges to find a matching half-edge
00663 * and add a list of half-edges belonging to the one-ring neighborhood to a queue till it finds
00664 * a match.
00665 */
00666
00667 bool collect_and_compare( const EntityHandle vid,
00668 const EntityHandle* edg_vert,
00669 int* qsize,
00670 int* count,
00671 EntityHandle* he_fid,
00672 int* he_lid );
00673
00674 ErrorCode add_cells_of_single_component( EntityHandle vid,
00675 EntityHandle curcid,
00676 int curlid,
00677 std::multimap< EntityHandle, EntityHandle >& comps,
00678 HFacet& hf );
00679 bool find_cell_in_component( EntityHandle vid,
00680 EntityHandle cell,
00681 std::multimap< EntityHandle, EntityHandle >& comps );
00682
00683 //! Given an edge, finds a matching local edge in an incident cell.
00684 /** Find a local edge with the same connectivity as the input edge, belonging to an incident
00685 * cell.
00686 *
00687 * \param eid EntityHandle of the edge
00688 * \param cid Returns EntityHandle of the incident cell
00689 * \param leid Returns the local id of the edge corresponding to the input edge w.r.t the
00690 * incident cell.
00691 */
00692
00693 bool find_matching_implicit_edge_in_cell( EntityHandle eid,
00694 std::vector< EntityHandle >& cid,
00695 std::vector< int >& leid );
00696
00697 //! Given a face, finds a matching local face in an incident cell.
00698 /** Find a local face with the same connectivity as the input face, belonging to an incident
00699 * cell.
00700 *
00701 * \param fid EntityHandle of the face
00702 * \param cid Returns EntityHandle of the incident cell
00703 * \param lfid Returns the local id of the face corresponding to the input face w.r.t the
00704 * incident cell.
00705 */
00706
00707 bool find_matching_halfface( EntityHandle fid, EntityHandle* cid, int* leid );
00708
00709 bool find_match_in_array( EntityHandle ent,
00710 EntityHandle* ent_list,
00711 int count,
00712 bool get_index = false,
00713 int* index = NULL );
00714 };
00715
00716 } // namespace moab
00717
00718 #endif