Mesh Oriented datABase  (version 5.5.0)
An array-based unstructured mesh library
Core.hpp
Go to the documentation of this file.
1 /**
2  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
3  * storing and accessing finite element mesh data.
4  *
5  * Copyright 2004 Sandia Corporation. Under the terms of Contract
6  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
7  * retains certain rights in this software.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  */
15 
16 #ifndef MOAB_IMPL_GENERAL_HPP
17 #define MOAB_IMPL_GENERAL_HPP
18 
19 #include "moab/Interface.hpp"
20 #include "moab/ReaderIface.hpp"
21 #include <map>
22 #include <list>
23 
24 namespace moab
25 {
26 
27 class WriteUtil;
28 class ReadUtil;
29 class ScdInterface;
30 class AEntityFactory;
31 class SequenceManager;
32 class Error;
33 class HomCoord;
34 class ReaderWriterSet;
35 class EntitySequence;
36 class FileOptions;
37 class SetIterator;
38 
39 #ifdef MOAB_HAVE_AHF
40 class HalfFacetRep;
41 #endif
42 
43 /**\class Core
44  * \brief Implementation of MOAB Interface
45  * Implementation of the MOAB Interface class. You shouldn't call functions directly
46  * on an object of type Core (use Interface instead), unless you really have to access
47  * non-API functionality.
48  */
49 class Core : public Interface
50 {
51 
52  public:
53  friend class SetIterator;
54 
55  //! constructor
56  Core();
57 
58  //! destructor
59  ~Core();
60 
61  //! Get a pointer to an internal MOAB interface
62  //!\return NULL if not found, iterface pointer otherwise
63  virtual ErrorCode query_interface_type( const std::type_info& interface_type, void*& ptr );
64 
65  //! Release reference to MB interface
66  virtual ErrorCode release_interface_type( const std::type_info& interface_type, void* iface );
67 
68  virtual int QueryInterface( const MBuuid& uuid, UnknownInterface** iface );
69 
70  //! Returns the major.minor version number of the implementation
71  /**
72  \param iface_name If non-NULL, will be filled in with a string, possibly
73  containing implementation-specific information
74  */
75  virtual float impl_version( std::string* version_string = NULL );
76 
77  //! get the type from a handle, returns type
78  virtual EntityType type_from_handle( const EntityHandle handle ) const;
79 
80  //! get the id from a handle, returns id
81  virtual EntityID id_from_handle( const EntityHandle handle ) const;
82 
83  //! get a handle from an id and type
84  virtual ErrorCode handle_from_id( const EntityType type, const EntityID id, EntityHandle& handle ) const;
85 
86  virtual int dimension_from_handle( const EntityHandle ) const;
87 
88  //! load mesh from data in file
89  //! NOTE: if there is mesh already present, the new mesh will be added
90  virtual ErrorCode load_mesh( const char* file_name,
91  const int* active_block_id_list = NULL,
92  const int num_blocks = 0 );
93 
94  /**Load or import a file. */
95  virtual ErrorCode load_file( const char* file_name,
96  const EntityHandle* file_set = 0,
97  const char* options = 0,
98  const char* set_tag_name = 0,
99  const int* set_tag_vals = 0,
100  int num_set_tag_vals = 0 );
101 
102  /**Load or import a file. */
103  ErrorCode serial_load_file( const char* file_name,
104  const EntityHandle* file_set,
105  const FileOptions& opts,
106  const ReaderIface::SubsetList* subsets = 0,
107  const Tag* file_id_tag = 0 );
108 
109  ErrorCode serial_read_tag( const char* file_name,
110  const char* tag_name,
111  const FileOptions& opts,
112  std::vector< int >& tag_vals,
113  const ReaderIface::SubsetList* subsets = 0 );
114 
115  virtual ErrorCode write_mesh( const char* file_name,
116  const EntityHandle* output_list = NULL,
117  const int num_sets = 0 );
118  /** Write or export a file. */
119  virtual ErrorCode write_file( const char* file_name,
120  const char* file_type = 0,
121  const char* options = 0,
122  const EntityHandle* output_sets = 0,
123  int num_output_sets = 0,
124  const Tag* tag_list = 0,
125  int num_tags = 0 );
126 
127  /** Write or export a file */
128  virtual ErrorCode write_file( const char* file_name,
129  const char* file_type,
130  const char* options,
131  const Range& output_sets,
132  const Tag* tag_list = 0,
133  int num_tags = 0 );
134 
135  //! deletes all mesh entities from this datastore
136  virtual ErrorCode delete_mesh();
137 
138  //! get overall geometric dimension
139  virtual ErrorCode get_dimension( int& dim ) const;
140 
141  //! set overall geometric dimension
142  /** Returns error if setting to 3 dimensions, mesh has been created, and
143  * there are only 2 dimensions on that mesh
144  */
145  virtual ErrorCode set_dimension( const int dim );
146 
147  //! get blocked vertex coordinates for all vertices
148  /** Blocked = all x, then all y, etc.
149  */
150  virtual ErrorCode get_vertex_coordinates( std::vector< double >& coords ) const;
151 
152  //! get pointers to coordinate data
155  double*& xcoords_ptr,
156  double*& ycoords_ptr,
157  double*& zcoords_ptr,
158  int& count );
159 
160  //! get the coordinate information for this handle if it is of type Vertex
161  //! otherwise, return an error
162  virtual ErrorCode get_coords( const Range& entities, double* coords ) const;
163 
164  virtual ErrorCode get_coords( const EntityHandle* entities, const int num_entities, double* coords ) const;
165 
166  virtual ErrorCode get_coords( const EntityHandle entity_handle,
167  const double*& x,
168  const double*& y,
169  const double*& z ) const;
170 
171  virtual ErrorCode get_coords( const Range& entities, double* x_coords, double* y_coords, double* z_coords ) const;
172 
173  //! set the coordinate information for this handle if it is of type Vertex
174  //! otherwise, return an error
175  virtual ErrorCode set_coords( const EntityHandle* entity_handles, const int num_entities, const double* coords );
176 
177  //! set the coordinate information for this handle if it is of type Vertex
178  //! otherwise, return an error
179  virtual ErrorCode set_coords( Range entity_handles, const double* coords );
180 
181  //! get global connectivity array for specified entity type
182  /** Assumes just vertices, no higher order nodes
183  */
184  virtual ErrorCode get_connectivity_by_type( const EntityType type, std::vector< EntityHandle >& connect ) const;
185 
186  //! get pointer to connectivity data
189  EntityHandle*& connect,
190  int& verts_per_entity,
191  int& count );
192 
193  //! Gets the connectivity for an element EntityHandle.
194  /** For non-element handles (ie, MeshSets),
195  * returns an error. Connectivity data is copied from the database into the vector
196  * <em>connectivity</em>. The nodes in <em>connectivity</em> are properly ordered.
197  * \param entity_handle EntityHandle to get connectivity of.
198  * \param connectivity Vector in which connectivity of <em>entity_handle</em> is returned.
199  * Should contain MeshVertices.
200  * \param corners_only If true, returns only corner vertices, otherwise returns all of them
201  * (including any higher-order vertices)
202  *
203  * Example: \code
204  * std::vector<EntityHandle> conn;
205  * get_connectivity( entity_handle, conn ); \endcode
206  */
207  virtual ErrorCode get_connectivity( const EntityHandle* entity_handles,
208  const int num_handles,
209  std::vector< EntityHandle >& connectivity,
210  bool corners_only = false,
211  std::vector< int >* offsets = NULL ) const;
212 
213  //! Gets the connectivity for a vector of elements
214  /** Same as vector-based version except range is returned (unordered!)
215  */
216  virtual ErrorCode get_connectivity( const EntityHandle* entity_handles,
217  const int num_handles,
218  Range& connectivity,
219  bool corners_only = false ) const;
220 
221  //! Gets the connectivity for elements
222  /** Same as vector-based version except range is returned (unordered!)
223  */
224  virtual ErrorCode get_connectivity( const Range& from_entities,
225  Range& adj_entities,
226  bool corners_only = false ) const;
227 
228  //! Gets a pointer to constant connectivity data of <em>entity_handle</em>
229  /** Sets <em>number_nodes</em> equal to the number of nodes of the <em>
230  entity_handle </em>. Faster then the other <em>get_connectivity</em> function.
231  The nodes in 'connectivity' are properly ordered.
232  \param entity_handle EntityHandle to get connectivity of.
233  \param connectivity Array in which connectivity of <em>entity_handle</em> is returned.
234  Should contain MBVERTEX's.
235  \param num_nodes Number of MeshVertices in array <em>connectivity</em>.
236 
237  Example: \code
238  const EntityHandle* conn;
239  int number_nodes = 0;
240  get_connectivity( entity_handle, conn, number_nodes ); \endcode
241 
242  Example2: \code
243  std::vector<EntityHandle> sm_storage;
244  const EntityHandle* conn;
245  int number_nodes;
246  get_connectivity( handle, conn, number_nodes, false, &sm_storage );
247  if (conn == &sm_storage[0])
248  std::cout << "Structured mesh element" << std::endl;
249  \endcode
250  */
251  virtual ErrorCode get_connectivity( const EntityHandle entity_handle,
252  const EntityHandle*& connectivity,
253  int& number_nodes,
254  bool corners_only = false,
255  std::vector< EntityHandle >* storage = 0 ) const;
256 
257  //! Sets the connectivity for an EntityHandle. For non-element handles, return an error.
258  /** Connectivity is stored exactly as it is ordered in vector <em>connectivity</em>.
259  \param entity_handle EntityHandle to set connectivity of.
260  \param connect Vector containing new connectivity of <em>entity_handle</em>.
261  \param num_connect Number of vertices in <em>connect</em>
262 
263  Example: \code
264  std::vector<EntityHandle> conn(3);
265  conn[0] = node1;
266  conn[1] = node2;
267  conn[2] = node3;
268  set_connectivity( entity_handle, conn, 3 ); \endcode */
269  virtual ErrorCode set_connectivity( const EntityHandle entity_handle,
270  EntityHandle* connect,
271  const int num_connect );
272 
273  //! get the adjacencies associated with a set of entities
274  /** \param from_entities vector of EntityHandle to get adjacencies of.
275  \param to_dimension Dimension of desired adjacency information.
276  \param adj_entities Vector in which adjacent EntityHandles are returned.
277  \param operation_type enum of INTERSECT or UNION. Defines whether to take
278  the intersection or union of the set of adjacencies recovered for the from_entities.
279 
280  The adjacent entities in vector <em>adjacencies</em> are not in any particular
281  order.
282 
283  Example: \code
284  // get the set of edges that are adjacent to all entities in the from_entities list
285  std::vector<EntityHandle> from_entities = {hex1, hex2};
286  std::vector<EntityHandle> adjacencies;
287  get_adjacencies( from_entities, MB_1D_ENTITY, adjacencies );
288  \endcode */
289 
290  virtual ErrorCode get_adjacencies( const EntityHandle* from_entities,
291  const int num_entities,
292  const int to_dimension,
293  const bool create_if_missing,
294  std::vector< EntityHandle >& adj_entities,
295  const int operation_type = Interface::INTERSECT );
296 
297  virtual ErrorCode get_adjacencies( const EntityHandle* from_entities,
298  const int num_entities,
299  const int to_dimension,
300  const bool create_if_missing,
301  Range& adj_entities,
302  const int operation_type = Interface::INTERSECT );
303 
304  virtual ErrorCode get_adjacencies( const Range& from_entities,
305  const int to_dimension,
306  const bool create_if_missing,
307  Range& adj_entities,
308  const int operation_type = Interface::INTERSECT );
309 
310  /**\brief Get a ptr to adjacency lists
311  * Get a pointer to adjacency lists. These lists are std::vector<EntityHandle>, which are
312  * pointed to by adjs[i]. Adjacencies are not guaranteed to be in order of increasing
313  * dimension. Only a const version of this function is given, because adjacency data is managed
314  * more carefully in MOAB and should be treated as read-only by applications. If adjacencies
315  * have not yet been initialized, adjs_ptr will be NULL (i.e. adjs_ptr == NULL). There may also
316  * be NULL entries for individual entities, i.e. adjs_ptr[i] == NULL. \param iter Iterator to
317  * beginning of entity range desired \param end End iterator for which adjacencies are requested
318  * \param adjs_ptr Pointer to pointer to const std::vector<EntityHandle>; each member of that
319  * array is the vector of adjacencies for this entity \param count Number of entities in the
320  * contiguous chunk starting from *iter
321  */
324  const std::vector< EntityHandle >**& adjs_ptr,
325  int& count );
326 
327  /**\brief Get all vertices for input entities
328  *
329  * Special case of get_adjacencies where to_dimension == 0
330  * and operation_type == Interface::UNION.
331  *\Note This is not a variation of get_connectivity because
332  * the behavior is different for polyhedra.
333  */
334  virtual ErrorCode get_vertices( const Range& from_entities, Range& vertices );
335 
336  //! Adds adjacencies
337  /** \param from_handle entities
338  \param both_ways add the adjacency information to both the
339  to_handle and and the from_from :handle
340 
341  Example: \code
342  */
343  virtual ErrorCode add_adjacencies( const EntityHandle entity_handle,
344  const EntityHandle* adjacencies,
345  const int num_handles,
346  bool both_ways );
347 
348  //! Adds adjacencies; same as vector-based, but with range instead
349  virtual ErrorCode add_adjacencies( const EntityHandle entity_handle, Range& adjacencies, bool both_ways );
350 
351  //! Removes adjacencies
352  /** \param handle EntityHandle to get adjacencies of.
353 
354  Example: \code
355  */
356  virtual ErrorCode remove_adjacencies( const EntityHandle entity_handle,
357  const EntityHandle* adjacencies,
358  const int num_handles );
359 
360  //! Retrieves all entities in the database of given dimension.
361  /** \param dimension Dimension of entities desired.
362  \param entities Range in which entities of dimension <em>dimension</em> are returned.
363 
364  Example: \code
365  int dimension = 2;
366  Range entities;
367  get_entities_by_dimension( dimension, entities ); //get 2D EntityHandles in the database
368  \endcode */
369  virtual ErrorCode get_entities_by_dimension( const EntityHandle meshset,
370  const int dimension,
371  Range& entities,
372  const bool recursive = false ) const;
373 
374  virtual ErrorCode get_entities_by_dimension( const EntityHandle meshset,
375  const int dimension,
376  std::vector< EntityHandle >& entities,
377  const bool recursive = false ) const;
378 
379  //! Retrieves all entities in the data base of given type.
380  /** \param type EntityType of entities desired (ie, MBHEX, MBEDGE, MBTRI, etc )
381  \param entities Range in which entities of EntityType <em>type</em> are returned.
382 
383  Example: \code
384  EntityType type = MBTET;
385  Range entities;
386  get_entities_by_dimension( type, entities ); //get MBTET type EntityHandles in the database
387  \endcode */
388  virtual ErrorCode get_entities_by_type( const EntityHandle meshset,
389  const EntityType type,
390  Range& entities,
391  const bool recursive = false ) const;
392 
393  //! Retrieves all entities in the data base of given type.
394  /** \param type EntityType of entities desired (ie, MBHEX, MBEDGE, MBTRI, etc )
395  \param entities Range in which entities of EntityType <em>type</em> are returned.
396 
397  Example: \code
398  EntityType type = MBTET;
399  Range entities;
400  get_entities_by_dimension( type, entities ); //get MBTET type EntityHandles in the database
401  \endcode */
402  virtual ErrorCode get_entities_by_type( const EntityHandle meshset,
403  const EntityType type,
404  std::vector< EntityHandle >& entities,
405  const bool recursive = false ) const;
406 
407  virtual ErrorCode get_entities_by_type_and_tag( const EntityHandle meshset,
408  const EntityType type,
409  const Tag* tags,
410  const void* const* values,
411  const int num_tags,
412  Range& entities,
413  const int condition = Interface::INTERSECT,
414  const bool recursive = false ) const;
415 
416  //! Retrieves all entities in the data base
417  /** \param entities Range in which entities of EntityType <em>type</em> are returned.
418 
419  Example: \code
420  Range entities;
421  get_entities( entities ); //get MBTET type EntityHandles in the database
422  \endcode */
423  virtual ErrorCode get_entities_by_handle( const EntityHandle meshset,
424  Range& entities,
425  const bool recursive = false ) const;
426 
427  //! Retrieves all entities in the data base
428  /** \param entities Range in which entities of EntityType <em>type</em> are returned.
429 
430  Example: \code
431  Range entities;
432  get_entities( entities ); //get MBTET type EntityHandles in the database
433  \endcode */
434  virtual ErrorCode get_entities_by_handle( const EntityHandle meshset,
435  std::vector< EntityHandle >& entities,
436  const bool recursive = false ) const;
437 
438  //! Retrieves all entities in the database of given dimension.
439  /** \param dimension Dimension of entities desired.
440  \param entities Range in which entities of dimension <em>dimension</em> are returned.
441 
442  Example: \code
443  int dimension = 2;
444  Range entities;
445  get_entities_by_dimension( dimension, entities ); //get 2D EntityHandles in the database
446  \endcode */
448  const int dimension,
449  int& number,
450  const bool recursive = false ) const;
451 
452  //! Retrieves all entities in the data base of given type.
453  /** \param type EntityType of entities desired (ie, MBHEX, MBEDGE, MBTRI, etc )
454  \param entities Range in which entities of EntityType <em>type</em> are returned.
455 
456  Example: \code
457  EntityType type = MBTET;
458  Range entities;
459  get_entities_by_dimension( type, entities ); //get MBTET type EntityHandles in the database
460  \endcode */
461  virtual ErrorCode get_number_entities_by_type( const EntityHandle meshset,
462  const EntityType type,
463  int& num_entities,
464  const bool recursive = false ) const;
465 
467  const EntityType type,
468  const Tag* tag_handles,
469  const void* const* values,
470  const int num_tags,
471  int& num_entities,
472  const int condition = Interface::INTERSECT,
473  const bool recursive = false ) const;
474 
475  //! Retrieves all entities in the data base
476  /** \param entities Range in which entities of EntityType <em>type</em> are returned.
477 
478  Example: \code
479  Range entities;
480  get_entities( entities ); //get MBTET type EntityHandles in the database
481  \endcode */
483  int& num_entities,
484  const bool recursive = false ) const;
485 
486  //! Creates an element based on the type and connectivity.
487  /** If connectivity vector is not correct for EntityType <em>type</em> (ie, a vector with
488  3 vertices is passed in to make an MBQUAD), the function returns MB_FAILURE.
489  \param type Type of element to create. (MBTET, MBTRI, MBKNIFE, etc.)
490  \param connectivity Vector containing connectivity of element to create.
491  \param handle EntityHandle representing the newly created element in the database.
492 
493  Example: \code
494  EntityType type = MBQUAD;
495  std::vector<EntityHandle> connectivity(4);
496  quad_conn[0] = vertex0;
497  quad_conn[1] = vertex1;
498  quad_conn[2] = vertex2;
499  quad_conn[3] = vertex3;
500  EntityHandle element_handle;
501  create_element( type, connectivity, element_handle ); \endcode */
502  virtual ErrorCode create_element( const EntityType type,
503  const EntityHandle* connectivity,
504  const int num_nodes,
505  EntityHandle& element_handle );
506 
507  //! Creates a vertex based on coordinates.
508  /**
509  \param coordinates Array that has 3 doubles in it.
510  \param entity_handle EntityHandle representing the newly created vertex in the database.
511 
512  Example: \code
513  double *coordinates = double[3];
514  coordinates[0] = 1.034;
515  coordinates[1] = 23.23;
516  coordinates[2] = -0.432;
517  EntityHandle entity_handle = 0;
518  create_vertex( coordinates, entity_handle ); \endcode */
519  virtual ErrorCode create_vertex( const double coords[3], EntityHandle& entity_handle );
520 
521  //! Create a set of vertices with the specified coordinates
522  /**
523  \param coordinates Array that has 3*n doubles in it.
524  \param nverts Number of vertices to create
525  \param entity_handles Range passed back with new vertex handles
526  */
527  virtual ErrorCode create_vertices( const double* coordinates, const int nverts, Range& entity_handles );
528 
529  //! merges two entities
530  virtual ErrorCode merge_entities( EntityHandle entity_to_keep,
531  EntityHandle entity_to_remove,
532  bool auto_merge,
533  bool delete_removed_entity );
534 
535  //! Removes entities in a vector from the data base.
536  /** If any of the entities are contained in any meshsets, it is removed from those meshsets
537  which were created with MESHSET_TRACK_OWNER option bit set. Tags for <em>entity<\em> are
538  removed as part of this function.
539  \param entities 1d vector of entities to delete
540  \param num_entities Number of entities in 1d vector
541  */
542  virtual ErrorCode delete_entities( const EntityHandle* entities, const int num_entities );
543 
544  //! Removes entities in a range from the data base.
545  /** If any of the entities are contained in any meshsets, it is removed from those meshsets
546  which were created with MESHSET_TRACK_OWNER option bit set. Tags for <em>entity<\em> are
547  removed as part of this function.
548  \param entities Range of entities to delete
549  */
550  virtual ErrorCode delete_entities( const Range& range );
551 
552  virtual ErrorCode list_entities( const Range& temp_range ) const;
553 
554  virtual ErrorCode list_entities( const EntityHandle* entities, const int num_entities ) const;
555 
556  virtual ErrorCode list_entity( const EntityHandle entity ) const;
557 
558  typedef unsigned long long type_memstorage;
559 
560  //! function object for recieving events from MB of higher order nodes
561  //! added to entities
563  {
564  public:
566  virtual ~HONodeAddedRemoved() {}
567  //! node_added called when a node was added to an element's connectivity array
568  //! note: connectivity array of element may be incomplete (corner nodes will exist always)
569  virtual void node_added( EntityHandle node, EntityHandle element );
570  virtual void node_removed( EntityHandle node );
571  };
572 
573  virtual ErrorCode convert_entities( const EntityHandle meshset,
574  const bool mid_side,
575  const bool mid_face,
576  const bool mid_volume,
577  Interface::HONodeAddedRemoved* function_object = 0 );
578 
579  //! function to get the side number given two elements; returns
580  //! MB_FAILURE if child not related to parent; does *not* create adjacencies
581  //! between parent and child
582  virtual ErrorCode side_number( const EntityHandle parent,
583  const EntityHandle child,
584  int& sd_number,
585  int& sense,
586  int& offset ) const;
587 
588  //! given an entity and the connectivity and type of one of its subfacets, find the
589  //! high order node on that subfacet, if any
590  virtual ErrorCode high_order_node( const EntityHandle parent_handle,
591  const EntityHandle* subfacet_conn,
592  const EntityType subfacet_type,
593  EntityHandle& hon ) const;
594 
595  //! given an entity and a target dimension & side number, get that entity
596  virtual ErrorCode side_element( const EntityHandle source_entity,
597  const int dim,
598  const int sd_number,
599  EntityHandle& target_entity ) const;
600 
601  //-------------------------Tag Stuff-------------------------------------//
602 
603  /**\brief Get a tag handle, possibly creating the tag
604  *
605  * Get a handle used to associate application-defined values
606  * with MOAB entities. If the tag does not already exist then
607  * \c flags should contain exactly one of \c MB_TAG_SPARSE,
608  * \c MB_TAG_DENSE, \c MB_TAG_MESH unless \c type is MB_TYPE_BIT,
609  * which implies \c MB_TAG_BIT storage.
610  * .
611  *\param name The tag name
612  *\param size Tag size as number of values of of data type per entity
613  * (or number of bytes if \c MB_TAG_BYTES is passed in flags). If \c
614  *MB_TAG_VARLEN is specified, this value is taken to be the size of the default value if one is
615  *specified and is otherwise ignored. \param type The type of the data (used for IO)
616  *\param tag_handle Output: the resulting tag handle.
617  *\param flags Bitwise OR of values from \c TagType
618  *\param default_value Optional default value for tag.
619  *\param created Optional returned boolean indicating that the tag
620  * was created.
621  *\return - \c MB_ALREADY_ALLOCATED if tag exists and \c MB_TAG_EXCL is specified, or
622  *default values do not match (and \c MB_TAG_ANY or \c MB_TAG_DFTOK not specified).
623  * - \c MB_TAG_NOT_FOUND if tag does not exist and \c MB_TAG_CREAT is not
624  *specified
625  * - \c MB_INVALID_SIZE if tag value size is not a multiple of the size of the
626  *data type (and \c MB_TAG_ANY not specified).
627  * - \c MB_TYPE_OUT_OF_RANGE invalid or inconsistent parameter
628  * - \c MB_VARIABLE_DATA_LENGTH if \c MB_TAG_VARLEN and \c default_value is non-null and
629  * \c default_value_size is not specified.
630  */
631  virtual ErrorCode tag_get_handle( const char* name,
632  int size,
633  DataType type,
634  Tag& tag_handle,
635  unsigned flags = 0,
636  const void* default_value = 0,
637  bool* created = 0 );
638 
639  /**\brief same as non-const version, except that TAG_CREAT flag is ignored. */
640  virtual ErrorCode tag_get_handle( const char* name,
641  int size,
642  DataType type,
643  Tag& tag_handle,
644  unsigned flags = 0,
645  const void* default_value = 0 ) const;
646 
647  //! Gets the tag name string of the tag_handle.
648  /** \param tag_handle Tag you want the name of.
649  \param tag_name Name string of <em>tag_handle</em>.
650 
651  Example: \code
652  Tag tag_handle = 0;
653  std::string tag_name = "my_special_tag";
654  tag_get_name( tag_handle, tag_name ); //gets the Tag from the tag's name string
655  \endcode */
656  virtual ErrorCode tag_get_name( const Tag tag_handle, std::string& tag_name ) const;
657 
658  /**\brief Gets the tag handle corresponding to a name
659  *
660  * If a tag of that name does not exist, returns MB_TAG_NOT_FOUND
661  * \param tag_name Name of the desired tag.
662  * \param tag_handle Tag handle corresponding to <em>tag_name</em>
663  */
664  virtual ErrorCode tag_get_handle( const char* tag_name, Tag& tag_handle ) const;
665 
666  //! Get handles for all tags defined on this entity
667  virtual ErrorCode tag_get_tags_on_entity( const EntityHandle entity, std::vector< Tag >& tag_handles ) const;
668 
669  //! Get the size of the specified tag in bytes
670  virtual ErrorCode tag_get_bytes( const Tag tag, int& tag_size ) const;
671 
672  //! Get the array length of a tag
673  virtual ErrorCode tag_get_length( const Tag tag, int& tag_size ) const;
674 
675  //! Get the default value of the specified tag
676  virtual ErrorCode tag_get_default_value( const Tag tag, void* def_val ) const;
677  virtual ErrorCode tag_get_default_value( Tag tag, const void*& ptr, int& size ) const;
678 
679  //! get type of tag (sparse, dense, etc.; 0 = dense, 1 = sparse, 2 = bit, 3 = mesh)
680  virtual ErrorCode tag_get_type( const Tag, TagType& tag_type ) const;
681 
682  /** \brief Get data type of tag.
683  *
684  * Get the type of the tag data. The tag is data is assumed to
685  * be a vector of this type. If the tag data vetcor contains
686  * more than one value, then the tag size must be a multiple of
687  * the size of this type.
688  * \param tag The tag
689  * \param type The type of the specified tag (output).
690  */
691  virtual ErrorCode tag_get_data_type( const Tag handle, DataType& type ) const;
692 
693  //! get handles for all tags defined
694  virtual ErrorCode tag_get_tags( std::vector< Tag >& tag_handles ) const;
695 
696  virtual ErrorCode tag_get_data( const Tag tag_handle,
697  const EntityHandle* entity_handles,
698  const int num_entities,
699  void* tag_data ) const;
700 
701  virtual ErrorCode tag_get_data( const Tag tag_handle, const Range& entity_handles, void* tag_data ) const;
702 
703  //! Sets the data of a given EntityHandle and Tag.
704  /** If the <em>tag_handle</em> and the entity type of <em>entity_handle</em> are not
705  compatible, data of <em>entity_handle</em> never existed and MB_FAILURE
706  is returned.
707  \param tag_handle Tag indicating what data is to be set.
708  \param entity_handle EntityHandle on which to set tag's data.
709  \param tag_data Data to set the <em>entity_handle</em>'s tag data to.
710 
711  Example: \code
712  int tag_data = 1004;
713  tag_set_data( tag_handle, entity_handle, &tag_data ); \endcode */
714  virtual ErrorCode tag_set_data( Tag tag_handle,
715  const EntityHandle* entity_handles,
716  int num_entities,
717  const void* tag_data );
718 
719  virtual ErrorCode tag_set_data( Tag tag_handle, const Range& entity_handles, const void* tag_data );
720 
721  /**\brief Get pointers to tag data
722  *
723  * For a tag, get the values for a list of passed entity handles.
724  *\note This function may not be used for bit tags.
725  *\param tag_handle The tag
726  *\param entity_handles An array of entity handles for which to retreive tag values.
727  *\param num_entities The length of the 'entity_handles' array.
728  *\param tag_data An array of 'const void*'. Array must be at least
729  * 'num_entitities' long. Array is populated (output)
730  * with pointers to the internal storage for the
731  * tag value corresponding to each entity handle.
732  *\param tag_sizes The length of each tag value. Optional for
733  * fixed-length tags. Required for variable-length tags.
734  */
735  virtual ErrorCode tag_get_by_ptr( const Tag tag_handle,
736  const EntityHandle* entity_handles,
737  int num_entities,
738  const void** tag_data,
739  int* tag_sizes = 0 ) const;
740 
741  /**\brief Get pointers to tag data
742  *
743  * For a tag, get the values for a list of passed entity handles.
744  *\note This function may not be used for bit tags.
745  *\param tag_handle The tag
746  *\param entity_handles The entity handles for which to retreive tag values.
747  *\param tag_data An array of 'const void*'. Array is populated (output)
748  * with pointers to the internal storage for the
749  * tag value corresponding to each entity handle.
750  *\param tag_sizes The length of each tag value. Optional for
751  * fixed-length tags. Required for variable-length tags.
752  */
753  virtual ErrorCode tag_get_by_ptr( const Tag tag_handle,
754  const Range& entity_handles,
755  const void** tag_data,
756  int* tag_sizes = 0 ) const;
757 
758  /**\brief Set tag data given an array of pointers to tag values.
759  *
760  * For a tag, set the values for a list of passed entity handles.
761  *\note This function may not be used for bit tags.
762  *\param tag_handle The tag
763  *\param entity_handles An array of entity handles for which to set tag values.
764  *\param num_entities The length of the 'entity_handles' array.
765  *\param tag_data An array of 'const void*'. Array must be at least
766  * 'num_entitities' long. Array is expected to
767  * contain pointers to tag values for the corresponding
768  * EntityHandle in 'entity_handles'.
769  *\param tag_sizes The length of each tag value. Optional for
770  * fixed-length tags. Required for variable-length tags.
771  */
772  virtual ErrorCode tag_set_by_ptr( Tag tag_handle,
773  const EntityHandle* entity_handles,
774  int num_entities,
775  void const* const* tag_data,
776  const int* tag_sizes = 0 );
777 
778  /**\brief Set tag data given an array of pointers to tag values.
779  *
780  * For a tag, set the values for a list of passed entity handles.
781  *\note This function may not be used for bit tags.
782  *\param tag_handle The tag
783  *\param entity_handles The entity handles for which to set tag values.
784  *\param tag_data An array of 'const void*'. Array is expected to
785  * contain pointers to tag values for the corresponding
786  * EntityHandle in 'entity_handles'.
787  *\param tag_sizes The length of each tag value. Optional for
788  * fixed-length tags. Required for variable-length tags.
789  */
790  virtual ErrorCode tag_set_by_ptr( Tag tag_handle,
791  const Range& entity_handles,
792  void const* const* tag_data,
793  const int* tag_sizes = 0 );
794 
795  /**\brief Set tag data given value.
796  *
797  * For a tag, set the values for a list of passed entity handles to
798  * the same, specified value.
799  *
800  *\param tag_handle The tag
801  *\param entity_handles The entity handles for which to set tag values.
802  *\param tag_data A pointer to the tag value.
803  *\param tag_sizes For variable-length tags, the lenght of the
804  * tag value. This argument will be ignored for
805  * fixed-length tags.
806  */
807  virtual ErrorCode tag_clear_data( Tag tag_handle,
808  const Range& entity_handles,
809  const void* tag_data,
810  int tag_size = 0 );
811 
812  /**\brief Set tag data given value.
813  *
814  * For a tag, set the values for a list of passed entity handles to
815  * the same, specified value.
816  *
817  *\param tag_handle The tag
818  *\param entity_handles The entity handles for which to set tag values.
819  *\param tag_data A pointer to the tag value.
820  *\param tag_sizes For variable-length tags, the lenght of the
821  * tag value. This argument will be ignored for
822  * fixed-length tags.
823  */
824  virtual ErrorCode tag_clear_data( Tag tag_handle,
825  const EntityHandle* entity_handles,
826  int num_entities,
827  const void* tag_data,
828  int tag_size = 0 );
829 
830  //! Delete the data of a vector of entity handles and sparse tag
831  /** Delete the data of a tag on a vector of entity handles. Only sparse tag data are deleted
832  with this function; dense tags are deleted by deleting the tag itself using tag_delete.
833  \param tag_handle Handle of the (sparse) tag being deleted from entity
834  \param entity_handles 1d vector of entity handles from which the tag is being deleted
835  \param num_handles Number of entity handles in 1d vector
836  */
837  virtual ErrorCode tag_delete_data( Tag tag_handle, const EntityHandle* entity_handles, int num_entities );
838 
839  //! Delete the data of a range of entity handles and sparse tag
840  /** Delete the data of a tag on a range of entity handles. Only sparse tag data are deleted
841  with this function; dense tags are deleted by deleting the tag itself using tag_delete.
842  \param tag_handle Handle of the (sparse) tag being deleted from entity
843  \param entity_range Range of entities from which the tag is being deleted
844  */
845  virtual ErrorCode tag_delete_data( Tag tag_handle, const Range& entity_handles );
846 
847  //! Removes the tag from the database and deletes all of its associated data.
848  virtual ErrorCode tag_delete( Tag tag_handle );
849 
850  /**\brief Access tag data via direct pointer into contiguous blocks
851  *
852  * Iteratively obtain direct access to contiguous blocks of tag
853  * storage. This function cannot be used with bit tags because
854  * of the compressed bit storage. This function cannot be used
855  * with variable length tags because it does not provide a mechanism
856  * to determine the length of the value for each entity. This
857  * function may be used with sparse tags, but if it is used, it
858  * will return data for a single entity at a time.
859  *
860  *\param tag_handle The handle of the tag for which to access data
861  *\param iter The first entity for which to return data.
862  *\param end One past the last entity for which data is desired.
863  *\param count The number of entities for which data was returned
864  *\param data_ptr Output: pointer to tag storage.
865  *\param allocate If true, space for this tag will be allocated, if not it wont
866  *
867  *\Note If this function is called for entities for which no tag value
868  * has been set, but for which a default value exists, it will
869  * force the allocation of explicit storage for each such entity
870  * even though MOAB would normally not explicitly store tag values
871  * for such entities.
872  *
873  *\Example:
874  *\code
875  * Range ents; // range to iterate over
876  * Tag tag; // tag for which to access data
877  * int bytes;
878  * ErrorCode err = mb.tag_get_size( tag, bytes );
879  * if (err) { ... }
880  *
881  * ...
882  * Range::iterator iter = ents.begin();
883  * while (iter != ents.end()) {
884  * int count;
885  * // get contiguous block of tag dat
886  * void* ptr;
887  * err = mb.tag_iterate( tag, iter, ents.end(), count, ptr );
888  * if (err) { ... }
889  * // do something with tag data
890  * process_Data( ptr, count );
891  * // advance to next block of data
892  * iter += count;
893  * }
894  *\endcode
895  */
896  virtual ErrorCode tag_iterate( Tag tag_handle,
899  int& count,
900  void*& data_ptr,
901  bool allocate = true );
902 
903  //! creates a mesh set
904  virtual ErrorCode create_meshset( const unsigned int options, EntityHandle& ms_handle, int start_id = 0 );
905 
906  //! Empty a vector of mesh set
907  /** Empty a mesh set.
908  \param ms_handles 1d vector of handles of sets being emptied
909  \param num_meshsets Number of entities in 1d vector
910  */
911  virtual ErrorCode clear_meshset( const EntityHandle* ms_handles, const int num_meshsets );
912 
913  //! Empty a range of mesh set
914  /** Empty a mesh set.
915  \param ms_handles Range of handles of sets being emptied
916  */
917  virtual ErrorCode clear_meshset( const Range& ms_handles );
918 
919  //! get the options of a mesh set
920  virtual ErrorCode get_meshset_options( const EntityHandle ms_handle, unsigned int& options ) const;
921 
922  //! set the options of a mesh set
923  virtual ErrorCode set_meshset_options( const EntityHandle ms_handle, const unsigned int options );
924 
925  //! subtracts meshset2 from meshset1 - modifies meshset1
926  virtual ErrorCode subtract_meshset( EntityHandle meshset1, const EntityHandle meshset2 );
927 
928  //! intersects meshset2 with meshset1 - modifies meshset1
929  virtual ErrorCode intersect_meshset( EntityHandle meshset1, const EntityHandle meshset2 );
930 
931  //! unites meshset2 with meshset1 - modifies meshset1
932  virtual ErrorCode unite_meshset( EntityHandle meshset1, const EntityHandle meshset2 );
933 
934  //! add entities to meshset
935  virtual ErrorCode add_entities( EntityHandle meshset, const Range& entities );
936 
937  //! add entities to meshset
938  virtual ErrorCode add_entities( EntityHandle meshset, const EntityHandle* entities, const int num_entities );
939 
940  //! remove entities from meshset
941  virtual ErrorCode remove_entities( EntityHandle meshset, const Range& entities );
942 
943  //! remove entities from meshset
944  virtual ErrorCode remove_entities( EntityHandle meshset, const EntityHandle* entities, const int num_entities );
945 
946  //! return true if all entities are contained in set
947  virtual bool contains_entities( EntityHandle meshset,
948  const EntityHandle* entities,
949  int num_entities,
950  const int operation_type = Interface::INTERSECT );
951 
952  //! replace entities
953  virtual ErrorCode replace_entities( EntityHandle meshset,
954  const EntityHandle* old_entities,
955  const EntityHandle* new_entities,
956  int num_entities );
957 
958  //------MeshSet Parent/Child functions------
959 
960  //! get parent meshsets
961  virtual ErrorCode get_parent_meshsets( const EntityHandle meshset,
962  std::vector< EntityHandle >& parents,
963  const int num_hops = 1 ) const;
964 
965  //! get parent meshsets
966  virtual ErrorCode get_parent_meshsets( const EntityHandle meshset, Range& parents, const int num_hops = 1 ) const;
967 
968  //! get child meshsets
969  virtual ErrorCode get_child_meshsets( const EntityHandle meshset,
970  std::vector< EntityHandle >& children,
971  const int num_hops = 1 ) const;
972 
973  //! get child meshsets
974  virtual ErrorCode get_child_meshsets( const EntityHandle meshset, Range& children, const int num_hops = 1 ) const;
975 
976  //! get contained meshsets
977  virtual ErrorCode get_contained_meshsets( const EntityHandle meshset,
978  std::vector< EntityHandle >& children,
979  const int num_hops = 1 ) const;
980 
981  //! get contained meshsets
982  virtual ErrorCode get_contained_meshsets( const EntityHandle meshset,
983  Range& children,
984  const int num_hops = 1 ) const;
985 
986  //! gets number of parent meshsets
987  virtual ErrorCode num_parent_meshsets( const EntityHandle meshset, int* number, const int num_hops = 1 ) const;
988 
989  //! gets number of child meshsets
990  virtual ErrorCode num_child_meshsets( const EntityHandle meshset, int* number, const int num_hops = 1 ) const;
991 
992  //! gets number of contained meshsets
993  virtual ErrorCode num_contained_meshsets( const EntityHandle meshset, int* number, const int num_hops = 1 ) const;
994 
995  //! add a parent meshset
996  virtual ErrorCode add_parent_meshset( EntityHandle meshset, const EntityHandle parent_meshset );
997 
998  //! add parent meshsets
999  virtual ErrorCode add_parent_meshsets( EntityHandle meshset, const EntityHandle* parents, int count );
1000 
1001  //! add a child meshset
1002  virtual ErrorCode add_child_meshset( EntityHandle meshset, const EntityHandle child_meshset );
1003 
1004  //! add parent meshsets
1005  virtual ErrorCode add_child_meshsets( EntityHandle meshset, const EntityHandle* children, int count );
1006 
1007  //! adds 'parent' to child's parent list and adds 'child' to parent's child list
1009 
1010  //! removes 'parent' to child's parent list and removes 'child' to parent's child list
1012 
1013  //! remove parent meshset
1014  virtual ErrorCode remove_parent_meshset( EntityHandle meshset, const EntityHandle parent_meshset );
1015 
1016  //! remove child meshset
1017  virtual ErrorCode remove_child_meshset( EntityHandle meshset, const EntityHandle child_meshset );
1018 
1019  // ************************ tag information ***************
1020 
1021  //! return various specific tag handles
1022  Tag material_tag();
1023  Tag neumannBC_tag();
1024  Tag dirichletBC_tag();
1025  Tag globalId_tag();
1027 
1028  //! get/set the number of nodes
1029  // int total_num_nodes() const;
1030  // void total_num_nodes(const int val);
1031 
1032  //! get/set the number of elements
1033  // int total_num_elements() const;
1034  // void total_num_elements(const int val);
1035 
1036  // ************************ structured sequence information ***************
1037 
1038  //! return a reference to the sequence manager
1040  {
1041  return sequenceManager;
1042  }
1044  {
1045  return sequenceManager;
1046  }
1047 
1048  /// create structured sequence
1049  ErrorCode create_scd_sequence( const HomCoord& coord_min,
1050  const HomCoord& coord_max,
1051  EntityType type,
1052  EntityID start_id_hint,
1053  EntityHandle& first_handle_out,
1054  EntitySequence*& sequence_out );
1055 
1057  EntitySequence* elem_seq,
1058  const HomCoord& p1,
1059  const HomCoord& q1,
1060  const HomCoord& p2,
1061  const HomCoord& q2,
1062  const HomCoord& p3,
1063  const HomCoord& q3,
1064  bool bb_input = false,
1065  const HomCoord* bb_min = NULL,
1066  const HomCoord* bb_max = NULL );
1067 
1068  //! return the a_entity_factory pointer
1070  {
1071  return aEntityFactory;
1072  }
1074  {
1075  return aEntityFactory;
1076  }
1077 
1078 #ifdef MOAB_HAVE_AHF
1079  HalfFacetRep* a_half_facet_rep()
1080  {
1081  return ahfRep;
1082  }
1083  const HalfFacetRep* a_half_facet_rep() const
1084  {
1085  return ahfRep;
1086  }
1087 #endif
1088 
1089  //! return set of registered IO tools
1091  {
1092  return readerWriterSet;
1093  }
1094 
1095  //-----------------MeshSet Interface Functions------------------//
1096 
1097  void print( const EntityHandle handle, const char* prefix, bool first_call = true ) const;
1098 
1099  ErrorCode print_entity_tags( std::string indent_prefix, const EntityHandle handle, TagType tp ) const;
1100 
1101  virtual ErrorCode get_last_error( std::string& info ) const;
1102 
1103  virtual std::string get_error_string( const ErrorCode code ) const;
1104 
1105  //! check all adjacencies for consistency
1107 
1108  //! check some adjacencies for consistency
1109  ErrorCode check_adjacencies( const EntityHandle* ents, int num_ents );
1110 
1111  //! return whether the input handle is valid or not
1112  bool is_valid( const EntityHandle this_ent ) const;
1113 
1114  /** \brief Create an iterator over the set
1115  * Create a new iterator that iterates over entities with the specified type or dimension.
1116  * Only one of ent_type or dim can be set; use dim=-1 or ent_type=MBMAXTYPE for the other.
1117  * Iterators for list-type (ordered) sets are stable over set modification, unless entity
1118  * removed or deleted is the one at the current position of the iterator. If the check_valid
1119  * parameter is passed as true, entities are checked for validity before being passed back by
1120  * get_next_entities function (checking entity validity can have a non-negligible cost).
1121  *
1122  * Iterators returned by this function can be deleted using the normal C++ delete function.
1123  * After creating the iterator through this function, further interactions are through methods
1124  * on the SetIterator class.
1125  * \param meshset The entity set associated with this iterator (use 0 for whole instance)
1126  * \param ent_type Entity type associated with this iterator
1127  * \param ent_dim Dimension associated with this iterator
1128  * \param chunk_size Chunk size of the iterator
1129  * \param check_valid If true, entities are checked for validity before being returned
1130  */
1131  virtual ErrorCode create_set_iterator( EntityHandle meshset,
1132  EntityType ent_type,
1133  int ent_dim,
1134  int chunk_size,
1135  bool check_valid,
1136  SetIterator*& set_iter );
1137 
1138  /** \brief Remove the set iterator from the instance's list
1139  * \param set_iter Set iterator being removed
1140  */
1142 
1143  /** \brief Get all set iterators associated with the set passed in
1144  * \param meshset Meshset for which iterators are requested
1145  * \param set_iters Set iterators for the set
1146  */
1147  ErrorCode get_set_iterators( EntityHandle meshset, std::vector< SetIterator* >& set_iters );
1148 
1149  //-----------------Memory Functions------------------//
1150 
1151  /**\brief Calculate amount of memory used to store MOAB data
1152  *
1153  * This function calculates the amount of memory used to store
1154  * MOAB data.
1155  *
1156  * There are two possible values for each catagory of memory use.
1157  * The exact value and the amortized value. The exact value is the
1158  * amount of memory used to store the data for the specified entities.
1159  * The amortized value includes the exact value and an amortized
1160  * estimate of the memory consumed in overhead for storing the values
1161  * (indexing structures, access structures, etc.)
1162  *
1163  * Note: If ent_array is NULL, the total memory used by MOAB for storing
1164  * data will be returned in the address pointed to by
1165  * total_amortized_storage, if total_amortized_storage is not NULL.
1166  *
1167  *\param ent_array Array of entities for which to estimate the memory use.
1168  * If NULL, estimate is done for all entities.
1169  *\param num_ents The length of ent_array. Not used if ent_rray is NULL.
1170  *\param total_(amortized_)storage The sum of the memory entity, adjacency, and all tag storage.
1171  *\param (amortized_)entity_storage The storage for the entity definitions
1172  * (connectivity arrays for elements, coordinates for vertices,
1173  * list storage within sets, etc.)
1174  *\param (amortized_)adjacency_storage The storage for adjacency data.
1175  *\param tag_array An array of tags for which to calculate the memory use.
1176  *\param num_tags The lenght of tag_array
1177  *\param (amortized_)tag_storage If tag_array is not NULL, then one value
1178  * for each tag specifying the memory used for storing that
1179  * tag. If tag_array is NULL and this value is not, the
1180  * location at which to store the total memory used for
1181  * all tags.
1182  */
1183  void estimated_memory_use( const EntityHandle* ent_array = 0,
1184  unsigned long num_ents = 0,
1185  unsigned long long* total_storage = 0,
1186  unsigned long long* total_amortized_storage = 0,
1187  unsigned long long* entity_storage = 0,
1188  unsigned long long* amortized_entity_storage = 0,
1189  unsigned long long* adjacency_storage = 0,
1190  unsigned long long* amortized_adjacency_storage = 0,
1191  const Tag* tag_array = 0,
1192  unsigned num_tags = 0,
1193  unsigned long long* tag_storage = 0,
1194  unsigned long long* amortized_tag_storage = 0 );
1195 
1196  /**\brief Calculate amount of memory used to store MOAB data
1197  *
1198  * This function calculates the amount of memory used to store
1199  * MOAB data.
1200  *
1201  * There are two possible values for each catagory of memory use.
1202  * The exact value and the amortized value. The exact value is the
1203  * amount of memory used to store the data for the specified entities.
1204  * The amortized value includes the exact value and an amortized
1205  * estimate of the memory consumed in overhead for storing the values
1206  * (indexing structures, access structures, etc.)
1207  *
1208  *\param ents Entities for which to estimate the memory use.
1209  *\param total_(amortized_)storage The sum of the memory entity, adjacency, and all tag storage.
1210  *\param (amortized_)entity_storage The storage for the entity definitions
1211  * (connectivity arrays for elements, coordinates for vertices,
1212  * list storage within sets, etc.)
1213  *\param (amortized_)adjacency_storage The storage for adjacency data.
1214  *\param tag_array An array of tags for which to calculate the memory use.
1215  *\param num_tags The lenght of tag_array
1216  *\param (amortized_)tag_storage If tag_array is not NULL, then one value
1217  * for each tag specifying the memory used for storing that
1218  * tag. If tag_array is NULL and this value is not, the
1219  * location at which to store the total memory used for
1220  * all tags.
1221  */
1222  void estimated_memory_use( const Range& ents,
1223  unsigned long long* total_storage = 0,
1224  unsigned long long* total_amortized_storage = 0,
1225  unsigned long long* entity_storage = 0,
1226  unsigned long long* amortized_entity_storage = 0,
1227  unsigned long long* adjacency_storage = 0,
1228  unsigned long long* amortized_adjacency_storage = 0,
1229  const Tag* tag_array = 0,
1230  unsigned num_tags = 0,
1231  unsigned long long* tag_storage = 0,
1232  unsigned long long* amortized_tag_storage = 0 );
1233 
1234  void print_database() const;
1235 
1236  /** \name Sequence Option controllers */
1237 
1238  /**@{*/
1239 
1240  /** \brief Interface to control memory allocation for sequences
1241  * Provide a factor that controls the size of the sequence that gets allocated.
1242  * This is typically useful in the parallel setting when a-priori, the number of ghost entities
1243  * and the memory required for them within the same sequence as the owned entities are unknown.
1244  * The default factor is 1.0 but this can be appropriately updated at runtime so that we do not
1245  * have broken sequences.
1246  */
1247  virtual double get_sequence_multiplier() const;
1248 
1249  /** \brief Interface to control memory allocation for sequences
1250  * Provide a factor that controls the size of the sequence that gets allocated.
1251  * This is typically useful in the parallel setting when a-priori, the number of ghost entities
1252  * and the memory required for them within the same sequence as the owned entities are unknown.
1253  * The default factor is 1.0 but this can be appropriately updated at runtime so that we do not
1254  * have broken sequences.
1255  *
1256  * \param meshset User specified multiplier (should be greater than 1.0)
1257  */
1258  virtual void set_sequence_multiplier( double factor );
1259 
1260  /**@}*/
1261 
1262  private:
1263  /**\brief Do not allow copying */
1264  Core( const Core& copy );
1265  /**\brief Do not allow copying */
1266  Core& operator=( const Core& copy );
1267 
1268  void estimated_memory_use_internal( const Range* ents,
1269  unsigned long long* total_storage,
1270  unsigned long long* total_amortized_storage,
1271  unsigned long long* entity_storage,
1272  unsigned long long* amortized_entity_storage,
1273  unsigned long long* adjacency_storage,
1274  unsigned long long* amortized_adjacency_storage,
1275  const Tag* tag_array,
1276  unsigned num_tags,
1277  unsigned long long* tag_storage,
1278  unsigned long long* amortized_tag_storage );
1279 
1280  //! database init and de-init routines
1282  void deinitialize();
1283 
1284  //! return the entity set representing the whole mesh
1286 
1287  //!\brief Clean up after a file reader returns failure.
1288  //!
1289  //! Delete all entities not contained in initial_entities
1290  //! and all tags not contained in initial_tags.
1291  void clean_up_failed_read( const Range& initial_ents, std::vector< Tag > initial_tags );
1292 
1293  // other interfaces for MB
1297 
1298  //! store the total number of elements defined in this interface
1299  // int totalNumElements;
1300 
1301  //! store the total number of nodes defined in this interface
1302  // int totalNumNodes;
1303 
1304  //! the overall geometric dimension of this mesh
1306 
1312 
1313  //! tag server for this interface
1314  std::list< TagInfo* > tagList;
1315  inline bool valid_tag_handle( const TagInfo* t ) const
1316  {
1317  return std::find( tagList.begin(), tagList.end(), t ) != tagList.end();
1318  }
1319 
1321 
1323 
1325 
1330 
1331  //! list of iterators
1332  std::vector< SetIterator* > setIterators;
1333 
1334 #ifdef MOAB_HAVE_AHF
1335  HalfFacetRep* ahfRep;
1336  bool mesh_modified;
1337 #endif
1338 };
1339 
1340 } // namespace moab
1341 
1342 #endif // MOAB_IMPL_GENERAL_HPP