![]() |
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_MESH_TOPO_UTIL_HPP
00017 #define MOAB_MESH_TOPO_UTIL_HPP
00018
00019 #include "moab/Forward.hpp"
00020
00021 namespace moab
00022 {
00023
00024 /*!
00025 * \authors Tim Tautges
00026 * \date 2/04
00027 * \brief MeshTopoUtil contains general mesh utility functions
00028 *
00029 */
00030 class MeshTopoUtil
00031 {
00032 public:
00033 MeshTopoUtil( Interface* impl ) : mbImpl( impl ) {}
00034
00035 ~MeshTopoUtil() {}
00036
00037 //! generate all the AEntities bounding the vertices
00038 ErrorCode construct_aentities( const Range& vertices );
00039
00040 //! given an entity, get its average position (avg vertex locations)
00041 ErrorCode get_average_position( Range& entities, double* avg_position );
00042
00043 //! given an entity, get its average position (avg vertex locations)
00044 ErrorCode get_average_position( const EntityHandle entity, double* avg_position );
00045
00046 //! given a set of entities, get their average position (avg vertex locations)
00047 ErrorCode get_average_position( const EntityHandle* entities, const int num_entities, double* avg_position );
00048
00049 //! get (target_dim)-dimensional manifold entities connected to star_entity; that is,
00050 //! the entities with <= 1 connected (target_dim+2)-dimensional adjacent entities;
00051 //! for target_dim=3, just return all of them
00052 //! just insert into the list, w/o clearing manifold list first
00053 ErrorCode get_manifold( const EntityHandle star_entity, const int target_dim, Range& manifold );
00054
00055 //! given an entity, find the entities of next higher dimension around
00056 //! that entity, ordered by connection through next higher dimension entities;
00057 //! if any of the star entities is in only entity of next higher dimension,
00058 //! on_boundary is returned true
00059 ErrorCode star_entities( const EntityHandle star_center,
00060 std::vector< EntityHandle >& star_entities,
00061 bool& bdy_entity,
00062 const EntityHandle starting_star_entity = 0,
00063 std::vector< EntityHandle >* star_entities_dp1 = NULL,
00064 Range* star_entities_candidates_dp1 = NULL );
00065
00066 //! Get a series of (d+1)-dimensional stars around a d-dimensional entity, such that
00067 //! each star is on a (d+2)-manifold containing the d-dimensional entity; each star
00068 //! is either open or closed, and also defines a (d+2)-star whose entities are bounded by
00069 //! (d+1)-entities on the star and on the (d+2)-manifold
00070 ErrorCode star_entities_nonmanifold( const EntityHandle star_entity,
00071 std::vector< std::vector< EntityHandle > >& stars,
00072 std::vector< bool >* bdy_flags = NULL,
00073 std::vector< std::vector< EntityHandle > >* dp2_stars = NULL );
00074
00075 //! given a star_center, a last_entity (whose dimension should be 1 greater than center)
00076 //! and last_dp1 (dimension 2 higher than center), returns the next star entity across
00077 //! last_dp1, and the next dp1 entity sharing next_entity; if star_candidates is non-empty,
00078 //! star must come from those
00079 ErrorCode star_next_entity( const EntityHandle star_center,
00080 const EntityHandle last_entity,
00081 const EntityHandle last_dp1,
00082 Range* star_candidates_dp1,
00083 EntityHandle& next_entity,
00084 EntityHandle& next_dp1 );
00085
00086 //! get "bridge" or "2nd order" adjacencies, going through dimension bridge_dim
00087 ErrorCode get_bridge_adjacencies( Range& from_entities,
00088 int bridge_dim,
00089 int to_dim,
00090 Range& to_ents,
00091 int num_layers = 1 );
00092
00093 //! get "bridge" or "2nd order" adjacencies, going through dimension bridge_dim
00094 ErrorCode get_bridge_adjacencies( const EntityHandle from_entity,
00095 const int bridge_dim,
00096 const int to_dim,
00097 Range& to_adjs );
00098
00099 //! return a common entity of the specified dimension, or 0 if there isn't one
00100 EntityHandle common_entity( const EntityHandle ent1, const EntityHandle ent2, const int dim );
00101
00102 //! return the opposite side entity given a parent and bounding entity.
00103 //! This function is only defined for certain types of parent/child types;
00104 //! See MBCN.hpp::OppositeSide for details.
00105 //!
00106 //! \param parent The parent element
00107 //! \param child The child element
00108 //! \param opposite_element The index of the opposite element
00109 ErrorCode opposite_entity( const EntityHandle parent, const EntityHandle child, EntityHandle& opposite_element );
00110
00111 //! split entity which is non-manifold, that is, which has > 2 connected entities
00112 //! of next higher dimension; assumes that there are >= 2 connected regions of
00113 //! (d+2)-dimensional entities; a new d-entity is created for each region after the
00114 //! first, and it's made explicitly-adjacent to the region to which it corresponds
00115 ErrorCode split_entity_nonmanifold( EntityHandle split_ent,
00116 Range& old_adjs,
00117 Range& new_adjs,
00118 EntityHandle& new_entity );
00119
00120 //! split entities that are manifold (shared by two or less entities of each higher dimension),
00121 //! optionally creating an entity of next higher dimension to fill the gap
00122 /**
00123 \param entities The entities to be split
00124 \param new_entities New entities, in order of correspondence to that of entities
00125 \param fill_entities If non-NULL, create an entity of next higher dimension to fill the gap,
00126 passing it back in *fill_entities
00127 */
00128 ErrorCode split_entities_manifold( Range& entities, Range& new_entities, Range* fill_entities );
00129
00130 //! split entities that are manifold (shared by two or less entities of each higher dimension),
00131 //! optionally creating an entity of next higher dimension to fill the gap
00132 /**
00133 \param entities The entities to be split
00134 \param new_entities New entities, in order of correspondence to that of entities
00135 \param fill_entities If non-NULL, create an entity of next higher dimension to fill the gap,
00136 passing it back in *fill_entities
00137 \param gowith_ents If non-NULL, each of the new entities will adj to the
00138 corresponding gowith entities after the split; this parameter is
00139 ignored for boundary split entities; in that case, the split entity
00140 remains on the boundary (i.e. not adj to any entity of higher
00141 dimension). Dimension of gowith_ents must be the same as entities.
00142 */
00143 ErrorCode split_entities_manifold( EntityHandle* entities,
00144 const int num_entities,
00145 EntityHandle* new_entities,
00146 Range* fill_entities,
00147 EntityHandle* gowith_ents = NULL );
00148
00149 //! return whether entity is equivalent to any other of same type and same vertices;
00150 //! if equivalent entity is found, it's returned in equiv_ents and return value is true,
00151 //! false otherwise.
00152 bool equivalent_entities( const EntityHandle entity, Range* equiv_ents = NULL );
00153
00154 private:
00155 Interface* mbImpl;
00156 };
00157
00158 } // namespace moab
00159
00160 #endif