LCOV - code coverage report
Current view: top level - src/moab - Interface.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 14 18 77.8 %
Date: 2020-12-16 07:07:30 Functions: 13 14 92.9 %
Branches: 5 20 25.0 %

           Branch data     Line data    Source code
       1                 :            : /** \mainpage The Mesh-Oriented datABase (MOAB)
       2                 :            :  *
       3                 :            :  * MOAB is a component for representing and evaluating mesh data.  MOAB can store
       4                 :            :  * structured and unstructured mesh, consisting of elements in the finite element “zoo”,
       5                 :            :  * along with polygons and polyhedra.  The functional interface to MOAB is simple, consisting
       6                 :            :  * of only four fundamental data types.  This data is quite powerful, allowing the representation
       7                 :            :  * of most types of metadata commonly found on the mesh.  MOAB is optimized for efficiency in
       8                 :            :  * space and time, based on access to mesh in chunks rather than through individual entities,
       9                 :            :  * while also versatile enough to support individual entity access.
      10                 :            :  *
      11                 :            :  * The MOAB data model consists of the following four fundamental types: mesh interface instance,
      12                 :            :  * mesh entities (vertex, edge, tri, etc.), sets, and tags.  Entities are addressed through handles
      13                 :            :  * rather than pointers, to allow the underlying representation of an entity to change without
      14                 :            :  * changing the handle to that entity.  Sets are arbitrary groupings of mesh entities and other
      15                 :            :  * sets.  Sets also support parent/child relationships as a relation distinct from sets containing
      16                 :            :  * other sets.  The directed-graph provided by set parent/child relationships is useful for modeling
      17                 :            :  * topological relations from a geometric model and other metadata.  Tags are named data which can
      18                 :            :  * be assigned to the mesh as a whole, individual entities, or sets.  Tags are a mechanism for
      19                 :            :  * attaching data to individual entities and sets are a mechanism for describing relations between
      20                 :            :  * entities; the combination of these two mechanisms is a powerful yet simple interface for
      21                 :            :  * representing metadata or application-specific data.  For example, sets and tags can be used
      22                 :            :  * together to describe geometric topology, boundary condition, and inter-processor interface
      23                 :            :  * groupings in a mesh.
      24                 :            :  *
      25                 :            :  * MOAB's API is documented in the moab::Interface class.  Questions and comments should be sent to
      26                 :            :  * moab-dev _at_ mcs.anl.gov.
      27                 :            :  *
      28                 :            :  * \ref userguide "User's Guide"
      29                 :            :  *
      30                 :            :  * \ref developerguide "Developer's Guide"
      31                 :            :  *
      32                 :            :  * \ref metadata "I/O and Meta-Data Storage Conventions in MOAB"
      33                 :            :  *
      34                 :            :  * <a href="pages.html">Full List of Documents</a>
      35                 :            :  */
      36                 :            : 
      37                 :            : #ifdef WIN32               /* windows */
      38                 :            : #define _USE_MATH_DEFINES  // For M_PI
      39                 :            : #endif
      40                 :            : #ifndef MOAB_INTERFACE_HPP
      41                 :            : #define MOAB_INTERFACE_HPP
      42                 :            : 
      43                 :            : #define MOAB_API_VERSION        1.01
      44                 :            : #define MOAB_API_VERSION_STRING "1.01"
      45                 :            : 
      46                 :            : #include "moab/MOABConfig.h"
      47                 :            : #include "moab/Forward.hpp"
      48                 :            : #include "moab/Range.hpp"
      49                 :            : #include "moab/Compiler.hpp"
      50                 :            : #include "moab/ErrorHandler.hpp"
      51                 :            : 
      52                 :            : // include files
      53                 :            : #include <string>
      54                 :            : #include <functional>
      55                 :            : #include <typeinfo>
      56                 :            : 
      57                 :            : //! component architecture definitions
      58                 :            : #ifdef XPCOM_MB
      59                 :            : 
      60                 :            : #ifndef __gen_nsISupports_h__
      61                 :            : #include "nsISupports.h"
      62                 :            : #endif
      63                 :            : 
      64                 :            : #ifndef NS_NO_VTABLE
      65                 :            : #define NS_NO_VTABLE
      66                 :            : #endif
      67                 :            : 
      68                 :            : #define MBINTERFACE_IID_STR "f728830e-1dd1-11b2-9598-fb9f414f2465"
      69                 :            : 
      70                 :            : #define MBINTERFACE_IID                                    \
      71                 :            :     {                                                      \
      72                 :            :         0xf728830e, 0x1dd1, 0x11b2,                        \
      73                 :            :         {                                                  \
      74                 :            :             0x95, 0x98, 0xfb, 0x9f, 0x41, 0x4f, 0x24, 0x65 \
      75                 :            :         }                                                  \
      76                 :            :     }
      77                 :            : 
      78                 :            : #endif
      79                 :            : 
      80                 :            : #include "moab/UnknownInterface.hpp"
      81                 :            : #define MB_INTERFACE_VERSION "2.0.0"
      82                 :            : namespace moab
      83                 :            : {
      84                 :            : 
      85                 :       4804 : static const MBuuid IDD_MBCore = MBuuid( 0x8956e0a, 0xc300, 0x4005, 0xbd, 0xf6, 0xc3, 0x4e, 0xf7, 0x1f, 0x5a, 0x52 );
      86                 :            : 
      87                 :            : /**
      88                 :            :  * \class Interface Interface.hpp "moab/Interface.hpp"
      89                 :            :  * \brief Main interface class to MOAB
      90                 :            :  * \nosubgrouping
      91                 :            :  */
      92                 :            : #if defined( XPCOM_MB )
      93                 :            : class NS_NO_VTABLE Interface : public nsISupports
      94                 :            : {
      95                 :            : #else
      96                 :            : class Interface : public UnknownInterface
      97                 :            : {
      98                 :            : #endif
      99                 :            : 
     100                 :            :   public:
     101                 :            : #ifdef XPCOM_MB
     102                 :            :     NS_DEFINE_STATIC_IID_ACCESSOR( MBINTERFACE_IID )
     103                 :            : #endif
     104                 :            : 
     105                 :            :     /** \name Interface */
     106                 :            : 
     107                 :            :     /**@{*/
     108                 :            : 
     109                 :            :     //! constructor
     110                 :        744 :     Interface() {}
     111                 :            : 
     112                 :            :     //! destructor
     113         [ -  + ]:        738 :     virtual ~Interface() {}
     114                 :            : 
     115                 :            :     //! return the entity set representing the whole mesh
     116                 :            :     virtual EntityHandle get_root_set() = 0;
     117                 :            : 
     118                 :            :     //! Get a pointer to an internal MOAB interface
     119                 :            :     //!\return NULL if not found, iterface pointer otherwise
     120                 :            :     virtual ErrorCode query_interface_type( const std::type_info& iface_type, void*& iface ) = 0;
     121                 :            : 
     122                 :            :     //! Get a pointer to an internal MOAB interface
     123                 :            :     //!\return NULL if not found, iterface pointer otherwise
     124                 :            :     template < class IFace >
     125                 :       1229 :     ErrorCode query_interface( IFace*& ptr )
     126                 :            :     {
     127                 :            :         void* tmp_ptr;
     128 [ +  - ][ +  - ]:       1229 :         ErrorCode result = query_interface_type( typeid( IFace ), tmp_ptr );
                 [ +  - ]
     129                 :       1229 :         ptr              = reinterpret_cast< IFace* >( tmp_ptr );
     130                 :       1229 :         return result;
     131                 :            :     }
     132                 :            : 
     133                 :            :     //! Release reference to MB interface
     134                 :            :     virtual ErrorCode release_interface_type( const std::type_info& iface_type, void* iface ) = 0;
     135                 :            : 
     136                 :            :     template < class IFace >
     137                 :       1020 :     ErrorCode release_interface( IFace* interface )
     138                 :            :     {
     139                 :       1020 :         return release_interface_type( typeid( IFace ), interface );
     140                 :            :     }
     141                 :            : 
     142                 :            :     //! Release reference to MB interface
     143                 :            : 
     144                 :            :     //! Returns the major.minor version number of the interface
     145                 :            :     /**
     146                 :            :        \param version_string If non-NULL, will be filled in with a string, possibly
     147                 :            :        containing implementation-specific information
     148                 :            :     */
     149                 :            :     virtual float api_version( std::string* version_string = NULL );
     150                 :            : 
     151                 :            :     //! Returns the major.minor version number of the implementation
     152                 :            :     /**
     153                 :            :        \param version_string If non-NULL, will be filled in with a string, possibly
     154                 :            :        containing implementation-specific information
     155                 :            :     */
     156                 :            :     virtual float impl_version( std::string* version_string = NULL ) = 0;
     157                 :            : 
     158                 :            :     /**@}*/
     159                 :            : 
     160                 :            :     /** \name Type and id */
     161                 :            : 
     162                 :            :     /**@{*/
     163                 :            : 
     164                 :            :     //! Returns the entity type of an EntityHandle.
     165                 :            :     /** Returns the EntityType (ie, MBVERTEX, MBQUAD, MBHEX ) of <em>handle</em>.
     166                 :            :         \param handle The EntityHandle you want to find the entity type of.
     167                 :            :         \return type The entity type of <em>handle</em>.
     168                 :            : 
     169                 :            :         Example: \code
     170                 :            :         EntityType type = type_from_handle( handle);
     171                 :            :         if( type == MBHEX ) ...  \endcode
     172                 :            :     */
     173                 :            :     virtual EntityType type_from_handle( const EntityHandle handle ) const = 0;
     174                 :            : 
     175                 :            :     //! Returns the id from an EntityHandle.
     176                 :            :     /** \param handle The EntityHandle you want to find the id of.
     177                 :            :         \return id Id of <em>handle</em>
     178                 :            : 
     179                 :            :         Example: \code
     180                 :            :         int id = id_from_handle(handle); \endcode
     181                 :            :     */
     182                 :            :     virtual EntityID id_from_handle( const EntityHandle handle ) const = 0;
     183                 :            : 
     184                 :            :     //! Returns the topological dimension of an entity
     185                 :            :     /** Returns the topological dimension of an entity.
     186                 :            :         \param handle The EntityHandle you want to find the dimension of.
     187                 :            :         \return type The topological dimension of <em>handle</em>.
     188                 :            : 
     189                 :            :         Example: \code
     190                 :            :         int dim = dimension_from_handle( handle);
     191                 :            :         if( dim == 0 ) ...  \endcode
     192                 :            :     */
     193                 :            :     virtual int dimension_from_handle( const EntityHandle handle ) const = 0;
     194                 :            : 
     195                 :            :     //! Gets an entity handle from the data base, if it exists, according to type and id.
     196                 :            :     /** Given an EntiyType and an id, this function gets the existent EntityHandle.
     197                 :            :         If no such EntityHandle exits, it returns MB_ENTITY_NOT_FOUND
     198                 :            :         and sets handle to zero.
     199                 :            :         \param type The type of the EntityHandle to retrieve from the database.
     200                 :            :         \param id The id of the EntityHandle to retrieve from the database.
     201                 :            :         \param handle An EntityHandle of type <em>type</em> and <em>id</em>.
     202                 :            : 
     203                 :            :         Example: \code
     204                 :            :         EntityType handle;
     205                 :            :         ErrorCode error_code = handle_from_id(MBTRI, 204, handle );
     206                 :            :         if( error_code == MB_ENTITY_NOT_FOUND ) ... \endcode
     207                 :            :     */
     208                 :            :     virtual ErrorCode handle_from_id( const EntityType type, const EntityID, EntityHandle& handle ) const = 0;
     209                 :            : 
     210                 :            :     /**@}*/
     211                 :            : 
     212                 :            :     /** \name Mesh input/output */
     213                 :            : 
     214                 :            :     /**@{*/
     215                 :            : 
     216                 :            :     //! Loads a mesh file into the database.
     217                 :            :     /** Loads the file 'file_name'; types of mesh which can be loaded
     218                 :            :         depend on modules available at MB compile time.  If
     219                 :            :         active_block_id_list is NULL, all material sets (blocks in the
     220                 :            :         ExodusII jargon) are loaded.  Individual material sets  can be
     221                 :            :         loaded by specifying their ids in 'active_block_id_list'.  All
     222                 :            :         nodes are loaded on first call for a given file.  Subsequent
     223                 :            :         calls for a file load any material sets not loaded in previous
     224                 :            :         calls.
     225                 :            :         \param file_name Name of file to load into database.
     226                 :            :         \param active_block_id_list Material set/block ids to load.
     227                 :            :                 If NULL, ALL blocks of <em>file_name</em> are loaded.
     228                 :            :         \param num_blocks Number of blocks in active_block_id_list
     229                 :            : 
     230                 :            :         Example: \code
     231                 :            :         std::vector<int> active_block_id_list;
     232                 :            :         int active_block_id_list[] = {1, 4, 10};
     233                 :            :         load_mesh( "temp.gen", active_block_id_list, 3 );  //load blocks 1, 4, 10
     234                 :            :         \endcode
     235                 :            :     */
     236                 :            :     virtual ErrorCode load_mesh( const char* file_name, const int* active_block_id_list = NULL,
     237                 :            :                                  const int num_blocks = 0 ) = 0;
     238                 :            : 
     239                 :            :     /**\brief Load or import a file.
     240                 :            :      *
     241                 :            :      * Load a MOAB-native file or import data from some other supported
     242                 :            :      * file format.
     243                 :            :      *
     244                 :            :      *\param file_name The location of the file to read.
     245                 :            :      *\param file_set  If non-null, this argument must be a pointer to
     246                 :            :      *                 a valid entity set handle.  All entities read from
     247                 :            :      *                 the file will be added to this set.  File metadata
     248                 :            :      *                 will be added to tags on the set.
     249                 :            :      *\param options A list of string options, separated by semicolons (;).
     250                 :            :      *               See README.IO for more information.  Options are typically
     251                 :            :      *               format-specific options or parallel options.  If an
     252                 :            :      *               option value is unrecognized but the file read otherwise
     253                 :            :      *               succeeded, MB_UNHANDLED_OPTION will be returned.
     254                 :            :      *\param set_tag_name The name of a tag used to designate the subset
     255                 :            :      *               of the file to read.  The name must correspond to
     256                 :            :      *               data in the file that will be instantiated in MOAB
     257                 :            :      *               as a tag.
     258                 :            :      *\param set_tag_values If the name specified in 'set_tag_name'
     259                 :            :      *               corresponds to a tag with a single integer value,
     260                 :            :      *               the values in this tag can be used to further
     261                 :            :      *               limit the subset of data written from the file to
     262                 :            :      *               only those entities or sets that have a value for
     263                 :            :      *               the tag that is one of the values in this array.
     264                 :            :      *\param num_set_tag_values The length of set_tag_values.
     265                 :            :      *
     266                 :            :      *\Note file_set is passed by pointer rather than by value (where a
     267                 :            :      *      zero handle value would indicate no set) so as to intentionally
     268                 :            :      *      break compatibility with the previous version of this function
     269                 :            :      *      because the behavior with respect to the file set was changed.
     270                 :            :      *      The file_set is now an input-only argument.  The previous
     271                 :            :      *      version of this function unconditionally created a set and
     272                 :            :      *      passed it back to the caller via a non-const reference argument.
     273                 :            :      */
     274                 :            :     virtual ErrorCode load_file( const char* file_name, const EntityHandle* file_set = 0, const char* options = 0,
     275                 :            :                                  const char* set_tag_name = 0, const int* set_tag_values = 0,
     276                 :            :                                  int num_set_tag_values = 0 ) = 0;
     277                 :            : 
     278                 :            :     //! Writes mesh to a file.
     279                 :            :     /** Write mesh to file 'file_name'; if output_list is non-NULL, only
     280                 :            :         material sets contained in that list will be written.
     281                 :            :         \param file_name Name of file to write.
     282                 :            :         \param output_list 1d array of material set handles to write; if
     283                 :            :                            NULL, all sets are written
     284                 :            :         \param num_sets Number of sets in output_list array
     285                 :            : 
     286                 :            :         Example: \code
     287                 :            :         EntityHandle output_list[] = {meshset1, meshset2, meshset3};
     288                 :            :         write_mesh( "output_file.gen", output_list, 3 ); \endcode
     289                 :            :     */
     290                 :            :     virtual ErrorCode write_mesh( const char* file_name, const EntityHandle* output_list = NULL,
     291                 :            :                                   const int num_sets = 0 ) = 0;
     292                 :            : 
     293                 :            :     /**\brief Write or export a file.
     294                 :            :      *
     295                 :            :      * Write a MOAB-native file or export data to some other supported
     296                 :            :      * file format.
     297                 :            :      *
     298                 :            :      *\param file_name The location of the file to write.
     299                 :            :      *\param file_type The type of the file.  If this value is NULL,
     300                 :            :      *                 then file type will be determined using the
     301                 :            :      *                 file name suffix.
     302                 :            :      *\param options   A semicolon-separated list of options.
     303                 :            :      *                 See README.IO for more information.  Typical options
     304                 :            :      *                 include the file type, parallel options, and options
     305                 :            :      *                 specific to certain file formats.
     306                 :            :      *\param output_sets A list of entity sets to write to the file.  If
     307                 :            :      *                 no sets are sepcified, the default behavior is to
     308                 :            :      *                 write all data that is supported by the target file
     309                 :            :      *                 type.
     310                 :            :      *\param num_output_sets The length of the output_sets array.
     311                 :            :      *\param tag_list A list of tags for which to write the tag data.  The
     312                 :            :      *                write may fail if a tag list is specified but the
     313                 :            :      *                target file type is not capable of representing the
     314                 :            :      *                data.  If no tags are specified, the default is to
     315                 :            :      *                write whatever data the target file format supports.
     316                 :            :      *\param num_tags The length of tag_list.
     317                 :            :      */
     318                 :            :     virtual ErrorCode write_file( const char* file_name, const char* file_type = 0, const char* options = 0,
     319                 :            :                                   const EntityHandle* output_sets = 0, int num_output_sets = 0, const Tag* tag_list = 0,
     320                 :            :                                   int num_tags = 0 ) = 0;
     321                 :            : 
     322                 :            :     /**\brief Write or export a file.
     323                 :            :      *
     324                 :            :      * Write a MOAB-native file or export data to some other supported
     325                 :            :      * file format.
     326                 :            :      *
     327                 :            :      *\param file_name The location of the file to write.
     328                 :            :      *\param file_type The type of the file.  If this value is NULL,
     329                 :            :      *                 then file type will be determined using the
     330                 :            :      *                 file name suffix.
     331                 :            :      *\param options   A semicolon-separated list of options.
     332                 :            :      *                 See README.IO for more information.  Typical options
     333                 :            :      *                 include the file type, parallel options, and options
     334                 :            :      *                 specific to certain file formats.
     335                 :            :      *\param output_sets A list of entity sets to write to the file.  If
     336                 :            :      *                 no sets are sepcified, the default behavior is to
     337                 :            :      *                 write all data that is supported by the target file
     338                 :            :      *                 type.
     339                 :            :      *\param tag_list A list of tags for which to write the tag data.  The
     340                 :            :      *                write may fail if a tag list is specified but the
     341                 :            :      *                target file type is not capable of representing the
     342                 :            :      *                data.  If no tags are specified, the default is to
     343                 :            :      *                write whatever data the target file format supports.
     344                 :            :      *\param num_tags The length of tag_list.
     345                 :            :      */
     346                 :            :     virtual ErrorCode write_file( const char* file_name, const char* file_type, const char* options,
     347                 :            :                                   const Range& output_sets, const Tag* tag_list = 0, int num_tags = 0 ) = 0;
     348                 :            : 
     349                 :            :     //! Deletes all mesh entities from this MB instance
     350                 :            :     virtual ErrorCode delete_mesh() = 0;
     351                 :            : 
     352                 :            :     /**@}*/
     353                 :            : 
     354                 :            :     /** \name Coordinates and dimensions */
     355                 :            : 
     356                 :            :     /**@{*/
     357                 :            : 
     358                 :            :     //! Get blocked vertex coordinates for all vertices
     359                 :            :     /** Blocked = all x, then all y, etc.
     360                 :            : 
     361                 :            :     Example: \code
     362                 :            :     std::vector<double> coords;
     363                 :            :     get_vertex_coordinates(coords);
     364                 :            :     double xavg = 0;
     365                 :            :     for (int i = 0; i < coords.size()/3; i++) xavg += coords[i]; \endcode
     366                 :            :     */
     367                 :            :     virtual ErrorCode get_vertex_coordinates( std::vector< double >& coords ) const = 0;
     368                 :            : 
     369                 :            :     //! get pointers to coordinate data
     370                 :            :     /** BEWARE, THIS GIVES ACCESS TO MOAB'S INTERNAL STORAGE, USE WITH CAUTION!
     371                 :            :      * This function returns pointers to MOAB's internal storage for vertex coordinates.
     372                 :            :      * Access is similar to tag_iterate, see documentation for that function for details
     373                 :            :      * about arguments and a coding example.
     374                 :            :      */
     375                 :            :     virtual ErrorCode coords_iterate( Range::const_iterator iter,
     376                 :            :                                       /**< Iterator to first entity you want coordinates for */
     377                 :            :                                       Range::const_iterator end,
     378                 :            :                                       /**< Iterator to last entity you want coordinates for */
     379                 :            :                                       double*& xcoords_ptr,
     380                 :            :                                       /**< Pointer to x coordinate storage for these entities */
     381                 :            :                                       double*& ycoords_ptr,
     382                 :            :                                       /**< Pointer to y coordinate storage for these entities */
     383                 :            :                                       double*& zcoords_ptr,
     384                 :            :                                       /**< Pointer to z coordinate storage for these entities */
     385                 :            :                                       int& count
     386                 :            :                                       /**< Number of entities for which returned pointers are valid/contiguous */
     387                 :            :                                       ) = 0;
     388                 :            : 
     389                 :            :     //! Gets xyz coordinate information for range of vertices
     390                 :            :     /** Length of 'coords' should be at least 3*<em>entity_handles.size()</em> before making call.
     391                 :            :         \param entity_handles Range of vertex handles (error if not of type MBVERTEX)
     392                 :            :         \param coords Array used to return x, y, and z coordinates.
     393                 :            : 
     394                 :            :         Example: \code
     395                 :            :         double coords[3];
     396                 :            :         get_coords( vertex_handle, coords );
     397                 :            :         std::cout<<"x = "<<coords[0]<<std::endl;
     398                 :            :         std::cout<<"y = "<<coords[1]<<std::endl;
     399                 :            :         std::cout<<"z = "<<coords[2]<<std::endl; \endcode
     400                 :            :     */
     401                 :            :     virtual ErrorCode get_coords( const Range& entity_handles, double* coords ) const = 0;
     402                 :            : 
     403                 :            :     //! Gets xyz coordinate information for vector of vertices
     404                 :            :     /** Identical to range-based function, except entity handles are specified using a 1d vector
     405                 :            :         and vector length.
     406                 :            :     */
     407                 :            :     virtual ErrorCode get_coords( const EntityHandle* entity_handles, const int num_entities,
     408                 :            :                                   double* coords ) const = 0;
     409                 :            : 
     410                 :            :     /**\brief Get vertex coordinates in blocks by dimension.
     411                 :            :      *
     412                 :            :      * Get the X, Y, and Z coordinates of a group of vertices.
     413                 :            :      * Coordinates are returned in separate arrays, one for each
     414                 :            :      * dimension.  Each coordinate array must be of sufficient
     415                 :            :      * length to hold the coordinate value for each vertex.  Array
     416                 :            :      * pointers may be NULL if coordinates in the the respective
     417                 :            :      * dimension are not desired.
     418                 :            :      *\param entity_handles  The group of vertex handles for which to get the coordiantes.
     419                 :            :      *\param x_coords        Output: the X coordinate of each vertex.  May be NULL.
     420                 :            :      *\param y_coords        Output: the Y coordinate of each vertex.  May be NULL.
     421                 :            :      *\param z_coords        Output: the Z coordinate of each vertex.  May be NULL.
     422                 :            :      */
     423                 :            :     virtual ErrorCode get_coords( const Range& entity_handles, double* x_coords, double* y_coords,
     424                 :            :                                   double* z_coords ) const = 0;
     425                 :            : 
     426                 :            :     //! Sets the xyz coordinates for a vector of vertices
     427                 :            :     /** An error is returned if any entities in the vector are not vertices.
     428                 :            :         \param entity_handles EntityHandle's to set coordinates of. (Must be of type MBVERTEX)
     429                 :            :         \param num_entities Number of entities in entity_handles
     430                 :            :         \param coords Array containing new xyz coordinates.
     431                 :            : 
     432                 :            :         Example: \code
     433                 :            :         double coords[3] = {0.234, -2.52, 12.023};
     434                 :            :         set_coords( entity_handle, 1, coords ); \endcode
     435                 :            :     */
     436                 :            :     virtual ErrorCode set_coords( const EntityHandle* entity_handles, const int num_entities,
     437                 :            :                                   const double* coords ) = 0;
     438                 :            : 
     439                 :            :     //! Sets the xyz coordinates for a vector of vertices
     440                 :            :     /** An error is returned if any entities in the vector are not vertices.
     441                 :            :         \param entity_handles EntityHandle's to set coordinates of. (Must be of type MBVERTEX)
     442                 :            :         \param num_entities Number of entities in entity_handles
     443                 :            :         \param coords Array containing new xyz coordinates.
     444                 :            : 
     445                 :            :         Example: \code
     446                 :            :         double coords[3] = {0.234, -2.52, 12.023};
     447                 :            :         set_coords( entity_handle, 1, coords ); \endcode
     448                 :            :     */
     449                 :            :     virtual ErrorCode set_coords( Range entity_handles, const double* coords ) = 0;
     450                 :            : 
     451                 :            :     //! Get overall geometric dimension
     452                 :            :     virtual ErrorCode get_dimension( int& dim ) const = 0;
     453                 :            : 
     454                 :            :     //! Set overall geometric dimension
     455                 :            :     /** Returns error if setting to 3 dimensions, mesh has been created, and
     456                 :            :      *  there are only 2 dimensions on that mesh
     457                 :            :      */
     458                 :            :     virtual ErrorCode set_dimension( const int dim ) = 0;
     459                 :            : 
     460                 :            :     /**@}*/
     461                 :            : 
     462                 :            :     /** \name Connectivity */
     463                 :            : 
     464                 :            :     /**@{*/
     465                 :            : 
     466                 :            :     //! get pointers to connectivity data
     467                 :            :     /** BEWARE, THIS GIVES ACCESS TO MOAB'S INTERNAL STORAGE, USE WITH CAUTION!
     468                 :            :      * This function returns a pointer to MOAB's internal storage for entity connectivity.
     469                 :            :      * For each contiguous sub-range of entities, those entities are guaranteed to have
     470                 :            :      * the same number of vertices (since they're in the same ElementSequence).  Count
     471                 :            :      * is given in terms of entities, not elements of the connectivity array.
     472                 :            :      * Access is similar to tag_iterate, see documentation for that function for details
     473                 :            :      * about arguments and a coding example.
     474                 :            :      */
     475                 :            :     virtual ErrorCode connect_iterate( Range::const_iterator iter,
     476                 :            :                                        /**< Iterator to first entity you want coordinates for */
     477                 :            :                                        Range::const_iterator end,
     478                 :            :                                        /**< Iterator to last entity you want coordinates for */
     479                 :            :                                        EntityHandle*& connect,
     480                 :            :                                        /**< Pointer to connectivity storage for these entities */
     481                 :            :                                        int& verts_per_entity,
     482                 :            :                                        /**< Number of vertices per entity in this block of entities */
     483                 :            :                                        int& count
     484                 :            :                                        /**< Number of entities for which returned pointers are valid/contiguous */
     485                 :            :                                        ) = 0;
     486                 :            : 
     487                 :            :     //! Get the connectivity array for all entities of the specified entity type
     488                 :            :     /**  This function returns the connectivity of just the corner vertices, no higher order nodes
     489                 :            :          \param type The entity type of elements whose connectivity is to be returned
     490                 :            :          \param connect an STL vector used to return connectivity array (in the form of entity
     491                 :            :        handles)
     492                 :            :     */
     493                 :            :     virtual ErrorCode get_connectivity_by_type( const EntityType type, std::vector< EntityHandle >& connect ) const = 0;
     494                 :            : 
     495                 :            :     //! Gets the connectivity for a vector of elements
     496                 :            :     /** Same as vector-based version except range is returned (unordered!)
     497                 :            :      */
     498                 :            :     virtual ErrorCode get_connectivity( const EntityHandle* entity_handles, const int num_handles, Range& connectivity,
     499                 :            :                                         bool corners_only = false ) const = 0;
     500                 :            : 
     501                 :            :     //! Gets the connectivity for elements
     502                 :            :     /** Same as vector-based version except range is returned (unordered!)
     503                 :            :      */
     504                 :            :     virtual ErrorCode get_connectivity( const Range& entity_handles, Range& connectivity,
     505                 :            :                                         bool corners_only = false ) const = 0;
     506                 :            : 
     507                 :            :     //! Gets the connectivity for a vector of elements
     508                 :            :     /** Corner vertices or all vertices (including higher-order nodes, if any) are returned.
     509                 :            :         For non-element handles (ie, MB_MeshSets), returns an error. Connectivity data is copied
     510                 :            :         from the database into the vector.  Connectivity of a vertex is the same vertex.
     511                 :            :         The nodes in <em>connectivity</em> are properly ordered according to that element's
     512                 :            :         canonical ordering.
     513                 :            :         \param entity_handles Vector of element handles to get connectivity of.
     514                 :            :         \param num_handles Number of entity handles in <em>entity_handles</em>
     515                 :            :         \param connectivity Vector in which connectivity of <em>entity_handles</em> is returned.
     516                 :            :         \param corners_only If true, returns only corner vertices, otherwise returns all of them
     517                 :            :        (including any higher-order vertices) \param offsets If non-NULL, offsets->[i] stores the
     518                 :            :        index of the start of entity i's connectivity, with the last value in offsets one beyond the
     519                 :            :        last entry
     520                 :            :     */
     521                 :            :     virtual ErrorCode get_connectivity( const EntityHandle* entity_handles, const int num_handles,
     522                 :            :                                         std::vector< EntityHandle >& connectivity, bool corners_only = false,
     523                 :            :                                         std::vector< int >* offsets = NULL ) const = 0;
     524                 :            : 
     525                 :            :     //! Gets a pointer to constant connectivity data of <em>entity_handle</em>
     526                 :            :     /** Sets <em>number_nodes</em> equal to the number of nodes of the <em>
     527                 :            :         entity_handle </em>.  Faster then the other <em>get_connectivity</em> function because no
     528                 :            :         data is copied.  The nodes in 'connectivity' are properly ordered according to the
     529                 :            :         element's canonical ordering.
     530                 :            : 
     531                 :            : 
     532                 :            :           Example: \code
     533                 :            :           const EntityHandle* conn;
     534                 :            :           int number_nodes = 0;
     535                 :            :           get_connectivity( entity_handle, conn, number_nodes ); \endcode
     536                 :            : 
     537                 :            :           Example2: \code
     538                 :            :           std::vector<EntityHandle> sm_storage;
     539                 :            :           const EntityHandle* conn;
     540                 :            :           int number_nodes;
     541                 :            :           get_connectivity( handle, conn, number_nodes, false, &sm_storage );
     542                 :            :           if (conn == &sm_storage[0])
     543                 :            :             std::cout << "Structured mesh element" << std::endl;
     544                 :            :           \endcode
     545                 :            : 
     546                 :            :         \param entity_handle EntityHandle to get connectivity of.
     547                 :            :         \param connectivity Array in which connectivity of <em>entity_handle</em> is returned.
     548                 :            :         \param num_nodes Number of MeshVertices in array <em>connectivity</em>.
     549                 :            :         \param corners_only If true, returns only corner vertices, otherwise returns all of them
     550                 :            :        (including any higher-order vertices) \param storage Some elements (e.g. structured mesh) may
     551                 :            :        not have an explicit connectivity list.  This function will normally return
     552                 :            :        MB_NOT_IMPLEMENTED for such elements.  However, if the caller passes in a non-null value for
     553                 :            :        this argument, space will be allocated in this vector for the connectivity data and the
     554                 :            :        connectivity pointer will be set to the data in this vector.
     555                 :            :     */
     556                 :            :     virtual ErrorCode get_connectivity( const EntityHandle entity_handle, const EntityHandle*& connectivity,
     557                 :            :                                         int& num_nodes, bool corners_only = false,
     558                 :            :                                         std::vector< EntityHandle >* storage = 0 ) const = 0;
     559                 :            : 
     560                 :            :     //! Sets the connectivity for an EntityHandle.  For non-element handles, return an error.
     561                 :            :     /** Connectivity is stored exactly as it is ordered in vector <em>connectivity</em>.
     562                 :            :         \param entity_handle EntityHandle to set connectivity of.
     563                 :            :         \param connect Vector containing new connectivity of <em>entity_handle</em>.
     564                 :            :         \param num_connect Number of vertices in <em>connect</em>
     565                 :            : 
     566                 :            :         Example: \code
     567                 :            :         EntityHandle conn[] = {node1, node2, node3};
     568                 :            :         set_connectivity( tri_element, conn, 3 ); \endcode
     569                 :            :     */
     570                 :            :     virtual ErrorCode set_connectivity( const EntityHandle entity_handle, EntityHandle* connect,
     571                 :            :                                         const int num_connect ) = 0;
     572                 :            : 
     573                 :            :     /**@}*/
     574                 :            : 
     575                 :            :     /** \name Adjacencies */
     576                 :            : 
     577                 :            :     /**@{*/
     578                 :            : 
     579                 :            :     //! Get the adjacencies associated with a vector of entities to entities of a specfied
     580                 :            :     //! dimension.
     581                 :            :     /** \param from_entities Vector of EntityHandle to get adjacencies of.
     582                 :            :         \param num_entities Number of entities in <em>from_entities</em>
     583                 :            :         \param to_dimension Dimension of desired adjacencies
     584                 :            :         \param create_if_missing If true, MB will create any entities of the specfied dimension
     585                 :            :         which have not yet been created (only useful when <em>to_dimension <
     586                 :            :        dim(*from_entities)</em>) \param adj_entities STL vector to which adjacent entities are
     587                 :            :        appended. \param operation_type Enum of INTERSECT or UNION.  Defines whether to take the
     588                 :            :        intersection or union of the set of adjacencies recovered for the from_entities.
     589                 :            : 
     590                 :            :         The adjacent entities in vector <em>adjacencies</em> are not in any particular
     591                 :            :         order.
     592                 :            : 
     593                 :            :         Example: \code
     594                 :            :         std::vector<EntityHandle> adjacencies, from_entities = {hex1, hex2};
     595                 :            :           // generate all edges for these two hexes
     596                 :            :           get_adjacencies( from_entities, 2, 1, true, adjacencies, Interface::UNION);
     597                 :            :           adjacencies.clear();
     598                 :            :             // now find the edges common to both hexes
     599                 :            :             get_adjacencies( from_entities, 2, 1, false, adjacencies, Interface::INTERSECT);
     600                 :            :             \endcode
     601                 :            :     */
     602                 :            : 
     603                 :            :     virtual ErrorCode get_adjacencies( const EntityHandle* from_entities, const int num_entities,
     604                 :            :                                        const int to_dimension, const bool create_if_missing,
     605                 :            :                                        std::vector< EntityHandle >& adj_entities,
     606                 :            :                                        const int operation_type = Interface::INTERSECT ) = 0;
     607                 :            : 
     608                 :            :     //! Get the adjacencies associated with a vector of entities to entities of a specfied
     609                 :            :     //! dimension.
     610                 :            :     /** Identical to vector-based get_adjacencies function, except results are returned in a
     611                 :            :         range instead of a vector.
     612                 :            :     */
     613                 :            :     virtual ErrorCode get_adjacencies( const EntityHandle* from_entities, const int num_entities,
     614                 :            :                                        const int to_dimension, const bool create_if_missing, Range& adj_entities,
     615                 :            :                                        const int operation_type = Interface::INTERSECT ) = 0;
     616                 :            : 
     617                 :            :     //! Get the adjacencies associated with a range of entities to entities of a specfied dimension.
     618                 :            :     /** Identical to vector-based get_adjacencies function, except "from" entities specified in a
     619                 :            :         range instead of a vector.
     620                 :            :     */
     621                 :            :     virtual ErrorCode get_adjacencies( const Range& from_entities, const int to_dimension, const bool create_if_missing,
     622                 :            :                                        Range& adj_entities, const int operation_type = Interface::INTERSECT ) = 0;
     623                 :            : 
     624                 :            :     //! Adds adjacencies between "from" and "to" entities.
     625                 :            :     /** \param from_handle Entities on which the adjacencies are placed
     626                 :            :         \param to_handles Vector of entities referenced by new adjacencies added to
     627                 :            :        <em>from_handle</em> \param num_handles Number of entities in <em>to_handles</em> \param
     628                 :            :        both_ways If true, add the adjacency information in both directions; if false, adjacencies
     629                 :            :        are added only to <em>from_handle</em>
     630                 :            :     */
     631                 :            :     virtual ErrorCode add_adjacencies( const EntityHandle from_handle, const EntityHandle* to_handles,
     632                 :            :                                        const int num_handles, bool both_ways ) = 0;
     633                 :            : 
     634                 :            :     //! Adds adjacencies; same as vector-based, but with range instead
     635                 :            :     virtual ErrorCode add_adjacencies( const EntityHandle from_handle, Range& adjacencies, bool both_ways ) = 0;
     636                 :            : 
     637                 :            :     //! Removes adjacencies between handles.
     638                 :            :     /** Adjacencies in both directions are removed.
     639                 :            :         \param from_handle Entity from which adjacencies are being removed.
     640                 :            :         \param to_handles Entities to which adjacencies are being removed.
     641                 :            :         \param num_handles Number of handles in <em>to_handles</em>
     642                 :            :     */
     643                 :            :     virtual ErrorCode remove_adjacencies( const EntityHandle from_handle, const EntityHandle* to_handles,
     644                 :            :                                           const int num_handles ) = 0;
     645                 :            : 
     646                 :            :     /**\brief Get a ptr to adjacency lists
     647                 :            :      * Get a pointer to adjacency lists.  These lists are std::vector<EntityHandle>, which are
     648                 :            :      * pointed to by adjs[i].  Adjacencies are not guaranteed to be in order of increasing
     649                 :            :      * dimension.  Only a const version of this function is given, because adjacency data is managed
     650                 :            :      * more carefully in MOAB and should be treated as read-only by applications.  If adjacencies
     651                 :            :      * have not yet been initialized, adjs_ptr will be NULL (i.e. adjs_ptr == NULL).  There may also
     652                 :            :      * be NULL entries for individual entities, i.e. adjs_ptr[i] == NULL. \param iter Iterator to
     653                 :            :      * beginning of entity range desired \param end End iterator for which adjacencies are requested
     654                 :            :      * \param adjs_ptr Pointer to pointer to const std::vector<EntityHandle>; each member of that
     655                 :            :      * array is the vector of adjacencies for this entity \param count Number of entities in the
     656                 :            :      * contiguous chunk starting from *iter
     657                 :            :      */
     658                 :            :     virtual ErrorCode adjacencies_iterate( Range::const_iterator iter, Range::const_iterator end,
     659                 :            :                                            const std::vector< EntityHandle >**& adjs_ptr, int& count ) = 0;
     660                 :            :     /**@}*/
     661                 :            : 
     662                 :            :     //! Enumerated type used in get_adjacencies() and other functions
     663                 :            :     enum
     664                 :            :     {
     665                 :            :         INTERSECT,
     666                 :            :         UNION
     667                 :            :     };
     668                 :            : 
     669                 :            :     /** \name Getting entities */
     670                 :            : 
     671                 :            :     /**@{*/
     672                 :            : 
     673                 :            :     //! Retrieves all entities of a given topological dimension in the database or meshset.
     674                 :            :     /** Appends entities to list passed in.
     675                 :            :         \param meshset Meshset whose entities are being queried (zero if query is for entire mesh).
     676                 :            :         \param dimension Topological dimension of entities desired.
     677                 :            :         \param entities Range in which entities of dimension <em>dimension</em> are returned.
     678                 :            :         \param recursive If true, meshsets containing meshsets are queried recursively.  Returns
     679                 :            :                          the contents of meshsets, but not the meshsets themselves if true.
     680                 :            : 
     681                 :            :         Example: \code
     682                 :            :           // get 1d (edge) elements in the entire mesh
     683                 :            :           Range edges;
     684                 :            :           get_entities_by_dimension( 0, 1, edges );
     685                 :            :           \endcode
     686                 :            :     */
     687                 :            :     virtual ErrorCode get_entities_by_dimension( const EntityHandle meshset, const int dimension, Range& entities,
     688                 :            :                                                  const bool recursive = false ) const = 0;
     689                 :            : 
     690                 :            :     //! Retrieves all entities of a given topological dimension in the database or meshset.
     691                 :            :     /** Appends entities to list passed in.
     692                 :            :         \param meshset Meshset whose entities are being queried (zero if query is for entire mesh).
     693                 :            :         \param dimension Topological dimension of entities desired.
     694                 :            :         \param entities Range in which entities of dimension <em>dimension</em> are returned.
     695                 :            :         \param recursive If true, meshsets containing meshsets are queried recursively.  Returns
     696                 :            :                          the contents of meshsets, but not the meshsets themselves if true.
     697                 :            : 
     698                 :            :         Example: \code
     699                 :            :           // get 1d (edge) elements in the entire mesh
     700                 :            :           Range edges;
     701                 :            :           get_entities_by_dimension( 0, 1, edges );
     702                 :            :           \endcode
     703                 :            :     */
     704                 :            :     virtual ErrorCode get_entities_by_dimension( const EntityHandle meshset, const int dimension,
     705                 :            :                                                  std::vector< EntityHandle >& entities,
     706                 :            :                                                  const bool recursive = false ) const = 0;
     707                 :            : 
     708                 :            :     //! Retrieve all entities of a given type in the database or meshset.
     709                 :            :     /** Appends entities to list passed in.
     710                 :            :         \param meshset Meshset whose entities are being queried (zero if query is for entire mesh).
     711                 :            :         \param type Type of entities to be returned
     712                 :            :         \param entities Range in which entities of type <em>type</em> are returned.
     713                 :            :         \param recursive If true, meshsets containing meshsets are queried recursively.  Returns
     714                 :            :                          the contents of meshsets, but not the meshsets themselves.  Specifying
     715                 :            :                          both recursive=true and type=MBENTITYSET is an error, as it would always
     716                 :            :                          result in an empty list.
     717                 :            : 
     718                 :            :         Example: \code
     719                 :            :           // get the quadrilateral elements in meshset
     720                 :            :           Range quads;
     721                 :            :           get_entities_by_type( meshset, MBQUAD, quads );
     722                 :            :           \endcode
     723                 :            :     */
     724                 :            :     virtual ErrorCode get_entities_by_type( const EntityHandle meshset, const EntityType type, Range& entities,
     725                 :            :                                             const bool recursive = false ) const = 0;
     726                 :            : 
     727                 :            :     //! Retrieve all entities of a given type in the database or meshset.
     728                 :            :     /** Appends entities to list passed in.
     729                 :            :         \param meshset Meshset whose entities are being queried (zero if query is for entire mesh).
     730                 :            :         \param type Type of entities to be returned
     731                 :            :         \param entities Range in which entities of type <em>type</em> are returned.
     732                 :            :         \param recursive If true, meshsets containing meshsets are queried recursively.  Returns
     733                 :            :                          the contents of meshsets, but not the meshsets themselves.  Specifying
     734                 :            :                          both recursive=true and type=MBENTITYSET is an error, as it would always
     735                 :            :                          result in an empty list.
     736                 :            : 
     737                 :            :         Example: \code
     738                 :            :           // get the quadrilateral elements in meshset
     739                 :            :           Range quads;
     740                 :            :           get_entities_by_type( meshset, MBQUAD, quads );
     741                 :            :           \endcode
     742                 :            :     */
     743                 :            :     virtual ErrorCode get_entities_by_type( const EntityHandle meshset, const EntityType type,
     744                 :            :                                             std::vector< EntityHandle >& entities,
     745                 :            :                                             const bool recursive = false ) const = 0;
     746                 :            : 
     747                 :            :     //! Retrieve entities in the database or meshset which have any or all of the tag(s) and
     748                 :            :     //! (optionally) value(s) specified.
     749                 :            :     /** \param meshset Meshset whose entities are being queried (zero if query is for entire mesh).
     750                 :            :         \param type Type of entities to be returned
     751                 :            :         \param tag_handles Vector of tag handles entities must have
     752                 :            :         \param values Vector of pointers to values of tags in <em>tag_handles</em>
     753                 :            :         \param num_tags Number of tags and values in <em>tag_handles</em> and <em>values</em>
     754                 :            :         \param entities Range in which entities are returned.
     755                 :            :         \param condition Boolean condition, either Interface::UNION or Interface::INTERSECT
     756                 :            :         \param recursive If true, meshsets containing meshsets are queried recursively.  Returns
     757                 :            :                          the contents of meshsets, but not the meshsets themselves.  Specifying
     758                 :            :                          both recursive=true and type=MBENTITYSET is an error, as it would always
     759                 :            :                          result in an empty list.
     760                 :            : 
     761                 :            :         If Interface::UNION is specified as the condition, entities with <em>any</em> of the tags
     762                 :            :         and values specified are returned.  If Interface::INTERSECT is specified, only entities with
     763                 :            :         <em>all</em> of the tags/values are returned.
     764                 :            : 
     765                 :            :         If <em>values</em> is NULL, entities with the specified tags and any corresponding values
     766                 :            :        are returned.  Note that if <em>values</em> is non-NULL, it is a vector of <em>pointers</em>
     767                 :            :        to tag values.
     768                 :            : 
     769                 :            :         Example: \code
     770                 :            :           // get the dirichlet sets in a mesh
     771                 :            :           Range dir_sets;
     772                 :            :           Tag dir_tag;
     773                 :            :           tag_get_handle(DIRICHLET_SET_TAG_NAME, dir_tag, 1, MB_TYPE_INTEGER);
     774                 :            :           get_entities_by_type_and_tag(0, MBENTITYSET, &dir_tag, NULL, 1, dir_sets,
     775                 :            :           Interface::UNION);
     776                 :            :           \endcode
     777                 :            :     */
     778                 :            :     virtual ErrorCode get_entities_by_type_and_tag( const EntityHandle meshset, const EntityType type,
     779                 :            :                                                     const Tag* tag_handles, const void* const* values,
     780                 :            :                                                     const int num_tags, Range& entities,
     781                 :            :                                                     const int condition  = Interface::INTERSECT,
     782                 :            :                                                     const bool recursive = false ) const = 0;
     783                 :            : 
     784                 :            :     //! Returns all entities in the data base or meshset, in a range (order not preserved)
     785                 :            :     /** Appends entities to list passed in.
     786                 :            :         \param meshset Meshset whose entities are being queried (zero if query is for the entire
     787                 :            :        mesh). \param entities Range in which entities are returned. \param recursive If true,
     788                 :            :        meshsets containing meshsets are queried recursively.  Returns the contents of meshsets, but
     789                 :            :        not the meshsets themselves if true.
     790                 :            : 
     791                 :            :         Example: \code
     792                 :            :         Range entities;
     793                 :            :           // get all non-meshset entities in meshset, including in contained meshsets
     794                 :            :           get_entities_by_handle(meshset, entities, true);
     795                 :            :           \endcode
     796                 :            :     */
     797                 :            :     virtual ErrorCode get_entities_by_handle( const EntityHandle meshset, Range& entities,
     798                 :            :                                               const bool recursive = false ) const = 0;
     799                 :            : 
     800                 :            :     //! Returns all entities in the data base or meshset, in a vector (order preserved)
     801                 :            :     /** Appends entities to list passed in.
     802                 :            :         \param meshset Meshset whose entities are being queried (zero if query is for the entire
     803                 :            :        mesh). \param entities STL vector in which entities are returned. \param recursive If true,
     804                 :            :        meshsets containing meshsets are queried recursively.  Returns the contents of meshsets, but
     805                 :            :        not the meshsets themselves if true.
     806                 :            : 
     807                 :            :         Example: \code
     808                 :            :         std::vector<EntityHandle> entities;
     809                 :            :           // get all non-meshset entities in meshset, including in contained meshsets
     810                 :            :           get_entities_by_handle(meshset, entities, true);
     811                 :            :           \endcode
     812                 :            :     */
     813                 :            :     virtual ErrorCode get_entities_by_handle( const EntityHandle meshset, std::vector< EntityHandle >& entities,
     814                 :            :                                               const bool recursive = false ) const = 0;
     815                 :            : 
     816                 :            :     //! Return the number of entities of given dimension in the database or meshset
     817                 :            :     /** \param meshset Meshset whose entities are being queried (zero if query is for the entire
     818                 :            :        mesh). \param dimension Dimension of entities desired. \param num_entities Number of entities
     819                 :            :        of the given dimension \param recursive If true, meshsets containing meshsets are queried
     820                 :            :        recursively.  Returns the contents of meshsets, but not the meshsets themselves if true.
     821                 :            :     */
     822                 :            :     virtual ErrorCode get_number_entities_by_dimension( const EntityHandle meshset, const int dimension,
     823                 :            :                                                         int& num_entities, const bool recursive = false ) const = 0;
     824                 :            : 
     825                 :            :     //! Retrieve the number of entities of a given type in the database or meshset.
     826                 :            :     /** Identical to get_entities_by_dimension, except returns number instead of entities
     827                 :            :         \param meshset Meshset whose entities are being queried (zero if query is for entire mesh).
     828                 :            :         \param type Type of entities to be returned
     829                 :            :         \param num_entities Number of entities of type <em>type</em>
     830                 :            :         \param recursive If true, meshsets containing meshsets are queried recursively.  Returns
     831                 :            :                          the contents of meshsets, but not the meshsets themselves.  Specifying
     832                 :            :                          both recursive=true and type=MBENTITYSET is an error, as it would always
     833                 :            :                          result in an empty list.
     834                 :            :     */
     835                 :            :     virtual ErrorCode get_number_entities_by_type( const EntityHandle meshset, const EntityType type, int& num_entities,
     836                 :            :                                                    const bool recursive = false ) const = 0;
     837                 :            : 
     838                 :            :     //! Retrieve number of entities in the database or meshset which have any or all of the
     839                 :            :     //! tag(s) and (optionally) value(s) specified.
     840                 :            :     /** Identical to get_entities_by_type_and_tag, except number instead of entities are returned
     841                 :            :         \param meshset Meshset whose entities are being queried (zero if query is for entire mesh).
     842                 :            :         \param type Type of entities to be returned
     843                 :            :         \param tag_handles Vector of tag handles entities must have
     844                 :            :         \param values Vector of pointers to values of tags in <em>tag_handles</em>
     845                 :            :         \param num_tags Number of tags and values in <em>tag_handles</em> and <em>values</em>
     846                 :            :         \param num_entities Range in which number of entities are returned.
     847                 :            :         \param recursive If true, meshsets containing meshsets are queried recursively.  Returns
     848                 :            :                          the contents of meshsets, but not the meshsets themselves.  Specifying
     849                 :            :                          both recursive=true and type=MBENTITYSET is an error, as it would always
     850                 :            :                          result in an empty list.
     851                 :            :     */
     852                 :            :     virtual ErrorCode get_number_entities_by_type_and_tag( const EntityHandle meshset, const EntityType type,
     853                 :            :                                                            const Tag* tag_handles, const void* const* values,
     854                 :            :                                                            const int num_tags, int& num_entities,
     855                 :            :                                                            const int condition  = Interface::INTERSECT,
     856                 :            :                                                            const bool recursive = false ) const = 0;
     857                 :            : 
     858                 :            :     //! Returns number of entities in the data base or meshset
     859                 :            :     /** Identical to get-entities_by_handle, except number instead of entities are returned
     860                 :            :         \param meshset Meshset whose entities are being queried (zero if query is for the entire
     861                 :            :        mesh). \param num_entities Range in which num_entities are returned. \param recursive If
     862                 :            :        true, meshsets containing meshsets are queried recursively.  Returns the contents of
     863                 :            :        meshsets, but not the meshsets themselves if true.
     864                 :            :     */
     865                 :            :     virtual ErrorCode get_number_entities_by_handle( const EntityHandle meshset, int& num_entities,
     866                 :            :                                                      const bool recursive = false ) const = 0;
     867                 :            : 
     868                 :            :     /**@}*/
     869                 :            : 
     870                 :            :     /** \name Mesh modification */
     871                 :            : 
     872                 :            :     /**@{*/
     873                 :            : 
     874                 :            :     //! Create an element based on the type and connectivity.
     875                 :            :     /** Create a new element in the database.  Vertices composing this element must already exist,
     876                 :            :         and connectivity must be specified in canonical order for the given element type.  If
     877                 :            :         connectivity vector is not correct for EntityType <em>type</em> (ie, a vector with
     878                 :            :         3 vertices is passed in to make an MBQUAD), the function returns MB_FAILURE.
     879                 :            :         \param type Type of element to create. (MBTET, MBTRI, MBKNIFE, etc.)
     880                 :            :         \param connectivity 1d vector containing connectivity of element to create.
     881                 :            :         \param num_vertices Number of vertices in element
     882                 :            :         \param element_handle Handle representing the newly created element in the database.
     883                 :            : 
     884                 :            :         Example: \code
     885                 :            :         EntityHandle quad_conn[] = {vertex0, vertex1, vertex2, vertex3};
     886                 :            :         EntityHandle quad_handle = 0;
     887                 :            :         create_element( MBQUAD, quad_conn, 4, quad_handle ); \endcode
     888                 :            :     */
     889                 :            :     virtual ErrorCode create_element( const EntityType type, const EntityHandle* connectivity, const int num_vertices,
     890                 :            :                                       EntityHandle& element_handle ) = 0;
     891                 :            : 
     892                 :            :     //! Creates a vertex with the specified coordinates.
     893                 :            :     /**
     894                 :            :        \param coordinates Array that has 3 doubles in it.
     895                 :            :        \param entity_handle EntityHandle representing the newly created vertex in the database.
     896                 :            : 
     897                 :            :        Example: \code
     898                 :            :        double coordinates[] = {1.034, 23.23, -0.432};
     899                 :            :        EntityHandle new_handle = 0;
     900                 :            :        create_vertex( coordinates, entity_handle ); \endcode
     901                 :            :     */
     902                 :            :     virtual ErrorCode create_vertex( const double coordinates[3], EntityHandle& entity_handle ) = 0;
     903                 :            : 
     904                 :            :     //! Create a set of vertices with the specified coordinates
     905                 :            :     /**
     906                 :            :        \param coordinates Array that has 3*n doubles in it.
     907                 :            :        \param nverts Number of vertices to create
     908                 :            :        \param entity_handles Range passed back with new vertex handles
     909                 :            :     */
     910                 :            :     virtual ErrorCode create_vertices( const double* coordinates, const int nverts, Range& entity_handles ) = 0;
     911                 :            : 
     912                 :            :     //! Merge two entities into a single entity
     913                 :            :     /** Merge two entities into a single entities, with <em>entity_to_keep</em> receiving
     914                 :            :         adjacencies that were on <em>entity_to_remove</em>.
     915                 :            :         \param entity_to_keep Entity to be kept after merge
     916                 :            :         \param entity_to_remove Entity to be merged into <em>entity_to_keep</em>
     917                 :            :         \param auto_merge If false, <em>entity_to_keep</em> and <em>entity_to_remove</em> must share
     918                 :            :         the same lower-dimensional entities; if true, MB tries to merge those entities automatically
     919                 :            :         \param delete_removed_entity If true, <em>entity_to_remove</em> is deleted after merge is
     920                 :            :        complete
     921                 :            :     */
     922                 :            :     virtual ErrorCode merge_entities( EntityHandle entity_to_keep, EntityHandle entity_to_remove, bool auto_merge,
     923                 :            :                                       bool delete_removed_entity ) = 0;
     924                 :            : 
     925                 :            :     //! Removes entities in a vector from the data base.
     926                 :            :     /** If any of the entities are contained in any meshsets, it is removed from those meshsets
     927                 :            :         which were created with MESHSET_TRACK_OWNER option bit set.  Tags for <em>entity</em> are
     928                 :            :         removed as part of this function.
     929                 :            :         \param entities 1d vector of entities to delete
     930                 :            :         \param num_entities Number of entities in 1d vector
     931                 :            :     */
     932                 :            :     virtual ErrorCode delete_entities( const EntityHandle* entities, const int num_entities ) = 0;
     933                 :            : 
     934                 :            :     //! Removes entities in a range from the data base.
     935                 :            :     /** If any of the entities are contained in any meshsets, it is removed from those meshsets
     936                 :            :         which were created with MESHSET_TRACK_OWNER option bit set.  Tags for <em>entity</em> are
     937                 :            :         removed as part of this function.
     938                 :            :         \param entities Range of entities to delete
     939                 :            :     */
     940                 :            :     virtual ErrorCode delete_entities( const Range& entities ) = 0;
     941                 :            : 
     942                 :            :     /**@}*/
     943                 :            : 
     944                 :            :     /** \name Information */
     945                 :            : 
     946                 :            :     /**@{*/
     947                 :            : 
     948                 :            :     //! List entities to standard output
     949                 :            :     /** Lists all data pertaining to entities (i.e. vertex coordinates if vertices, connectivity if
     950                 :            :         elements, set membership if set).  Useful for debugging, but output can become quite long
     951                 :            :         for large databases.
     952                 :            :     */
     953                 :            :     virtual ErrorCode list_entities( const Range& entities ) const = 0;
     954                 :            : 
     955                 :            :     //! List entities, or number of entities in database, to standard output
     956                 :            :     /** Lists data pertaining to entities to standard output.  If <em>entities</em> is NULL and
     957                 :            :         <em>num_entities</em> is zero, lists only the number of entities of each type in the
     958                 :            :         database.  If <em>entities</em> is NULL and <em>num_entities</em> is non-zero, lists all
     959                 :            :         information for all entities in the database.
     960                 :            :         \param entities 1d vector of entities to list
     961                 :            :         \param num_entities Number of entities in 1d vector
     962                 :            :     */
     963                 :            :     virtual ErrorCode list_entities( const EntityHandle* entities, const int num_entities ) const = 0;
     964                 :            : 
     965                 :            :     //! List a single entity; no header printed
     966                 :            :     /** Lists a single entity, including its connectivity and its adjacencies.
     967                 :            :      *  No header is printed, because calling function might print information between header
     968                 :            :      *  and information printed by this function.
     969                 :            :      *  \param entity The entity to be listed.
     970                 :            :      */
     971                 :            :     virtual ErrorCode list_entity( const EntityHandle entity ) const = 0;
     972                 :            : 
     973                 :            :     //! Return information about the last error
     974                 :            :     /** \param info std::string into which information on the last error is written.
     975                 :            :      */
     976                 :            :     virtual ErrorCode get_last_error( std::string& info ) const = 0;
     977                 :            : 
     978                 :            :     //! Return string representation of given error code
     979                 :            :     /** \param code Error code for which string is wanted
     980                 :            :      */
     981                 :            :     virtual std::string get_error_string( const ErrorCode code ) const = 0;
     982                 :            : 
     983                 :            :     /**\brief Calculate amount of memory used to store MOAB data
     984                 :            :      *
     985                 :            :      * This function calculates the amount of memory used to store
     986                 :            :      * MOAB data.
     987                 :            :      *
     988                 :            :      * There are two possible values for each catagory of memory use.
     989                 :            :      * The exact value and the amortized value.  The exact value is the
     990                 :            :      * amount of memory used to store the data for the specified entities.
     991                 :            :      * The amortized value includes the exact value and an amortized
     992                 :            :      * estimate of the memory consumed in overhead for storing the values
     993                 :            :      * (indexing structures, access structures, etc.)
     994                 :            :      *
     995                 :            :      * Note: If ent_array is NULL and total_amortized_storage is *not* NULL,
     996                 :            :      *       the total memory used by MOAB for storing data all will be
     997                 :            :      *       returned in the address pointed to by total_amortized_storage.
     998                 :            :      *
     999                 :            :      *\param ent_array Array of entities for which to estimate the memory use.
    1000                 :            :      *                 If NULL, estimate is done for all entities.
    1001                 :            :      *\param num_ents The length of ent_array.  Not used if ent_rray is NULL.
    1002                 :            :      *\param total_(amortized_)storage The sum of the memory entity, adjacency,
    1003                 :            :      *                   and all tag storage.
    1004                 :            :      *\param (amortized_)entity_storage The storage for the entity definitions
    1005                 :            :      *                   (connectivity arrays for elements, coordinates for
    1006                 :            :      *                   vertices, list storage within sets, etc.)
    1007                 :            :      *\param (amortized_)adjacency_storage The storage for adjacency data.
    1008                 :            :      *\param tag_array   An array of tags for which to calculate the memory use.
    1009                 :            :      *\param num_tags    The lenght of tag_array
    1010                 :            :      *\param (amortized_)tag_storage If tag_array is not NULL, then one value
    1011                 :            :      *                   for each tag specifying the memory used for storing
    1012                 :            :      *                   that tag.  If tag_array is NULL and this value is not,
    1013                 :            :      *                   the location at which to store the total memory used
    1014                 :            :      *                   for all tags.
    1015                 :            :      */
    1016                 :            :     virtual void estimated_memory_use(
    1017                 :            :         const EntityHandle* ent_array = 0, unsigned long num_ents = 0, unsigned long long* total_storage = 0,
    1018                 :            :         unsigned long long* total_amortized_storage = 0, unsigned long long* entity_storage = 0,
    1019                 :            :         unsigned long long* amortized_entity_storage = 0, unsigned long long* adjacency_storage = 0,
    1020                 :            :         unsigned long long* amortized_adjacency_storage = 0, const Tag* tag_array = 0, unsigned num_tags = 0,
    1021                 :            :         unsigned long long* tag_storage = 0, unsigned long long* amortized_tag_storage = 0 ) = 0;
    1022                 :            : 
    1023                 :            :     /**\brief Calculate amount of memory used to store MOAB data
    1024                 :            :      *
    1025                 :            :      * This function calculates the amount of memory used to store
    1026                 :            :      * MOAB data.
    1027                 :            :      *
    1028                 :            :      * There are two possible values for each catagory of memory use.
    1029                 :            :      * The exact value and the amortized value.  The exact value is the
    1030                 :            :      * amount of memory used to store the data for the specified entities.
    1031                 :            :      * The amortized value includes the exact value and an amortized
    1032                 :            :      * estimate of the memory consumed in overhead for storing the values
    1033                 :            :      * (indexing structures, access structures, etc.)
    1034                 :            :      *
    1035                 :            :      *\param ents        Entities for which to estimate the memory use.
    1036                 :            :      *\param total_(amortized_)storage The sum of the memory entity, adjacency,
    1037                 :            :      *                   and all tag storage.
    1038                 :            :      *\param (amortized_)entity_storage The storage for the entity definitions
    1039                 :            :      *                   (connectivity arrays for elements, coordinates for
    1040                 :            :      *                   vertices, list storage within sets, etc.)
    1041                 :            :      *\param (amortized_)adjacency_storage The storage for adjacency data.
    1042                 :            :      *\param tag_array   An array of tags for which to calculate the memory use.
    1043                 :            :      *\param num_tags    The lenght of tag_array
    1044                 :            :      *\param (amortized_)tag_storage If tag_array is not NULL, then one value
    1045                 :            :      *                   for each tag specifying the memory used for storing
    1046                 :            :      *                   that tag.  If tag_array is NULL and this value is not,
    1047                 :            :      *                   the location at which to store the total memory used
    1048                 :            :      *                   for all tags.
    1049                 :            :      */
    1050                 :            :     virtual void estimated_memory_use( const Range& ents, unsigned long long* total_storage = 0,
    1051                 :            :                                        unsigned long long* total_amortized_storage     = 0,
    1052                 :            :                                        unsigned long long* entity_storage              = 0,
    1053                 :            :                                        unsigned long long* amortized_entity_storage    = 0,
    1054                 :            :                                        unsigned long long* adjacency_storage           = 0,
    1055                 :            :                                        unsigned long long* amortized_adjacency_storage = 0, const Tag* tag_array = 0,
    1056                 :            :                                        unsigned num_tags = 0, unsigned long long* tag_storage = 0,
    1057                 :            :                                        unsigned long long* amortized_tag_storage = 0 ) = 0;
    1058                 :            :     /**@}*/
    1059                 :            : 
    1060                 :            :     /** \name Higher-order elements */
    1061                 :            : 
    1062                 :            :     /**@{*/
    1063                 :            : 
    1064                 :            :     //! function object for recieving events from MB of higher order nodes added to entities
    1065                 :            :     class HONodeAddedRemoved
    1066                 :            :     {
    1067                 :            :       public:
    1068                 :            :         //! Constructor
    1069                 :          1 :         HONodeAddedRemoved() {}
    1070                 :            : 
    1071                 :            :         //! Destructor
    1072         [ -  + ]:          2 :         virtual ~HONodeAddedRemoved() {}
    1073                 :            : 
    1074                 :            :         //! node_added called when a node was added to an element's connectivity array
    1075                 :            :         //! note: connectivity array of element may be incomplete (corner nodes will exist always)
    1076                 :            :         /**
    1077                 :            :          * \param node Node being added
    1078                 :            :          * \param element Element node is being added to
    1079                 :            :          */
    1080                 :            :         virtual void node_added( EntityHandle node, EntityHandle element ) = 0;
    1081                 :            : 
    1082                 :            :         //! node_added called when a node was added to an element's connectivity array
    1083                 :            :         //! note: connectivity array of element may be incomplete (corner nodes will exist always)
    1084                 :            :         /**
    1085                 :            :          * \param node Node being removed.
    1086                 :            :          */
    1087                 :            :         virtual void node_removed( EntityHandle node ) = 0;
    1088                 :            :     };
    1089                 :            : 
    1090                 :            :     //! Convert entities to higher-order elements by adding mid nodes
    1091                 :            :     /** This function causes MB to create mid-nodes on all edges, faces, and element interiors
    1092                 :            :         for all entities in <em>meshset</em>.  Higher order nodes appear in an element's
    1093                 :            :        connectivity array according to the algorithm described in the documentation for Mesh.  If
    1094                 :            :         <em>HONodeAddedRemoved</em> function is input, this function is called to notify the
    1095                 :            :        application of nodes being added/removed from the mesh. \param meshset The set of entities
    1096                 :            :        being converted \param mid_edge If true, mid-edge nodes are created \param mid_face If true,
    1097                 :            :        mid-face nodes are created \param mid_region If true, mid-element nodes are created \param
    1098                 :            :        function_object If non-NULL, the node_added or node_removed functions on this object are
    1099                 :            :        called when nodes are added or removed from an entity, respectively
    1100                 :            :     */
    1101                 :            :     virtual ErrorCode convert_entities( const EntityHandle meshset, const bool mid_edge, const bool mid_face,
    1102                 :            :                                         const bool mid_region, HONodeAddedRemoved* function_object = 0 ) = 0;
    1103                 :            : 
    1104                 :            :     //! Returns the side number, in canonical ordering, of <em>child</em> with respect to
    1105                 :            :     //! <em>parent</em>
    1106                 :            :     /** Given a parent and child entity, returns the canonical ordering information side number,
    1107                 :            :        sense, and offset of <em>child</em> with respect to <em>parent</em>.  This function returns
    1108                 :            :         MB_FAILURE if <em>child</em> is not related to <em>parent</em>.  This function does *not*
    1109                 :            :         create adjacencies between <em>parent</em> and <em>child</em>.
    1110                 :            :         \param parent Parent entity to be compared
    1111                 :            :         \param child Child entity to be compared
    1112                 :            :         \param side_number Side number in canonical ordering of <em>child</em> with respect to
    1113                 :            :         <em>parent</em>
    1114                 :            :         \param sense Sense of <em>child</em> with respect to <em>parent</em>, assuming ordering of
    1115                 :            :         <em>child</em> as given by get_connectivity called on <em>child</em>; sense is 1, -1
    1116                 :            :         for forward/reverse sense, resp.
    1117                 :            :         \param offset Offset between first vertex of <em>child</em> and first vertex of side
    1118                 :            :         <em>side_number</em> on <em>parent</em>
    1119                 :            :     */
    1120                 :            :     virtual ErrorCode side_number( const EntityHandle parent, const EntityHandle child, int& side_number, int& sense,
    1121                 :            :                                    int& offset ) const = 0;
    1122                 :            : 
    1123                 :            :     //! Find the higher-order node on a subfacet of an entity
    1124                 :            :     /** Given an entity and the connectivity and type of one of its subfacets, find the
    1125                 :            :         high order node on that subfacet, if any.  The number of vertices in <em>subfacet_conn</em>
    1126                 :            :         is derived from <em>subfacet_type</em> and the canonical numbering for that type.
    1127                 :            :         \param parent_handle The element whose subfacet is being queried
    1128                 :            :         \param subfacet_conn The connectivity of the subfacet being queried
    1129                 :            :         \param subfacet_type The type of subfacet being queried
    1130                 :            :         \param high_order_node If the subfacet has a high-order node defined on
    1131                 :            :        <em>parent_handle</em>, the handle for that node.
    1132                 :            :     */
    1133                 :            :     virtual ErrorCode high_order_node( const EntityHandle parent_handle, const EntityHandle* subfacet_conn,
    1134                 :            :                                        const EntityType subfacet_type, EntityHandle& high_order_node ) const = 0;
    1135                 :            : 
    1136                 :            :     //! Return the handle of the side element of a given dimension and index
    1137                 :            :     /** Given a parent entity and a target dimension and side number, return the handle of
    1138                 :            :         the entity corresponding to that side.  If an entity has not been created to represent
    1139                 :            :         that side, one is not created by this function, and zero is returned in
    1140                 :            :        <em>target_entity</em>. \param source_entity The entity whose side is being queried. \param
    1141                 :            :        dim The topological dimension of the side being queried. \param side_number The canonical
    1142                 :            :        index of the side being queried. \param target_entity The handle of the entity representing
    1143                 :            :        this side, if any.
    1144                 :            :     */
    1145                 :            :     virtual ErrorCode side_element( const EntityHandle source_entity, const int dim, const int side_number,
    1146                 :            :                                     EntityHandle& target_entity ) const = 0;
    1147                 :            : 
    1148                 :            :     /**@}*/
    1149                 :            : 
    1150                 :            :     /** \name Tags */
    1151                 :            : 
    1152                 :            :     /**@{*/
    1153                 :            : 
    1154                 :            :     /**\brief Get a tag handle, possibly creating the tag
    1155                 :            :      *
    1156                 :            :      * Get a handle used to associate application-defined values
    1157                 :            :      * with MOAB entities.  If the tag does not already exist then
    1158                 :            :      * \c flags should contain exactly one of \c MB_TAG_SPARSE,
    1159                 :            :      * \c MB_TAG_DENSE, \c MB_TAG_MESH unless \c type is MB_TYPE_BIT,
    1160                 :            :      * which implies \c MB_TAG_BIT storage.
    1161                 :            :      * .
    1162                 :            :      *\param name          The tag name
    1163                 :            :      *\param size          Tag size as number of values of of data type per entity
    1164                 :            :      *                     (or number of bytes if \c MB_TAG_BYTES is passed in flags).  If \c
    1165                 :            :      *MB_TAG_VARLEN is specified, this value is taken to be the size of the default value if one is
    1166                 :            :      *specified and is otherwise ignored. \param type          The type of the data (used for IO)
    1167                 :            :      *\param tag_handle    Output: the resulting tag handle.
    1168                 :            :      *\param flags         Bitwise OR of values from TagType
    1169                 :            :      *\param default_value Optional default value for tag.
    1170                 :            :      *\param created       Optional returned boolean indicating that the tag
    1171                 :            :      *                     was created.
    1172                 :            :      *\return - \c MB_ALREADY_ALLOCATED     if tag exists and \c MB_TAG_EXCL is specified, or
    1173                 :            :      *default values do not match (and \c MB_TAG_ANY or \c MB_TAG_DFTOK not specified).
    1174                 :            :      *        - \c MB_TAG_NOT_FOUND         if tag does not exist and \c MB_TAG_CREAT is not
    1175                 :            :      *specified
    1176                 :            :      *        - \c MB_INVALID_SIZE          if tag value size is not a multiple of the size of the
    1177                 :            :      *data type (and \c MB_TAG_ANY not specified).
    1178                 :            :      *        - \c MB_TYPE_OUT_OF_RANGE     invalid or inconsistent parameter
    1179                 :            :      *        - \c MB_VARIABLE_DATA_LENGTH  if \c MB_TAG_VARLEN and \c default_value is non-null and
    1180                 :            :      *                                      \c default_value_size is not specified.
    1181                 :            :      *
    1182                 :            :      *\NOTE A call to tag_get_handle that includes a default value will fail
    1183                 :            :      * if the tag already exists with a different default value.  A call without
    1184                 :            :      * a default value will succeed if the tag already exists, regardless of
    1185                 :            :      * whether or not the existing tag has a default value.
    1186                 :            :      *
    1187                 :            :      * Examples:
    1188                 :            :      *
    1189                 :            :      * Retrieve a handle for an existing tag, returning a non-success error
    1190                 :            :      * code if the tag does not exist or does not store 1 integer value per
    1191                 :            :      * entity:
    1192                 :            :      *\code
    1193                 :            :      * Tag git_tag;
    1194                 :            :      * mb.tag_get_handle( GLOBAL_ID_TAG_NAME, 1, MB_TYPE_INTEGER, gid_tag );
    1195                 :            :      * \endcode
    1196                 :            :      * Get the tag handle, or create it as a dense tag if it does not already
    1197                 :            :      * exist:
    1198                 :            :      *\code
    1199                 :            :      * Tag gid_tag;
    1200                 :            :      * mb.tag_get_handle( GLOBAL_ID_TAG_NAME, 1, MB_TYPE_INTEGER, gid_tag, MB_TAG_CREAT|MB_TAG_BIT
    1201                 :            :      *); \endcode Create the tag or *fail* if it already exists: \code Tag gid_tag;
    1202                 :            :      * mb.tag_get_handle( GLOBAL_ID_TAG_NAME, 1, MB_TYPE_INTEGER, gid_tag, MB_TAG_EXCL|MB_TAG_DENSE
    1203                 :            :      *); \endcode Get an existing variable length tag, failing if it does not exist or is not
    1204                 :            :      *variable-length or does not contain double values. \code Tag vtag; mb.tag_get_handle(
    1205                 :            :      *tag_name, 0, MB_TYPE_DOUBLE, vtag ); \endcode Get the same variable-length tag, but create it
    1206                 :            :      *with a default value if it doesn't exist.  Note that if the tag already exists this call will
    1207                 :            :      *return a non-success error code if the existing tag has a different default value. \code Tag
    1208                 :            :      *vtag; const double default_val = M_PI; const int def_val_len = 1; mb.tag_get_handle( tag_name,
    1209                 :            :      *def_val_len, MB_TYPE_DOUBLE, vtag, MB_TAG_SPARSE|MB_TAG_VARLEN|MB_TAG_CREAT, &default_val );
    1210                 :            :      * \endcode
    1211                 :            :      */
    1212                 :            :     virtual ErrorCode tag_get_handle( const char* name, int size, DataType type, Tag& tag_handle, unsigned flags = 0,
    1213                 :            :                                       const void* default_value = 0, bool* created = 0 ) = 0;
    1214                 :            : 
    1215                 :            :     /**\brief same as non-const version, except that MB_TAG_CREAT flag is ignored. */
    1216                 :            :     virtual ErrorCode tag_get_handle( const char* name, int size, DataType type, Tag& tag_handle, unsigned flags = 0,
    1217                 :            :                                       const void* default_value = 0 ) const = 0;
    1218                 :            : 
    1219                 :            :     //! Get the name of a tag corresponding to a handle
    1220                 :            :     /** \param tag_handle Tag you want the name of.
    1221                 :            :         \param tag_name Name string for <em>tag_handle</em>.
    1222                 :            :     */
    1223                 :            :     virtual ErrorCode tag_get_name( const Tag tag_handle, std::string& tag_name ) const = 0;
    1224                 :            : 
    1225                 :            :     /**\brief Gets the tag handle corresponding to a name
    1226                 :            : 
    1227                 :            :         If a tag of that name does not exist, returns MB_TAG_NOT_FOUND
    1228                 :            :         \param tag_name Name of the desired tag.
    1229                 :            :         \param tag_handle Tag handle corresponding to <em>tag_name</em>
    1230                 :            :     */
    1231                 :            :     virtual ErrorCode tag_get_handle( const char* tag_name, Tag& tag_handle ) const = 0;
    1232                 :            : 
    1233                 :            :     //! Get the size of the specified tag in bytes
    1234                 :            :     /** Get the size of the specified tag, in bytes (MB_TAG_SPARSE, MB_TAG_DENSE, MB_TAG_MESH)
    1235                 :            :         \note always returns 1 for bit tags.
    1236                 :            :         \param tag Handle of the desired tag.
    1237                 :            :         \param bytes_per_tag Size of the specified tag
    1238                 :            :         \return - MB_TAG_NOT_FOUND for invalid tag handles
    1239                 :            :                 - MB_VARIABLE_DATA_LENGTH for variable-length tags
    1240                 :            :                 - MB_SUCCESS otherwise
    1241                 :            :     */
    1242                 :            :     virtual ErrorCode tag_get_bytes( const Tag tag, int& bytes_per_tag ) const = 0;
    1243                 :            : 
    1244                 :            :     //! Get the array length of a tag
    1245                 :            :     /** Get the size of the specified tag, in as the number of values of
    1246                 :            :         the basic type (e.g. number of integer values for each tag value if
    1247                 :            :         the data type is MB_TYPE_INTEGER).  Gives number of bits for bit tags
    1248                 :            :         and is the same as \c tag_get_bytes for MB_TYPE_OPAQUE tags.
    1249                 :            :         \param tag Handle of the desired tag.
    1250                 :            :         \param length Size of the specified tag
    1251                 :            :         \return - MB_TAG_NOT_FOUND for invalid tag handles
    1252                 :            :                 - MB_VARIABLE_DATA_LENGTH for variable-length tags
    1253                 :            :                 - MB_SUCCESS otherwise
    1254                 :            :     */
    1255                 :            :     virtual ErrorCode tag_get_length( const Tag tag, int& length ) const = 0;
    1256                 :            : 
    1257                 :            :     //! Get the type of the specified tag
    1258                 :            :     /** Get the type of the specified tag
    1259                 :            :         \param tag Handle of the desired tag.
    1260                 :            :         \param tag_type Type of the specified tag
    1261                 :            :     */
    1262                 :            :     virtual ErrorCode tag_get_type( const Tag tag, TagType& tag_type ) const = 0;
    1263                 :            : 
    1264                 :            :     /** \brief Get data type of tag.
    1265                 :            :      *
    1266                 :            :      * Get the type of the tag data.  The tag is data is assumed to
    1267                 :            :      * be a vector of this type.  If the tag data vetcor contains
    1268                 :            :      * more than one value, then the tag size must be a multiple of
    1269                 :            :      * the size of this type.
    1270                 :            :      * \param tag  The tag
    1271                 :            :      * \param type The type of the specified tag (output).
    1272                 :            :      */
    1273                 :            :     virtual ErrorCode tag_get_data_type( const Tag tag, DataType& type ) const = 0;
    1274                 :            : 
    1275                 :            :     //! Get the default value of the specified tag
    1276                 :            :     /** Get the default value of the specified tag
    1277                 :            :         \param tag Handle of the desired tag.
    1278                 :            :         \param def_value Pointer to memory where default value of the specified tag is written
    1279                 :            :         \return - MB_ENTITY_NOT_FOUND If no default value is set for tag.
    1280                 :            :                 - MB_SUCCESS          If success.
    1281                 :            :                 - MB_FAILURE          If <code>def_val</code> is NULL.
    1282                 :            :                 - MB_TAG_NOT_FOUND    If <code>tag_handle</code> is invalid.
    1283                 :            :     */
    1284                 :            :     virtual ErrorCode tag_get_default_value( const Tag tag, void* def_val ) const             = 0;
    1285                 :            :     virtual ErrorCode tag_get_default_value( Tag tag, const void*& def_val, int& size ) const = 0;
    1286                 :            : 
    1287                 :            :     //! Get handles for all tags defined in the mesh instance
    1288                 :            :     /** Get handles for all tags defined on the mesh instance.
    1289                 :            :         \param tag_handles STL vector of all tags
    1290                 :            :     */
    1291                 :            :     virtual ErrorCode tag_get_tags( std::vector< Tag >& tag_handles ) const = 0;
    1292                 :            : 
    1293                 :            :     //! Get handles for all tags defined on this entity
    1294                 :            :     /** Get handles for all tags defined on this entity; if zero, get all tags defined
    1295                 :            :         on mesh instance
    1296                 :            :         \param entity Entity for which you want tags
    1297                 :            :         \param tag_handles STL vector of all tags defined on <em>entity</em>
    1298                 :            :     */
    1299                 :            :     virtual ErrorCode tag_get_tags_on_entity( const EntityHandle entity, std::vector< Tag >& tag_handles ) const = 0;
    1300                 :            : 
    1301                 :            :     //! Get the value of the indicated tag on the specified entities in the specified vector
    1302                 :            :     /** Get the value of the indicated tag on the specified entities; <em>tag_data</em> must contain
    1303                 :            :         enough space (i.e. tag_size*num_entities bytes) to hold all tag data.  MOAB does
    1304                 :            :        <em>not</em> check whether this space is available before writing to it. \note For bit tags,
    1305                 :            :        tag_data must contain one byte per entity.  For each entity, the corresponding byte will
    1306                 :            :        contain the tag bits in the lower bit positions and zero bits in the higher. \param
    1307                 :            :        tag_handle Tag whose values are being queried. \param entity_handles 1d vector of entity
    1308                 :            :        handles whose tag values are being queried \param num_entities Number of entities in 1d
    1309                 :            :        vector of entity handles \param tag_data Pointer to memory into which tag data will be
    1310                 :            :        written
    1311                 :            :     */
    1312                 :            :     virtual ErrorCode tag_get_data( const Tag tag_handle, const EntityHandle* entity_handles, int num_entities,
    1313                 :            :                                     void* tag_data ) const = 0;
    1314                 :            : 
    1315                 :            :     //! Get the value of the indicated tag on the specified entities in the specified range
    1316                 :            :     /** Identical to previous function, except entities are specified using a range instead of a 1d
    1317                 :            :        vector. \param tag_handle Tag whose values are being queried. \param entity_handles Range of
    1318                 :            :        entity handles whose tag values are being queried \param tag_data Pointer to memory into
    1319                 :            :        which tag data will be written
    1320                 :            :     */
    1321                 :            :     virtual ErrorCode tag_get_data( const Tag tag_handle, const Range& entity_handles, void* tag_data ) const = 0;
    1322                 :            : 
    1323                 :            :     //! Set the value of the indicated tag on the specified entities in the specified vector
    1324                 :            :     /** Set the value of the indicated tag on the specified entities; <em>tag_data</em> contains the
    1325                 :            :         values, <em>one value per entity in <em>entity_handles</em></em>.
    1326                 :            :         \note For bit tags, tag_data must contain one byte per entity.  For each
    1327                 :            :               entity, the tag bits will be read from the lower bits of the
    1328                 :            :               corresponding byte.
    1329                 :            :         \param tag_handle Tag whose values are being set
    1330                 :            :         \param entity_handles 1d vector of entity handles whose tag values are being set
    1331                 :            :         \param num_entities Number of entities in 1d vector of entity handles
    1332                 :            :         \param tag_data Pointer to memory holding tag values to be set, <em>one entry per entity
    1333                 :            :        handle</em>
    1334                 :            :     */
    1335                 :            :     virtual ErrorCode tag_set_data( Tag tag_handle, const EntityHandle* entity_handles, int num_entities,
    1336                 :            :                                     const void* tag_data ) = 0;
    1337                 :            : 
    1338                 :            :     //! Set the value of the indicated tag on the specified entities in the specified range
    1339                 :            :     /** Identical to previous function, except entities are specified using a range instead of a 1d
    1340                 :            :        vector. \param tag_handle Tag whose values are being set \param entity_handles Range of
    1341                 :            :        entity handles whose tag values are being set \param tag_data Pointer to memory holding tag
    1342                 :            :        values to be set, <em>one entry per entity handle</em>
    1343                 :            :     */
    1344                 :            :     virtual ErrorCode tag_set_data( Tag tag_handle, const Range& entity_handles, const void* tag_data ) = 0;
    1345                 :            : 
    1346                 :            :     /**\brief Get pointers to tag data
    1347                 :            :      *
    1348                 :            :      * For a tag, get the values for a list of passed entity handles.
    1349                 :            :      *\note  This function may not be used for bit tags.
    1350                 :            :      *\param tag_handle     The tag
    1351                 :            :      *\param entity_handles An array of entity handles for which to retreive tag values.
    1352                 :            :      *\param num_entities   The length of the 'entity_handles' array.
    1353                 :            :      *\param tag_data       An array of 'const void*'.  Array must be at least
    1354                 :            :      *                      'num_entitities' long.  Array is populated (output)
    1355                 :            :      *                      with pointers to the internal storage for the
    1356                 :            :      *                      tag value corresponding to each entity handle.
    1357                 :            :      *\param tag_sizes      The length of each tag value.  Optional for
    1358                 :            :      *                      fixed-length tags.  Required for variable-length tags.
    1359                 :            :      */
    1360                 :            :     virtual ErrorCode tag_get_by_ptr( const Tag tag_handle, const EntityHandle* entity_handles, int num_entities,
    1361                 :            :                                       const void** tag_data, int* tag_sizes = 0 ) const = 0;
    1362                 :            : 
    1363                 :            :     /**\brief Get pointers to tag data
    1364                 :            :      *
    1365                 :            :      * For a tag, get the values for a list of passed entity handles.
    1366                 :            :      *\note  This function may not be used for bit tags.
    1367                 :            :      *\param tag_handle     The tag
    1368                 :            :      *\param entity_handles The entity handles for which to retreive tag values.
    1369                 :            :      *\param tag_data       An array of 'const void*'.  Array is populated (output)
    1370                 :            :      *                      with pointers to the internal storage for the
    1371                 :            :      *                      tag value corresponding to each entity handle.
    1372                 :            :      *\param tag_sizes      The length of each tag value.  Optional for
    1373                 :            :      *                      fixed-length tags.  Required for variable-length tags.
    1374                 :            :      */
    1375                 :            :     virtual ErrorCode tag_get_by_ptr( const Tag tag_handle, const Range& entity_handles, const void** tag_data,
    1376                 :            :                                       int* tag_sizes = 0 ) const = 0;
    1377                 :            : 
    1378                 :            :     /**\brief Set tag data given an array of pointers to tag values.
    1379                 :            :      *
    1380                 :            :      * For a tag, set the values for a list of passed entity handles.
    1381                 :            :      *\note  This function may not be used for bit tags.
    1382                 :            :      *\param tag_handle     The tag
    1383                 :            :      *\param entity_handles An array of entity handles for which to set tag values.
    1384                 :            :      *\param num_entities   The length of the 'entity_handles' array.
    1385                 :            :      *\param tag_data       An array of 'const void*'.  Array must be at least
    1386                 :            :      *                      'num_entitities' long.  Array is expected to
    1387                 :            :      *                      contain pointers to tag values for the corresponding
    1388                 :            :      *                      EntityHandle in 'entity_handles'.
    1389                 :            :      *\param tag_sizes      The length of each tag value.  Optional for
    1390                 :            :      *                      fixed-length tags.  Required for variable-length tags.
    1391                 :            :      */
    1392                 :            :     virtual ErrorCode tag_set_by_ptr( Tag tag_handle, const EntityHandle* entity_handles, int num_entities,
    1393                 :            :                                       void const* const* tag_data, const int* tag_sizes = 0 ) = 0;
    1394                 :            : 
    1395                 :            :     /**\brief Set tag data given an array of pointers to tag values.
    1396                 :            :      *
    1397                 :            :      * For a tag, set the values for a list of passed entity handles.
    1398                 :            :      *\note  This function may not be used for bit tags.
    1399                 :            :      *\param tag_handle     The tag
    1400                 :            :      *\param entity_handles The entity handles for which to set tag values.
    1401                 :            :      *\param tag_data       An array of 'const void*'.  Array is expected to
    1402                 :            :      *                      contain pointers to tag values for the corresponding
    1403                 :            :      *                      EntityHandle in 'entity_handles'.
    1404                 :            :      *\param tag_sizes      The length of each tag value.  Optional for
    1405                 :            :      *                      fixed-length tags.  Required for variable-length tags.
    1406                 :            :      */
    1407                 :            :     virtual ErrorCode tag_set_by_ptr( Tag tag_handle, const Range& entity_handles, void const* const* tag_data,
    1408                 :            :                                       const int* tag_sizes = 0 ) = 0;
    1409                 :            : 
    1410                 :            :     /**\brief Set tag data given value.
    1411                 :            :      *
    1412                 :            :      * For a tag, set the values for a list of passed entity handles to
    1413                 :            :      * the same, specified value.
    1414                 :            :      *
    1415                 :            :      *\param tag_handle     The tag
    1416                 :            :      *\param entity_handles The entity handles for which to set tag values.
    1417                 :            :      *\param tag_data       A pointer to the tag value.
    1418                 :            :      *\param tag_sizes      For variable-length tags, the length of the
    1419                 :            :      *                      tag value.  This argument will be ignored for
    1420                 :            :      *                      fixed-length tags.
    1421                 :            :      */
    1422                 :            :     virtual ErrorCode tag_clear_data( Tag tag_handle, const Range& entity_handles, const void* value,
    1423                 :            :                                       int value_size = 0 ) = 0;
    1424                 :            : 
    1425                 :            :     /**\brief Set tag data given value.
    1426                 :            :      *
    1427                 :            :      * For a tag, set the values for a list of passed entity handles to
    1428                 :            :      * the same, specified value.
    1429                 :            :      *
    1430                 :            :      *\param tag_handle     The tag
    1431                 :            :      *\param entity_handles The entity handles for which to set tag values.
    1432                 :            :      *\param tag_data       A pointer to the tag value.
    1433                 :            :      *\param tag_sizes      For variable-length tags, the length of the
    1434                 :            :      *                      tag value.  This argument will be ignored for
    1435                 :            :      *                      fixed-length tags.
    1436                 :            :      */
    1437                 :            :     virtual ErrorCode tag_clear_data( Tag tag_handle, const EntityHandle* entity_handles, int num_entity_handles,
    1438                 :            :                                       const void* value, int value_size = 0 ) = 0;
    1439                 :            : 
    1440                 :            :     //! Delete the data of a vector of entity handles and sparse tag
    1441                 :            :     /** Delete the data of a tag on a vector of entity handles.  Only sparse tag data are deleted
    1442                 :            :        with this function; dense tags are deleted by deleting the tag itself using tag_delete.
    1443                 :            :         \param tag_handle Handle of the (sparse) tag being deleted from entity
    1444                 :            :         \param entity_handles 1d vector of entity handles from which the tag is being deleted
    1445                 :            :         \param num_handles Number of entity handles in 1d vector
    1446                 :            :     */
    1447                 :            :     virtual ErrorCode tag_delete_data( Tag tag_handle, const EntityHandle* entity_handles, int num_handles ) = 0;
    1448                 :            : 
    1449                 :            :     //! Delete the data of a range of entity handles and sparse tag
    1450                 :            :     /** Delete the data of a tag on a range of entity handles.  Only sparse tag data are deleted
    1451                 :            :        with this function; dense tags are deleted by deleting the tag itself using tag_delete.
    1452                 :            :         \param tag_handle Handle of the (sparse) tag being deleted from entity
    1453                 :            :         \param entity_range Range of entities from which the tag is being deleted
    1454                 :            :     */
    1455                 :            :     virtual ErrorCode tag_delete_data( Tag tag_handle, const Range& entity_range ) = 0;
    1456                 :            : 
    1457                 :            :     /**\brief Access tag data via direct pointer into contiguous blocks
    1458                 :            :      *
    1459                 :            :      * Iteratively obtain direct access to contiguous blocks of tag
    1460                 :            :      * storage.  This function cannot be used with bit tags because
    1461                 :            :      * of the compressed bit storage.  This function cannot be used
    1462                 :            :      * with variable length tags because it does not provide a mechanism
    1463                 :            :      * to determine the length of the value for each entity.  This
    1464                 :            :      * function may be used with sparse tags, but if it is used, it
    1465                 :            :      * will return data for a single entity at a time.
    1466                 :            :      *
    1467                 :            :      *\param tag_handle  The handle of the tag for which to access data
    1468                 :            :      *\param iter        The first entity for which to return data.
    1469                 :            :      *\param end         One past the last entity for which data is desired.
    1470                 :            :      *\param count       The number of entities for which data was returned
    1471                 :            :      *\param data_ptr    Output: pointer to tag storage.
    1472                 :            :      *\param allocate    If true, space for this tag will be allocated, if not it wont
    1473                 :            :      *
    1474                 :            :      *\Note If this function is called for entities for which no tag value
    1475                 :            :      *      has been set, but for which a default value exists, it will
    1476                 :            :      *      force the allocation of explicit storage for each such entity
    1477                 :            :      *      even though MOAB would normally not explicitly store tag values
    1478                 :            :      *      for such entities.
    1479                 :            :      *
    1480                 :            :      *\Example:
    1481                 :            :      *\code
    1482                 :            :      * Range ents; // range to iterate over
    1483                 :            :      * Tag tag; // tag for which to access data
    1484                 :            :      * int bytes;
    1485                 :            :      * ErrorCode err = mb.tag_get_size( tag, bytes );
    1486                 :            :      * if (err) { ... }
    1487                 :            :      *
    1488                 :            :      * ...
    1489                 :            :      * Range::iterator iter = ents.begin();
    1490                 :            :      * while (iter != ents.end()) {
    1491                 :            :      *   int count;
    1492                 :            :      *    // get contiguous block of tag dat
    1493                 :            :      *   void* ptr;
    1494                 :            :      *   err = mb.tag_iterate( tag, iter, ents.end(), count, ptr );
    1495                 :            :      *   if (err) { ... }
    1496                 :            :      *    // do something with tag data
    1497                 :            :      *   process_Data( ptr, count );
    1498                 :            :      *    // advance to next block of data
    1499                 :            :      *   iter += count;
    1500                 :            :      * }
    1501                 :            :      *\endcode
    1502                 :            :      */
    1503                 :            :     virtual ErrorCode tag_iterate( Tag tag_handle, Range::const_iterator begin, Range::const_iterator end, int& count,
    1504                 :            :                                    void*& data_ptr, bool allocate = true ) = 0;
    1505                 :            : 
    1506                 :            :     //! Remove a tag from the database and delete all of its associated data
    1507                 :            :     /** Deletes a tag and all associated data.
    1508                 :            :      */
    1509                 :            :     virtual ErrorCode tag_delete( Tag tag_handle ) = 0;
    1510                 :            : 
    1511                 :            :     /**@}*/
    1512                 :            : 
    1513                 :            :     /** \name Sets */
    1514                 :            : 
    1515                 :            :     /**@{*/
    1516                 :            : 
    1517                 :            :     //! Create a new mesh set
    1518                 :            :     /** Create a new mesh set.  Meshsets can store entities ordered or unordered. A set can include
    1519                 :            :        entities at most once (MESHSET_SET) or more than once.  Meshsets can optionally track its
    1520                 :            :        members using adjacencies (MESHSET_TRACK_OWNER); if set, entities are deleted from tracking
    1521                 :            :        meshsets before being deleted.  This adds data to mesh entities, which can be expensive.
    1522                 :            :         \param options Options bitmask for the new meshset, possible values defined above
    1523                 :            :         \param ms_handle Handle for the meshset created
    1524                 :            :     */
    1525                 :            :     virtual ErrorCode create_meshset( const unsigned int options, EntityHandle& ms_handle, int start_id = 0 ) = 0;
    1526                 :            : 
    1527                 :            :     //! Empty a vector of mesh set
    1528                 :            :     /** Empty a mesh set.
    1529                 :            :         \param ms_handles 1d vector of handles of sets being emptied
    1530                 :            :         \param num_meshsets Number of entities in 1d vector
    1531                 :            :     */
    1532                 :            :     virtual ErrorCode clear_meshset( const EntityHandle* ms_handles, const int num_meshsets ) = 0;
    1533                 :            : 
    1534                 :            :     //! Empty a range of mesh set
    1535                 :            :     /** Empty a mesh set.
    1536                 :            :         \param ms_handles Range of handles of sets being emptied
    1537                 :            :     */
    1538                 :            :     virtual ErrorCode clear_meshset( const Range& ms_handles ) = 0;
    1539                 :            : 
    1540                 :            :     //! Get the options of a mesh set
    1541                 :            :     /** Get the options of a mesh set.
    1542                 :            :         \param ms_handle Handle for mesh set being queried
    1543                 :            :         \param options Bit mask in which mesh set options are returned
    1544                 :            :     */
    1545                 :            :     virtual ErrorCode get_meshset_options( const EntityHandle ms_handle, unsigned int& options ) const = 0;
    1546                 :            : 
    1547                 :            :     //! Set the options of a mesh set
    1548                 :            :     /** Set the options of a mesh set.
    1549                 :            :         \param ms_handle Handle for meshset whose options are being changed
    1550                 :            :         \param options Bit mask of options to be used
    1551                 :            :     */
    1552                 :            :     virtual ErrorCode set_meshset_options( const EntityHandle ms_handle, const unsigned int options ) = 0;
    1553                 :            : 
    1554                 :            :     //! Subtract meshsets
    1555                 :            :     /** Subtract <em>meshset2</em> from <em>meshset1</em>, placing the results in meshset1.
    1556                 :            :         \param meshset1 Mesh set being subtracted from, also used to pass back result
    1557                 :            :         \param meshset2 Mesh set being subtracted from <em>meshset1</em>
    1558                 :            :     */
    1559                 :            :     virtual ErrorCode subtract_meshset( EntityHandle meshset1, const EntityHandle meshset2 ) = 0;
    1560                 :            : 
    1561                 :            :     //! Intersect meshsets
    1562                 :            :     /** Intersect <em>meshset1</em> with <em>meshset2</em>, placing the results in meshset1.
    1563                 :            :         \param meshset1 Mesh set being intersected, also used to pass back result
    1564                 :            :         \param meshset2 Mesh set being intersected with <em>meshset1</em>
    1565                 :            :     */
    1566                 :            :     virtual ErrorCode intersect_meshset( EntityHandle meshset1, const EntityHandle meshset2 ) = 0;
    1567                 :            : 
    1568                 :            :     //! Unite meshsets
    1569                 :            :     /** Unite <em>meshset1</em> with <em>meshset2</em>, placing the results in meshset1.
    1570                 :            :         \param meshset1 Mesh set being united, also used to pass back result
    1571                 :            :         \param meshset2 Mesh set being united with <em>meshset1</em>
    1572                 :            :     */
    1573                 :            :     virtual ErrorCode unite_meshset( EntityHandle meshset1, const EntityHandle meshset2 ) = 0;
    1574                 :            : 
    1575                 :            :     //! Add to a meshset entities in specified range
    1576                 :            :     /** Add to a meshset entities in specified range.  If <em>meshset</em> has MESHSET_TRACK_OWNER
    1577                 :            :         option set, adjacencies are also added to entities in <em>entities</em>.
    1578                 :            :         \param meshset Mesh set being added to
    1579                 :            :         \param entities Range of entities being added to meshset
    1580                 :            :     */
    1581                 :            :     virtual ErrorCode add_entities( EntityHandle meshset, const Range& entities ) = 0;
    1582                 :            : 
    1583                 :            :     //! Add to a meshset entities in specified vector
    1584                 :            :     /** Add to a meshset entities in specified vector.  If <em>meshset</em> has MESHSET_TRACK_OWNER
    1585                 :            :         option set, adjacencies are also added to entities in <em>entities</em>.
    1586                 :            :         \param meshset Mesh set being added to
    1587                 :            :         \param entities 1d vector of entities being added to meshset
    1588                 :            :         \param num_entities Number of entities in 1d vector
    1589                 :            :     */
    1590                 :            :     virtual ErrorCode add_entities( EntityHandle meshset, const EntityHandle* entities, const int num_entities ) = 0;
    1591                 :            : 
    1592                 :            :     //! Remove from a meshset entities in specified range
    1593                 :            :     /** Remove from a meshset entities in specified range.  If <em>meshset</em> has
    1594                 :            :        MESHSET_TRACK_OWNER option set, adjacencies in entities in <em>entities</em> are updated.
    1595                 :            :         \param meshset Mesh set being removed from
    1596                 :            :         \param entities Range of entities being removed from meshset
    1597                 :            :     */
    1598                 :            :     virtual ErrorCode remove_entities( EntityHandle meshset, const Range& entities ) = 0;
    1599                 :            : 
    1600                 :            :     //! Remove from a meshset entities in specified vector
    1601                 :            :     /** Remove from a meshset entities in specified vector.  If <em>meshset</em> has
    1602                 :            :        MESHSET_TRACK_OWNER option set, adjacencies in entities in <em>entities</em> are updated.
    1603                 :            :         \param meshset Mesh set being removed from
    1604                 :            :         \param entities 1d vector of entities being removed from meshset
    1605                 :            :         \param num_entities Number of entities in 1d vector
    1606                 :            :     */
    1607                 :            :     virtual ErrorCode remove_entities( EntityHandle meshset, const EntityHandle* entities, const int num_entities ) = 0;
    1608                 :            : 
    1609                 :            :     //! Return whether a set contains entities
    1610                 :            :     /** Return whether a set contains entities.  Returns true only
    1611                 :            :      * if ALL entities are contained
    1612                 :            :      * \param meshset Mesh set being queried
    1613                 :            :      * \param entities Entities being queried
    1614                 :            :      * \param num_entities Number of entities
    1615                 :            :      * \return bool If true, all entities are contained in set
    1616                 :            :      */
    1617                 :            :     virtual bool contains_entities( EntityHandle meshset, const EntityHandle* entities, int num_entities,
    1618                 :            :                                     const int operation_type = Interface::INTERSECT ) = 0;
    1619                 :            : 
    1620                 :            :     //! Replace entities in a set with other entities
    1621                 :            :     /** Replace entities in a set with other entities
    1622                 :            :      *
    1623                 :            :      * \note  Behavior is undefined if an entity handle exists in both the
    1624                 :            :      *        old_entities and the new_entities arrays or old_entities
    1625                 :            :      *        contains multiple copies of an entity.
    1626                 :            :      * \note  If an entity occurs multiple times in an ordered set, all
    1627                 :            :      *        occurances will be replaced.
    1628                 :            :      * \note  For list-based sets, if not all handles in old_entities
    1629                 :            :      *        occcur in the set, the corresponding new_entities will not
    1630                 :            :      *        be added and  MB_ENTITY_NOT_FOUND will be returned.
    1631                 :            :      *        For set-based sets, all entities in new_entities wll be
    1632                 :            :      *        added and any contained entities in old_entities will be
    1633                 :            :      *        removed, and the return value will be MB_SUCCESS.
    1634                 :            :      * \param meshset Mesh set being modified
    1635                 :            :      * \param old_entities Entities to replace
    1636                 :            :      * \param new_entities New entities to add
    1637                 :            :      * \param num_entities Number of entities in input arrays
    1638                 :            :      * \return - MB_SUCCESS : all entities in old_entities replaced
    1639                 :            :      *         - MB_ENTITY_NOT_FOUND : one or more entities in new_entities
    1640                 :            :      *                        not added to set because corresponding entity
    1641                 :            :      *                        in old_entities did not occur in the ordered
    1642                 :            :      *                        set.
    1643                 :            :      *         - MB_FAILURE : internal error
    1644                 :            :      */
    1645                 :            :     virtual ErrorCode replace_entities( EntityHandle meshset, const EntityHandle* old_entities,
    1646                 :            :                                         const EntityHandle* new_entities, int num_entities ) = 0;
    1647                 :            :     /**@}*/
    1648                 :            : 
    1649                 :            :     /** \name Set parents/children */
    1650                 :            : 
    1651                 :            :     /**@{*/
    1652                 :            : 
    1653                 :            :     //! Get parent mesh sets of a mesh set
    1654                 :            :     /** If <em>num_hops</em> is 1, only immediate parents are returned.  If <em>num_hops</em> is
    1655                 :            :        zero, all ancenstors are returned.  Otherwise, <em>num_hops</em> specifies the maximum number
    1656                 :            :        of generations to traverse. \param meshset The mesh set whose parents are being queried
    1657                 :            :         \param parents STL vector holding the parents returned by this function
    1658                 :            :         \param num_hops Number of generations to traverse (0 = all)
    1659                 :            :     */
    1660                 :            :     virtual ErrorCode get_parent_meshsets( const EntityHandle meshset, std::vector< EntityHandle >& parents,
    1661                 :            :                                            const int num_hops = 1 ) const = 0;
    1662                 :            : 
    1663                 :            :     //! Get parent mesh sets of a mesh set
    1664                 :            :     /** If <em>num_hops</em> is 1, only immediate parents are returned.  If <em>num_hops</em> is
    1665                 :            :        zero, all ancenstors are returned.  Otherwise, <em>num_hops</em> specifies the maximum number
    1666                 :            :        of generations to traverse. \param meshset The mesh set whose parents are being queried
    1667                 :            :         \param parents Range holding the parents returned by this function
    1668                 :            :         \param num_hops Number of generations to traverse (0 = all)
    1669                 :            :     */
    1670                 :            :     virtual ErrorCode get_parent_meshsets( const EntityHandle meshset, Range& parents,
    1671                 :            :                                            const int num_hops = 1 ) const = 0;
    1672                 :            : 
    1673                 :            :     //! Get child mesh sets of a mesh set
    1674                 :            :     /** If <em>num_hops</em> is 1, only immediate children are returned.  If <em>num_hops</em> is
    1675                 :            :        zero, all ancenstors are returned.  Otherwise, <em>num_hops</em> specifies the maximum number
    1676                 :            :        of generations to traverse. \param meshset The mesh set whose children are being queried
    1677                 :            :         \param children STL vector holding the children returned by this function
    1678                 :            :         \param num_hops Number of generations to traverse (0 = all)
    1679                 :            :     */
    1680                 :            :     virtual ErrorCode get_child_meshsets( const EntityHandle meshset, std::vector< EntityHandle >& children,
    1681                 :            :                                           const int num_hops = 1 ) const = 0;
    1682                 :            : 
    1683                 :            :     //! Get child mesh sets of a mesh set
    1684                 :            :     /** If <em>num_hops</em> is 1, only immediate children are returned.  If <em>num_hops</em> is
    1685                 :            :        zero, all ancenstors are returned.  Otherwise, <em>num_hops</em> specifies the maximum number
    1686                 :            :        of generations to traverse. \param meshset The mesh set whose children are being queried
    1687                 :            :         \param children Range holding the children returned by this function
    1688                 :            :         \param num_hops Number of generations to traverse (0 = all)
    1689                 :            :     */
    1690                 :            :     virtual ErrorCode get_child_meshsets( const EntityHandle meshset, Range& children,
    1691                 :            :                                           const int num_hops = 1 ) const = 0;
    1692                 :            : 
    1693                 :            :     /**\brief Get mesh sets contained in a mesh set
    1694                 :            :      *
    1695                 :            :      * If <em>num_hops</em> is 1, only immediate contents are returned.
    1696                 :            :      * Otherwise a recursive query of all contained sets is performed,
    1697                 :            :      * returning every visted set.  The value of num_hops limites the
    1698                 :            :      * depth of the search, with zero indicating no depth limit.
    1699                 :            :      *
    1700                 :            :      *\param meshset The mesh set whose contents are being queried
    1701                 :            :      *\param contained The result list.
    1702                 :            :      *\param num_hops Number of generations to traverse (0 = all)
    1703                 :            :      */
    1704                 :            :     virtual ErrorCode get_contained_meshsets( const EntityHandle meshset, std::vector< EntityHandle >& contained,
    1705                 :            :                                               const int num_hops = 1 ) const = 0;
    1706                 :            : 
    1707                 :            :     /**\brief Get mesh sets contained in a mesh set
    1708                 :            :      *
    1709                 :            :      * If <em>num_hops</em> is 1, only immediate contents are returned.
    1710                 :            :      * Otherwise a recursive query of all contained sets is performed,
    1711                 :            :      * returning every visted set.  The value of num_hops limites the
    1712                 :            :      * depth of the search, with zero indicating no depth limit.
    1713                 :            :      *
    1714                 :            :      *\param meshset The mesh set whose contents are being queried
    1715                 :            :      *\param contained The result list.
    1716                 :            :      *\param num_hops Number of generations to traverse (0 = all)
    1717                 :            :      */
    1718                 :            :     virtual ErrorCode get_contained_meshsets( const EntityHandle meshset, Range& contained,
    1719                 :            :                                               const int num_hops = 1 ) const = 0;
    1720                 :            : 
    1721                 :            :     //! Get the number of parent mesh sets of a mesh set
    1722                 :            :     /** Identical to get_parent_meshsets, only number is returned instead of actual parents.
    1723                 :            :         \param meshset The mesh set whose parents are being queried
    1724                 :            :         \param number Number of parents
    1725                 :            :     */
    1726                 :            :     virtual ErrorCode num_parent_meshsets( const EntityHandle meshset, int* number, const int num_hops = 1 ) const = 0;
    1727                 :            : 
    1728                 :            :     //! Get the number of child mesh sets of a mesh set
    1729                 :            :     /** Identical to get_child_meshsets, only number is returned instead of actual children.
    1730                 :            :         \param meshset The mesh set whose children are being queried
    1731                 :            :         \param number Number of children
    1732                 :            :     */
    1733                 :            :     virtual ErrorCode num_child_meshsets( const EntityHandle meshset, int* number, const int num_hops = 1 ) const = 0;
    1734                 :            : 
    1735                 :            :     /**\brief Get the number of mesh sets contained in a mesh set
    1736                 :            :      *
    1737                 :            :      * Return the number of sets that would be returned by get_contained_meshsets
    1738                 :            :      *
    1739                 :            :      *\param meshset  The initial set to begin the query from.
    1740                 :            :      *\param number   (Output) The result count.
    1741                 :            :      *\param num_hops Search depth (0 => unbounded).
    1742                 :            :      */
    1743                 :            :     virtual ErrorCode num_contained_meshsets( const EntityHandle meshset, int* number,
    1744                 :            :                                               const int num_hops = 1 ) const = 0;
    1745                 :            : 
    1746                 :            :     //! Add a parent mesh set to a mesh set
    1747                 :            :     /** Make <em>parent_meshset</em> a new parent of <em>child_meshset</em>.  This function does
    1748                 :            :         <em>not</em> add a corresponding child link to <em>parent_meshset</em>.
    1749                 :            :         \param child_meshset The child mesh set being given a new parent.
    1750                 :            :         \param parent_meshset The parent being added to <em>child_meshset</em>
    1751                 :            :     */
    1752                 :            :     virtual ErrorCode add_parent_meshset( EntityHandle child_meshset, const EntityHandle parent_meshset ) = 0;
    1753                 :            : 
    1754                 :            :     //! Add a parent mesh sets to a mesh set
    1755                 :            :     /** Make <em>parent_meshset</em> a new parent of <em>child_meshset</em>.  This function does
    1756                 :            :         <em>not</em> add a corresponding child link to <em>parent_meshset</em>.
    1757                 :            :         \param child_meshset The child mesh set being given a new parent.
    1758                 :            :         \param parent_meshset The parent being added to <em>child_meshset</em>
    1759                 :            :     */
    1760                 :            :     virtual ErrorCode add_parent_meshsets( EntityHandle child_meshset, const EntityHandle* parent_meshsets,
    1761                 :            :                                            int num_parent_meshsets ) = 0;
    1762                 :            : 
    1763                 :            :     //! Add a child mesh set to a mesh set
    1764                 :            :     /** Make <em>child_meshset</em> a new child of <em>parent_meshset</em>.  This function does
    1765                 :            :         <em>not</em> add a corresponding parent link to <em>child_meshset</em>.
    1766                 :            :         \param parent_meshset The parent mesh set being given a new child.
    1767                 :            :         \param child_meshset The child being added to <em>parent_meshset</em>
    1768                 :            :     */
    1769                 :            :     virtual ErrorCode add_child_meshset( EntityHandle parent_meshset, const EntityHandle child_meshset ) = 0;
    1770                 :            : 
    1771                 :            :     //! Add a child mesh sets to a mesh set
    1772                 :            :     /** Make <em>child_meshset</em> a new child of <em>parent_meshset</em>.  This function does
    1773                 :            :         <em>not</em> add a corresponding parent link to <em>child_meshset</em>.
    1774                 :            :         \param parent_meshset The parent mesh set being given a new child.
    1775                 :            :         \param child_meshset The child being added to <em>parent_meshset</em>
    1776                 :            :     */
    1777                 :            :     virtual ErrorCode add_child_meshsets( EntityHandle parent_meshset, const EntityHandle* child_meshsets,
    1778                 :            :                                           int num_child_meshsets ) = 0;
    1779                 :            : 
    1780                 :            :     //! Add parent and child links between mesh sets
    1781                 :            :     /** Makes <em>child_meshset</em> a new child of <em>parent_meshset</em>, and vica versa.
    1782                 :            :         \param parent The parent mesh set being given a new child, and the new parent
    1783                 :            :         \param child The child being given a new parent, and the new child
    1784                 :            :     */
    1785                 :            :     virtual ErrorCode add_parent_child( EntityHandle parent, EntityHandle child ) = 0;
    1786                 :            : 
    1787                 :            :     //! Remove parent and child links between mesh sets
    1788                 :            :     /** Removes parent/child links between <em>child_meshset</em> and <em>parent_meshset</em>.
    1789                 :            :         \param parent The parent mesh set being removed from <em>child</em>
    1790                 :            :         \param child The child mesh set being removed from <em>parent</em>
    1791                 :            :     */
    1792                 :            :     virtual ErrorCode remove_parent_child( EntityHandle parent, EntityHandle child ) = 0;
    1793                 :            : 
    1794                 :            :     //! Remove a parent mesh set from a mesh set
    1795                 :            :     /** Removes <em>parent_meshset</em> from the parents of <em>child_meshset</em>.  This function
    1796                 :            :        does <em>not</em> remove a corresponding child link from <em>parent_meshset</em>. \param
    1797                 :            :        child_meshset The child mesh whose parent is being removed \param parent_meshset The parent
    1798                 :            :        being removed from <em>meshset</em>
    1799                 :            :     */
    1800                 :            :     virtual ErrorCode remove_parent_meshset( EntityHandle child_meshset, const EntityHandle parent_meshset ) = 0;
    1801                 :            : 
    1802                 :            :     //! Remove a child mesh set from a mesh set
    1803                 :            :     /** Removes <em>child_meshset</em> from the children of <em>parent_meshset</em>.  This function
    1804                 :            :        does <em>not</em> remove a corresponding parent link from <em>child_meshset</em>. \param
    1805                 :            :        parent_meshset The parent mesh set whose child is being removed \param child_meshset The
    1806                 :            :        child being removed from <em>parent_meshset</em>
    1807                 :            :     */
    1808                 :            :     virtual ErrorCode remove_child_meshset( EntityHandle parent_meshset, const EntityHandle child_meshset ) = 0;
    1809                 :            : 
    1810                 :            :     // ! Returns the global id tag; default value is -1
    1811                 :            :     virtual Tag globalId_tag() = 0;
    1812                 :            : 
    1813                 :            :     /**@}*/
    1814                 :            : 
    1815                 :            :     /** \name Set iterators */
    1816                 :            : 
    1817                 :            :     /**@{*/
    1818                 :            : 
    1819                 :            :     /** \brief Create an iterator over the set
    1820                 :            :      * Create a new iterator that iterates over entities with the specified type or dimension.
    1821                 :            :      * Only one of ent_type or dim can be set; use dim=-1 or ent_type=MBMAXTYPE for the other.
    1822                 :            :      * Iterators for list-type (ordered) sets are stable over set modification, unless entity
    1823                 :            :      * removed or deleted is the one at the current position of the iterator.  If the check_valid
    1824                 :            :      * parameter is passed as true, entities are checked for validity before being passed back by
    1825                 :            :      * get_next_entities function (checking entity validity can have a non-negligible cost).
    1826                 :            :      *
    1827                 :            :      * Iterators returned by this function can be deleted using the normal C++ delete function.
    1828                 :            :      * After creating the iterator through this function, further interactions are through methods
    1829                 :            :      * on the SetIterator class.
    1830                 :            :      * \param meshset The entity set associated with this iterator (use 0 for whole instance)
    1831                 :            :      * \param ent_type Entity type associated with this iterator
    1832                 :            :      * \param ent_dim Dimension associated with this iterator
    1833                 :            :      * \param chunk_size Chunk size of the iterator
    1834                 :            :      * \param check_valid If true, entities are checked for validity before being returned
    1835                 :            :      */
    1836                 :            : 
    1837                 :            :     virtual ErrorCode create_set_iterator( EntityHandle meshset, EntityType ent_type, int ent_dim, int chunk_size,
    1838                 :            :                                            bool check_valid, SetIterator*& set_iter ) = 0;
    1839                 :            :     /**@}*/
    1840                 :            : 
    1841                 :            :     // ************************  Interface options controllable by user  ***************
    1842                 :            : 
    1843                 :            :     /** \name Sequence Option controllers */
    1844                 :            : 
    1845                 :            :     /**@{*/
    1846                 :            : 
    1847                 :            :     /** \brief Interface to control memory allocation for sequences
    1848                 :            :      * Provide a factor that controls the size of the sequence that gets allocated.
    1849                 :            :      * This is typically useful in the parallel setting when a-priori, the number of ghost entities
    1850                 :            :      * and the memory required for them within the same sequence as the owned entities are unknown.
    1851                 :            :      * The default factor is 1.0 but this can be appropriately updated at runtime so that we do not
    1852                 :            :      * have broken sequences.
    1853                 :            :      */
    1854                 :            :     virtual double get_sequence_multiplier() const = 0;
    1855                 :            : 
    1856                 :            :     /** \brief Interface to control memory allocation for sequences
    1857                 :            :      * Provide a factor that controls the size of the sequence that gets allocated.
    1858                 :            :      * This is typically useful in the parallel setting when a-priori, the number of ghost entities
    1859                 :            :      * and the memory required for them within the same sequence as the owned entities are unknown.
    1860                 :            :      * The default factor is 1.0 but this can be appropriately updated at runtime so that we do not
    1861                 :            :      * have broken sequences.
    1862                 :            :      *
    1863                 :            :      * \param meshset User specified multiplier (should be greater than 1.0)
    1864                 :            :      */
    1865                 :            :     virtual void set_sequence_multiplier( double factor ) = 0;
    1866                 :            : 
    1867                 :            :     /**@}*/
    1868                 :            : };
    1869                 :            : 
    1870                 :            : //! predicate for STL algorithms.  Returns true if the entity handle is
    1871                 :            : //! of the specified type.  For example, to remove all the tris out of a list
    1872                 :            : //! of 2D entities retrieved using get_adjacencies you could do
    1873                 :            : //! std::remove_if(list.begin(), list.end(), type_equals(gMB, MBTRI));
    1874                 :            : class type_equals : public std::unary_function< EntityHandle, bool >
    1875                 :            : {
    1876                 :            :   public:
    1877                 :            :     //! interface object
    1878                 :            :     Interface* meshDB;
    1879                 :            : 
    1880                 :            :     //! type corresponding to this predicate
    1881                 :            :     const EntityType test_type;
    1882                 :            : 
    1883                 :            :     //! Constructor
    1884                 :            :     type_equals( Interface* mdb, const EntityType type ) : meshDB( mdb ), test_type( type ) {}
    1885                 :            : 
    1886                 :            :     //! operator predicate
    1887                 :            :     bool operator()( EntityHandle handle ) const
    1888                 :            :     {
    1889                 :            :         return ( meshDB->type_from_handle( handle ) == test_type );
    1890                 :            :     }
    1891                 :            : };
    1892                 :            : 
    1893                 :            : //! predicate for STL algorithms.  Returns true if the entity handle is not
    1894                 :            : //! of the specified type.  For example, to remove all but the tris out of a list
    1895                 :            : //! of 2D entities retrieved using get_adjacencies you could do
    1896                 :            : //! std::remove_if(list.begin(), list.end(), type_not_equals(gMB, MBTRI));
    1897                 :            : class type_not_equals : public std::unary_function< EntityHandle, bool >
    1898                 :            : {
    1899                 :            :   public:
    1900                 :            :     //! interface object
    1901                 :            :     Interface* meshDB;
    1902                 :            : 
    1903                 :            :     //! type corresponding to this predicate
    1904                 :            :     const EntityType test_type;
    1905                 :            : 
    1906                 :            :     //! Constructor
    1907                 :         54 :     type_not_equals( Interface* mdb, const EntityType type ) : meshDB( mdb ), test_type( type ) {}
    1908                 :            : 
    1909                 :            :     //! operator predicate
    1910                 :         64 :     bool operator()( EntityHandle handle ) const
    1911                 :            :     {
    1912                 :         64 :         return ( meshDB->type_from_handle( handle ) != test_type );
    1913                 :            :     }
    1914                 :            : };
    1915                 :            : 
    1916                 :          0 : inline float Interface::api_version( std::string* version_string )
    1917                 :            : {
    1918         [ #  # ]:          0 :     if( NULL != version_string )
    1919 [ #  # ][ #  # ]:          0 :         *version_string = std::string( "MOAB API version " ) + std::string( MOAB_API_VERSION_STRING );
         [ #  # ][ #  # ]
    1920                 :          0 :     return MOAB_API_VERSION;
    1921                 :            : }
    1922                 :            : 
    1923                 :            : }  // namespace moab
    1924                 :            : 
    1925                 :            : #endif  // MB_INTERFACE_HPP

Generated by: LCOV version 1.11