1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
/**
 * MOAB, a Mesh-Oriented datABase, is a software component for creating,
 * storing and accessing finite element mesh data.
 *
 * Copyright 2004 Sandia Corporation.  Under the terms of Contract
 * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
 * retains certain rights in this software.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 */

#ifndef MOAB_IMPL_GENERAL_HPP
#define MOAB_IMPL_GENERAL_HPP

#include "moab/Interface.hpp"
#include "moab/ReaderIface.hpp"
#include <map>
#include <list>

namespace moab
{

class WriteUtil;
class ReadUtil;
class ScdInterface;
class AEntityFactory;
class SequenceManager;
class Error;
class HomCoord;
class ReaderWriterSet;
class EntitySequence;
class FileOptions;
class SetIterator;

#ifdef MOAB_HAVE_AHF
class HalfFacetRep;
#endif

/**\class Core
 * \brief Implementation of MOAB Interface
 * Implementation of the MOAB Interface class.  You shouldn't call functions directly
 * on an object of type Core (use Interface instead), unless you really have to access
 * non-API functionality.
 */
class Core : public Interface
{

  public:
    friend class SetIterator;

    //! constructor
    Core();

    //! destructor
    ~Core();

    //! Get a pointer to an internal MOAB interface
    //!\return NULL if not found, iterface pointer otherwise
    virtual ErrorCode query_interface_type( const std::type_info& interface_type, void*& ptr );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! Release reference to MB interface
    virtual ErrorCode release_interface_type( const std::type_info& interface_type, void* iface );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    virtual int QueryInterface( const MBuuid& uuid, UnknownInterface** iface );

    //! Returns the major.minor version number of the implementation
    /**
       \param iface_name If non-NULL, will be filled in with a string, possibly
       containing implementation-specific information
    */
    virtual float impl_version( std::string* version_string = NULL );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! get the type from a handle, returns type
    virtual EntityType type_from_handle( const EntityHandle handle ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! get the id from a handle, returns id
    virtual EntityID id_from_handle( const EntityHandle handle ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! get a handle from an id and type
    virtual ErrorCode handle_from_id( const EntityType type, const EntityID id, EntityHandle& handle ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    virtual int dimension_from_handle( const EntityHandle ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! load mesh from data in file
    //! NOTE: if there is mesh already present, the new mesh will be added
    virtual ErrorCode load_mesh( const char* file_name,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                 const int* active_block_id_list = NULL,
                                 const int num_blocks            = 0 );

    /**Load or import a file. */
    virtual ErrorCode load_file( const char* file_name,
                                 const EntityHandle* file_set = 0,
                                 const char* options          = 0,
                                 const char* set_tag_name     = 0,
                                 const int* set_tag_vals      = 0,
                                 int num_set_tag_vals         = 0 );

    /**Load or import a file. */
    ErrorCode serial_load_file( const char* file_name,
                                const EntityHandle* file_set,
                                const FileOptions& opts,
                                const ReaderIface::SubsetList* subsets = 0,
                                const Tag* file_id_tag                 = 0 );

    ErrorCode serial_read_tag( const char* file_name,
                               const char* tag_name,
                               const FileOptions& opts,
                               std::vector< int >& tag_vals,
                               const ReaderIface::SubsetList* subsets = 0 );

    virtual ErrorCode write_mesh( const char* file_name,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                  const EntityHandle* output_list = NULL,
                                  const int num_sets              = 0 );
    /** Write or export a file. */
    virtual ErrorCode write_file( const char* file_name,<--- Function in derived class
                                  const char* file_type           = 0,
                                  const char* options             = 0,
                                  const EntityHandle* output_sets = 0,
                                  int num_output_sets             = 0,
                                  const Tag* tag_list             = 0,
                                  int num_tags                    = 0 );

    /** Write or export a file */
    virtual ErrorCode write_file( const char* file_name,<--- Function in derived class
                                  const char* file_type,
                                  const char* options,
                                  const Range& output_sets,
                                  const Tag* tag_list = 0,
                                  int num_tags        = 0 );

    //! deletes all mesh entities from this datastore
    virtual ErrorCode delete_mesh();<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! get overall geometric dimension
    virtual ErrorCode get_dimension( int& dim ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! set overall geometric dimension
    /** Returns error if setting to 3 dimensions, mesh has been created, and
     *  there are only 2 dimensions on that mesh
     */
    virtual ErrorCode set_dimension( const int dim );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! get blocked vertex coordinates for all vertices
    /** Blocked = all x, then all y, etc.
     */
    virtual ErrorCode get_vertex_coordinates( std::vector< double >& coords ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! get pointers to coordinate data
    virtual ErrorCode coords_iterate( Range::const_iterator iter,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                      Range::const_iterator end,
                                      double*& xcoords_ptr,
                                      double*& ycoords_ptr,
                                      double*& zcoords_ptr,
                                      int& count );

    //! get the coordinate information for this handle if it is of type Vertex
    //! otherwise, return an error
    virtual ErrorCode get_coords( const Range& entities, double* coords ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    virtual ErrorCode get_coords( const EntityHandle* entities, const int num_entities, double* coords ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    virtual ErrorCode get_coords( const EntityHandle entity_handle,
                                  const double*& x,
                                  const double*& y,
                                  const double*& z ) const;

    virtual ErrorCode get_coords( const Range& entities, double* x_coords, double* y_coords, double* z_coords ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! set the coordinate information for this handle if it is of type Vertex
    //! otherwise, return an error
    virtual ErrorCode set_coords( const EntityHandle* entity_handles, const int num_entities, const double* coords );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! set the coordinate information for this handle if it is of type Vertex
    //! otherwise, return an error
    virtual ErrorCode set_coords( Range entity_handles, const double* coords );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! get global connectivity array for specified entity type
    /**  Assumes just vertices, no higher order nodes
     */
    virtual ErrorCode get_connectivity_by_type( const EntityType type, std::vector< EntityHandle >& connect ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! get pointer to connectivity data
    virtual ErrorCode connect_iterate( Range::const_iterator iter,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                       Range::const_iterator end,
                                       EntityHandle*& connect,
                                       int& verts_per_entity,
                                       int& count );

    //! Gets the connectivity for an element EntityHandle.
    /** For non-element handles (ie, MeshSets),
     * returns an error. Connectivity data is copied from the database into the vector
     *   <em>connectivity</em>. The nodes in <em>connectivity</em> are properly ordered.
     *  \param entity_handle EntityHandle to get connectivity of.
     *  \param connectivity Vector in which connectivity of <em>entity_handle</em> is returned.
     *   Should contain MeshVertices.
     *  \param corners_only If true, returns only corner vertices, otherwise returns all of them
     * (including any higher-order vertices)
     *
     *   Example: \code
     *   std::vector<EntityHandle> conn;
     *   get_connectivity( entity_handle, conn ); \endcode
     */
    virtual ErrorCode get_connectivity( const EntityHandle* entity_handles,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                        const int num_handles,
                                        std::vector< EntityHandle >& connectivity,
                                        bool corners_only           = false,
                                        std::vector< int >* offsets = NULL ) const;

    //! Gets the connectivity for a vector of elements
    /** Same as vector-based version except range is returned (unordered!)
     */
    virtual ErrorCode get_connectivity( const EntityHandle* entity_handles,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                        const int num_handles,
                                        Range& connectivity,
                                        bool corners_only = false ) const;

    //! Gets the connectivity for elements
    /** Same as vector-based version except range is returned (unordered!)
     */
    virtual ErrorCode get_connectivity( const Range& from_entities,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                        Range& adj_entities,
                                        bool corners_only = false ) const;

    //! Gets a pointer to constant connectivity data of <em>entity_handle</em>
    /** Sets <em>number_nodes</em> equal to the number of nodes of the <em>
        entity_handle </em>.  Faster then the other <em>get_connectivity</em> function.
        The nodes in 'connectivity' are properly ordered.
        \param entity_handle EntityHandle to get connectivity of.
        \param connectivity Array in which connectivity of <em>entity_handle</em> is returned.
        Should contain MBVERTEX's.
        \param num_nodes Number of MeshVertices in array <em>connectivity</em>.

        Example: \code
        const EntityHandle* conn;
        int number_nodes = 0;
        get_connectivity( entity_handle, conn, number_nodes ); \endcode

        Example2: \code
        std::vector<EntityHandle> sm_storage;
        const EntityHandle* conn;
        int number_nodes;
        get_connectivity( handle, conn, number_nodes, false, &sm_storage );
        if (conn == &sm_storage[0])
          std::cout << "Structured mesh element" << std::endl;
        \endcode
      */
    virtual ErrorCode get_connectivity( const EntityHandle entity_handle,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                        const EntityHandle*& connectivity,
                                        int& number_nodes,
                                        bool corners_only                    = false,
                                        std::vector< EntityHandle >* storage = 0 ) const;

    //! Sets the connectivity for an EntityHandle.  For non-element handles, return an error.
    /** Connectivity is stored exactly as it is ordered in vector <em>connectivity</em>.
        \param entity_handle EntityHandle to set connectivity of.
        \param connect Vector containing new connectivity of <em>entity_handle</em>.
        \param num_connect Number of vertices in <em>connect</em>

        Example: \code
        std::vector<EntityHandle> conn(3);
        conn[0] = node1;
        conn[1] = node2;
        conn[2] = node3;
        set_connectivity( entity_handle, conn, 3 ); \endcode */
    virtual ErrorCode set_connectivity( const EntityHandle entity_handle,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                        EntityHandle* connect,
                                        const int num_connect );

    //! get the adjacencies associated with a set of entities
    /** \param from_entities vector of EntityHandle to get adjacencies of.
        \param to_dimension Dimension of desired adjacency information.
        \param adj_entities Vector in which adjacent EntityHandles are returned.
        \param operation_type enum of INTERSECT or UNION.  Defines whether to take
        the intersection or union of the set of adjacencies recovered for the from_entities.

        The adjacent entities in vector <em>adjacencies</em> are not in any particular
        order.

        Example: \code
          // get the set of edges that are adjacent to all entities in the from_entities list
          std::vector<EntityHandle> from_entities = {hex1, hex2};
          std::vector<EntityHandle> adjacencies;
          get_adjacencies( from_entities, MB_1D_ENTITY, adjacencies );
          \endcode */

    virtual ErrorCode get_adjacencies( const EntityHandle* from_entities,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                       const int num_entities,
                                       const int to_dimension,
                                       const bool create_if_missing,
                                       std::vector< EntityHandle >& adj_entities,
                                       const int operation_type = Interface::INTERSECT );

    virtual ErrorCode get_adjacencies( const EntityHandle* from_entities,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                       const int num_entities,
                                       const int to_dimension,
                                       const bool create_if_missing,
                                       Range& adj_entities,
                                       const int operation_type = Interface::INTERSECT );

    virtual ErrorCode get_adjacencies( const Range& from_entities,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                       const int to_dimension,
                                       const bool create_if_missing,
                                       Range& adj_entities,
                                       const int operation_type = Interface::INTERSECT );

    /**\brief Get a ptr to adjacency lists
     * Get a pointer to adjacency lists.  These lists are std::vector<EntityHandle>, which are
     * pointed to by adjs[i].  Adjacencies are not guaranteed to be in order of increasing
     * dimension.  Only a const version of this function is given, because adjacency data is managed
     * more carefully in MOAB and should be treated as read-only by applications.  If adjacencies
     * have not yet been initialized, adjs_ptr will be NULL (i.e. adjs_ptr == NULL).  There may also
     * be NULL entries for individual entities, i.e. adjs_ptr[i] == NULL. \param iter Iterator to
     * beginning of entity range desired \param end End iterator for which adjacencies are requested
     * \param adjs_ptr Pointer to pointer to const std::vector<EntityHandle>; each member of that
     * array is the vector of adjacencies for this entity \param count Number of entities in the
     * contiguous chunk starting from *iter
     */
    ErrorCode adjacencies_iterate( Range::const_iterator iter,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                   Range::const_iterator end,
                                   const std::vector< EntityHandle >**& adjs_ptr,
                                   int& count );

    /**\brief Get all vertices for input entities
     *
     * Special case of get_adjacencies where to_dimension == 0
     * and operation_type == Interface::UNION.
     *\Note This is not a variation of get_connectivity because
     *      the behavior is different for polyhedra.
     */
    virtual ErrorCode get_vertices( const Range& from_entities, Range& vertices );

    //! Adds adjacencies
    /** \param from_handle entities
        \param both_ways add the adjacency information to both the
        to_handle and and the from_from :handle

        Example: \code
    */
    virtual ErrorCode add_adjacencies( const EntityHandle entity_handle,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                       const EntityHandle* adjacencies,
                                       const int num_handles,
                                       bool both_ways );

    //! Adds adjacencies; same as vector-based, but with range instead
    virtual ErrorCode add_adjacencies( const EntityHandle entity_handle, Range& adjacencies, bool both_ways );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! Removes adjacencies
    /** \param handle EntityHandle to get adjacencies of.

    Example: \code
    */
    virtual ErrorCode remove_adjacencies( const EntityHandle entity_handle,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                          const EntityHandle* adjacencies,
                                          const int num_handles );

    //! Retrieves all entities in the database of given dimension.
    /** \param dimension Dimension of entities desired.
        \param entities Range in which entities of dimension <em>dimension</em> are returned.

        Example: \code
        int dimension = 2;
        Range entities;
        get_entities_by_dimension( dimension, entities ); //get 2D EntityHandles in the database
        \endcode */
    virtual ErrorCode get_entities_by_dimension( const EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                                 const int dimension,
                                                 Range& entities,
                                                 const bool recursive = false ) const;

    virtual ErrorCode get_entities_by_dimension( const EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                                 const int dimension,
                                                 std::vector< EntityHandle >& entities,
                                                 const bool recursive = false ) const;

    //! Retrieves all entities in the data base of given type.
    /** \param type EntityType of entities desired (ie, MBHEX, MBEDGE, MBTRI, etc )
        \param entities Range in which entities of EntityType <em>type</em> are returned.

        Example: \code
        EntityType type = MBTET;
        Range entities;
        get_entities_by_dimension( type, entities ); //get MBTET type EntityHandles in the database
        \endcode */
    virtual ErrorCode get_entities_by_type( const EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                            const EntityType type,
                                            Range& entities,
                                            const bool recursive = false ) const;

    //! Retrieves all entities in the data base of given type.
    /** \param type EntityType of entities desired (ie, MBHEX, MBEDGE, MBTRI, etc )
        \param entities Range in which entities of EntityType <em>type</em> are returned.

        Example: \code
        EntityType type = MBTET;
        Range entities;
        get_entities_by_dimension( type, entities ); //get MBTET type EntityHandles in the database
        \endcode */
    virtual ErrorCode get_entities_by_type( const EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                            const EntityType type,
                                            std::vector< EntityHandle >& entities,
                                            const bool recursive = false ) const;

    virtual ErrorCode get_entities_by_type_and_tag( const EntityHandle meshset,<--- Function in derived class
                                                    const EntityType type,
                                                    const Tag* tags,
                                                    const void* const* values,
                                                    const int num_tags,
                                                    Range& entities,
                                                    const int condition  = Interface::INTERSECT,
                                                    const bool recursive = false ) const;

    //! Retrieves all entities in the data base
    /** \param entities Range in which entities of EntityType <em>type</em> are returned.

    Example: \code
    Range entities;
    get_entities( entities ); //get MBTET type EntityHandles in the database
    \endcode */
    virtual ErrorCode get_entities_by_handle( const EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                              Range& entities,
                                              const bool recursive = false ) const;

    //! Retrieves all entities in the data base
    /** \param entities Range in which entities of EntityType <em>type</em> are returned.

    Example: \code
    Range entities;
    get_entities( entities ); //get MBTET type EntityHandles in the database
    \endcode */
    virtual ErrorCode get_entities_by_handle( const EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                              std::vector< EntityHandle >& entities,
                                              const bool recursive = false ) const;

    //! Retrieves all entities in the database of given dimension.
    /** \param dimension Dimension of entities desired.
        \param entities Range in which entities of dimension <em>dimension</em> are returned.

        Example: \code
        int dimension = 2;
        Range entities;
        get_entities_by_dimension( dimension, entities ); //get 2D EntityHandles in the database
        \endcode */
    virtual ErrorCode get_number_entities_by_dimension( const EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                                        const int dimension,
                                                        int& number,
                                                        const bool recursive = false ) const;

    //! Retrieves all entities in the data base of given type.
    /** \param type EntityType of entities desired (ie, MBHEX, MBEDGE, MBTRI, etc )
        \param entities Range in which entities of EntityType <em>type</em> are returned.

        Example: \code
        EntityType type = MBTET;
        Range entities;
        get_entities_by_dimension( type, entities ); //get MBTET type EntityHandles in the database
        \endcode */
    virtual ErrorCode get_number_entities_by_type( const EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                                   const EntityType type,
                                                   int& num_entities,
                                                   const bool recursive = false ) const;

    virtual ErrorCode get_number_entities_by_type_and_tag( const EntityHandle meshset,<--- Function in derived class
                                                           const EntityType type,
                                                           const Tag* tag_handles,
                                                           const void* const* values,
                                                           const int num_tags,
                                                           int& num_entities,
                                                           const int condition  = Interface::INTERSECT,
                                                           const bool recursive = false ) const;

    //! Retrieves all entities in the data base
    /** \param entities Range in which entities of EntityType <em>type</em> are returned.

    Example: \code
    Range entities;
    get_entities( entities ); //get MBTET type EntityHandles in the database
    \endcode */
    virtual ErrorCode get_number_entities_by_handle( const EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                                     int& num_entities,
                                                     const bool recursive = false ) const;

    //! Creates an element based on the type and connectivity.
    /** If connectivity vector is not correct for EntityType <em>type</em> (ie, a vector with
        3 vertices is passed in to make an MBQUAD), the function returns MB_FAILURE.
        \param type Type of element to create. (MBTET, MBTRI, MBKNIFE, etc.)
        \param connectivity Vector containing connectivity of element to create.
        \param handle EntityHandle representing the newly created element in the database.

        Example: \code
        EntityType type = MBQUAD;
        std::vector<EntityHandle> connectivity(4);
        quad_conn[0] = vertex0;
        quad_conn[1] = vertex1;
        quad_conn[2] = vertex2;
        quad_conn[3] = vertex3;
        EntityHandle element_handle;
        create_element( type, connectivity, element_handle ); \endcode */
    virtual ErrorCode create_element( const EntityType type,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                      const EntityHandle* connectivity,
                                      const int num_nodes,
                                      EntityHandle& element_handle );

    //! Creates a vertex based on coordinates.
    /**
       \param coordinates Array that has 3 doubles in it.
       \param entity_handle EntityHandle representing the newly created vertex in the database.

       Example: \code
       double *coordinates = double[3];
       coordinates[0] = 1.034;
       coordinates[1] = 23.23;
       coordinates[2] = -0.432;
       EntityHandle entity_handle = 0;
       create_vertex( coordinates, entity_handle ); \endcode */
    virtual ErrorCode create_vertex( const double coords[3], EntityHandle& entity_handle );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! Create a set of vertices with the specified coordinates
    /**
       \param coordinates Array that has 3*n doubles in it.
       \param nverts Number of vertices to create
       \param entity_handles Range passed back with new vertex handles
    */
    virtual ErrorCode create_vertices( const double* coordinates, const int nverts, Range& entity_handles );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! merges two entities
    virtual ErrorCode merge_entities( EntityHandle entity_to_keep,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                      EntityHandle entity_to_remove,
                                      bool auto_merge,
                                      bool delete_removed_entity );

    //! Removes entities in a vector from the data base.
    /** If any of the entities are contained in any meshsets, it is removed from those meshsets
        which were created with MESHSET_TRACK_OWNER option bit set.  Tags for <em>entity<\em> are
        removed as part of this function.
        \param entities 1d vector of entities to delete
        \param num_entities Number of entities in 1d vector
    */
    virtual ErrorCode delete_entities( const EntityHandle* entities, const int num_entities );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! Removes entities in a range from the data base.
    /** If any of the entities are contained in any meshsets, it is removed from those meshsets
        which were created with MESHSET_TRACK_OWNER option bit set.  Tags for <em>entity<\em> are
        removed as part of this function.
        \param entities Range of entities to delete
    */
    virtual ErrorCode delete_entities( const Range& range );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    virtual ErrorCode list_entities( const Range& temp_range ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    virtual ErrorCode list_entities( const EntityHandle* entities, const int num_entities ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    virtual ErrorCode list_entity( const EntityHandle entity ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    typedef unsigned long long type_memstorage;

    //! function object for recieving events from MB of higher order nodes
    //! added to entities
    class HONodeAddedRemoved
    {
      public:
        HONodeAddedRemoved() {}
        virtual ~HONodeAddedRemoved() {}
        //! node_added called when a node was added to an element's connectivity array
        //! note: connectivity array of element may be incomplete (corner nodes will exist always)
        virtual void node_added( EntityHandle node, EntityHandle element );
        virtual void node_removed( EntityHandle node );
    };

    virtual ErrorCode convert_entities( const EntityHandle meshset,
                                        const bool mid_side,
                                        const bool mid_face,
                                        const bool mid_volume,
                                        Interface::HONodeAddedRemoved* function_object = 0 );

    //! function to get the side number given two elements; returns
    //! MB_FAILURE if child not related to parent; does *not* create adjacencies
    //! between parent and child
    virtual ErrorCode side_number( const EntityHandle parent,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                   const EntityHandle child,
                                   int& sd_number,
                                   int& sense,
                                   int& offset ) const;

    //! given an entity and the connectivity and type of one of its subfacets, find the
    //! high order node on that subfacet, if any
    virtual ErrorCode high_order_node( const EntityHandle parent_handle,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                       const EntityHandle* subfacet_conn,
                                       const EntityType subfacet_type,
                                       EntityHandle& hon ) const;

    //! given an entity and a target dimension & side number, get that entity
    virtual ErrorCode side_element( const EntityHandle source_entity,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                    const int dim,
                                    const int sd_number,
                                    EntityHandle& target_entity ) const;

    //-------------------------Tag Stuff-------------------------------------//

    /**\brief Get a tag handle, possibly creating the tag
     *
     * Get a handle used to associate application-defined values
     * with MOAB entities.  If the tag does not already exist then
     * \c flags should contain exactly one of \c MB_TAG_SPARSE,
     * \c MB_TAG_DENSE, \c MB_TAG_MESH unless \c type is MB_TYPE_BIT,
     * which implies \c MB_TAG_BIT storage.
     * .
     *\param name          The tag name
     *\param size          Tag size as number of values of of data type per entity
     *                     (or number of bytes if \c MB_TAG_BYTES is passed in flags).  If \c
     *MB_TAG_VARLEN is specified, this value is taken to be the size of the default value if one is
     *specified and is otherwise ignored. \param type          The type of the data (used for IO)
     *\param tag_handle    Output: the resulting tag handle.
     *\param flags         Bitwise OR of values from \c TagType
     *\param default_value Optional default value for tag.
     *\param created       Optional returned boolean indicating that the tag
     *                     was created.
     *\return - \c MB_ALREADY_ALLOCATED     if tag exists and \c MB_TAG_EXCL is specified, or
     *default values do not match (and \c MB_TAG_ANY or \c MB_TAG_DFTOK not specified).
     *        - \c MB_TAG_NOT_FOUND         if tag does not exist and \c MB_TAG_CREAT is not
     *specified
     *        - \c MB_INVALID_SIZE          if tag value size is not a multiple of the size of the
     *data type (and \c MB_TAG_ANY not specified).
     *        - \c MB_TYPE_OUT_OF_RANGE     invalid or inconsistent parameter
     *        - \c MB_VARIABLE_DATA_LENGTH  if \c MB_TAG_VARLEN and \c default_value is non-null and
     *                                      \c default_value_size is not specified.
     */
    virtual ErrorCode tag_get_handle( const char* name,<--- Function in derived class
                                      int size,
                                      DataType type,
                                      Tag& tag_handle,
                                      unsigned flags            = 0,
                                      const void* default_value = 0,
                                      bool* created             = 0 );

    /**\brief same as non-const version, except that TAG_CREAT flag is ignored. */
    virtual ErrorCode tag_get_handle( const char* name,<--- Function in derived class
                                      int size,
                                      DataType type,
                                      Tag& tag_handle,
                                      unsigned flags            = 0,
                                      const void* default_value = 0 ) const;

    //! Gets the tag name string of the tag_handle.
    /** \param tag_handle Tag you want the name of.
        \param tag_name Name string of <em>tag_handle</em>.

        Example: \code
        Tag tag_handle = 0;
        std::string tag_name = "my_special_tag";
        tag_get_name( tag_handle, tag_name );  //gets the Tag from the tag's name string
        \endcode */
    virtual ErrorCode tag_get_name( const Tag tag_handle, std::string& tag_name ) const;<--- Function in derived class

    /**\brief Gets the tag handle corresponding to a name
     *
     * If a tag of that name does not exist, returns MB_TAG_NOT_FOUND
     *   \param tag_name Name of the desired tag.
     *   \param tag_handle Tag handle corresponding to <em>tag_name</em>
     */
    virtual ErrorCode tag_get_handle( const char* tag_name, Tag& tag_handle ) const;<--- Function in derived class

    //! Get handles for all tags defined on this entity
    virtual ErrorCode tag_get_tags_on_entity( const EntityHandle entity, std::vector< Tag >& tag_handles ) const;<--- Function in derived class

    //! Get the size of the specified tag in bytes
    virtual ErrorCode tag_get_bytes( const Tag tag, int& tag_size ) const;<--- Function in derived class

    //! Get the array length of a tag
    virtual ErrorCode tag_get_length( const Tag tag, int& tag_size ) const;<--- Function in derived class

    //! Get the default value of the specified tag
    virtual ErrorCode tag_get_default_value( const Tag tag, void* def_val ) const;<--- Function in derived class
    virtual ErrorCode tag_get_default_value( Tag tag, const void*& ptr, int& size ) const;<--- Function in derived class

    //! get type of tag (sparse, dense, etc.; 0 = dense, 1 = sparse, 2 = bit, 3 = mesh)
    virtual ErrorCode tag_get_type( const Tag, TagType& tag_type ) const;<--- Function in derived class

    /** \brief Get data type of tag.
     *
     * Get the type of the tag data.  The tag is data is assumed to
     * be a vector of this type.  If the tag data vetcor contains
     * more than one value, then the tag size must be a multiple of
     * the size of this type.
     * \param tag  The tag
     * \param type The type of the specified tag (output).
     */
    virtual ErrorCode tag_get_data_type( const Tag handle, DataType& type ) const;<--- Function in derived class

    //! get handles for all tags defined
    virtual ErrorCode tag_get_tags( std::vector< Tag >& tag_handles ) const;<--- Function in derived class

    virtual ErrorCode tag_get_data( const Tag tag_handle,<--- Function in derived class
                                    const EntityHandle* entity_handles,
                                    const int num_entities,
                                    void* tag_data ) const;

    virtual ErrorCode tag_get_data( const Tag tag_handle, const Range& entity_handles, void* tag_data ) const;<--- Function in derived class

    //! Sets the data of a given EntityHandle and Tag.
    /** If the <em>tag_handle</em> and the entity type of <em>entity_handle</em> are not
        compatible, data of <em>entity_handle</em> never existed and MB_FAILURE
        is returned.
        \param tag_handle Tag indicating what data is to be set.
        \param entity_handle EntityHandle on which to set tag's data.
        \param tag_data Data to set the <em>entity_handle</em>'s tag data to.

        Example: \code
        int tag_data = 1004;
        tag_set_data( tag_handle, entity_handle, &tag_data ); \endcode */
    virtual ErrorCode tag_set_data( Tag tag_handle,<--- Function in derived class
                                    const EntityHandle* entity_handles,
                                    int num_entities,
                                    const void* tag_data );

    virtual ErrorCode tag_set_data( Tag tag_handle, const Range& entity_handles, const void* tag_data );<--- Function in derived class

    /**\brief Get pointers to tag data
     *
     * For a tag, get the values for a list of passed entity handles.
     *\note  This function may not be used for bit tags.
     *\param tag_handle     The tag
     *\param entity_handles An array of entity handles for which to retreive tag values.
     *\param num_entities   The length of the 'entity_handles' array.
     *\param tag_data       An array of 'const void*'.  Array must be at least
     *                      'num_entitities' long.  Array is populated (output)
     *                      with pointers to the internal storage for the
     *                      tag value corresponding to each entity handle.
     *\param tag_sizes      The length of each tag value.  Optional for
     *                      fixed-length tags.  Required for variable-length tags.
     */
    virtual ErrorCode tag_get_by_ptr( const Tag tag_handle,<--- Function in derived class
                                      const EntityHandle* entity_handles,
                                      int num_entities,
                                      const void** tag_data,
                                      int* tag_sizes = 0 ) const;

    /**\brief Get pointers to tag data
     *
     * For a tag, get the values for a list of passed entity handles.
     *\note  This function may not be used for bit tags.
     *\param tag_handle     The tag
     *\param entity_handles The entity handles for which to retreive tag values.
     *\param tag_data       An array of 'const void*'.  Array is populated (output)
     *                      with pointers to the internal storage for the
     *                      tag value corresponding to each entity handle.
     *\param tag_sizes      The length of each tag value.  Optional for
     *                      fixed-length tags.  Required for variable-length tags.
     */
    virtual ErrorCode tag_get_by_ptr( const Tag tag_handle,<--- Function in derived class
                                      const Range& entity_handles,
                                      const void** tag_data,
                                      int* tag_sizes = 0 ) const;

    /**\brief Set tag data given an array of pointers to tag values.
     *
     * For a tag, set the values for a list of passed entity handles.
     *\note  This function may not be used for bit tags.
     *\param tag_handle     The tag
     *\param entity_handles An array of entity handles for which to set tag values.
     *\param num_entities   The length of the 'entity_handles' array.
     *\param tag_data       An array of 'const void*'.  Array must be at least
     *                      'num_entitities' long.  Array is expected to
     *                      contain pointers to tag values for the corresponding
     *                      EntityHandle in 'entity_handles'.
     *\param tag_sizes      The length of each tag value.  Optional for
     *                      fixed-length tags.  Required for variable-length tags.
     */
    virtual ErrorCode tag_set_by_ptr( Tag tag_handle,<--- Function in derived class
                                      const EntityHandle* entity_handles,
                                      int num_entities,
                                      void const* const* tag_data,
                                      const int* tag_sizes = 0 );

    /**\brief Set tag data given an array of pointers to tag values.
     *
     * For a tag, set the values for a list of passed entity handles.
     *\note  This function may not be used for bit tags.
     *\param tag_handle     The tag
     *\param entity_handles The entity handles for which to set tag values.
     *\param tag_data       An array of 'const void*'.  Array is expected to
     *                      contain pointers to tag values for the corresponding
     *                      EntityHandle in 'entity_handles'.
     *\param tag_sizes      The length of each tag value.  Optional for
     *                      fixed-length tags.  Required for variable-length tags.
     */
    virtual ErrorCode tag_set_by_ptr( Tag tag_handle,<--- Function in derived class
                                      const Range& entity_handles,
                                      void const* const* tag_data,
                                      const int* tag_sizes = 0 );

    /**\brief Set tag data given value.
     *
     * For a tag, set the values for a list of passed entity handles to
     * the same, specified value.
     *
     *\param tag_handle     The tag
     *\param entity_handles The entity handles for which to set tag values.
     *\param tag_data       A pointer to the tag value.
     *\param tag_sizes      For variable-length tags, the lenght of the
     *                      tag value.  This argument will be ignored for
     *                      fixed-length tags.
     */
    virtual ErrorCode tag_clear_data( Tag tag_handle,
                                      const Range& entity_handles,
                                      const void* tag_data,
                                      int tag_size = 0 );

    /**\brief Set tag data given value.
     *
     * For a tag, set the values for a list of passed entity handles to
     * the same, specified value.
     *
     *\param tag_handle     The tag
     *\param entity_handles The entity handles for which to set tag values.
     *\param tag_data       A pointer to the tag value.
     *\param tag_sizes      For variable-length tags, the lenght of the
     *                      tag value.  This argument will be ignored for
     *                      fixed-length tags.
     */
    virtual ErrorCode tag_clear_data( Tag tag_handle,
                                      const EntityHandle* entity_handles,
                                      int num_entities,
                                      const void* tag_data,
                                      int tag_size = 0 );

    //! Delete the data of a vector of entity handles and sparse tag
    /** Delete the data of a tag on a vector of entity handles.  Only sparse tag data are deleted
       with this function; dense tags are deleted by deleting the tag itself using tag_delete.
        \param tag_handle Handle of the (sparse) tag being deleted from entity
        \param entity_handles 1d vector of entity handles from which the tag is being deleted
        \param num_handles Number of entity handles in 1d vector
    */
    virtual ErrorCode tag_delete_data( Tag tag_handle, const EntityHandle* entity_handles, int num_entities );<--- Function in derived class

    //! Delete the data of a range of entity handles and sparse tag
    /** Delete the data of a tag on a range of entity handles.  Only sparse tag data are deleted
       with this function; dense tags are deleted by deleting the tag itself using tag_delete.
        \param tag_handle Handle of the (sparse) tag being deleted from entity
        \param entity_range Range of entities from which the tag is being deleted
    */
    virtual ErrorCode tag_delete_data( Tag tag_handle, const Range& entity_handles );<--- Function in derived class

    //! Removes the tag from the database and deletes all of its associated data.
    virtual ErrorCode tag_delete( Tag tag_handle );<--- Function in derived class

    /**\brief Access tag data via direct pointer into contiguous blocks
     *
     * Iteratively obtain direct access to contiguous blocks of tag
     * storage.  This function cannot be used with bit tags because
     * of the compressed bit storage.  This function cannot be used
     * with variable length tags because it does not provide a mechanism
     * to determine the length of the value for each entity.  This
     * function may be used with sparse tags, but if it is used, it
     * will return data for a single entity at a time.
     *
     *\param tag_handle  The handle of the tag for which to access data
     *\param iter        The first entity for which to return data.
     *\param end         One past the last entity for which data is desired.
     *\param count       The number of entities for which data was returned
     *\param data_ptr    Output: pointer to tag storage.
     *\param allocate    If true, space for this tag will be allocated, if not it wont
     *
     *\Note If this function is called for entities for which no tag value
     *      has been set, but for which a default value exists, it will
     *      force the allocation of explicit storage for each such entity
     *      even though MOAB would normally not explicitly store tag values
     *      for such entities.
     *
     *\Example:
     *\code
     * Range ents; // range to iterate over
     * Tag tag; // tag for which to access data
     * int bytes;
     * ErrorCode err = mb.tag_get_size( tag, bytes );
     * if (err) { ... }
     *
     * ...
     * Range::iterator iter = ents.begin();
     * while (iter != ents.end()) {
     *   int count;
     *    // get contiguous block of tag dat
     *   void* ptr;
     *   err = mb.tag_iterate( tag, iter, ents.end(), count, ptr );
     *   if (err) { ... }
     *    // do something with tag data
     *   process_Data( ptr, count );
     *    // advance to next block of data
     *   iter += count;
     * }
     *\endcode
     */
    virtual ErrorCode tag_iterate( Tag tag_handle,<--- Function in derived class
                                   Range::const_iterator iter,
                                   Range::const_iterator end,
                                   int& count,
                                   void*& data_ptr,
                                   bool allocate = true );

    //! creates a mesh set
    virtual ErrorCode create_meshset( const unsigned int options, EntityHandle& ms_handle, int start_id = 0 );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! Empty a vector of mesh set
    /** Empty a mesh set.
        \param ms_handles 1d vector of handles of sets being emptied
        \param num_meshsets Number of entities in 1d vector
    */
    virtual ErrorCode clear_meshset( const EntityHandle* ms_handles, const int num_meshsets );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! Empty a range of mesh set
    /** Empty a mesh set.
        \param ms_handles Range of handles of sets being emptied
    */
    virtual ErrorCode clear_meshset( const Range& ms_handles );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! get the options of a mesh set
    virtual ErrorCode get_meshset_options( const EntityHandle ms_handle, unsigned int& options ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! set the options of a mesh set
    virtual ErrorCode set_meshset_options( const EntityHandle ms_handle, const unsigned int options );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! subtracts meshset2 from meshset1 - modifies meshset1
    virtual ErrorCode subtract_meshset( EntityHandle meshset1, const EntityHandle meshset2 );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! intersects meshset2 with meshset1 - modifies meshset1
    virtual ErrorCode intersect_meshset( EntityHandle meshset1, const EntityHandle meshset2 );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! unites meshset2 with meshset1 - modifies meshset1
    virtual ErrorCode unite_meshset( EntityHandle meshset1, const EntityHandle meshset2 );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! add entities to meshset
    virtual ErrorCode add_entities( EntityHandle meshset, const Range& entities );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! add entities to meshset
    virtual ErrorCode add_entities( EntityHandle meshset, const EntityHandle* entities, const int num_entities );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! remove entities from meshset
    virtual ErrorCode remove_entities( EntityHandle meshset, const Range& entities );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! remove entities from meshset
    virtual ErrorCode remove_entities( EntityHandle meshset, const EntityHandle* entities, const int num_entities );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! return true if all entities are contained in set
    virtual bool contains_entities( EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                    const EntityHandle* entities,
                                    int num_entities,
                                    const int operation_type = Interface::INTERSECT );

    //! replace entities
    virtual ErrorCode replace_entities( EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                        const EntityHandle* old_entities,
                                        const EntityHandle* new_entities,
                                        int num_entities );

    //------MeshSet Parent/Child functions------

    //! get parent meshsets
    virtual ErrorCode get_parent_meshsets( const EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                           std::vector< EntityHandle >& parents,
                                           const int num_hops = 1 ) const;

    //! get parent meshsets
    virtual ErrorCode get_parent_meshsets( const EntityHandle meshset, Range& parents, const int num_hops = 1 ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! get child meshsets
    virtual ErrorCode get_child_meshsets( const EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                          std::vector< EntityHandle >& children,
                                          const int num_hops = 1 ) const;

    //! get child meshsets
    virtual ErrorCode get_child_meshsets( const EntityHandle meshset, Range& children, const int num_hops = 1 ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! get contained meshsets
    virtual ErrorCode get_contained_meshsets( const EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                              std::vector< EntityHandle >& children,
                                              const int num_hops = 1 ) const;

    //! get contained meshsets
    virtual ErrorCode get_contained_meshsets( const EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                              Range& children,
                                              const int num_hops = 1 ) const;

    //! gets number of parent meshsets
    virtual ErrorCode num_parent_meshsets( const EntityHandle meshset, int* number, const int num_hops = 1 ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! gets number of child meshsets
    virtual ErrorCode num_child_meshsets( const EntityHandle meshset, int* number, const int num_hops = 1 ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! gets number of contained meshsets
    virtual ErrorCode num_contained_meshsets( const EntityHandle meshset, int* number, const int num_hops = 1 ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! add a parent meshset
    virtual ErrorCode add_parent_meshset( EntityHandle meshset, const EntityHandle parent_meshset );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! add parent meshsets
    virtual ErrorCode add_parent_meshsets( EntityHandle meshset, const EntityHandle* parents, int count );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! add a child meshset
    virtual ErrorCode add_child_meshset( EntityHandle meshset, const EntityHandle child_meshset );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! add parent meshsets
    virtual ErrorCode add_child_meshsets( EntityHandle meshset, const EntityHandle* children, int count );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! adds 'parent' to child's parent list and adds 'child' to parent's child list
    virtual ErrorCode add_parent_child( EntityHandle parent, EntityHandle child );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! removes 'parent' to child's parent list and removes 'child' to parent's child list
    virtual ErrorCode remove_parent_child( EntityHandle parent, EntityHandle child );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! remove parent meshset
    virtual ErrorCode remove_parent_meshset( EntityHandle meshset, const EntityHandle parent_meshset );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! remove child meshset
    virtual ErrorCode remove_child_meshset( EntityHandle meshset, const EntityHandle child_meshset );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    // ************************  tag  information ***************

    //! return various specific tag handles
    Tag material_tag();
    Tag neumannBC_tag();
    Tag dirichletBC_tag();
    Tag globalId_tag();<--- Function in derived class
    Tag geom_dimension_tag();

    //! get/set the number of nodes
    // int total_num_nodes() const;
    // void total_num_nodes(const int val);

    //! get/set the number of elements
    // int total_num_elements() const;
    // void total_num_elements(const int val);

    // ************************  structured sequence  information ***************

    //! return a reference to the sequence manager
    SequenceManager* sequence_manager()
    {
        return sequenceManager;
    }
    const SequenceManager* sequence_manager() const
    {
        return sequenceManager;
    }

    /// create structured sequence
    ErrorCode create_scd_sequence( const HomCoord& coord_min,
                                   const HomCoord& coord_max,
                                   EntityType type,
                                   EntityID start_id_hint,
                                   EntityHandle& first_handle_out,
                                   EntitySequence*& sequence_out );

    ErrorCode add_vsequence( EntitySequence* vert_seq,
                             EntitySequence* elem_seq,
                             const HomCoord& p1,
                             const HomCoord& q1,
                             const HomCoord& p2,
                             const HomCoord& q2,
                             const HomCoord& p3,
                             const HomCoord& q3,
                             bool bb_input          = false,
                             const HomCoord* bb_min = NULL,
                             const HomCoord* bb_max = NULL );

    //! return the a_entity_factory pointer
    AEntityFactory* a_entity_factory()
    {
        return aEntityFactory;
    }
    const AEntityFactory* a_entity_factory() const
    {
        return aEntityFactory;
    }

#ifdef MOAB_HAVE_AHF
    HalfFacetRep* a_half_facet_rep()
    {
        return ahfRep;
    }
    const HalfFacetRep* a_half_facet_rep() const
    {
        return ahfRep;
    }
#endif

    //! return set of registered IO tools
    ReaderWriterSet* reader_writer_set()
    {
        return readerWriterSet;
    }

    //-----------------MeshSet Interface Functions------------------//

    void print( const EntityHandle handle, const char* prefix, bool first_call = true ) const;

    ErrorCode print_entity_tags( std::string indent_prefix, const EntityHandle handle, TagType tp ) const;

    virtual ErrorCode get_last_error( std::string& info ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    virtual std::string get_error_string( const ErrorCode code ) const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //! check all adjacencies for consistency
    ErrorCode check_adjacencies();

    //! check some adjacencies for consistency
    ErrorCode check_adjacencies( const EntityHandle* ents, int num_ents );

    //! return whether the input handle is valid or not
    bool is_valid( const EntityHandle this_ent ) const;

    /** \brief Create an iterator over the set
     * Create a new iterator that iterates over entities with the specified type or dimension.
     * Only one of ent_type or dim can be set; use dim=-1 or ent_type=MBMAXTYPE for the other.
     * Iterators for list-type (ordered) sets are stable over set modification, unless entity
     * removed or deleted is the one at the current position of the iterator.  If the check_valid
     * parameter is passed as true, entities are checked for validity before being passed back by
     * get_next_entities function (checking entity validity can have a non-negligible cost).
     *
     * Iterators returned by this function can be deleted using the normal C++ delete function.
     * After creating the iterator through this function, further interactions are through methods
     * on the SetIterator class.
     * \param meshset The entity set associated with this iterator (use 0 for whole instance)
     * \param ent_type Entity type associated with this iterator
     * \param ent_dim Dimension associated with this iterator
     * \param chunk_size Chunk size of the iterator
     * \param check_valid If true, entities are checked for validity before being returned
     */
    virtual ErrorCode create_set_iterator( EntityHandle meshset,<--- Function in derived class<--- Function in derived class<--- Function in derived class
                                           EntityType ent_type,
                                           int ent_dim,
                                           int chunk_size,
                                           bool check_valid,
                                           SetIterator*& set_iter );

    /** \brief Remove the set iterator from the instance's list
     * \param set_iter Set iterator being removed
     */
    ErrorCode remove_set_iterator( SetIterator* set_iter );

    /** \brief Get all set iterators associated with the set passed in
     * \param meshset Meshset for which iterators are requested
     * \param set_iters Set iterators for the set
     */
    ErrorCode get_set_iterators( EntityHandle meshset, std::vector< SetIterator* >& set_iters );

    //-----------------Memory Functions------------------//

    /**\brief Calculate amount of memory used to store MOAB data
     *
     * This function calculates the amount of memory used to store
     * MOAB data.
     *
     * There are two possible values for each catagory of memory use.
     * The exact value and the amortized value.  The exact value is the
     * amount of memory used to store the data for the specified entities.
     * The amortized value includes the exact value and an amortized
     * estimate of the memory consumed in overhead for storing the values
     * (indexing structures, access structures, etc.)
     *
     * Note: If ent_array is NULL, the total memory used by MOAB for storing
     *       data will be returned in the address pointed to by
     *       total_amortized_storage, if total_amortized_storage is not NULL.
     *
     *\param ent_array Array of entities for which to estimate the memory use.
     *                 If NULL, estimate is done for all entities.
     *\param num_ents The length of ent_array.  Not used if ent_rray is NULL.
     *\param total_(amortized_)storage The sum of the memory entity, adjacency, and all tag storage.
     *\param (amortized_)entity_storage The storage for the entity definitions
     *                 (connectivity arrays for elements, coordinates for vertices,
     *                  list storage within sets, etc.)
     *\param (amortized_)adjacency_storage The storage for adjacency data.
     *\param tag_array  An array of tags for which to calculate the memory use.
     *\param num_tags   The lenght of tag_array
     *\param (amortized_)tag_storage If tag_array is not NULL, then one value
     *                   for each tag specifying the memory used for storing that
     *                   tag.  If tag_array is NULL and this value is not, the
     *                   location at which to store the total memory used for
     *                   all tags.
     */
    void estimated_memory_use( const EntityHandle* ent_array                   = 0,<--- Function in derived class
                               unsigned long num_ents                          = 0,
                               unsigned long long* total_storage               = 0,
                               unsigned long long* total_amortized_storage     = 0,
                               unsigned long long* entity_storage              = 0,
                               unsigned long long* amortized_entity_storage    = 0,
                               unsigned long long* adjacency_storage           = 0,
                               unsigned long long* amortized_adjacency_storage = 0,
                               const Tag* tag_array                            = 0,
                               unsigned num_tags                               = 0,
                               unsigned long long* tag_storage                 = 0,
                               unsigned long long* amortized_tag_storage       = 0 );

    /**\brief Calculate amount of memory used to store MOAB data
     *
     * This function calculates the amount of memory used to store
     * MOAB data.
     *
     * There are two possible values for each catagory of memory use.
     * The exact value and the amortized value.  The exact value is the
     * amount of memory used to store the data for the specified entities.
     * The amortized value includes the exact value and an amortized
     * estimate of the memory consumed in overhead for storing the values
     * (indexing structures, access structures, etc.)
     *
     *\param ents      Entities for which to estimate the memory use.
     *\param total_(amortized_)storage The sum of the memory entity, adjacency, and all tag storage.
     *\param (amortized_)entity_storage The storage for the entity definitions
     *                 (connectivity arrays for elements, coordinates for vertices,
     *                  list storage within sets, etc.)
     *\param (amortized_)adjacency_storage The storage for adjacency data.
     *\param tag_array  An array of tags for which to calculate the memory use.
     *\param num_tags   The lenght of tag_array
     *\param (amortized_)tag_storage If tag_array is not NULL, then one value
     *                   for each tag specifying the memory used for storing that
     *                   tag.  If tag_array is NULL and this value is not, the
     *                   location at which to store the total memory used for
     *                   all tags.
     */
    void estimated_memory_use( const Range& ents,<--- Function in derived class
                               unsigned long long* total_storage               = 0,
                               unsigned long long* total_amortized_storage     = 0,
                               unsigned long long* entity_storage              = 0,
                               unsigned long long* amortized_entity_storage    = 0,
                               unsigned long long* adjacency_storage           = 0,
                               unsigned long long* amortized_adjacency_storage = 0,
                               const Tag* tag_array                            = 0,
                               unsigned num_tags                               = 0,
                               unsigned long long* tag_storage                 = 0,
                               unsigned long long* amortized_tag_storage       = 0 );

    void print_database() const;

    /** \name Sequence Option controllers */

    /**@{*/

    /** \brief Interface to control memory allocation for sequences
     * Provide a factor that controls the size of the sequence that gets allocated.
     * This is typically useful in the parallel setting when a-priori, the number of ghost entities
     * and the memory required for them within the same sequence as the owned entities are unknown.
     * The default factor is 1.0 but this can be appropriately updated at runtime so that we do not
     * have broken sequences.
     */
    virtual double get_sequence_multiplier() const;<--- Function in derived class<--- Function in derived class<--- Function in derived class

    /** \brief Interface to control memory allocation for sequences
     * Provide a factor that controls the size of the sequence that gets allocated.
     * This is typically useful in the parallel setting when a-priori, the number of ghost entities
     * and the memory required for them within the same sequence as the owned entities are unknown.
     * The default factor is 1.0 but this can be appropriately updated at runtime so that we do not
     * have broken sequences.
     *
     * \param meshset User specified multiplier (should be greater than 1.0)
     */
    virtual void set_sequence_multiplier( double factor );<--- Function in derived class<--- Function in derived class<--- Function in derived class

    /**@}*/

  private:
    /**\brief Do not allow copying */
    Core( const Core& copy );
    /**\brief Do not allow copying */
    Core& operator=( const Core& copy );

    void estimated_memory_use_internal( const Range* ents,
                                        unsigned long long* total_storage,
                                        unsigned long long* total_amortized_storage,
                                        unsigned long long* entity_storage,
                                        unsigned long long* amortized_entity_storage,
                                        unsigned long long* adjacency_storage,
                                        unsigned long long* amortized_adjacency_storage,
                                        const Tag* tag_array,
                                        unsigned num_tags,
                                        unsigned long long* tag_storage,
                                        unsigned long long* amortized_tag_storage );

    //! database init and de-init routines
    ErrorCode initialize();
    void deinitialize();

    //! return the entity set representing the whole mesh
    EntityHandle get_root_set();<--- Function in derived class<--- Function in derived class<--- Function in derived class

    //!\brief Clean up after a file reader returns failure.
    //!
    //! Delete all entities not contained in initial_entities
    //! and all tags not contained in initial_tags.
    void clean_up_failed_read( const Range& initial_ents, std::vector< Tag > initial_tags );

    // other interfaces for MB
    WriteUtil* mMBWriteUtil;
    ReadUtil* mMBReadUtil;
    ScdInterface* scdInterface;

    //! store the total number of elements defined in this interface
    // int totalNumElements;

    //! store the total number of nodes defined in this interface
    // int totalNumNodes;

    //! the overall geometric dimension of this mesh
    int geometricDimension;

    Tag materialTag;
    Tag neumannBCTag;
    Tag dirichletBCTag;
    Tag geomDimensionTag;
    Tag globalIdTag;

    //! tag server for this interface
    std::list< TagInfo* > tagList;
    inline bool valid_tag_handle( const TagInfo* t ) const
    {
        return std::find( tagList.begin(), tagList.end(), t ) != tagList.end();
    }

    SequenceManager* sequenceManager;

    AEntityFactory* aEntityFactory;

    ReaderWriterSet* readerWriterSet;

    Error* mError;
    bool mpiFinalize;
    int writeMPELog;
    bool initErrorHandlerInCore;

    //! list of iterators
    std::vector< SetIterator* > setIterators;

#ifdef MOAB_HAVE_AHF
    HalfFacetRep* ahfRep;
    bool mesh_modified;
#endif
};

}  // namespace moab

#endif  // MOAB_IMPL_GENERAL_HPP