LCOV - code coverage report
Current view: top level - src/moab - MeshTopoUtil.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 2 2 100.0 %
Date: 2020-12-16 07:07:30 Functions: 2 2 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /**
       2                 :            :  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
       3                 :            :  * storing and accessing finite element mesh data.
       4                 :            :  *
       5                 :            :  * Copyright 2004 Sandia Corporation.  Under the terms of Contract
       6                 :            :  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
       7                 :            :  * retains certain rights in this software.
       8                 :            :  *
       9                 :            :  * This library is free software; you can redistribute it and/or
      10                 :            :  * modify it under the terms of the GNU Lesser General Public
      11                 :            :  * License as published by the Free Software Foundation; either
      12                 :            :  * version 2.1 of the License, or (at your option) any later version.
      13                 :            :  *
      14                 :            :  */
      15                 :            : 
      16                 :            : #ifndef MOAB_MESH_TOPO_UTIL_HPP
      17                 :            : #define MOAB_MESH_TOPO_UTIL_HPP
      18                 :            : 
      19                 :            : #include "moab/Forward.hpp"
      20                 :            : 
      21                 :            : namespace moab
      22                 :            : {
      23                 :            : 
      24                 :            : /*!
      25                 :            :  *  \authors Tim Tautges
      26                 :            :  *  \date    2/04
      27                 :            :  *  \brief   MeshTopoUtil contains general mesh utility functions
      28                 :            :  *
      29                 :            :  */
      30                 :            : class MeshTopoUtil
      31                 :            : {
      32                 :            :   public:
      33                 :         45 :     MeshTopoUtil( Interface* impl ) : mbImpl( impl ) {}
      34                 :            : 
      35                 :         45 :     ~MeshTopoUtil() {}
      36                 :            : 
      37                 :            :     //! generate all the AEntities bounding the vertices
      38                 :            :     ErrorCode construct_aentities( const Range& vertices );
      39                 :            : 
      40                 :            :     //! given an entity, get its average position (avg vertex locations)
      41                 :            :     ErrorCode get_average_position( Range& entities, double* avg_position );
      42                 :            : 
      43                 :            :     //! given an entity, get its average position (avg vertex locations)
      44                 :            :     ErrorCode get_average_position( const EntityHandle entity, double* avg_position );
      45                 :            : 
      46                 :            :     //! given a set of entities, get their average position (avg vertex locations)
      47                 :            :     ErrorCode get_average_position( const EntityHandle* entities, const int num_entities, double* avg_position );
      48                 :            : 
      49                 :            :     //! get (target_dim)-dimensional manifold entities connected to star_entity; that is,
      50                 :            :     //! the entities with <= 1 connected (target_dim+2)-dimensional adjacent entities;
      51                 :            :     //! for target_dim=3, just return all of them
      52                 :            :     //! just insert into the list, w/o clearing manifold list first
      53                 :            :     ErrorCode get_manifold( const EntityHandle star_entity, const int target_dim, Range& manifold );
      54                 :            : 
      55                 :            :     //! given an entity, find the entities of next higher dimension around
      56                 :            :     //! that entity, ordered by connection through next higher dimension entities;
      57                 :            :     //! if any of the star entities is in only entity of next higher dimension,
      58                 :            :     //! on_boundary is returned true
      59                 :            :     ErrorCode star_entities( const EntityHandle star_center, std::vector< EntityHandle >& star_entities,
      60                 :            :                              bool& bdy_entity, const EntityHandle starting_star_entity = 0,
      61                 :            :                              std::vector< EntityHandle >* star_entities_dp1 = NULL,
      62                 :            :                              Range* star_entities_candidates_dp1            = NULL );
      63                 :            : 
      64                 :            :     //! Get a series of (d+1)-dimensional stars around a d-dimensional entity, such that
      65                 :            :     //! each star is on a (d+2)-manifold containing the d-dimensional entity; each star
      66                 :            :     //! is either open or closed, and also defines a (d+2)-star whose entities are bounded by
      67                 :            :     //! (d+1)-entities on the star and on the (d+2)-manifold
      68                 :            :     ErrorCode star_entities_nonmanifold( const EntityHandle star_entity,
      69                 :            :                                          std::vector< std::vector< EntityHandle > >& stars,
      70                 :            :                                          std::vector< bool >* bdy_flags                        = NULL,
      71                 :            :                                          std::vector< std::vector< EntityHandle > >* dp2_stars = NULL );
      72                 :            : 
      73                 :            :     //! given a star_center, a last_entity (whose dimension should be 1 greater than center)
      74                 :            :     //! and last_dp1 (dimension 2 higher than center), returns the next star entity across
      75                 :            :     //! last_dp1, and the next dp1 entity sharing next_entity; if star_candidates is non-empty,
      76                 :            :     //! star must come from those
      77                 :            :     ErrorCode star_next_entity( const EntityHandle star_center, const EntityHandle last_entity,
      78                 :            :                                 const EntityHandle last_dp1, Range* star_candidates_dp1, EntityHandle& next_entity,
      79                 :            :                                 EntityHandle& next_dp1 );
      80                 :            : 
      81                 :            :     //! get "bridge" or "2nd order" adjacencies, going through dimension bridge_dim
      82                 :            :     ErrorCode get_bridge_adjacencies( Range& from_entities, int bridge_dim, int to_dim, Range& to_ents,
      83                 :            :                                       int num_layers = 1 );
      84                 :            : 
      85                 :            :     //! get "bridge" or "2nd order" adjacencies, going through dimension bridge_dim
      86                 :            :     ErrorCode get_bridge_adjacencies( const EntityHandle from_entity, const int bridge_dim, const int to_dim,
      87                 :            :                                       Range& to_adjs );
      88                 :            : 
      89                 :            :     //! return a common entity of the specified dimension, or 0 if there isn't one
      90                 :            :     EntityHandle common_entity( const EntityHandle ent1, const EntityHandle ent2, const int dim );
      91                 :            : 
      92                 :            :     //! return the opposite side entity given a parent and bounding entity.
      93                 :            :     //! This function is only defined for certain types of parent/child types;
      94                 :            :     //! See MBCN.hpp::OppositeSide for details.
      95                 :            :     //!
      96                 :            :     //! \param parent The parent element
      97                 :            :     //! \param child The child element
      98                 :            :     //! \param opposite_element The index of the opposite element
      99                 :            :     ErrorCode opposite_entity( const EntityHandle parent, const EntityHandle child, EntityHandle& opposite_element );
     100                 :            : 
     101                 :            :     //! split entity which is non-manifold, that is, which has > 2 connected entities
     102                 :            :     //! of next higher dimension; assumes that there are >= 2 connected regions of
     103                 :            :     //! (d+2)-dimensional entities; a new d-entity is created for each region after the
     104                 :            :     //! first, and it's made explicitly-adjacent to the region to which it corresponds
     105                 :            :     ErrorCode split_entity_nonmanifold( EntityHandle split_ent, Range& old_adjs, Range& new_adjs,
     106                 :            :                                         EntityHandle& new_entity );
     107                 :            : 
     108                 :            :     //! split entities that are manifold (shared by two or less entities of each higher dimension),
     109                 :            :     //! optionally creating an entity of next higher dimension to fill the gap
     110                 :            :     /**
     111                 :            :        \param entities The entities to be split
     112                 :            :        \param new_entities New entities, in order of correspondence to that of entities
     113                 :            :        \param fill_entities If non-NULL, create an entity of next higher dimension to fill the gap,
     114                 :            :                        passing it back in *fill_entities
     115                 :            :     */
     116                 :            :     ErrorCode split_entities_manifold( Range& entities, Range& new_entities, Range* fill_entities );
     117                 :            : 
     118                 :            :     //! split entities that are manifold (shared by two or less entities of each higher dimension),
     119                 :            :     //! optionally creating an entity of next higher dimension to fill the gap
     120                 :            :     /**
     121                 :            :        \param entities The entities to be split
     122                 :            :        \param new_entities New entities, in order of correspondence to that of entities
     123                 :            :        \param fill_entities If non-NULL, create an entity of next higher dimension to fill the gap,
     124                 :            :                        passing it back in *fill_entities
     125                 :            :        \param gowith_ents If non-NULL, each of the new entities will adj to the
     126                 :            :                        corresponding gowith entities after the split; this parameter is
     127                 :            :                        ignored for boundary split entities; in that case, the split entity
     128                 :            :                        remains on the boundary (i.e. not adj to any entity of higher
     129                 :            :                        dimension).  Dimension of gowith_ents must be the same as entities.
     130                 :            :     */
     131                 :            :     ErrorCode split_entities_manifold( EntityHandle* entities, const int num_entities, EntityHandle* new_entities,
     132                 :            :                                        Range* fill_entities, EntityHandle* gowith_ents = NULL );
     133                 :            : 
     134                 :            :     //! return whether entity is equivalent to any other of same type and same vertices;
     135                 :            :     //! if equivalent entity is found, it's returned in equiv_ents and return value is true,
     136                 :            :     //! false otherwise.
     137                 :            :     bool equivalent_entities( const EntityHandle entity, Range* equiv_ents = NULL );
     138                 :            : 
     139                 :            :   private:
     140                 :            :     Interface* mbImpl;
     141                 :            : };
     142                 :            : 
     143                 :            : }  // namespace moab
     144                 :            : 
     145                 :            : #endif

Generated by: LCOV version 1.11