MOAB: Mesh Oriented datABase
(version 5.2.1)
|
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. More...
#include <Core.hpp>
Classes | |
class | HONodeAddedRemoved |
Public Types | |
typedef unsigned long long | type_memstorage |
Public Member Functions | |
Core () | |
constructor | |
~Core () | |
destructor | |
virtual ErrorCode | query_interface_type (const std::type_info &iface_type, void *&iface) |
virtual ErrorCode | release_interface_type (const std::type_info &iface_type, void *iface) |
Release reference to MB interface. | |
virtual int | QueryInterface (const MBuuid &uuid, UnknownInterface **iface) |
virtual float | impl_version (std::string *version_string=NULL) |
Returns the major.minor version number of the implementation. | |
virtual EntityType | type_from_handle (const EntityHandle handle) const |
get the type from a handle, returns type | |
virtual EntityID | id_from_handle (const EntityHandle handle) const |
get the id from a handle, returns id | |
virtual ErrorCode | handle_from_id (const EntityType type, const EntityID id, EntityHandle &handle) const |
get a handle from an id and type | |
virtual int | dimension_from_handle (const EntityHandle) const |
virtual ErrorCode | load_mesh (const char *file_name, const int *active_block_id_list=NULL, const int num_blocks=0) |
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_values=0, int num_set_tag_values=0) |
ErrorCode | serial_load_file (const char *file_name, const EntityHandle *file_set, const FileOptions &opts, const ReaderIface::SubsetList *subset_list=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 *subset_list=0) |
virtual ErrorCode | write_mesh (const char *file_name, const EntityHandle *output_list=NULL, const int num_sets=0) |
virtual ErrorCode | write_file (const char *file_name, 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) |
virtual ErrorCode | write_file (const char *file_name, const char *file_type, const char *options, const Range &output_sets, const Tag *tag_list=0, int num_tags=0) |
virtual ErrorCode | delete_mesh () |
deletes all mesh entities from this datastore | |
virtual ErrorCode | get_dimension (int &dim) const |
get overall geometric dimension | |
virtual ErrorCode | set_dimension (const int dim) |
set overall geometric dimension | |
virtual ErrorCode | get_vertex_coordinates (std::vector< double > &coords) const |
get blocked vertex coordinates for all vertices | |
virtual ErrorCode | coords_iterate (Range::const_iterator iter, Range::const_iterator end, double *&xcoords_ptr, double *&ycoords_ptr, double *&zcoords_ptr, int &count) |
get pointers to coordinate data | |
virtual ErrorCode | get_coords (const Range &entity_handles, double *coords) const |
virtual ErrorCode | get_coords (const EntityHandle *entity_handles, const int num_entities, double *coords) const |
virtual ErrorCode | get_coords (const EntityHandle entity_handle, const double *&x, const double *&y, const double *&z) const |
virtual ErrorCode | get_coords (const Range &entity_handles, double *x_coords, double *y_coords, double *z_coords) const |
virtual ErrorCode | set_coords (const EntityHandle *entity_handles, const int num_entities, const double *coords) |
virtual ErrorCode | set_coords (Range entity_handles, const double *coords) |
virtual ErrorCode | get_connectivity_by_type (const EntityType type, std::vector< EntityHandle > &connect) const |
get global connectivity array for specified entity type | |
virtual ErrorCode | connect_iterate (Range::const_iterator iter, Range::const_iterator end, EntityHandle *&connect, int &verts_per_entity, int &count) |
get pointer to connectivity data | |
virtual ErrorCode | get_connectivity (const EntityHandle *entity_handles, const int num_handles, std::vector< EntityHandle > &connectivity, bool corners_only=false, std::vector< int > *offsets=NULL) const |
Gets the connectivity for an element EntityHandle. | |
virtual ErrorCode | get_connectivity (const EntityHandle *entity_handles, const int num_handles, Range &connectivity, bool corners_only=false) const |
Gets the connectivity for a vector of elements. | |
virtual ErrorCode | get_connectivity (const Range &entity_handles, Range &connectivity, bool corners_only=false) const |
Gets the connectivity for elements. | |
virtual ErrorCode | get_connectivity (const EntityHandle entity_handle, const EntityHandle *&connectivity, int &num_nodes, bool corners_only=false, std::vector< EntityHandle > *storage=0) const |
Gets a pointer to constant connectivity data of entity_handle | |
virtual ErrorCode | set_connectivity (const EntityHandle entity_handle, EntityHandle *connect, const int num_connect) |
Sets the connectivity for an EntityHandle. For non-element handles, return an error. | |
virtual ErrorCode | get_adjacencies (const EntityHandle *from_entities, const int num_entities, const int to_dimension, const bool create_if_missing, std::vector< EntityHandle > &adj_entities, const int operation_type=Interface::INTERSECT) |
get the adjacencies associated with a set of entities | |
virtual ErrorCode | get_adjacencies (const EntityHandle *from_entities, 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, const int to_dimension, const bool create_if_missing, Range &adj_entities, const int operation_type=Interface::INTERSECT) |
ErrorCode | adjacencies_iterate (Range::const_iterator iter, Range::const_iterator end, const std::vector< EntityHandle > **&adjs_ptr, int &count) |
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. | |
virtual ErrorCode | get_vertices (const Range &from_entities, Range &vertices) |
Get all vertices for input entities. | |
virtual ErrorCode | get_entities_by_dimension (const EntityHandle meshset, const int dimension, Range &entities, const bool recursive=false) const |
Adds adjacencies. | |
virtual ErrorCode | get_entities_by_dimension (const EntityHandle meshset, const int dimension, std::vector< EntityHandle > &entities, const bool recursive=false) const |
virtual ErrorCode | get_entities_by_type (const EntityHandle meshset, const EntityType type, Range &entities, const bool recursive=false) const |
Retrieves all entities in the data base of given type. | |
virtual ErrorCode | get_entities_by_type (const EntityHandle meshset, const EntityType type, std::vector< EntityHandle > &entities, const bool recursive=false) const |
Retrieves all entities in the data base of given type. | |
virtual ErrorCode | get_entities_by_type_and_tag (const EntityHandle meshset, const EntityType type, const Tag *tag_handles, const void *const *values, const int num_tags, Range &entities, const int condition=Interface::INTERSECT, const bool recursive=false) const |
virtual ErrorCode | get_entities_by_handle (const EntityHandle meshset, Range &entities, const bool recursive=false) const |
Retrieves all entities in the data base. | |
virtual ErrorCode | get_entities_by_handle (const EntityHandle meshset, std::vector< EntityHandle > &entities, const bool recursive=false) const |
Retrieves all entities in the data base. | |
virtual ErrorCode | get_number_entities_by_dimension (const EntityHandle meshset, const int dimension, int &num_entities, const bool recursive=false) const |
Retrieves all entities in the database of given dimension. | |
virtual ErrorCode | get_number_entities_by_type (const EntityHandle meshset, const EntityType type, int &num_entities, const bool recursive=false) const |
Retrieves all entities in the data base of given type. | |
virtual ErrorCode | get_number_entities_by_type_and_tag (const EntityHandle meshset, 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 |
virtual ErrorCode | get_number_entities_by_handle (const EntityHandle meshset, int &num_entities, const bool recursive=false) const |
Retrieves all entities in the data base. | |
virtual ErrorCode | create_element (const EntityType type, const EntityHandle *connectivity, const int num_nodes, EntityHandle &element_handle) |
Creates an element based on the type and connectivity. | |
virtual ErrorCode | create_vertex (const double coordinates[3], EntityHandle &entity_handle) |
Creates a vertex based on coordinates. | |
virtual ErrorCode | create_vertices (const double *coordinates, const int nverts, Range &entity_handles) |
Create a set of vertices with the specified coordinates. | |
virtual ErrorCode | merge_entities (EntityHandle entity_to_keep, EntityHandle entity_to_remove, bool auto_merge, bool delete_removed_entity) |
merges two entities | |
virtual ErrorCode | delete_entities (const EntityHandle *entities, const int num_entities) |
Removes entities in a vector from the data base. | |
virtual ErrorCode | delete_entities (const Range &entities) |
Removes entities in a range from the data base. | |
virtual ErrorCode | list_entities (const Range &entities) const |
virtual ErrorCode | list_entities (const EntityHandle *entities, const int num_entities) const |
virtual ErrorCode | list_entity (const EntityHandle entity) const |
virtual ErrorCode | convert_entities (const EntityHandle meshset, const bool mid_side, const bool mid_face, const bool mid_volume, Interface::HONodeAddedRemoved *function_object=0) |
virtual ErrorCode | side_number (const EntityHandle parent, const EntityHandle child, int &side_number, int &sense, int &offset) const |
virtual ErrorCode | high_order_node (const EntityHandle parent_handle, const EntityHandle *subfacet_conn, const EntityType subfacet_type, EntityHandle &high_order_node) const |
virtual ErrorCode | side_element (const EntityHandle source_entity, const int dim, const int side_number, EntityHandle &target_entity) const |
given an entity and a target dimension & side number, get that entity | |
virtual ErrorCode | tag_get_handle (const char *name, int size, DataType type, Tag &tag_handle, unsigned flags=0, const void *default_value=0, bool *created=0) |
Get a tag handle, possibly creating the tag. | |
virtual ErrorCode | tag_get_handle (const char *name, int size, DataType type, Tag &tag_handle, unsigned flags=0, const void *default_value=0) const |
same as non-const version, except that TAG_CREAT flag is ignored. | |
virtual ErrorCode | tag_get_name (const Tag tag_handle, std::string &tag_name) const |
Gets the tag name string of the tag_handle. | |
virtual ErrorCode | tag_get_handle (const char *tag_name, Tag &tag_handle) const |
Gets the tag handle corresponding to a name. | |
virtual ErrorCode | tag_get_tags_on_entity (const EntityHandle entity, std::vector< Tag > &tag_handles) const |
Get handles for all tags defined on this entity. | |
virtual ErrorCode | tag_get_bytes (const Tag tag, int &bytes_per_tag) const |
Get the size of the specified tag in bytes. | |
virtual ErrorCode | tag_get_length (const Tag tag, int &length) const |
Get the array length of a tag. | |
virtual ErrorCode | tag_get_default_value (const Tag tag, void *def_val) const |
Get the default value of the specified tag. | |
virtual ErrorCode | tag_get_default_value (Tag tag, const void *&def_val, int &size) const |
virtual ErrorCode | tag_get_type (const Tag, TagType &tag_type) const |
get type of tag (sparse, dense, etc.; 0 = dense, 1 = sparse, 2 = bit, 3 = mesh) | |
virtual ErrorCode | tag_get_data_type (const Tag tag, DataType &type) const |
Get data type of tag. | |
virtual ErrorCode | tag_get_tags (std::vector< Tag > &tag_handles) const |
get handles for all tags defined | |
virtual ErrorCode | tag_get_data (const Tag tag_handle, const EntityHandle *entity_handles, const int num_entities, void *tag_data) const |
return the tag data for a given EntityHandle and Tag | |
virtual ErrorCode | tag_get_data (const Tag tag_handle, const Range &entity_handles, void *tag_data) const |
return the tag data for a given EntityHandle and Tag | |
virtual ErrorCode | tag_set_data (Tag tag_handle, const EntityHandle *entity_handles, int num_entities, const void *tag_data) |
Sets the data of a given EntityHandle and Tag. | |
virtual ErrorCode | tag_set_data (Tag tag_handle, const Range &entity_handles, const void *tag_data) |
set the data for given EntityHandles and Tag | |
virtual ErrorCode | tag_get_by_ptr (const Tag tag_handle, const EntityHandle *entity_handles, int num_entities, const void **tag_data, int *tag_sizes=0) const |
Get pointers to tag data. | |
virtual ErrorCode | tag_get_by_ptr (const Tag tag_handle, const Range &entity_handles, const void **tag_data, int *tag_sizes=0) const |
Get pointers to tag data. | |
virtual ErrorCode | tag_set_by_ptr (Tag tag_handle, const EntityHandle *entity_handles, int num_entities, void const *const *tag_data, const int *tag_sizes=0) |
Set tag data given an array of pointers to tag values. | |
virtual ErrorCode | tag_set_by_ptr (Tag tag_handle, const Range &entity_handles, void const *const *tag_data, const int *tag_sizes=0) |
Set tag data given an array of pointers to tag values. | |
virtual ErrorCode | tag_clear_data (Tag tag_handle, const Range &entity_handles, const void *value, int value_size=0) |
Set tag data given value. | |
virtual ErrorCode | tag_clear_data (Tag tag_handle, const EntityHandle *entity_handles, int num_entity_handles, const void *value, int value_size=0) |
Set tag data given value. | |
virtual ErrorCode | tag_delete_data (Tag tag_handle, const EntityHandle *entity_handles, int num_handles) |
Delete the data of a vector of entity handles and sparse tag. | |
virtual ErrorCode | tag_delete_data (Tag tag_handle, const Range &entity_range) |
Delete the data of a range of entity handles and sparse tag. | |
virtual ErrorCode | tag_delete (Tag tag_handle) |
Removes the tag from the database and deletes all of its associated data. | |
virtual ErrorCode | tag_iterate (Tag tag_handle, Range::const_iterator begin, Range::const_iterator end, int &count, void *&data_ptr, bool allocate=true) |
Access tag data via direct pointer into contiguous blocks. | |
virtual ErrorCode | create_meshset (const unsigned int options, EntityHandle &ms_handle, int start_id=0) |
creates a mesh set | |
virtual ErrorCode | clear_meshset (const EntityHandle *ms_handles, const int num_meshsets) |
Empty a vector of mesh set. | |
virtual ErrorCode | clear_meshset (const Range &ms_handles) |
Empty a range of mesh set. | |
virtual ErrorCode | get_meshset_options (const EntityHandle ms_handle, unsigned int &options) const |
get the options of a mesh set | |
virtual ErrorCode | set_meshset_options (const EntityHandle ms_handle, const unsigned int options) |
set the options of a mesh set | |
virtual ErrorCode | subtract_meshset (EntityHandle meshset1, const EntityHandle meshset2) |
subtracts meshset2 from meshset1 - modifies meshset1 | |
virtual ErrorCode | intersect_meshset (EntityHandle meshset1, const EntityHandle meshset2) |
intersects meshset2 with meshset1 - modifies meshset1 | |
virtual ErrorCode | unite_meshset (EntityHandle meshset1, const EntityHandle meshset2) |
unites meshset2 with meshset1 - modifies meshset1 | |
virtual ErrorCode | add_entities (EntityHandle meshset, const Range &entities) |
add entities to meshset | |
virtual ErrorCode | add_entities (EntityHandle meshset, const EntityHandle *entities, const int num_entities) |
add entities to meshset | |
virtual ErrorCode | remove_entities (EntityHandle meshset, const Range &entities) |
remove entities from meshset | |
virtual ErrorCode | remove_entities (EntityHandle meshset, const EntityHandle *entities, const int num_entities) |
remove entities from meshset | |
virtual bool | contains_entities (EntityHandle meshset, const EntityHandle *entities, int num_entities, const int operation_type=Interface::INTERSECT) |
return true if all entities are contained in set | |
virtual ErrorCode | replace_entities (EntityHandle meshset, const EntityHandle *old_entities, const EntityHandle *new_entities, int num_entities) |
replace entities | |
virtual ErrorCode | get_parent_meshsets (const EntityHandle meshset, 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 |
get parent meshsets | |
virtual ErrorCode | get_child_meshsets (const EntityHandle meshset, 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 |
get child meshsets | |
virtual ErrorCode | get_contained_meshsets (const EntityHandle meshset, std::vector< EntityHandle > &contained, const int num_hops=1) const |
get contained meshsets | |
virtual ErrorCode | get_contained_meshsets (const EntityHandle meshset, Range &contained, const int num_hops=1) const |
get contained meshsets | |
virtual ErrorCode | num_parent_meshsets (const EntityHandle meshset, int *number, const int num_hops=1) const |
gets number of parent meshsets | |
virtual ErrorCode | num_child_meshsets (const EntityHandle meshset, int *number, const int num_hops=1) const |
gets number of child meshsets | |
virtual ErrorCode | num_contained_meshsets (const EntityHandle meshset, int *number, const int num_hops=1) const |
gets number of contained meshsets | |
virtual ErrorCode | add_parent_meshset (EntityHandle meshset, const EntityHandle parent_meshset) |
add a parent meshset | |
virtual ErrorCode | add_parent_meshsets (EntityHandle meshset, const EntityHandle *parent_meshsets, int num_parent_meshsets) |
add parent meshsets | |
virtual ErrorCode | add_child_meshset (EntityHandle meshset, const EntityHandle child_meshset) |
add a child meshset | |
virtual ErrorCode | add_child_meshsets (EntityHandle meshset, const EntityHandle *child_meshsets, int num_child_meshsets) |
add parent meshsets | |
virtual ErrorCode | add_parent_child (EntityHandle parent, EntityHandle child) |
adds 'parent' to child's parent list and adds 'child' to parent's child list | |
virtual ErrorCode | remove_parent_child (EntityHandle parent, EntityHandle child) |
removes 'parent' to child's parent list and removes 'child' to parent's child list | |
virtual ErrorCode | remove_parent_meshset (EntityHandle meshset, const EntityHandle parent_meshset) |
remove parent meshset | |
virtual ErrorCode | remove_child_meshset (EntityHandle meshset, const EntityHandle child_meshset) |
remove child meshset | |
Tag | material_tag () |
return various specific tag handles | |
Tag | neumannBC_tag () |
Tag | dirichletBC_tag () |
Tag | globalId_tag () |
Tag | geom_dimension_tag () |
SequenceManager * | sequence_manager () |
get/set the number of nodes | |
const SequenceManager * | sequence_manager () const |
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) |
create structured sequence | |
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) |
AEntityFactory * | a_entity_factory () |
return the a_entity_factory pointer | |
const AEntityFactory * | a_entity_factory () const |
HalfFacetRep * | a_half_facet_rep () |
const HalfFacetRep * | a_half_facet_rep () const |
ReaderWriterSet * | reader_writer_set () |
return set of registered IO tools | |
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 |
virtual std::string | get_error_string (const ErrorCode code) const |
ErrorCode | check_adjacencies () |
check all adjacencies for consistency | |
ErrorCode | check_adjacencies (const EntityHandle *ents, int num_ents) |
check some adjacencies for consistency | |
bool | is_valid (const EntityHandle this_ent) const |
return whether the input handle is valid or not | |
virtual ErrorCode | create_set_iterator (EntityHandle meshset, EntityType ent_type, int ent_dim, int chunk_size, bool check_valid, SetIterator *&set_iter) |
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). | |
ErrorCode | remove_set_iterator (SetIterator *set_iter) |
Remove the set iterator from the instance's list. | |
ErrorCode | get_set_iterators (EntityHandle meshset, std::vector< SetIterator * > &set_iters) |
Get all set iterators associated with the set passed in. | |
void | estimated_memory_use (const EntityHandle *ent_array=0, 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) |
Calculate amount of memory used to store MOAB data. | |
void | estimated_memory_use (const Range &ents, 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) |
Calculate amount of memory used to store MOAB data. | |
void | print_database () const |
Sequence Option controllers | |
virtual double | get_sequence_multiplier () const |
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 void | set_sequence_multiplier (double factor) |
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. | |
Private Member Functions | |
Core (const Core ©) | |
Do not allow copying. | |
Core & | operator= (const Core ©) |
Do not allow copying. | |
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) |
ErrorCode | initialize () |
database init and de-init routines | |
void | deinitialize () |
EntityHandle | get_root_set () |
return the entity set representing the whole mesh | |
void | clean_up_failed_read (const Range &initial_entities, std::vector< Tag > initial_tags) |
Clean up after a file reader returns failure. | |
bool | valid_tag_handle (const TagInfo *t) const |
Private Attributes | |
WriteUtil * | mMBWriteUtil |
ReadUtil * | mMBReadUtil |
ScdInterface * | scdInterface |
int | geometricDimension |
store the total number of elements defined in this interface | |
Tag | materialTag |
Tag | neumannBCTag |
Tag | dirichletBCTag |
Tag | geomDimensionTag |
Tag | globalIdTag |
std::list< TagInfo * > | tagList |
tag server for this interface | |
SequenceManager * | sequenceManager |
AEntityFactory * | aEntityFactory |
ReaderWriterSet * | readerWriterSet |
Error * | mError |
bool | mpiFinalize |
int | writeMPELog |
bool | initErrorHandlerInCore |
std::vector< SetIterator * > | setIterators |
list of iterators | |
HalfFacetRep * | ahfRep |
bool | mesh_modified |
Friends | |
class | SetIterator |
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.
typedef unsigned long long moab::Core::type_memstorage |
moab::Core::Core | ( | ) |
constructor
Constructor.
Definition at line 170 of file Core.cpp.
References GaussIntegration::initialize(), and MB_SUCCESS.
{ if( initialize() != MB_SUCCESS ) { printf( "Error initializing moab::Core\n" ); exit( 1 ); } }
destructor
Definition at line 180 of file Core.cpp.
Referenced by pack_unpack_noremoteh(), and test_var_length_parallel().
{ if( mMBWriteUtil ) delete mMBWriteUtil; if( mMBReadUtil ) delete mMBReadUtil; if( scdInterface ) delete scdInterface; mMBWriteUtil = NULL; mMBReadUtil = NULL; scdInterface = NULL; deinitialize(); }
moab::Core::Core | ( | const Core & | copy | ) | [private] |
Do not allow copying.
AEntityFactory* moab::Core::a_entity_factory | ( | ) | [inline] |
return the a_entity_factory pointer
Definition at line 938 of file Core.hpp.
References aEntityFactory.
Referenced by moab::HigherOrderFactory::center_node_exist(), check_set_contents(), moab::Skinner::find_skin(), moab::WriteUtil::get_adjacencies(), moab::get_adjacencies_intersection(), moab::get_adjacencies_union(), moab::ParCommGraph::receive_mesh(), moab::HigherOrderFactory::tag_for_deletion(), and moab::ReadUtil::update_adjacencies().
{ return aEntityFactory; }
const AEntityFactory* moab::Core::a_entity_factory | ( | ) | const [inline] |
HalfFacetRep* moab::Core::a_half_facet_rep | ( | ) | [inline] |
Definition at line 948 of file Core.hpp.
References ahfRep.
Referenced by moab::NestedRefine::initialize().
{ return ahfRep; }
const HalfFacetRep* moab::Core::a_half_facet_rep | ( | ) | const [inline] |
ErrorCode moab::Core::add_child_meshset | ( | EntityHandle | meshset, |
const EntityHandle | child_meshset | ||
) | [virtual] |
add a child meshset
Definition at line 3379 of file Core.cpp.
References moab::MeshSet::add_child(), moab::get_mesh_set(), MB_ENTITY_NOT_FOUND, and MB_SUCCESS.
Referenced by test_pack_set_parent_child().
{ MeshSet* set_ptr = get_mesh_set( sequence_manager(), meshset ); MeshSet* child_ptr = get_mesh_set( sequence_manager(), child_meshset ); if( !set_ptr || !child_ptr ) return MB_ENTITY_NOT_FOUND; set_ptr->add_child( child_meshset ); return MB_SUCCESS; }
ErrorCode moab::Core::add_child_meshsets | ( | EntityHandle | meshset, |
const EntityHandle * | child_meshsets, | ||
int | num_child_meshsets | ||
) | [virtual] |
add parent meshsets
Definition at line 3389 of file Core.cpp.
References moab::MeshSet::add_child(), moab::get_mesh_set(), MB_ENTITY_NOT_FOUND, and MB_SUCCESS.
{ MeshSet* set_ptr = get_mesh_set( sequence_manager(), meshset ); if( !set_ptr ) return MB_ENTITY_NOT_FOUND; for( int i = 0; i < count; ++i ) if( !get_mesh_set( sequence_manager(), children[i] ) ) return MB_ENTITY_NOT_FOUND; for( int i = 0; i < count; ++i ) set_ptr->add_child( children[i] ); return MB_SUCCESS; }
ErrorCode moab::Core::add_entities | ( | EntityHandle | meshset, |
const Range & | entities | ||
) | [virtual] |
add entities to meshset
Definition at line 3187 of file Core.cpp.
References moab::get_mesh_set(), and MB_ENTITY_NOT_FOUND.
Referenced by build_mesh(), check_order_by_sets_and_adj(), moab::NestedRefine::create_hm_storage_single_level(), moab::NestedRefine::exchange_ghosts(), main(), test_add_entities(), test_boolean(), test_clear(), test_entities_by_dimension(), test_entities_by_type(), test_file_set(), test_iterators(), test_pack_set_contents(), test_pack_sets_of_sets(), test_pack_sets_simple(), test_remove_entities(), test_sets_fileids(), moab::ReorderTool::update_set_contents(), and moab::NestedRefine::update_special_tags().
{ MeshSet* set = get_mesh_set( sequence_manager(), meshset ); if( set ) return set->add_entities( entities, meshset, a_entity_factory() ); else return MB_ENTITY_NOT_FOUND; }
ErrorCode moab::Core::add_entities | ( | EntityHandle | meshset, |
const EntityHandle * | entities, | ||
const int | num_entities | ||
) | [virtual] |
add entities to meshset
Definition at line 3196 of file Core.cpp.
References moab::get_mesh_set(), and MB_ENTITY_NOT_FOUND.
{ MeshSet* set = get_mesh_set( sequence_manager(), meshset ); if( set ) return set->add_entities( entities, num_entities, meshset, a_entity_factory() ); else return MB_ENTITY_NOT_FOUND; }
ErrorCode moab::Core::add_parent_child | ( | EntityHandle | parent, |
EntityHandle | child | ||
) | [virtual] |
adds 'parent' to child's parent list and adds 'child' to parent's child list
Definition at line 3402 of file Core.cpp.
References moab::MeshSet::add_child(), moab::MeshSet::add_parent(), moab::get_mesh_set(), MB_ENTITY_NOT_FOUND, and MB_SUCCESS.
Referenced by gather_related_test(), main(), and test_pack_set_parent_child().
{ MeshSet* parent_ptr = get_mesh_set( sequence_manager(), parent ); MeshSet* child_ptr = get_mesh_set( sequence_manager(), child ); if( !parent_ptr || !child_ptr ) return MB_ENTITY_NOT_FOUND; parent_ptr->add_child( child ); child_ptr->add_parent( parent ); return MB_SUCCESS; }
ErrorCode moab::Core::add_parent_meshset | ( | EntityHandle | meshset, |
const EntityHandle | parent_meshset | ||
) | [virtual] |
add a parent meshset
Definition at line 3356 of file Core.cpp.
References moab::MeshSet::add_parent(), moab::get_mesh_set(), MB_ENTITY_NOT_FOUND, and MB_SUCCESS.
Referenced by test_pack_set_parent_child().
{ MeshSet* set_ptr = get_mesh_set( sequence_manager(), meshset ); MeshSet* parent_ptr = get_mesh_set( sequence_manager(), parent_meshset ); if( !set_ptr || !parent_ptr ) return MB_ENTITY_NOT_FOUND; set_ptr->add_parent( parent_meshset ); return MB_SUCCESS; }
ErrorCode moab::Core::add_parent_meshsets | ( | EntityHandle | meshset, |
const EntityHandle * | parent_meshsets, | ||
int | num_parent_meshsets | ||
) | [virtual] |
add parent meshsets
Definition at line 3366 of file Core.cpp.
References moab::MeshSet::add_parent(), moab::get_mesh_set(), MB_ENTITY_NOT_FOUND, and MB_SUCCESS.
{ MeshSet* set_ptr = get_mesh_set( sequence_manager(), meshset ); if( !set_ptr ) return MB_ENTITY_NOT_FOUND; for( int i = 0; i < count; ++i ) if( !get_mesh_set( sequence_manager(), parents[i] ) ) return MB_ENTITY_NOT_FOUND; for( int i = 0; i < count; ++i ) set_ptr->add_parent( parents[i] ); return MB_SUCCESS; }
ErrorCode moab::Core::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 |
||
) |
Definition at line 4062 of file Core.cpp.
Referenced by create_hexes_and_verts().
{ return sequence_manager()->add_vsequence( vert_seq, elem_seq, p1, q1, p2, q2, p3, q3, bb_input, bb_min, bb_max ); }
ErrorCode moab::Core::adjacencies_iterate | ( | Range::const_iterator | iter, |
Range::const_iterator | end, | ||
const std::vector< EntityHandle > **& | adjs_ptr, | ||
int & | count | ||
) |
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.
iter | Iterator to beginning of entity range desired |
end | End iterator for which adjacencies are requested |
adjs_ptr | Pointer to pointer to const std::vector<EntityHandle>; each member of that array is the vector of adjacencies for this entity |
count | Number of entities in the contiguous chunk starting from *iter |
Definition at line 1719 of file Core.cpp.
References moab::EntitySequence::data(), moab::Range::const_iterator::end_of_block(), moab::SequenceData::get_adjacency_data(), MB_ENTITY_NOT_FOUND, MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MBENTITYSET, moab::SequenceData::start_handle(), and moab::TYPE_FROM_HANDLE().
{ // Make sure the entity should have a connectivity. EntityType entity_type = TYPE_FROM_HANDLE( *iter ); // WARNING: This is very dependent on the ordering of the EntityType enum if( entity_type < MBVERTEX || entity_type > MBENTITYSET ) return MB_TYPE_OUT_OF_RANGE; EntitySequence* seq = NULL; // We know that connectivity is stored in an EntitySequence so jump straight // to the entity sequence ErrorCode rval = sequence_manager()->find( *iter, seq ); if( !seq || rval != MB_SUCCESS ) return MB_ENTITY_NOT_FOUND; adjs_ptr = const_cast< const std::vector< EntityHandle >** >( seq->data()->get_adjacency_data() ); if( !adjs_ptr ) return rval; adjs_ptr += *iter - seq->data()->start_handle(); EntityHandle real_end = *( iter.end_of_block() ); if( *end ) real_end = std::min( real_end, *end ); count = real_end - *iter + 1; return MB_SUCCESS; }
check all adjacencies for consistency
Definition at line 3591 of file Core.cpp.
References moab::Range::begin(), moab::Range::end(), MB_CHK_ERR, and MB_SUCCESS.
Referenced by mb_poly_adjacency_test(), mb_poly_adjacency_test2(), and test_elements_on_several_procs().
{ // run through all entities, checking adjacencies and reverse-evaluating them Range all_ents; ErrorCode result = get_entities_by_handle( 0, all_ents );MB_CHK_ERR( result ); for( Range::iterator rit = all_ents.begin(); rit != all_ents.end(); ++rit ) { result = check_adjacencies( &( *rit ), 1 );MB_CHK_ERR( result ); } return MB_SUCCESS; }
ErrorCode moab::Core::check_adjacencies | ( | const EntityHandle * | ents, |
int | num_ents | ||
) |
check some adjacencies for consistency
Definition at line 3605 of file Core.cpp.
References moab::Range::begin(), dim, moab::Range::end(), moab::CN::EntityTypeName(), moab::Range::find(), moab::ID_FROM_HANDLE(), MB_FAILURE, MB_MULTIPLE_ENTITIES_FOUND, MB_SUCCESS, MBENTITYSET, moab::TYPE_FROM_HANDLE(), and smoab::UNION.
{ ErrorCode result = MB_SUCCESS, tmp_result; std::ostringstream oss; for( int i = 0; i < num_ents; i++ ) { EntityHandle this_ent = ents[i]; std::ostringstream ent_str; ent_str << CN::EntityTypeName( TYPE_FROM_HANDLE( this_ent ) ) << " " << ID_FROM_HANDLE( this_ent ) << ": "; int this_dim = dimension_from_handle( this_ent ); if( !is_valid( this_ent ) ) { std::cerr << ent_str.str() << "Not a valid entity." << std::endl; result = MB_FAILURE; } else { if( TYPE_FROM_HANDLE( this_ent ) == MBENTITYSET ) continue; // get adjacencies for this entity Range adjs; for( int dim = 0; dim <= 3; dim++ ) { if( dim == this_dim ) continue; tmp_result = get_adjacencies( &this_ent, 1, dim, false, adjs, Interface::UNION ); if( MB_SUCCESS != tmp_result ) { oss << ent_str.str() << "Failed to get adjacencies for dimension " << dim << "." << std::endl; result = tmp_result; } } if( !oss.str().empty() ) { std::cerr << oss.str(); oss.str( "" ); } // now check and reverse-evaluate them for( Range::iterator rit = adjs.begin(); rit != adjs.end(); ++rit ) { EntitySequence* seq = 0; tmp_result = sequence_manager()->find( *rit, seq ); if( seq == 0 || tmp_result != MB_SUCCESS ) { oss << ent_str.str() << "Adjacent entity " << CN::EntityTypeName( TYPE_FROM_HANDLE( *rit ) ) << " " << ID_FROM_HANDLE( *rit ) << " is invalid." << std::endl; result = tmp_result; } else { Range rev_adjs; tmp_result = get_adjacencies( &( *rit ), 1, this_dim, false, rev_adjs ); if( MB_SUCCESS != tmp_result ) { oss << ent_str.str() << "Failed to get reverse adjacency from " << CN::EntityTypeName( TYPE_FROM_HANDLE( *rit ) ) << " " << ID_FROM_HANDLE( *rit ); if( MB_MULTIPLE_ENTITIES_FOUND == tmp_result ) oss << " (MULTIPLE)" << std::endl; else oss << " (" << tmp_result << ")" << std::endl; result = tmp_result; } else if( rev_adjs.find( this_ent ) == rev_adjs.end() ) { oss << ent_str.str() << "Failed to find adjacency to this entity from " << CN::EntityTypeName( TYPE_FROM_HANDLE( *rit ) ) << " " << ID_FROM_HANDLE( *rit ) << "." << std::endl; result = tmp_result; } } if( !oss.str().empty() ) { std::cerr << oss.str(); oss.str( "" ); } } } } return result; }
void moab::Core::clean_up_failed_read | ( | const Range & | initial_entities, |
std::vector< Tag > | initial_tags | ||
) | [private] |
Clean up after a file reader returns failure.
Delete all entities not contained in initial_entities and all tags not contained in initial_tags.
Definition at line 483 of file Core.cpp.
References moab::subtract().
{ Range new_ents; get_entities_by_handle( 0, new_ents ); new_ents = subtract( new_ents, initial_ents ); delete_entities( new_ents ); std::vector< Tag > all_tags, new_tags; tag_get_tags( all_tags ); std::sort( initial_tags.begin(), initial_tags.end() ); std::sort( all_tags.begin(), all_tags.end() ); std::set_difference( all_tags.begin(), all_tags.end(), initial_tags.begin(), initial_tags.end(), std::back_inserter( new_tags ) ); while( !new_tags.empty() ) { tag_delete( new_tags.back() ); new_tags.pop_back(); } }
ErrorCode moab::Core::clear_meshset | ( | const EntityHandle * | ms_handles, |
const int | num_meshsets | ||
) | [virtual] |
Empty a vector of mesh set.
Empty a mesh set.
ms_handles | 1d vector of handles of sets being emptied |
num_meshsets | Number of entities in 1d vector |
Definition at line 3130 of file Core.cpp.
References moab::get_mesh_set(), MB_ENTITY_NOT_FOUND, and MB_SUCCESS.
Referenced by main(), moab::AEntityFactory::remove_all_adjacencies(), test_clear(), and moab::ReorderTool::update_set_contents().
{ ErrorCode result = MB_SUCCESS; for( int i = 0; i < num_meshsets; ++i ) { MeshSet* set = get_mesh_set( sequence_manager(), ms_handles[i] ); if( set ) set->clear( ms_handles[i], a_entity_factory() ); else result = MB_ENTITY_NOT_FOUND; } return result; }
ErrorCode moab::Core::clear_meshset | ( | const Range & | ms_handles | ) | [virtual] |
Empty a range of mesh set.
Empty a mesh set.
ms_handles | Range of handles of sets being emptied |
Definition at line 3145 of file Core.cpp.
References moab::Range::begin(), moab::Range::end(), moab::get_mesh_set(), MB_ENTITY_NOT_FOUND, and MB_SUCCESS.
{ ErrorCode result = MB_SUCCESS; for( Range::iterator i = ms_handles.begin(); i != ms_handles.end(); ++i ) { MeshSet* set = get_mesh_set( sequence_manager(), *i ); if( set ) set->clear( *i, a_entity_factory() ); else result = MB_ENTITY_NOT_FOUND; } return result; }
ErrorCode moab::Core::connect_iterate | ( | Range::const_iterator | iter, |
Range::const_iterator | end, | ||
EntityHandle *& | connect, | ||
int & | verts_per_entity, | ||
int & | count | ||
) | [virtual] |
get pointer to connectivity data
Definition at line 1609 of file Core.cpp.
References moab::EntitySequence::end_handle(), moab::Range::const_iterator::end_of_block(), moab::ElementSequence::get_connectivity_array(), MB_ENTITY_NOT_FOUND, MB_FAILURE, MB_SET_ERR, MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MBENTITYSET, moab::ElementSequence::nodes_per_element(), moab::EntitySequence::start_handle(), and moab::TYPE_FROM_HANDLE().
{ // Make sure the entity should have a connectivity. EntityType entity_type = TYPE_FROM_HANDLE( *iter ); // WARNING: This is very dependent on the ordering of the EntityType enum if( entity_type <= MBVERTEX || entity_type >= MBENTITYSET ) return MB_TYPE_OUT_OF_RANGE; EntitySequence* seq = NULL; // We know that connectivity is stored in an EntitySequence so jump straight // to the entity sequence ErrorCode rval = sequence_manager()->find( *iter, seq ); if( !seq || rval != MB_SUCCESS ) return MB_ENTITY_NOT_FOUND; ElementSequence* eseq = dynamic_cast< ElementSequence* >( seq ); assert( eseq != NULL ); connect = eseq->get_connectivity_array(); if( !connect ) { MB_SET_ERR( MB_FAILURE, "Couldn't find connectivity array for start handle" ); } connect += eseq->nodes_per_element() * ( *iter - eseq->start_handle() ); EntityHandle real_end = std::min( eseq->end_handle(), *( iter.end_of_block() ) ); if( *end ) real_end = std::min( real_end, *end ); count = real_end - *iter + 1; verts_per_entity = eseq->nodes_per_element(); return MB_SUCCESS; }
bool moab::Core::contains_entities | ( | EntityHandle | meshset, |
const EntityHandle * | entities, | ||
int | num_entities, | ||
const int | operation_type = Interface::INTERSECT |
||
) | [virtual] |
return true if all entities are contained in set
Definition at line 3226 of file Core.cpp.
References moab::get_mesh_set().
Referenced by MBMesquite::MsqMOAB::vertices_get_attached_elements().
{ if( !meshset ) // root return true; else if( MeshSet* set = get_mesh_set( sequence_manager(), meshset ) ) return set->contains_entities( entities, num_entities, operation_type ); else return false; }
ErrorCode moab::Core::convert_entities | ( | const EntityHandle | meshset, |
const bool | mid_side, | ||
const bool | mid_face, | ||
const bool | mid_volume, | ||
Interface::HONodeAddedRemoved * | function_object = 0 |
||
) | [virtual] |
Definition at line 2855 of file Core.cpp.
References moab::HigherOrderFactory::convert().
Referenced by main().
{ HigherOrderFactory fact( this, function_object ); return fact.convert( meshset, mid_side, mid_face, mid_volume ); }
ErrorCode moab::Core::coords_iterate | ( | Range::const_iterator | iter, |
Range::const_iterator | end, | ||
double *& | xcoords_ptr, | ||
double *& | ycoords_ptr, | ||
double *& | zcoords_ptr, | ||
int & | count | ||
) | [virtual] |
get pointers to coordinate data
Definition at line 794 of file Core.cpp.
References moab::EntitySequence::data(), moab::EntitySequence::end_handle(), moab::Range::const_iterator::end_of_block(), moab::SequenceData::get_sequence_data(), MB_ENTITY_NOT_FOUND, MB_SET_ERR, MB_SUCCESS, and moab::SequenceData::start_handle().
{ EntitySequence* seq; ErrorCode rval = sequence_manager()->find( *iter, seq ); if( MB_SUCCESS != rval ) { xcoords_ptr = ycoords_ptr = zcoords_ptr = NULL; MB_SET_ERR( rval, "Couldn't find sequence for start handle" ); } VertexSequence* vseq = dynamic_cast< VertexSequence* >( seq ); if( !vseq ) { MB_SET_ERR( MB_ENTITY_NOT_FOUND, "Couldn't find sequence for start handle" ); } unsigned int offset = *iter - vseq->data()->start_handle(); xcoords_ptr = reinterpret_cast< double* >( vseq->data()->get_sequence_data( 0 ) ) + offset; ycoords_ptr = reinterpret_cast< double* >( vseq->data()->get_sequence_data( 1 ) ) + offset; zcoords_ptr = reinterpret_cast< double* >( vseq->data()->get_sequence_data( 2 ) ) + offset; EntityHandle real_end = std::min( seq->end_handle(), *( iter.end_of_block() ) ); if( *end ) real_end = std::min( real_end, *end ); count = real_end - *iter + 1; return MB_SUCCESS; }
ErrorCode moab::Core::create_element | ( | const EntityType | type, |
const EntityHandle * | connectivity, | ||
const int | num_nodes, | ||
EntityHandle & | element_handle | ||
) | [virtual] |
Creates an element based on the type and connectivity.
creates an element based on the type and connectivity. returns a handle and error code
If connectivity vector is not correct for EntityType type (ie, a vector with 3 vertices is passed in to make an MBQUAD), the function returns MB_FAILURE.
type | Type of element to create. (MBTET, MBTRI, MBKNIFE, etc.) |
connectivity | Vector containing connectivity of element to create. |
handle | EntityHandle representing the newly created element in the database. |
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 );
Definition at line 2501 of file Core.cpp.
References MB_FAILURE, MB_SUCCESS, and moab::CN::VerticesPerEntity().
Referenced by build_mesh(), create_elements_single(), create_mesh(), create_missing_elements(), moab::AEntityFactory::get_down_adjacency_elements_poly(), moab::AEntityFactory::get_element(), main(), mb_memory_use_test(), obbvis_create(), test_build_from_tri(), test_file_set(), test_linear_hex(), test_linear_quad(), test_pack_elements(), test_pack_higher_order(), test_pack_poly(), test_quadratic_hex(), test_sets_fileids(), and write_tree_blocks().
{ // make sure we have enough vertices for this entity type if( num_nodes < CN::VerticesPerEntity( entity_type ) ) return MB_FAILURE; ErrorCode status = sequence_manager()->create_element( entity_type, connectivity, num_nodes, handle ); if( MB_SUCCESS == status ) status = aEntityFactory->notify_create_entity( handle, connectivity, num_nodes ); #ifdef MOAB_HAVE_AHF mesh_modified = true; #endif return status; }
ErrorCode moab::Core::create_meshset | ( | const unsigned int | options, |
EntityHandle & | ms_handle, | ||
int | start_id = 0 |
||
) | [virtual] |
creates a mesh set
Definition at line 3102 of file Core.cpp.
Referenced by build_mesh(), check_order_by_sets_and_adj(), moab::ReadUtil::create_gather_set(), moab::NestedRefine::create_hm_storage_single_level(), gather_one_cell_var(), gather_related_test(), main(), mb_mesh_set_set_add_remove_test(), multiple_loads_of_same_file(), regression_insert_set_1(), regression_tag_on_nonexistent_entity(), test_add_entities(), test_boolean(), test_clear(), test_entities_by_dimension(), test_entities_by_type(), test_eul_read_write_across_files(), test_file_set(), test_gather_onevar(), test_intx_in_parallel_elem_based(), test_intx_mpas(), test_iterators(), test_pack_set_contents(), test_pack_set_parent_child(), test_pack_sets_of_sets(), test_pack_sets_simple(), test_read_coord_vars(), test_read_domain(), test_read_eul_nomesh(), test_read_eul_novars(), test_read_fv_nomesh(), test_read_fv_novars(), test_read_nomesh(), test_read_novars(), test_read_parallel(), test_remove_entities(), test_sets_fileids(), update_tracer(), and write_id_test_file().
{ return sequence_manager()->create_mesh_set( setoptions, ms_handle ); }
ErrorCode moab::Core::create_scd_sequence | ( | const HomCoord & | coord_min, |
const HomCoord & | coord_max, | ||
EntityType | type, | ||
EntityID | start_id_hint, | ||
EntityHandle & | first_handle_out, | ||
EntitySequence *& | sequence_out | ||
) |
create structured sequence
Definition at line 4042 of file Core.cpp.
References moab::ScdBox::get_element(), moab::ScdBox::get_vertex(), MB_CHK_ERR, and MBVERTEX.
Referenced by create_hexes_and_verts().
{ // NR: Previously, the structured element sequences were created via direct call to // the sequence manager instead of using the same from the ScdInterface which // creates the associated scd bounding box after element sequence creation. if( !scdInterface ) scdInterface = new ScdInterface( this ); ScdBox* newBox = NULL; ErrorCode rval = scdInterface->create_scd_sequence( coord_min, coord_max, entity_type, /*starting_id*/ (int)start_id_hint, newBox );MB_CHK_ERR( rval ); if( MBVERTEX == entity_type ) first_handle_out = newBox->get_vertex( coord_min ); else first_handle_out = newBox->get_element( coord_min ); return sequence_manager()->find( first_handle_out, sequence_out ); }
ErrorCode moab::Core::create_set_iterator | ( | EntityHandle | meshset, |
EntityType | ent_type, | ||
int | ent_dim, | ||
int | chunk_size, | ||
bool | check_valid, | ||
SetIterator *& | set_iter | ||
) | [virtual] |
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.
meshset | The entity set associated with this iterator (use 0 for whole instance) |
ent_type | Entity type associated with this iterator |
ent_dim | Dimension associated with this iterator |
chunk_size | Chunk size of the iterator |
check_valid | If true, entities are checked for validity before being returned |
Definition at line 3698 of file Core.cpp.
References MB_CHK_ERR, MB_SUCCESS, and MESHSET_SET.
Referenced by test_iterators().
{ // check the type of set unsigned int setoptions; ErrorCode rval = MB_SUCCESS; if( meshset ) { rval = get_meshset_options( meshset, setoptions );MB_CHK_ERR( rval ); } if( !meshset || ( setoptions & MESHSET_SET ) ) set_iter = new( std::nothrow ) RangeSetIterator( this, meshset, chunk_size, ent_type, ent_dim, check_valid ); else set_iter = new( std::nothrow ) VectorSetIterator( this, meshset, chunk_size, ent_type, ent_dim, check_valid ); setIterators.push_back( set_iter ); return MB_SUCCESS; }
ErrorCode moab::Core::create_vertex | ( | const double | coordinates[3], |
EntityHandle & | entity_handle | ||
) | [virtual] |
Creates a vertex based on coordinates.
creates a vertex based on coordinates, returns a handle and error code
coordinates | Array that has 3 doubles in it. |
entity_handle | EntityHandle representing the newly created vertex in the database. |
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 );
Definition at line 2518 of file Core.cpp.
Referenced by moab::HigherOrderFactory::add_mid_edge_nodes(), moab::HigherOrderFactory::add_mid_face_nodes(), moab::HigherOrderFactory::add_mid_volume_nodes(), build_mesh(), create_mesh(), create_missing_vertices(), create_vertices_single(), mb_adjacent_create_test(), mb_forced_adjacencies_test(), mb_memory_use_test(), mb_merge_update_test(), mb_poly_adjacency_test(), mb_poly_adjacency_test2(), mb_poly_test(), mb_side_number_test(), mb_skin_curve_test_common(), mb_skin_full_common(), mb_skin_higher_order_faces_common(), mb_skin_surface_test_common(), mb_skin_volume_test_common(), mb_temporary_test(), regression_one_entity_by_var_tag(), test_build_from_tri(), test_pack_elements(), test_pack_higher_order(), test_pack_poly(), test_read_adjacencies(), test_read_one_set_polyhedra(), test_subset(), test_write_free_nodes(), test_write_read_many_tags(), and write_tree_blocks().
{ // get an available vertex handle return sequence_manager()->create_vertex( coords, handle ); }
ErrorCode moab::Core::create_vertices | ( | const double * | coordinates, |
const int | nverts, | ||
Range & | entity_handles | ||
) | [virtual] |
Create a set of vertices with the specified coordinates.
coordinates | Array that has 3*n doubles in it. |
nverts | Number of vertices to create |
entity_handles | Range passed back with new vertex handles |
Definition at line 2524 of file Core.cpp.
References moab::Range::clear(), moab::ReadUtilIface::get_node_coords(), moab::Range::insert(), MB_CHK_ERR, MB_START_ID, and MB_SUCCESS.
Referenced by main(), obbvis_create(), test_file_set(), test_linear_hex(), test_linear_quad(), test_linear_tet(), test_pack_vertices(), test_quadratic_hex(), and test_sets_fileids().
{ // Create vertices ReadUtilIface* read_iface; ErrorCode result = Interface::query_interface( read_iface );MB_CHK_ERR( result ); std::vector< double* > arrays; EntityHandle start_handle_out = 0; result = read_iface->get_node_coords( 3, nverts, MB_START_ID, start_handle_out, arrays ); Interface::release_interface( read_iface );MB_CHK_ERR( result ); // Cppcheck warning (false positive): variable arrays is assigned a value that is never used for( int i = 0; i < nverts; i++ ) { arrays[0][i] = coordinates[3 * i]; arrays[1][i] = coordinates[3 * i + 1]; arrays[2][i] = coordinates[3 * i + 2]; } entity_handles.clear(); entity_handles.insert( start_handle_out, start_handle_out + nverts - 1 ); return MB_SUCCESS; }
void moab::Core::deinitialize | ( | ) | [private] |
Definition at line 261 of file Core.cpp.
References moab::ParallelComm::get_all_pcomm(), moab::MBErrorHandler_Finalize(), MOAB_MPE_LOG, and MPE_Finish_log.
{ #ifdef MOAB_HAVE_MPI std::vector< ParallelComm* > pc_list; ParallelComm::get_all_pcomm( this, pc_list ); for( std::vector< ParallelComm* >::iterator vit = pc_list.begin(); vit != pc_list.end(); ++vit ) delete *vit; #endif #ifdef MOAB_HAVE_AHF delete ahfRep; ahfRep = 0; #endif if( aEntityFactory ) delete aEntityFactory; aEntityFactory = 0; while( !tagList.empty() ) tag_delete( tagList.front() ); if( sequenceManager ) delete sequenceManager; sequenceManager = 0; delete readerWriterSet; readerWriterSet = 0; if( mError ) delete mError; mError = 0; #ifdef MOAB_HAVE_MPI if( writeMPELog ) { const char* default_log = MOAB_MPE_LOG; const char* logfile = getenv( "MPE_LOG_FILE" ); if( !logfile ) logfile = default_log; MPE_Finish_log( logfile ); } #endif if( initErrorHandlerInCore ) MBErrorHandler_Finalize(); }
ErrorCode moab::Core::delete_entities | ( | const EntityHandle * | entities, |
const int | num_entities | ||
) | [virtual] |
Removes entities in a vector from the data base.
deletes an entity vector
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 entity< > are removed as part of this function.
entities | 1d vector of entities to delete |
num_entities | Number of entities in 1d vector |
Definition at line 2650 of file Core.cpp.
References moab::get_mesh_set(), MB_SUCCESS, MB_TAG_NOT_FOUND, MBENTITYSET, rel, and moab::TYPE_FROM_HANDLE().
Referenced by moab::HigherOrderFactory::convert_sequence(), delete_elem(), delete_vert(), main(), test_pack_set_contents(), test_pack_set_parent_child(), test_pack_sets_of_sets(), and test_pack_sets_simple().
{ ErrorCode result = MB_SUCCESS, temp_result; Range failed_ents; for( std::list< TagInfo* >::iterator i = tagList.begin(); i != tagList.end(); ++i ) { temp_result = ( *i )->remove_data( sequenceManager, mError, entities, num_entities ); // ok if the error is tag_not_found, some ents may not have every tag on them if( MB_SUCCESS != temp_result && MB_TAG_NOT_FOUND != temp_result ) result = temp_result; } for( int i = 0; i < num_entities; i++ ) { // tell AEntityFactory that this element is going away bool failed = false; temp_result = aEntityFactory->notify_delete_entity( entities[i] ); if( MB_SUCCESS != temp_result ) { result = temp_result; failed = true; } if( TYPE_FROM_HANDLE( entities[i] ) == MBENTITYSET ) { if( MeshSet* ptr = get_mesh_set( sequence_manager(), entities[i] ) ) { int j, count; const EntityHandle* rel; ptr->clear( entities[i], a_entity_factory() ); rel = ptr->get_parents( count ); for( j = 0; j < count; ++j ) remove_child_meshset( rel[j], entities[i] ); rel = ptr->get_children( count ); for( j = 0; j < count; ++j ) remove_parent_meshset( rel[j], entities[i] ); } } if( failed ) // don't test for success, since we'll return failure in this case sequence_manager()->delete_entity( mError, entities[i] ); else { // now delete the entity temp_result = sequence_manager()->delete_entity( mError, entities[i] ); if( MB_SUCCESS != temp_result ) result = temp_result; } } return result; }
ErrorCode moab::Core::delete_entities | ( | const Range & | entities | ) | [virtual] |
Removes entities in a range from the data base.
deletes an entity range
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 entity< > are removed as part of this function.
entities | Range of entities to delete |
Definition at line 2595 of file Core.cpp.
References moab::Range::empty(), moab::get_mesh_set(), moab::Range::insert(), MB_SUCCESS, MB_TAG_NOT_FOUND, MBENTITYSET, moab::Range::rbegin(), rel, moab::Range::rend(), moab::subtract(), and moab::TYPE_FROM_HANDLE().
{ ErrorCode result = MB_SUCCESS, temp_result; Range failed_ents; for( std::list< TagInfo* >::iterator i = tagList.begin(); i != tagList.end(); ++i ) { temp_result = ( *i )->remove_data( sequenceManager, mError, range ); // ok if the error is tag_not_found, some ents may not have every tag on them if( MB_SUCCESS != temp_result && MB_TAG_NOT_FOUND != temp_result ) result = temp_result; } for( Range::const_reverse_iterator rit = range.rbegin(); rit != range.rend(); ++rit ) { // tell AEntityFactory that this element is going away temp_result = aEntityFactory->notify_delete_entity( *rit ); if( MB_SUCCESS != temp_result ) { result = temp_result; failed_ents.insert( *rit ); continue; } if( TYPE_FROM_HANDLE( *rit ) == MBENTITYSET ) { if( MeshSet* ptr = get_mesh_set( sequence_manager(), *rit ) ) { int j, count; const EntityHandle* rel; ptr->clear( *rit, a_entity_factory() ); rel = ptr->get_parents( count ); for( j = 0; j < count; ++j ) remove_child_meshset( rel[j], *rit ); rel = ptr->get_children( count ); for( j = 0; j < count; ++j ) remove_parent_meshset( rel[j], *rit ); } } } if( !failed_ents.empty() ) { Range dum_range = subtract( range, failed_ents ); // don't test for success, since we'll return failure in this case sequence_manager()->delete_entities( mError, dum_range ); } else // now delete the entities result = sequence_manager()->delete_entities( mError, range ); return result; }
ErrorCode moab::Core::delete_mesh | ( | ) | [virtual] |
deletes all mesh entities from this datastore
Definition at line 714 of file Core.cpp.
References MB_CHK_ERR, and MB_SUCCESS.
Referenced by delete_mesh(), main(), test_build_tree_bisect_triangles(), test_closest_triangle(), test_ray_intersect_triangles(), test_sets_fileids(), test_sphere_intersect_triangles(), and test_tree_readwrite().
{ ErrorCode result = MB_SUCCESS; // perform all deinitialization procedures to clean up if( aEntityFactory ) delete aEntityFactory; aEntityFactory = new AEntityFactory( this ); for( std::list< TagInfo* >::iterator i = tagList.begin(); i != tagList.end(); ++i ) { result = ( *i )->release_all_data( sequenceManager, mError, false );MB_CHK_ERR( result ); } sequenceManager->clear(); return MB_SUCCESS; }
int moab::Core::dimension_from_handle | ( | const EntityHandle | handle | ) | const [virtual] |
Definition at line 400 of file Core.cpp.
References moab::CN::Dimension(), and moab::TYPE_FROM_HANDLE().
Referenced by moab::AEntityFactory::check_equiv_entities(), moab::ParCommGraph::compute_partition(), moab::AEntityFactory::create_explicit_adjs(), moab::HalfFacetRep::get_adjacencies(), moab::HalfFacetRep::get_down_adjacencies(), moab::AEntityFactory::get_element(), moab::HalfFacetRep::get_neighbor_adjacencies(), moab::HalfFacetRep::get_up_adjacencies(), and moab::HigherOrderFactory::tag_for_deletion().
{ if( !handle ) // root set return 4; else return CN::Dimension( TYPE_FROM_HANDLE( handle ) ); }
Definition at line 2474 of file Core.cpp.
References DIRICHLET_SET_TAG_NAME, MB_TAG_CREAT, MB_TAG_SPARSE, and MB_TYPE_INTEGER.
{ const int negone = -1; if( 0 == dirichletBCTag ) tag_get_handle( DIRICHLET_SET_TAG_NAME, 1, MB_TYPE_INTEGER, dirichletBCTag, MB_TAG_CREAT | MB_TAG_SPARSE, &negone ); return dirichletBCTag; }
void moab::Core::estimated_memory_use | ( | const EntityHandle * | ent_array = 0 , |
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 |
||
) |
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.
ent_array | Array of entities for which to estimate the memory use. If NULL, estimate is done for all entities. |
num_ents | The length of ent_array. Not used if ent_rray is NULL. |
total_(amortized_)storage | The sum of the memory entity, adjacency, and all tag storage. |
(amortized_)entity_storage | The storage for the entity definitions (connectivity arrays for elements, coordinates for vertices, list storage within sets, etc.) |
(amortized_)adjacency_storage | The storage for adjacency data. |
tag_array | An array of tags for which to calculate the memory use. |
num_tags | The lenght of tag_array |
(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. |
Definition at line 3890 of file Core.cpp.
References moab::Range::begin(), and moab::Range::insert().
Referenced by mb_memory_use_test().
{ Range range; // If non-empty entity list, call range version of function if( ent_array ) { if( num_ents > 20 ) { std::vector< EntityHandle > list( num_ents ); std::copy( ent_array, ent_array + num_ents, list.begin() ); std::sort( list.begin(), list.end() ); Range::iterator j = range.begin(); for( std::vector< EntityHandle >::reverse_iterator i = list.rbegin(); i != list.rend(); ++i ) j = range.insert( j, *i, *i ); } else { std::copy( ent_array, ent_array + num_ents, range_inserter( range ) ); } } estimated_memory_use_internal( ent_array ? &range : 0, total_storage, total_amortized_storage, entity_storage, amortized_entity_storage, adjacency_storage, amortized_adjacency_storage, tag_array, num_tags, tag_storage, amortized_tag_storage ); }
void moab::Core::estimated_memory_use | ( | const Range & | ents, |
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 |
||
) |
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.)
ents | Entities for which to estimate the memory use. |
total_(amortized_)storage | The sum of the memory entity, adjacency, and all tag storage. |
(amortized_)entity_storage | The storage for the entity definitions (connectivity arrays for elements, coordinates for vertices, list storage within sets, etc.) |
(amortized_)adjacency_storage | The storage for adjacency data. |
tag_array | An array of tags for which to calculate the memory use. |
num_tags | The lenght of tag_array |
(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. |
Definition at line 3921 of file Core.cpp.
{ estimated_memory_use_internal( &ents, total_storage, total_amortized_storage, entity_storage, amortized_entity_storage, adjacency_storage, amortized_adjacency_storage, tag_array, num_tags, tag_storage, amortized_tag_storage ); }
void moab::Core::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 | ||
) | [private] |
Definition at line 3744 of file Core.cpp.
References moab::TagInfo::get_memory_use(), MBMAXTYPE, and moab::TagInfo::num_tagged_entities().
{ // Figure out which values we need to calculate type_memstorage i_entity_storage, ia_entity_storage, i_adjacency_storage, ia_adjacency_storage, i_tag_storage, ia_tag_storage; type_memstorage *total_tag_storage = 0, *amortized_total_tag_storage = 0; if( !tag_array ) { total_tag_storage = tag_storage; amortized_total_tag_storage = amortized_tag_storage; } if( total_storage || total_amortized_storage ) { if( !entity_storage ) entity_storage = &i_entity_storage; if( !amortized_entity_storage ) amortized_entity_storage = &ia_entity_storage; if( !adjacency_storage ) adjacency_storage = &i_adjacency_storage; if( !amortized_adjacency_storage ) amortized_adjacency_storage = &ia_adjacency_storage; } else { if( entity_storage || amortized_entity_storage ) { if( !amortized_entity_storage ) amortized_entity_storage = &ia_entity_storage; else if( !entity_storage ) entity_storage = &i_entity_storage; } if( adjacency_storage || amortized_adjacency_storage ) { if( !amortized_adjacency_storage ) amortized_adjacency_storage = &ia_adjacency_storage; else if( !adjacency_storage ) adjacency_storage = &i_adjacency_storage; } } if( !total_tag_storage && total_storage ) total_tag_storage = &i_tag_storage; if( !amortized_total_tag_storage && total_amortized_storage ) amortized_total_tag_storage = &ia_tag_storage; // get entity storage if( amortized_entity_storage ) { if( ents ) sequenceManager->get_memory_use( *ents, *entity_storage, *amortized_entity_storage ); else sequenceManager->get_memory_use( *entity_storage, *amortized_entity_storage ); } // get adjacency storage if( amortized_adjacency_storage ) { if( ents ) aEntityFactory->get_memory_use( *ents, *adjacency_storage, *amortized_adjacency_storage ); else #ifdef MOAB_HAVE_AHF ahfRep->get_memory_use( *adjacency_storage, *amortized_adjacency_storage ); #else aEntityFactory->get_memory_use( *adjacency_storage, *amortized_adjacency_storage ); #endif } // get storage for requested list of tags if( tag_array ) { for( unsigned i = 0; i < num_tags; ++i ) { if( !valid_tag_handle( tag_array[i] ) ) continue; unsigned long total = 0, per_ent = 0; tag_array[i]->get_memory_use( sequenceManager, total, per_ent ); if( ents ) { size_t count = 0, count2 = 0; tag_array[i]->num_tagged_entities( sequenceManager, count, MBMAXTYPE, ents ); if( tag_storage ) tag_storage[i] = count * per_ent; if( amortized_tag_storage ) { tag_array[i]->num_tagged_entities( sequenceManager, count2 ); if( count2 ) amortized_tag_storage[i] = static_cast< type_memstorage >( total * count * 1.0 / count2 ); } } else { size_t count = 0; if( tag_storage ) { tag_array[i]->num_tagged_entities( sequenceManager, count ); tag_storage[i] = count * per_ent; } if( amortized_tag_storage ) amortized_tag_storage[i] = total; } } } // get storage for all tags if( total_tag_storage || amortized_total_tag_storage ) { if( amortized_total_tag_storage ) *amortized_total_tag_storage = 0; if( total_tag_storage ) *total_tag_storage = 0; std::vector< Tag > tags; tag_get_tags( tags ); for( std::list< TagInfo* >::const_iterator i = tagList.begin(); i != tagList.end(); ++i ) { unsigned long total = 0, per_ent = 0; ( *i )->get_memory_use( sequenceManager, total, per_ent ); if( ents ) { size_t count = 0, count2 = 0; ( *i )->num_tagged_entities( sequenceManager, count, MBMAXTYPE, ents ); if( total_tag_storage ) *total_tag_storage += count * per_ent; if( amortized_total_tag_storage ) { ( *i )->num_tagged_entities( sequenceManager, count2 ); if( count2 ) *amortized_total_tag_storage += static_cast< type_memstorage >( total * count * 1.0 / count2 ); } } else { size_t count = 0; if( total_tag_storage ) { ( *i )->num_tagged_entities( sequenceManager, count ); *total_tag_storage += count * per_ent; } if( amortized_total_tag_storage ) *amortized_total_tag_storage += total; } } } // calculate totals if( total_storage ) *total_storage = *entity_storage + *adjacency_storage + *total_tag_storage; if( total_amortized_storage ) *total_amortized_storage = *amortized_entity_storage + *amortized_adjacency_storage + *amortized_total_tag_storage; }
Definition at line 2491 of file Core.cpp.
References GEOM_DIMENSION_TAG_NAME, MB_TAG_CREAT, MB_TAG_SPARSE, and MB_TYPE_INTEGER.
{ const int negone = -1; if( 0 == geomDimensionTag ) tag_get_handle( GEOM_DIMENSION_TAG_NAME, 1, MB_TYPE_INTEGER, geomDimensionTag, MB_TAG_CREAT | MB_TAG_SPARSE, &negone ); return geomDimensionTag; }
ErrorCode moab::Core::get_adjacencies | ( | const EntityHandle * | from_entities, |
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] |
get the adjacencies associated with a set of entities
from_entities | vector of EntityHandle to get adjacencies of. |
to_dimension | Dimension of desired adjacency information. |
adj_entities | Vector in which adjacent EntityHandles are returned. |
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 adjacencies are not in any particular order.
// 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 );
Definition at line 1447 of file Core.cpp.
References conn, moab::get_adjacencies_intersection(), INTERSECT, MB_CHK_ERR, MB_FAILURE, MB_SUCCESS, MBPOLYHEDRON, moab::TYPE_FROM_HANDLE(), and smoab::UNION.
Referenced by moab::DualTool::check_dual_equiv_edges(), moab::AEntityFactory::check_equiv_entities(), check_meshset_common(), check_order_by_sets_and_adj(), moab::ParCommGraph::compute_partition(), moab::AEntityFactory::create_explicit_adjs(), moab::NestedRefine::exchange_ghosts(), moab::ReadUtil::gather_related_ents(), gather_set_stats(), MBMesquite::MsqMOAB::get_adjacent_entities(), moab::AEntityFactory::get_down_adjacency_elements_poly(), moab::AEntityFactory::get_polyhedron_vertices(), moab::AEntityFactory::get_vertices(), hcFilter(), moab::ReorderTool::int_order_from_sets_and_adj(), laplacianFilter(), main(), moab::AEntityFactory::merge_adjust_adjacencies(), pack_unpack_noremoteh(), test_read_side(), and moab::HiReconstruction::vertex_get_incident_elements().
{ #ifdef MOAB_HAVE_AHF bool can_handle = true; if( to_dimension == 4 ) can_handle = false; // NOT SUPPORTED: meshsets else if( create_if_missing ) can_handle = false; // NOT SUPPORTED: create_if_missing bool mixed = ahfRep->check_mixed_entity_type(); // NOT SUPPORTED: mixed entity types or // polygonal/hedrals types if( mixed ) can_handle = false; if( mesh_modified ) // NOT SUPPORTED: modified mesh can_handle = false; if( can_handle ) { ErrorCode result; if( operation_type == Interface::INTERSECT ) return get_adjacencies_intersection_ahf( this, from_entities, from_entities + num_entities, to_dimension, adj_entities ); else if( operation_type != Interface::UNION ) return MB_FAILURE; // do union std::vector< EntityHandle > tmp_storage; const EntityHandle* conn; int len; for( int i = 0; i < num_entities; ++i ) { if( to_dimension == 0 && TYPE_FROM_HANDLE( from_entities[0] ) != MBPOLYHEDRON ) { result = get_connectivity( from_entities[i], conn, len, false, &tmp_storage ); adj_entities.insert( adj_entities.end(), conn, conn + len ); if( MB_SUCCESS != result ) return result; } else { result = ahfRep->get_adjacencies( from_entities[i], to_dimension, adj_entities ); if( MB_SUCCESS != result ) return result; } } std::sort( adj_entities.begin(), adj_entities.end() ); adj_entities.erase( std::unique( adj_entities.begin(), adj_entities.end() ), adj_entities.end() ); } else { #endif if( operation_type == Interface::INTERSECT ) return get_adjacencies_intersection( this, from_entities, from_entities + num_entities, to_dimension, create_if_missing, adj_entities ); else if( operation_type != Interface::UNION ) return MB_FAILURE; // do union ErrorCode result; std::vector< EntityHandle > tmp_storage; const EntityHandle* conn; int len; for( int i = 0; i < num_entities; ++i ) { if( to_dimension == 0 && TYPE_FROM_HANDLE( from_entities[0] ) != MBPOLYHEDRON ) { result = get_connectivity( from_entities[i], conn, len, false, &tmp_storage );MB_CHK_ERR( result ); adj_entities.insert( adj_entities.end(), conn, conn + len ); } else { result = aEntityFactory->get_adjacencies( from_entities[i], to_dimension, create_if_missing, adj_entities );MB_CHK_ERR( result ); } } std::sort( adj_entities.begin(), adj_entities.end() ); adj_entities.erase( std::unique( adj_entities.begin(), adj_entities.end() ), adj_entities.end() ); // return MB_SUCCESS; #ifdef MOAB_HAVE_AHF } #endif return MB_SUCCESS; }
ErrorCode moab::Core::get_adjacencies | ( | const EntityHandle * | from_entities, |
const int | num_entities, | ||
const int | to_dimension, | ||
const bool | create_if_missing, | ||
Range & | adj_entities, | ||
const int | operation_type = Interface::INTERSECT |
||
) | [virtual] |
Definition at line 1539 of file Core.cpp.
References moab::get_adjacencies_intersection(), moab::get_adjacencies_union(), INTERSECT, MB_FAILURE, and smoab::UNION.
{ if( operation_type == Interface::INTERSECT ) return get_adjacencies_intersection( this, from_entities, from_entities + num_entities, to_dimension, create_if_missing, adj_entities ); else if( operation_type == Interface::UNION ) return get_adjacencies_union( this, from_entities, from_entities + num_entities, to_dimension, create_if_missing, adj_entities ); else return MB_FAILURE; }
ErrorCode moab::Core::get_adjacencies | ( | const Range & | from_entities, |
const int | to_dimension, | ||
const bool | create_if_missing, | ||
Range & | adj_entities, | ||
const int | operation_type = Interface::INTERSECT |
||
) | [virtual] |
Definition at line 1665 of file Core.cpp.
References moab::Range::begin(), moab::Range::end(), moab::get_adjacencies_intersection(), moab::get_adjacencies_union(), INTERSECT, MB_FAILURE, and smoab::UNION.
{ if( operation_type == Interface::INTERSECT ) return get_adjacencies_intersection( this, from_entities.begin(), from_entities.end(), to_dimension, create_if_missing, adj_entities ); else if( operation_type != Interface::UNION ) return MB_FAILURE; else if( to_dimension == 0 ) return get_vertices( from_entities, adj_entities ); else return get_adjacencies_union( this, from_entities.begin(), from_entities.end(), to_dimension, create_if_missing, adj_entities ); }
ErrorCode moab::Core::get_child_meshsets | ( | const EntityHandle | meshset, |
std::vector< EntityHandle > & | children, | ||
const int | num_hops = 1 |
||
) | const [virtual] |
get child meshsets
Definition at line 3272 of file Core.cpp.
References moab::MeshSetSequence::get_children(), MB_ENTITY_NOT_FOUND, and MB_SUCCESS.
Referenced by moab::ReadUtil::gather_related_ents(), and test_pack_set_parent_child().
{ if( 0 == meshset ) return MB_ENTITY_NOT_FOUND; const EntitySequence* seq; ErrorCode rval = sequence_manager()->find( meshset, seq ); if( MB_SUCCESS != rval ) return MB_ENTITY_NOT_FOUND; const MeshSetSequence* mseq = reinterpret_cast< const MeshSetSequence* >( seq ); return mseq->get_children( sequence_manager(), meshset, children, num_hops ); }
ErrorCode moab::Core::get_child_meshsets | ( | const EntityHandle | meshset, |
Range & | children, | ||
const int | num_hops = 1 |
||
) | const [virtual] |
get child meshsets
Definition at line 3285 of file Core.cpp.
References MB_CHK_ERR, MB_ENTITY_NOT_FOUND, and MB_SUCCESS.
{ if( 0 == meshset ) return MB_ENTITY_NOT_FOUND; std::vector< EntityHandle > child_vec; ErrorCode result = get_child_meshsets( meshset, child_vec, num_hops );MB_CHK_ERR( result ); std::sort( child_vec.begin(), child_vec.end() ); std::copy( child_vec.rbegin(), child_vec.rend(), range_inserter( children ) ); return MB_SUCCESS; }
ErrorCode moab::Core::get_connectivity | ( | const EntityHandle * | entity_handles, |
const int | num_handles, | ||
std::vector< EntityHandle > & | connectivity, | ||
bool | corners_only = false , |
||
std::vector< int > * | offsets = NULL |
||
) | const [virtual] |
Gets the connectivity for an element EntityHandle.
get the connectivity for element /handles. For non-element handles, return an error
For non-element handles (ie, MeshSets), returns an error. Connectivity data is copied from the database into the vector connectivity. The nodes in connectivity are properly ordered.
entity_handle | EntityHandle to get connectivity of. |
connectivity | Vector in which connectivity of entity_handle is returned. Should contain MeshVertices. |
corners_only | If true, returns only corner vertices, otherwise returns all of them (including any higher-order vertices) |
std::vector<EntityHandle> conn; get_connectivity( entity_handle, conn );
Definition at line 1113 of file Core.cpp.
References conn, MB_CHK_ERR, and MB_SUCCESS.
Referenced by moab::HalfFacetRep::add_cells_of_single_component(), moab::HalfFacetRep::another_halfedge(), moab::HiReconstruction::average_vertex_normal(), moab::HiReconstruction::average_vertex_tangent(), moab::HigherOrderFactory::center_node_exist(), check_handle_tag(), check_quad_conn(), moab::HalfFacetRep::collect_and_compare(), compute_area(), moab::HalfFacetRep::determine_border_vertices(), moab::HalfFacetRep::determine_incident_halfedges(), moab::HalfFacetRep::determine_incident_halffaces(), moab::HalfFacetRep::determine_incident_halfverts(), moab::HalfFacetRep::determine_sibling_halfedges(), moab::HalfFacetRep::determine_sibling_halffaces(), moab::HalfFacetRep::determine_sibling_halfverts(), MBMesquite::MsqMOAB::elements_get_attached_vertices(), moab::AEntityFactory::entities_equivalent(), moab::NestedRefine::exchange_ghosts(), moab::HalfFacetRep::find_matching_halfedge(), moab::HalfFacetRep::find_matching_halfface(), moab::HalfFacetRep::find_matching_implicit_edge_in_cell(), forward_order_query_element_verts(), forward_order_query_elements(), moab::WriteUtil::gather_nodes_from_elements(), gather_set_stats(), moab::AEntityFactory::get_adjacencies(), moab::get_adjacencies_intersection(), moab::get_adjacencies_union(), moab::NestedRefine::get_connectivity(), moab::HalfFacetRep::get_down_adjacencies_2d(), moab::HalfFacetRep::get_down_adjacencies_edg_3d(), moab::HalfFacetRep::get_down_adjacencies_face_3d(), moab::AEntityFactory::get_down_adjacency_elements(), moab::AEntityFactory::get_down_adjacency_elements_poly(), moab::HalfFacetRep::get_face_edges(), moab::HalfFacetRep::get_half_facet_in_comp(), moab::ReadUtil::get_ordered_vertices(), moab::AEntityFactory::get_polyhedron_vertices(), moab::HalfFacetRep::get_up_adjacencies_2d(), moab::HalfFacetRep::get_up_adjacencies_edg_3d(), moab::HalfFacetRep::get_up_adjacencies_edg_3d_comp(), moab::HalfFacetRep::get_up_adjacencies_vert_3d(), moab::AEntityFactory::get_up_adjacency_elements(), moab::AEntityFactory::get_vertices(), hcFilter(), moab::HiReconstruction::hiproj_walf_in_element(), laplacianFilter(), main(), moab::HalfFacetRep::mark_halfedges(), moab::AEntityFactory::merge_adjust_adjacencies(), moab::HiReconstruction::obtain_nring_ngbvs(), perform_laplacian_smoothing(), random_order_query_element_verts(), random_order_query_elements(), moab::ParCommGraph::receive_mesh(), moab::ReorderTool::reorder_entities(), reverse_order_query_element_verts(), reverse_order_query_elements(), moab::HigherOrderFactory::tag_for_deletion(), test_pack_elements(), test_pack_higher_order(), test_pack_poly(), test_spectral_quad(), moab::NestedRefine::update_global_ahf_3D(), and moab::NestedRefine::update_special_tags().
{ connectivity.clear(); // this seems wrong as compared to other API functions, // but changing it breaks lost of code, so I'm leaving // it in. - j.kraftcheck 2009-11-06 ErrorCode rval; std::vector< EntityHandle > tmp_storage; // used only for structured mesh const EntityHandle* conn; int len; if( offsets ) offsets->push_back( 0 ); for( int i = 0; i < num_handles; ++i ) { rval = get_connectivity( entity_handles[i], conn, len, corners_only, &tmp_storage );MB_CHK_ERR( rval ); connectivity.insert( connectivity.end(), conn, conn + len ); if( offsets ) offsets->push_back( connectivity.size() ); } return MB_SUCCESS; }
ErrorCode moab::Core::get_connectivity | ( | const EntityHandle * | entity_handles, |
const int | num_handles, | ||
Range & | connectivity, | ||
bool | corners_only = false |
||
) | const [virtual] |
Gets the connectivity for a vector of elements.
get the connectivity for element /handles. For non-element handles, return an error
Same as vector-based version except range is returned (unordered!)
Definition at line 1101 of file Core.cpp.
References MB_CHK_ERR.
{ std::vector< EntityHandle > tmp_connect; ErrorCode result = get_connectivity( entity_handles, num_handles, tmp_connect, corners_only );MB_CHK_ERR( result ); std::sort( tmp_connect.begin(), tmp_connect.end() ); std::copy( tmp_connect.rbegin(), tmp_connect.rend(), range_inserter( connectivity ) ); return result; }
ErrorCode moab::Core::get_connectivity | ( | const Range & | entity_handles, |
Range & | connectivity, | ||
bool | corners_only = false |
||
) | const [virtual] |
Gets the connectivity for elements.
Same as vector-based version except range is returned (unordered!)
Definition at line 1552 of file Core.cpp.
References moab::Range::begin(), conn, moab::Range::end(), moab::GeomUtil::first(), moab::Range::insert(), MB_SUCCESS, MBVERTEX, moab::Range::merge(), moab::Range::size(), and moab::TYPE_FROM_HANDLE().
{ const size_t DEFAULT_MAX_BLOCKS_SIZE = 4000; const size_t MAX_OUTER_ITERATIONS = 100; std::vector< EntityHandle > temp_vec, storage; std::vector< EntityHandle >::const_iterator ti; ErrorCode result = MB_SUCCESS, tmp_result; Range::const_iterator i = from_entities.begin(); Range::iterator ins; const EntityHandle* conn; int conn_len; // Just copy any vertices from the input range into the output size_t remaining = from_entities.size(); for( ; i != from_entities.end() && TYPE_FROM_HANDLE( *i ) == MBVERTEX; ++i ) --remaining; adj_entities.merge( from_entities.begin(), i ); // How many entities to work with at once? 2000 or so shouldn't require // too much memory, but don't iterate in outer loop more than a // 1000 times (make it bigger if many input entiites.) const size_t block_size = std::max( DEFAULT_MAX_BLOCKS_SIZE, remaining / MAX_OUTER_ITERATIONS ); while( remaining > 0 ) { const size_t count = remaining > block_size ? block_size : remaining; remaining -= count; temp_vec.clear(); for( size_t j = 0; j < count; ++i, ++j ) { tmp_result = get_connectivity( *i, conn, conn_len, corners_only, &storage ); if( MB_SUCCESS != tmp_result ) { result = tmp_result; continue; } const size_t oldsize = temp_vec.size(); temp_vec.resize( oldsize + conn_len ); memcpy( &temp_vec[oldsize], conn, sizeof( EntityHandle ) * conn_len ); } std::sort( temp_vec.begin(), temp_vec.end() ); ins = adj_entities.begin(); ti = temp_vec.begin(); while( ti != temp_vec.end() ) { EntityHandle first = *ti; EntityHandle second = *ti; for( ++ti; ti != temp_vec.end() && ( *ti - second <= 1 ); ++ti ) second = *ti; ins = adj_entities.insert( ins, first, second ); } } return result; }
ErrorCode moab::Core::get_connectivity | ( | const EntityHandle | entity_handle, |
const EntityHandle *& | connectivity, | ||
int & | num_nodes, | ||
bool | corners_only = false , |
||
std::vector< EntityHandle > * | storage = 0 |
||
) | const [virtual] |
Gets a pointer to constant connectivity data of entity_handle
get the connectivity for element handles. For non-element handles, return an error
Sets number_nodes equal to the number of nodes of the entity_handle . Faster then the other get_connectivity function. The nodes in 'connectivity' are properly ordered.
entity_handle | EntityHandle to get connectivity of. |
connectivity | Array in which connectivity of entity_handle is returned. Should contain MBVERTEX's. |
num_nodes | Number of MeshVertices in array connectivity. |
const EntityHandle* conn; int number_nodes = 0; get_connectivity( entity_handle, conn, number_nodes );
Example2:
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;
Definition at line 1136 of file Core.cpp.
References MB_ENTITY_NOT_FOUND, MB_FAILURE, MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MBENTITYSET, MBVERTEX, and moab::TYPE_FROM_HANDLE().
{ ErrorCode status; // Make sure the entity should have a connectivity. EntityType entity_type = TYPE_FROM_HANDLE( entity_handle ); // WARNING: This is very dependent on the ordering of the EntityType enum if( entity_type < MBVERTEX || entity_type >= MBENTITYSET ) return MB_TYPE_OUT_OF_RANGE; else if( entity_type == MBVERTEX ) { return MB_FAILURE; } const EntitySequence* seq = 0; // We know that connectivity is stored in an EntitySequence so jump straight // to the entity sequence status = sequence_manager()->find( entity_handle, seq ); if( seq == 0 || status != MB_SUCCESS ) return MB_ENTITY_NOT_FOUND; return static_cast< const ElementSequence* >( seq )->get_connectivity( entity_handle, connectivity, number_nodes, corners_only, storage ); }
ErrorCode moab::Core::get_connectivity_by_type | ( | const EntityType | entity_type, |
std::vector< EntityHandle > & | connect | ||
) | const [virtual] |
get global connectivity array for specified entity type
Assumes just vertices, no higher order nodes
Definition at line 1078 of file Core.cpp.
References moab::Range::begin(), moab::Range::end(), MB_CHK_ERR, MB_SUCCESS, moab::Range::size(), and moab::CN::VerticesPerEntity().
{ // inefficient implementation until we get blocked tag access // get the range of entities of this type Range this_range; ErrorCode result = get_entities_by_type( 0, entity_type, this_range ); int num_ents = this_range.size(); connect.reserve( num_ents * CN::VerticesPerEntity( entity_type ) ); // now loop over these entities, getting connectivity for each for( Range::iterator this_it = this_range.begin(); this_it != this_range.end(); ++this_it ) { const EntityHandle* connect_vec = NULL; result = get_connectivity( *this_it, connect_vec, num_ents, true );MB_CHK_ERR( result ); connect.insert( connect.end(), &connect_vec[0], &connect_vec[num_ents] ); } return MB_SUCCESS; }
ErrorCode moab::Core::get_contained_meshsets | ( | const EntityHandle | meshset, |
std::vector< EntityHandle > & | contained, | ||
const int | num_hops = 1 |
||
) | const [virtual] |
get contained meshsets
Definition at line 3296 of file Core.cpp.
References moab::MeshSetSequence::get_contained_sets(), MB_ENTITY_NOT_FOUND, MB_SUCCESS, and MBENTITYSET.
{ if( 0 == meshset ) { return get_entities_by_type( meshset, MBENTITYSET, children ); } const EntitySequence* seq; ErrorCode rval = sequence_manager()->find( meshset, seq ); if( MB_SUCCESS != rval ) return MB_ENTITY_NOT_FOUND; const MeshSetSequence* mseq = reinterpret_cast< const MeshSetSequence* >( seq ); return mseq->get_contained_sets( sequence_manager(), meshset, children, num_hops ); }
ErrorCode moab::Core::get_contained_meshsets | ( | const EntityHandle | meshset, |
Range & | contained, | ||
const int | num_hops = 1 |
||
) | const [virtual] |
get contained meshsets
Definition at line 3309 of file Core.cpp.
References MB_CHK_ERR, MB_SUCCESS, and MBENTITYSET.
{ if( 0 == meshset ) { return get_entities_by_type( meshset, MBENTITYSET, children ); } std::vector< EntityHandle > child_vec; ErrorCode result = get_contained_meshsets( meshset, child_vec, num_hops );MB_CHK_ERR( result ); std::sort( child_vec.begin(), child_vec.end() ); std::copy( child_vec.rbegin(), child_vec.rend(), range_inserter( children ) ); return MB_SUCCESS; }
ErrorCode moab::Core::get_coords | ( | const Range & | entity_handles, |
double * | coords | ||
) | const [virtual] |
get the coordinate information for this handle if it is of type Vertex otherwise, return an error
Definition at line 819 of file Core.cpp.
References moab::Range::const_pair_begin(), moab::Range::const_pair_end(), moab::TypeSequenceManager::end(), moab::Range::end(), moab::EntitySequence::end_handle(), moab::GeomUtil::first(), moab::VertexSequence::get_coordinate_arrays(), get_coords(), moab::TypeSequenceManager::lower_bound(), MB_CHK_ERR, MB_ENTITY_NOT_FOUND, MB_SUCCESS, MBVERTEX, moab::EntitySequence::start_handle(), moab::TYPE_FROM_HANDLE(), and z.
Referenced by moab::HiReconstruction::average_vertex_normal(), moab::HiReconstruction::average_vertex_tangent(), check_node_coords(), compute_area(), moab::NestedRefine::copy_vertices_from_prev_level(), forward_order_query_element_verts(), forward_order_query_vertices(), gather_set_stats(), moab::NestedRefine::get_coordinates(), moab::WriteUtil::get_node_coords(), moab::HiReconstruction::hiproj_walf_around_vertex(), moab::HiReconstruction::hiproj_walf_in_element(), main(), perform_laplacian_smoothing(), moab::HiReconstruction::polyfit3d_walf_curve_vertex(), moab::HiReconstruction::polyfit3d_walf_surf_vertex(), random_order_query_element_verts(), random_order_query_vertices(), moab::ReorderTool::reorder_entities(), reverse_order_query_element_verts(), reverse_order_query_vertices(), test_bound_box(), test_pack_elements(), test_pack_higher_order(), test_pack_poly(), test_pack_vertices(), test_spectral_quad(), test_write_dense_tags(), and MBMesquite::MsqMOAB::vertices_get_coordinates().
{ const TypeSequenceManager& vert_data = sequence_manager()->entity_map( MBVERTEX ); TypeSequenceManager::const_iterator seq_iter; Range::const_pair_iterator i = entities.const_pair_begin(); EntityHandle first = i->first; while( i != entities.const_pair_end() && TYPE_FROM_HANDLE( i->first ) == MBVERTEX ) { seq_iter = vert_data.lower_bound( first ); if( seq_iter == vert_data.end() || first < ( *seq_iter )->start_handle() ) return MB_ENTITY_NOT_FOUND; const VertexSequence* vseq = reinterpret_cast< const VertexSequence* >( *seq_iter ); EntityID offset = first - vseq->start_handle(); EntityID count; if( i->second <= vseq->end_handle() ) { count = i->second - first + 1; ++i; if( i != entities.const_pair_end() ) first = i->first; } else { count = vseq->end_handle() - first + 1; first = vseq->end_handle() + 1; } double const *x, *y, *z; ErrorCode rval = vseq->get_coordinate_arrays( x, y, z );MB_CHK_ERR( rval ); x += offset; y += offset; z += offset; for( EntityID j = 0; j < count; ++j ) { coords[3 * j] = x[j]; coords[3 * j + 1] = y[j]; coords[3 * j + 2] = z[j]; } coords = &coords[3 * count]; } // for non-vertices... ErrorCode rval = MB_SUCCESS; for( Range::const_iterator rit( &( *i ), i->first ); rit != entities.end(); ++rit ) { rval = get_coords( &( *rit ), 1, coords );MB_CHK_ERR( rval ); coords += 3; } return rval; }
ErrorCode moab::Core::get_coords | ( | const EntityHandle * | entity_handles, |
const int | num_entities, | ||
double * | coords | ||
) | const [virtual] |
Definition at line 934 of file Core.cpp.
References conn, moab::EntitySequence::end_handle(), entities, moab::VertexSequence::get_coordinates(), get_coords(), moab::CN::MAX_NODES_PER_ELEMENT, MB_CHK_ERR, MB_ENTITY_NOT_FOUND, MB_SUCCESS, MBVERTEX, moab::EntitySequence::start_handle(), and moab::TYPE_FROM_HANDLE().
{ const EntitySequence* seq = NULL; const VertexSequence* vseq = NULL; const EntityHandle* const end = entities + num_entities; const EntityHandle* iter = entities; ErrorCode status = MB_SUCCESS; while( iter != end ) { if( TYPE_FROM_HANDLE( *iter ) == MBVERTEX ) { if( !seq ) { seq = sequence_manager()->get_last_accessed_sequence( MBVERTEX ); vseq = static_cast< const VertexSequence* >( seq ); } if( !vseq ) return MB_ENTITY_NOT_FOUND; else if( vseq->start_handle() > *iter || vseq->end_handle() < *iter ) { if( MB_SUCCESS != sequence_manager()->find( *iter, seq ) ) return MB_ENTITY_NOT_FOUND; vseq = static_cast< const VertexSequence* >( seq ); } vseq->get_coordinates( *iter, coords ); } else { static std::vector< EntityHandle > dum_conn( CN::MAX_NODES_PER_ELEMENT ); static std::vector< double > dum_pos( 3 * CN::MAX_NODES_PER_ELEMENT ); static const EntityHandle* conn; static int num_conn; status = get_connectivity( *iter, conn, num_conn, false, &dum_conn );MB_CHK_ERR( status ); status = get_coords( conn, num_conn, &dum_pos[0] );MB_CHK_ERR( status ); coords[0] = coords[1] = coords[2] = 0.0; for( int i = 0; i < num_conn; i++ ) { coords[0] += dum_pos[3 * i]; coords[1] += dum_pos[3 * i + 1]; coords[2] += dum_pos[3 * i + 2]; } coords[0] /= num_conn; coords[1] /= num_conn; coords[2] /= num_conn; } coords += 3; ++iter; } return status; }
ErrorCode moab::Core::get_coords | ( | const EntityHandle | entity_handle, |
const double *& | x, | ||
const double *& | y, | ||
const double *& | z | ||
) | const [virtual] |
Definition at line 986 of file Core.cpp.
References MB_ENTITY_NOT_FOUND, MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MBVERTEX, and moab::TYPE_FROM_HANDLE().
{ ErrorCode status = MB_TYPE_OUT_OF_RANGE; if( TYPE_FROM_HANDLE( entity_handle ) == MBVERTEX ) { const EntitySequence* seq = 0; status = sequence_manager()->find( entity_handle, seq ); if( seq == 0 || status != MB_SUCCESS ) return MB_ENTITY_NOT_FOUND; status = static_cast< const VertexSequence* >( seq )->get_coordinates_ref( entity_handle, x, y, z ); } return status; }
ErrorCode moab::Core::get_coords | ( | const Range & | entities, |
double * | x_coords, | ||
double * | y_coords, | ||
double * | z_coords | ||
) | const [virtual] |
Definition at line 873 of file Core.cpp.
References moab::Range::const_pair_begin(), moab::Range::const_pair_end(), moab::TypeSequenceManager::end(), moab::Range::end(), moab::EntitySequence::end_handle(), moab::GeomUtil::first(), moab::VertexSequence::get_coordinate_arrays(), get_coords(), moab::TypeSequenceManager::lower_bound(), MB_CHK_ERR, MB_ENTITY_NOT_FOUND, MB_SUCCESS, MBVERTEX, moab::EntitySequence::start_handle(), moab::TYPE_FROM_HANDLE(), and z.
{ const TypeSequenceManager& vert_data = sequence_manager()->entity_map( MBVERTEX ); TypeSequenceManager::const_iterator seq_iter; Range::const_pair_iterator i = entities.const_pair_begin(); EntityHandle first = i->first; while( i != entities.const_pair_end() && TYPE_FROM_HANDLE( i->first ) == MBVERTEX ) { seq_iter = vert_data.lower_bound( first ); if( seq_iter == vert_data.end() || first < ( *seq_iter )->start_handle() ) return MB_ENTITY_NOT_FOUND; const VertexSequence* vseq = reinterpret_cast< const VertexSequence* >( *seq_iter ); EntityID offset = first - vseq->start_handle(); EntityID count; if( i->second <= vseq->end_handle() ) { count = i->second - first + 1; ++i; if( i != entities.const_pair_end() ) first = i->first; } else { count = vseq->end_handle() - first + 1; first = vseq->end_handle() + 1; } double const *x, *y, *z; ErrorCode rval = vseq->get_coordinate_arrays( x, y, z );MB_CHK_ERR( rval ); if( x_coords ) { memcpy( x_coords, x + offset, count * sizeof( double ) ); x_coords += count; } if( y_coords ) { memcpy( y_coords, y + offset, count * sizeof( double ) ); y_coords += count; } if( z_coords ) { memcpy( z_coords, z + offset, count * sizeof( double ) ); z_coords += count; } } // for non-vertices... ErrorCode rval = MB_SUCCESS; double xyz[3]; for( Range::const_iterator rit( &( *i ), i->first ); rit != entities.end(); ++rit ) { rval = get_coords( &( *rit ), 1, xyz );MB_CHK_ERR( rval ); *x_coords++ = xyz[0]; *y_coords++ = xyz[1]; *z_coords++ = xyz[2]; } return rval; }
ErrorCode moab::Core::get_dimension | ( | int & | dim | ) | const [virtual] |
get overall geometric dimension
Definition at line 734 of file Core.cpp.
References MB_SUCCESS.
Referenced by MBMesquite::MsqMOAB::init_active_mesh().
{ dim = geometricDimension; return MB_SUCCESS; }
ErrorCode moab::Core::get_entities_by_dimension | ( | const EntityHandle | meshset, |
const int | dimension, | ||
Range & | entities, | ||
const bool | recursive = false |
||
) | const [virtual] |
Adds adjacencies.
from_handle | entities |
both_ways | add the adjacency information to both the to_handle and and the from_from :handle |
*/ virtual ErrorCode add_adjacencies( const EntityHandle from_handle, const EntityHandle* to_handles, const int num_handles, bool both_ways ); //! Adds adjacencies; same as vector-based, but with range instead virtual ErrorCode add_adjacencies( const EntityHandle from_handle, Range& adjacencies, bool both_ways ); //! Removes adjacencies /** \param handle EntityHandle to get adjacencies of. Example: \code */ virtual ErrorCode remove_adjacencies( const EntityHandle from_handle, const EntityHandle* to_handles, 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
Definition at line 1747 of file Core.cpp.
References moab::GeomUtil::first(), moab::MeshSetSequence::get_dimension(), MB_CHK_ERR, MB_SUCCESS, MBENTITYSET, and moab::CN::TypeDimensionMap.
Referenced by moab::HalfFacetRep::check_mixed_entity_type(), check_order_by_sets_and_adj(), check_set_contents(), moab::NestedRefine::count_subentities(), moab::NestedRefine::exchange_ghosts(), MBMesquite::MsqMOAB::get_all_elements(), moab::HiReconstruction::initialize(), moab::HalfFacetRep::initialize(), moab::ReorderTool::int_order_from_sets_and_adj(), main(), print_output(), test_normal_linear_hex(), test_normal_linear_quad(), test_normal_linear_tet(), test_normal_linear_tri(), test_spectral_hex(), test_write_dense_tags(), and moab::HalfFacetRep::update_entity_ranges().
{ ErrorCode result = MB_SUCCESS; if( meshset ) { const EntitySequence* seq; result = sequence_manager()->find( meshset, seq );MB_CHK_ERR( result ); const MeshSetSequence* mseq = reinterpret_cast< const MeshSetSequence* >( seq ); result = mseq->get_dimension( sequence_manager(), meshset, dimension, entities, recursive );MB_CHK_ERR( result ); } else if( dimension > 3 ) { sequence_manager()->get_entities( MBENTITYSET, entities ); } else { for( EntityType this_type = CN::TypeDimensionMap[dimension].first; this_type <= CN::TypeDimensionMap[dimension].second; this_type++ ) { sequence_manager()->get_entities( this_type, entities ); } } return MB_SUCCESS; }
ErrorCode moab::Core::get_entities_by_dimension | ( | const EntityHandle | meshset, |
const int | dimension, | ||
std::vector< EntityHandle > & | entities, | ||
const bool | recursive = false |
||
) | const [virtual] |
Definition at line 1774 of file Core.cpp.
References moab::GeomUtil::first(), moab::MeshSetSequence::get_dimension(), MB_CHK_ERR, MB_SUCCESS, MBENTITYSET, and moab::CN::TypeDimensionMap.
{ ErrorCode result = MB_SUCCESS; if( meshset ) { const EntitySequence* seq; result = sequence_manager()->find( meshset, seq );MB_CHK_ERR( result ); const MeshSetSequence* mseq = reinterpret_cast< const MeshSetSequence* >( seq ); result = mseq->get_dimension( sequence_manager(), meshset, dimension, entities, recursive );MB_CHK_ERR( result ); } else if( dimension > 3 ) { sequence_manager()->get_entities( MBENTITYSET, entities ); } else { for( EntityType this_type = CN::TypeDimensionMap[dimension].first; this_type <= CN::TypeDimensionMap[dimension].second; this_type++ ) { sequence_manager()->get_entities( this_type, entities ); } } return MB_SUCCESS; }
ErrorCode moab::Core::get_entities_by_handle | ( | const EntityHandle | meshset, |
Range & | entities, | ||
const bool | recursive = false |
||
) | const [virtual] |
Retrieves all entities in the data base.
entities | Range in which entities of EntityType type are returned. |
Range entities; get_entities( entities ); //get MBTET type EntityHandles in the database
Definition at line 1892 of file Core.cpp.
References moab::MeshSetSequence::get_entities(), MB_CHK_ERR, MB_SUCCESS, MBENTITYSET, and MBVERTEX.
Referenced by moab::RangeSetIterator::build_pair_vec(), check_big_meshset(), check_handle_tag(), check_meshset_common(), check_set_contents(), moab::HigherOrderFactory::convert(), moab::WriteUtil::gather_entities(), moab::ReadUtil::gather_related_ents(), get_max_volume(), main(), pack_unpack_noremoteh(), report_sets(), test_pack_sets_simple(), test_read_fgh(), test_read_side(), moab::ReorderTool::update_set_contents(), and moab::NestedRefine::update_special_tags().
{ ErrorCode result = MB_SUCCESS; if( meshset ) { const EntitySequence* seq; result = sequence_manager()->find( meshset, seq );MB_CHK_ERR( result ); const MeshSetSequence* mseq = reinterpret_cast< const MeshSetSequence* >( seq ); result = mseq->get_entities( sequence_manager(), meshset, entities, recursive );MB_CHK_ERR( result ); } else { // iterate backwards so range insertion is quicker for( EntityType entity_type = MBENTITYSET; entity_type >= MBVERTEX; --entity_type ) sequence_manager()->get_entities( entity_type, entities ); } return MB_SUCCESS; }
ErrorCode moab::Core::get_entities_by_handle | ( | const EntityHandle | meshset, |
std::vector< EntityHandle > & | entities, | ||
const bool | recursive = false |
||
) | const [virtual] |
Retrieves all entities in the data base.
entities | Range in which entities of EntityType type are returned. |
Range entities; get_entities( entities ); //get MBTET type EntityHandles in the database
Definition at line 1912 of file Core.cpp.
References moab::Range::begin(), moab::Range::end(), moab::MeshSetSequence::get_entities(), MB_CHK_ERR, MB_SUCCESS, and moab::Range::size().
{ ErrorCode result; if( recursive || !meshset ) { Range tmp_range; result = get_entities_by_handle( meshset, tmp_range, recursive ); size_t offset = entities.size(); entities.resize( offset + tmp_range.size() ); std::copy( tmp_range.begin(), tmp_range.end(), entities.begin() + offset ); } else { const EntitySequence* seq; result = sequence_manager()->find( meshset, seq );MB_CHK_ERR( result ); const MeshSetSequence* mseq = reinterpret_cast< const MeshSetSequence* >( seq ); result = mseq->get_entities( meshset, entities );MB_CHK_ERR( result ); } return MB_SUCCESS; }
ErrorCode moab::Core::get_entities_by_type | ( | const EntityHandle | meshset, |
const EntityType | type, | ||
Range & | entities, | ||
const bool | recursive = false |
||
) | const [virtual] |
Retrieves all entities in the data base of given type.
type | EntityType of entities desired (ie, MBHEX, MBEDGE, MBTRI, etc ) |
entities | Range in which entities of EntityType type are returned. |
EntityType type = MBTET; Range entities; get_entities_by_dimension( type, entities ); //get MBTET type EntityHandles in the database
Definition at line 1801 of file Core.cpp.
References moab::MeshSetSequence::get_type(), MB_CHK_ERR, and MB_SUCCESS.
Referenced by check_big_meshset(), check_bit_tag(), check_handle_tag(), check_node_coords(), check_order(), check_order_by_sets_and_adj(), check_quad_conn(), check_set_contents(), check_varlen_tag(), moab::AEntityFactory::create_vert_elem_adjacencies(), dot_contained(), dot_nodes(), moab::ReadUtil::gather_related_ents(), gather_set_stats(), MBMesquite::MsqMOAB::get_all_elements(), main(), test_meshset_tags_1(), test_meshset_tags_2(), test_pack_elements(), test_pack_higher_order(), test_pack_poly(), test_pack_set_contents(), test_pack_set_parent_child(), test_pack_sets_of_sets(), test_pack_sets_simple(), test_sets_fileids(), test_spectral_quad(), test_tet_tags_1(), test_tet_tags_2(), test_tets_1(), test_tets_2(), test_triangles_1(), test_triangles_2(), test_triangles_tags_1(), test_triangles_tags_2(), test_vertices_1(), test_vertices_2(), and moab::ReorderTool::update_set_contents().
{ ErrorCode result = MB_SUCCESS; if( meshset ) { const EntitySequence* seq; result = sequence_manager()->find( meshset, seq );MB_CHK_ERR( result ); const MeshSetSequence* mseq = reinterpret_cast< const MeshSetSequence* >( seq ); result = mseq->get_type( sequence_manager(), meshset, entity_type, entities, recursive );MB_CHK_ERR( result ); } else { sequence_manager()->get_entities( entity_type, entities ); } return MB_SUCCESS; }
ErrorCode moab::Core::get_entities_by_type | ( | const EntityHandle | meshset, |
const EntityType | type, | ||
std::vector< EntityHandle > & | entities, | ||
const bool | recursive = false |
||
) | const [virtual] |
Retrieves all entities in the data base of given type.
type | EntityType of entities desired (ie, MBHEX, MBEDGE, MBTRI, etc ) |
entities | Range in which entities of EntityType type are returned. |
EntityType type = MBTET; Range entities; get_entities_by_dimension( type, entities ); //get MBTET type EntityHandles in the database
Definition at line 1820 of file Core.cpp.
References moab::MeshSetSequence::get_type(), MB_CHK_ERR, and MB_SUCCESS.
{ ErrorCode result = MB_SUCCESS; if( meshset ) { const EntitySequence* seq; result = sequence_manager()->find( meshset, seq );MB_CHK_ERR( result ); const MeshSetSequence* mseq = reinterpret_cast< const MeshSetSequence* >( seq ); result = mseq->get_type( sequence_manager(), meshset, entity_type, entities, recursive );MB_CHK_ERR( result ); } else { sequence_manager()->get_entities( entity_type, entities ); } return MB_SUCCESS; }
ErrorCode moab::Core::get_entities_by_type_and_tag | ( | const EntityHandle | meshset, |
const EntityType | type, | ||
const Tag * | tag_handles, | ||
const void *const * | values, | ||
const int | num_tags, | ||
Range & | entities, | ||
const int | condition = Interface::INTERSECT , |
||
const bool | recursive = false |
||
) | const [virtual] |
Definition at line 1839 of file Core.cpp.
References moab::Range::empty(), moab::TagInfo::find_entities_with_value(), moab::TagInfo::get_tagged_entities(), INTERSECT, moab::intersect(), MB_CHK_ERR, MB_SUCCESS, MB_TAG_NOT_FOUND, moab::Range::merge(), moab::subtract(), and moab::Range::swap().
Referenced by check_handle_tag(), check_meshset_common(), moab::HigherOrderFactory::convert_sequence(), dot_get_sets(), moab::ReadUtil::get_gather_set(), moab::ReadParallel::load_file(), main(), regression_one_entity_by_var_tag(), moab::ReorderTool::reorder_tag_data(), report_sets(), test_meshset_tags_1(), test_meshset_tags_2(), test_read_fgh(), test_spectral_hex(), test_tet_tags_1(), test_tet_tags_2(), test_tree_delete(), test_triangles_tags_1(), test_triangles_tags_2(), and moab::NestedRefine::update_special_tags().
{ ErrorCode result; Range range; result = get_entities_by_type( meshset, entity_type, range, recursive );MB_CHK_ERR( result ); if( !entities.empty() && Interface::INTERSECT == condition ) range = intersect( entities, range ); // For each tag: // if operation is INTERSECT remove from 'range' any non-tagged entities // if operation is UNION add to 'entities' any tagged entities for( int it = 0; it < num_tags && !range.empty(); it++ ) { if( !valid_tag_handle( tags[it] ) ) return MB_TAG_NOT_FOUND; // Of the entities in 'range', put in 'tmp_range' the subset // that are tagged as requested for this tag. Range tmp_range; // get the entities with this tag/value combo if( NULL == values || NULL == values[it] ) { result = tags[it]->get_tagged_entities( sequenceManager, tmp_range, entity_type, &range );MB_CHK_ERR( result ); } else { result = tags[it]->find_entities_with_value( sequenceManager, mError, tmp_range, values[it], 0, entity_type, &range );MB_CHK_ERR( result ); // if there is a default value, then we should return all entities // that are untagged if( tags[it]->equals_default_value( values[it] ) ) { Range all_tagged, untagged; result = tags[it]->get_tagged_entities( sequenceManager, all_tagged, entity_type, &range );MB_CHK_ERR( result ); // add to 'tmp_range' any untagged entities in 'range' tmp_range.merge( subtract( range, all_tagged ) ); } } // The above calls should have already done the intersect for us. if( Interface::INTERSECT == condition ) range.swap( tmp_range ); else entities.merge( tmp_range ); } if( Interface::INTERSECT == condition ) entities.swap( range ); return MB_SUCCESS; }
std::string moab::Core::get_error_string | ( | const ErrorCode | code | ) | const [virtual] |
Definition at line 3446 of file Core.cpp.
References MB_FAILURE.
Referenced by _run_test(), and main().
{ return (unsigned)code <= (unsigned)MB_FAILURE ? ErrorCodeStr[code] : "INVALID ERROR CODE"; }
ErrorCode moab::Core::get_last_error | ( | std::string & | info | ) | const [virtual] |
Definition at line 3440 of file Core.cpp.
References MB_SUCCESS, and moab::MBErrorHandler_GetLastError().
Referenced by create_parallel_mesh(), and main().
{ MBErrorHandler_GetLastError( info ); return MB_SUCCESS; }
ErrorCode moab::Core::get_meshset_options | ( | const EntityHandle | ms_handle, |
unsigned int & | options | ||
) | const [virtual] |
get the options of a mesh set
Definition at line 3107 of file Core.cpp.
References moab::get_mesh_set(), MB_ENTITY_NOT_FOUND, MB_SUCCESS, MESHSET_SET, and MESHSET_TRACK_OWNER.
Referenced by check_handle_tag(), check_meshset_common(), check_set_contents(), test_pack_sets_simple(), and moab::ReorderTool::update_set_contents().
{ if( !ms_handle ) { // root set setoptions = MESHSET_SET | MESHSET_TRACK_OWNER; return MB_SUCCESS; } const MeshSet* set = get_mesh_set( sequence_manager(), ms_handle ); if( !set ) return MB_ENTITY_NOT_FOUND; setoptions = set->flags(); return MB_SUCCESS; }
ErrorCode moab::Core::get_number_entities_by_dimension | ( | const EntityHandle | meshset, |
const int | dimension, | ||
int & | num_entities, | ||
const bool | recursive = false |
||
) | const [virtual] |
Retrieves all entities in the database of given dimension.
get # entities of a given dimension
dimension | Dimension of entities desired. |
entities | Range in which entities of dimension dimension are returned. |
int dimension = 2; Range entities; get_entities_by_dimension( dimension, entities ); //get 2D EntityHandles in the database
Definition at line 1935 of file Core.cpp.
References dim, moab::GeomUtil::first(), MB_CHK_ERR, MB_SUCCESS, moab::MeshSetSequence::num_dimension(), and moab::CN::TypeDimensionMap.
Referenced by check_set_contents(), MBMesquite::MsqMOAB::get_all_elements(), and test_existinterface().
{ ErrorCode result = MB_SUCCESS; if( !meshset ) { number = 0; for( EntityType this_type = CN::TypeDimensionMap[dim].first; this_type <= CN::TypeDimensionMap[dim].second; this_type++ ) { number += sequence_manager()->get_number_entities( this_type ); } } else { const EntitySequence* seq; result = sequence_manager()->find( meshset, seq );MB_CHK_ERR( result ); const MeshSetSequence* mseq = reinterpret_cast< const MeshSetSequence* >( seq ); result = mseq->num_dimension( sequence_manager(), meshset, dim, number, recursive );MB_CHK_ERR( result ); } return MB_SUCCESS; }
ErrorCode moab::Core::get_number_entities_by_handle | ( | const EntityHandle | meshset, |
int & | num_entities, | ||
const bool | recursive = false |
||
) | const [virtual] |
Retrieves all entities in the data base.
entities | Range in which entities of EntityType type are returned. |
Range entities; get_entities( entities ); //get MBTET type EntityHandles in the database
Definition at line 1996 of file Core.cpp.
References MB_CHK_ERR, MB_SUCCESS, MBMAXTYPE, MBVERTEX, and moab::MeshSetSequence::num_entities().
Referenced by check_set_contents().
{ ErrorCode result; if( meshset ) { const EntitySequence* seq; result = sequence_manager()->find( meshset, seq );MB_CHK_ERR( result ); const MeshSetSequence* mseq = reinterpret_cast< const MeshSetSequence* >( seq ); return mseq->num_entities( sequence_manager(), meshset, num_ent, recursive ); } num_ent = 0; for( EntityType this_type = MBVERTEX; this_type < MBMAXTYPE; this_type++ ) { int dummy = 0; result = get_number_entities_by_type( 0, this_type, dummy ); if( result != MB_SUCCESS ) { num_ent = 0; return result; } num_ent += dummy; } return MB_SUCCESS; }
ErrorCode moab::Core::get_number_entities_by_type | ( | const EntityHandle | meshset, |
const EntityType | type, | ||
int & | num_entities, | ||
const bool | recursive = false |
||
) | const [virtual] |
Retrieves all entities in the data base of given type.
returns the number of entities with a given type and tag
type | EntityType of entities desired (ie, MBHEX, MBEDGE, MBTRI, etc ) |
entities | Range in which entities of EntityType type are returned. |
EntityType type = MBTET; Range entities; get_entities_by_dimension( type, entities ); //get MBTET type EntityHandles in the database
Definition at line 1961 of file Core.cpp.
References MB_CHK_ERR, MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MBENTITYSET, and moab::MeshSetSequence::num_type().
Referenced by check_set_contents(), do_test(), gather_set_stats(), MBMesquite::MsqMOAB::get_all_elements(), test_file_set(), test_pack_sets_of_sets(), and test_pack_sets_simple().
{ ErrorCode result = MB_SUCCESS; if( recursive && entity_type == MBENTITYSET ) // will never return anything return MB_TYPE_OUT_OF_RANGE; if( meshset ) { const EntitySequence* seq; result = sequence_manager()->find( meshset, seq );MB_CHK_ERR( result ); const MeshSetSequence* mseq = reinterpret_cast< const MeshSetSequence* >( seq ); result = mseq->num_type( sequence_manager(), meshset, entity_type, num_ent, recursive );MB_CHK_ERR( result ); } else { num_ent = sequence_manager()->get_number_entities( entity_type ); } return MB_SUCCESS; }
ErrorCode moab::Core::get_number_entities_by_type_and_tag | ( | const EntityHandle | meshset, |
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 [virtual] |
Definition at line 1984 of file Core.cpp.
References moab::Range::size().
Referenced by gather_tag_counts().
{ Range dum_ents; ErrorCode result = get_entities_by_type_and_tag( meshset, entity_type, tag_handles, values, num_tags, dum_ents, condition, recursive ); num_entities = dum_ents.size(); return result; }
ErrorCode moab::Core::get_parent_meshsets | ( | const EntityHandle | meshset, |
std::vector< EntityHandle > & | parents, | ||
const int | num_hops = 1 |
||
) | const [virtual] |
get parent meshsets
Definition at line 3248 of file Core.cpp.
References moab::MeshSetSequence::get_parents(), MB_ENTITY_NOT_FOUND, and MB_SUCCESS.
Referenced by dot_children(), moab::ReadUtil::gather_related_ents(), and test_pack_set_parent_child().
{ if( 0 == meshset ) return MB_ENTITY_NOT_FOUND; const EntitySequence* seq; ErrorCode rval = sequence_manager()->find( meshset, seq ); if( MB_SUCCESS != rval ) return MB_ENTITY_NOT_FOUND; const MeshSetSequence* mseq = reinterpret_cast< const MeshSetSequence* >( seq ); return mseq->get_parents( sequence_manager(), meshset, parents, num_hops ); }
ErrorCode moab::Core::get_parent_meshsets | ( | const EntityHandle | meshset, |
Range & | parents, | ||
const int | num_hops = 1 |
||
) | const [virtual] |
get parent meshsets
Definition at line 3261 of file Core.cpp.
References MB_CHK_ERR, MB_ENTITY_NOT_FOUND, and MB_SUCCESS.
{ if( 0 == meshset ) return MB_ENTITY_NOT_FOUND; std::vector< EntityHandle > parent_vec; ErrorCode result = get_parent_meshsets( meshset, parent_vec, num_hops );MB_CHK_ERR( result ); std::sort( parent_vec.begin(), parent_vec.end() ); std::copy( parent_vec.rbegin(), parent_vec.rend(), range_inserter( parents ) ); return MB_SUCCESS; }
EntityHandle moab::Core::get_root_set | ( | ) | [private] |
return the entity set representing the whole mesh
Definition at line 256 of file Core.cpp.
Referenced by mb_root_set_test().
{
return 0;
}
double moab::Core::get_sequence_multiplier | ( | ) | const [virtual] |
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.
Definition at line 1064 of file Core.cpp.
{ return sequenceManager->get_sequence_multiplier(); }
ErrorCode moab::Core::get_set_iterators | ( | EntityHandle | meshset, |
std::vector< SetIterator * > & | set_iters | ||
) |
Get all set iterators associated with the set passed in.
Definition at line 3737 of file Core.cpp.
References MB_SUCCESS.
{ for( std::vector< SetIterator* >::const_iterator vit = setIterators.begin(); vit != setIterators.end(); ++vit ) if( ( *vit )->ent_set() == meshset ) set_iters.push_back( *vit ); return MB_SUCCESS; }
ErrorCode moab::Core::get_vertex_coordinates | ( | std::vector< double > & | coords | ) | const [virtual] |
get blocked vertex coordinates for all vertices
Blocked = all x, then all y, etc.
Definition at line 768 of file Core.cpp.
References moab::Range::begin(), moab::Range::end(), get_coords(), MB_CHK_ERR, MB_SUCCESS, MBVERTEX, and moab::Range::size().
{ // INEFFICIENT implementation for now, until we get blocked tag access Range vertices; ErrorCode result = get_entities_by_type( 0, MBVERTEX, vertices );MB_CHK_ERR( result ); // the least we can do is resize the vector and only go through the // vertex list once int num_verts = vertices.size(); int vec_pos = 0; double xyz[3]; coords.resize( geometricDimension * num_verts ); for( Range::iterator it = vertices.begin(); it != vertices.end(); ++it ) { result = get_coords( &( *it ), 1, xyz );MB_CHK_ERR( result ); coords[vec_pos] = xyz[0]; coords[num_verts + vec_pos] = xyz[1]; coords[2 * num_verts + vec_pos] = xyz[2]; vec_pos++; } return MB_SUCCESS; }
ErrorCode moab::Core::get_vertices | ( | const Range & | from_entities, |
Range & | vertices | ||
) | [virtual] |
Get all vertices for input entities.
Special case of get_adjacencies where to_dimension == 0 and operation_type == Interface::UNION. This is not a variation of get_connectivity because the behavior is different for polyhedra.
Definition at line 1642 of file Core.cpp.
References moab::Range::all_of_dimension(), moab::Range::empty(), moab::Range::end(), moab::Range::erase(), MB_CHK_ERR, MB_SUCCESS, MBVERTEX, moab::Range::merge(), moab::Range::swap(), and moab::Range::upper_bound().
{ Range range; ErrorCode rval = get_connectivity( from_entities, range );MB_CHK_ERR( rval ); // If input contained polyhedra, connectivity will contain faces. // Get vertices from faces. if( !range.all_of_dimension( 0 ) ) { Range::iterator it = range.upper_bound( MBVERTEX ); Range polygons; polygons.merge( it, range.end() ); range.erase( it, range.end() ); rval = get_connectivity( polygons, range );MB_CHK_ERR( rval ); } if( vertices.empty() ) vertices.swap( range ); else vertices.merge( range ); return MB_SUCCESS; }
Definition at line 2483 of file Core.cpp.
References GLOBAL_ID_TAG_NAME, MB_TAG_CREAT, MB_TAG_DENSE, and MB_TYPE_INTEGER.
Referenced by moab::WriteUtil::assign_ids(), create_parallel_mesh(), main(), test_iterates(), test_meshset_tags_1(), and test_meshset_tags_2().
{ const int negone = -1; if( 0 == globalIdTag ) tag_get_handle( GLOBAL_ID_TAG_NAME, 1, MB_TYPE_INTEGER, globalIdTag, MB_TAG_CREAT | MB_TAG_DENSE, &negone ); return globalIdTag; }
ErrorCode moab::Core::handle_from_id | ( | const EntityType | type, |
const EntityID | id, | ||
EntityHandle & | handle | ||
) | const [virtual] |
get a handle from an id and type
Definition at line 389 of file Core.cpp.
References moab::CREATE_HANDLE().
Referenced by moab::HalfFacetRep::fid_from_halfacet().
{ int err; handle = CREATE_HANDLE( entity_type, id, err ); // check to see if handle exists const EntitySequence* dummy_seq = 0; ErrorCode error_code = sequence_manager()->find( handle, dummy_seq ); return error_code; }
ErrorCode moab::Core::high_order_node | ( | const EntityHandle | parent_handle, |
const EntityHandle * | subfacet_conn, | ||
const EntityType | subfacet_type, | ||
EntityHandle & | hon | ||
) | const [virtual] |
given an entity and the connectivity and type of one of its subfacets, find the high order node on that subfacet, if any
Definition at line 2985 of file Core.cpp.
References moab::CN::Dimension(), moab::dum, moab::CN::HasMidNodes(), MB_CHK_ERR, MB_FAILURE, MB_INDEX_OUT_OF_RANGE, MB_SUCCESS, moab::CN::mConnectivityMap, moab::CN::ConnMap::num_sub_elements, moab::CN::SideNumber(), moab::TYPE_FROM_HANDLE(), and moab::CN::VerticesPerEntity().
{ hon = 0; EntityType parent_type = TYPE_FROM_HANDLE( parent_handle ); // get the parent's connectivity const EntityHandle* parent_conn = NULL; int num_parent_vertices = 0; ErrorCode result = get_connectivity( parent_handle, parent_conn, num_parent_vertices, false );MB_CHK_ERR( result ); // find whether this entity has ho nodes int mid_nodes[4]; CN::HasMidNodes( parent_type, num_parent_vertices, mid_nodes ); // check whether this entity has mid nodes on this dimension subfacet; // use dimension-1 because vertices don't have mid nodes if( !mid_nodes[CN::Dimension( subfacet_type )] ) return MB_SUCCESS; // ok, we have mid nodes; now must compute expected index in connectivity array; // ho nodes stored for edges, faces then entity // offset starts with # corner vertices int offset = CN::VerticesPerEntity( parent_type ); int i; for( i = 0; i < CN::Dimension( subfacet_type ) - 1; i++ ) // for each dimension lower than that of the subfacet we're looking for, // if this entity has midnodes in that dimension, increment offset by # // of subfacets of that dimension; use dimension-1 in loop because // canon numbering table only has 2 positions, for edges and faces; if( mid_nodes[i + 1] ) offset += CN::mConnectivityMap[parent_type][i].num_sub_elements; // now add the index of this subfacet; only need to if it's not the highest dimension if( subfacet_type != parent_type ) { // find indices into parent_conn for each entry in child_conn unsigned subfacet_size = CN::VerticesPerEntity( subfacet_type ); int subfacet_indices[10]; assert( subfacet_size <= sizeof( subfacet_indices ) / sizeof( subfacet_indices[0] ) ); for( unsigned j = 0; j < subfacet_size; ++j ) { subfacet_indices[j] = std::find( parent_conn, parent_conn + num_parent_vertices, subfacet_conn[j] ) - parent_conn; if( subfacet_indices[j] >= num_parent_vertices ) { return MB_FAILURE; } } int dum, side_no, temp_offset; int temp_result = CN::SideNumber( parent_type, subfacet_indices, subfacet_size, subfacet_type, side_no, dum, temp_offset ); if( temp_result != 0 ) return MB_FAILURE; offset += side_no; } // offset shouldn't be off the end of the connectivity vector if( offset >= num_parent_vertices ) return MB_INDEX_OUT_OF_RANGE; hon = parent_conn[offset]; return MB_SUCCESS; }
EntityID moab::Core::id_from_handle | ( | const EntityHandle | handle | ) | const [virtual] |
get the id from a handle, returns id
Definition at line 383 of file Core.cpp.
References moab::ID_FROM_HANDLE().
Referenced by dot_down_link(), dot_nodes(), dot_write_node(), main(), perform_laplacian_smoothing(), moab::ParCommGraph::receive_tag_values(), report_sets(), and moab::ParCommGraph::send_tag_values().
{ return ID_FROM_HANDLE( handle ); }
float moab::Core::impl_version | ( | std::string * | version_string = NULL | ) | [virtual] |
Returns the major.minor version number of the implementation.
iface_name | If non-NULL, will be filled in with a string, possibly containing implementation-specific information |
Definition at line 366 of file Core.cpp.
Referenced by main().
{ if( version_string ) *version_string = MOAB_VERSION_STRING; return MOAB_VERSION_MAJOR + MOAB_VERSION_MINOR / 100.0f; }
ErrorCode moab::Core::initialize | ( | ) | [private] |
database init and de-init routines
Definition at line 193 of file Core.cpp.
References MB_MEMORY_ALLOCATION_FAILED, MB_SUCCESS, moab::MBErrorHandler_Init(), moab::MBErrorHandler_Initialized(), MPE_Init_log, and MPE_Initialized_logging.
{ #ifdef MOAB_HAVE_MPI int flag; if( MPI_SUCCESS == MPI_Initialized( &flag ) ) { if( flag ) { writeMPELog = !MPE_Initialized_logging(); if( writeMPELog ) (void)MPE_Init_log(); } } #endif initErrorHandlerInCore = false; if( !MBErrorHandler_Initialized() ) { MBErrorHandler_Init(); initErrorHandlerInCore = true; } geometricDimension = 3; materialTag = 0; neumannBCTag = 0; dirichletBCTag = 0; geomDimensionTag = 0; globalIdTag = 0; sequenceManager = new( std::nothrow ) SequenceManager; if( !sequenceManager ) return MB_MEMORY_ALLOCATION_FAILED; aEntityFactory = new( std::nothrow ) AEntityFactory( this ); if( !aEntityFactory ) return MB_MEMORY_ALLOCATION_FAILED; mError = new( std::nothrow ) Error; if( !mError ) return MB_MEMORY_ALLOCATION_FAILED; mMBWriteUtil = NULL; mMBReadUtil = NULL; scdInterface = NULL; // Readers and writers try to get pointers to above utils. // Do this after pointers are initialized. (Pointers should // really be initialized in constructor to avoid this kind // of thing -- j.kraftcheck.) readerWriterSet = new( std::nothrow ) ReaderWriterSet( this ); if( !readerWriterSet ) return MB_MEMORY_ALLOCATION_FAILED; material_tag(); neumannBC_tag(); dirichletBC_tag(); geom_dimension_tag(); globalId_tag(); #ifdef MOAB_HAVE_AHF ahfRep = new HalfFacetRep( this ); if( !ahfRep ) return MB_MEMORY_ALLOCATION_FAILED; mesh_modified = false; #endif return MB_SUCCESS; }
ErrorCode moab::Core::intersect_meshset | ( | EntityHandle | meshset1, |
const EntityHandle | meshset2 | ||
) | [virtual] |
intersects meshset2 with meshset1 - modifies meshset1
Definition at line 3169 of file Core.cpp.
References moab::get_mesh_set(), moab::MeshSet::intersect(), and MB_ENTITY_NOT_FOUND.
Referenced by test_boolean().
{ MeshSet* set1 = get_mesh_set( sequence_manager(), meshset1 ); MeshSet* set2 = get_mesh_set( sequence_manager(), meshset2 ); if( !set1 || !set2 ) return MB_ENTITY_NOT_FOUND; return set1->intersect( set2, meshset1, a_entity_factory() ); }
bool moab::Core::is_valid | ( | const EntityHandle | this_ent | ) | const |
return whether the input handle is valid or not
Definition at line 3691 of file Core.cpp.
References MB_SUCCESS.
Referenced by moab::RangeSetIterator::get_next_arr(), moab::VectorSetIterator::get_next_arr(), test_delete_entities(), and moab::ScdBox::~ScdBox().
{ const EntitySequence* seq = 0; ErrorCode result = sequence_manager()->find( this_ent, seq ); return seq != 0 && result == MB_SUCCESS; }
ErrorCode moab::Core::list_entities | ( | const Range & | entities | ) | const [virtual] |
Definition at line 2760 of file Core.cpp.
References moab::Range::begin(), moab::Range::end(), moab::CN::EntityTypeName(), moab::ID_FROM_HANDLE(), MB_SUCCESS, and moab::TYPE_FROM_HANDLE().
Referenced by main().
{ ErrorCode result = MB_SUCCESS, tmp_result; for( Range::const_iterator rit = temp_range.begin(); rit != temp_range.end(); ++rit ) { EntityType this_type = TYPE_FROM_HANDLE( *rit ); std::cout << CN::EntityTypeName( this_type ) << " " << ID_FROM_HANDLE( *rit ) << ":" << endl; tmp_result = ( const_cast< Core* >( this ) )->list_entity( *rit ); if( MB_SUCCESS != tmp_result ) result = tmp_result; } return result; }
ErrorCode moab::Core::list_entities | ( | const EntityHandle * | entities, |
const int | num_entities | ||
) | const [virtual] |
Definition at line 2704 of file Core.cpp.
References moab::CN::EntityTypeName(), moab::ID_FROM_HANDLE(), MB_SUCCESS, MBMAXTYPE, MBVERTEX, and moab::TYPE_FROM_HANDLE().
{ Range temp_range; ErrorCode result = MB_SUCCESS; if( NULL == entities && num_entities == 0 ) { // just list the numbers of each entity type int num_ents; std::cout << std::endl; std::cout << "Number of entities per type: " << std::endl; for( EntityType this_type = MBVERTEX; this_type < MBMAXTYPE; this_type++ ) { result = get_number_entities_by_type( 0, this_type, num_ents ); std::cout << CN::EntityTypeName( this_type ) << ": " << num_ents << std::endl; } std::cout << std::endl; return MB_SUCCESS; } else if( NULL == entities && num_entities < 0 ) { // list all entities of all types std::cout << std::endl; for( EntityType this_type = MBVERTEX; this_type < MBMAXTYPE; this_type++ ) { result = get_entities_by_type( 0, this_type, temp_range ); } return list_entities( temp_range ); } else if( NULL == entities && num_entities > 0 ) { // list all entities of type == num_entities std::cout << std::endl; result = get_entities_by_type( 0, (EntityType)num_entities, temp_range ); return list_entities( temp_range ); } else { ErrorCode tmp_result; for( int i = 0; i < num_entities; i++ ) { EntityType this_type = TYPE_FROM_HANDLE( entities[i] ); std::cout << CN::EntityTypeName( this_type ) << " " << ID_FROM_HANDLE( entities[i] ) << ":" << endl; tmp_result = ( const_cast< Core* >( this ) )->list_entity( entities[i] ); if( MB_SUCCESS != tmp_result ) result = tmp_result; } } return result; }
ErrorCode moab::Core::list_entity | ( | const EntityHandle | entity | ) | const [virtual] |
Definition at line 2776 of file Core.cpp.
References dim, moab::CN::Dimension(), moab::dum, moab::CN::EntityTypeName(), get_coords(), moab::ID_FROM_HANDLE(), MB_CHK_ERR, MB_FAILURE, MB_MULTIPLE_ENTITIES_FOUND, MB_SUCCESS, MB_TAG_DENSE, MBENTITYSET, MBVERTEX, MBMesquite::print(), and moab::TYPE_FROM_HANDLE().
{ ErrorCode result; HandleVec adj_vec; if( !is_valid( entity ) ) { std::cout << "(invalid)" << std::endl; return MB_SUCCESS; } if( 0 != globalIdTag ) { int dum; result = tag_get_data( globalIdTag, &entity, 1, &dum ); if( MB_SUCCESS == result ) std::cout << "Global id = " << dum << std::endl; } // list entity EntityType this_type = TYPE_FROM_HANDLE( entity ); if( this_type == MBVERTEX ) { double coords[3]; result = get_coords( &( entity ), 1, coords );MB_CHK_ERR( result ); std::cout << "Coordinates: (" << coords[0] << ", " << coords[1] << ", " << coords[2] << ")" << std::endl; } else if( this_type == MBENTITYSET ) this->print( entity, "" ); std::cout << " Adjacencies:" << std::endl; bool some = false; int multiple = 0; for( int dim = 0; dim <= 3; dim++ ) { if( dim == CN::Dimension( this_type ) ) continue; adj_vec.clear(); // use const_cast here 'cuz we're in a const function and we're passing 'false' for // create_if_missing, so we know we won't change anything result = ( const_cast< Core* >( this ) )->get_adjacencies( &( entity ), 1, dim, false, adj_vec ); if( MB_FAILURE == result ) continue; for( HandleVec::iterator adj_it = adj_vec.begin(); adj_it != adj_vec.end(); ++adj_it ) { if( adj_it != adj_vec.begin() ) std::cout << ", "; else std::cout << " "; std::cout << CN::EntityTypeName( TYPE_FROM_HANDLE( *adj_it ) ) << " " << ID_FROM_HANDLE( *adj_it ); } if( !adj_vec.empty() ) { std::cout << std::endl; some = true; } if( MB_MULTIPLE_ENTITIES_FOUND == result ) multiple += dim; } if( !some ) std::cout << "(none)" << std::endl; const EntityHandle* explicit_adjs; int num_exp; aEntityFactory->get_adjacencies( entity, explicit_adjs, num_exp ); if( NULL != explicit_adjs && 0 != num_exp ) { std::cout << " Explicit adjacencies: "; for( int i = 0; i < num_exp; i++ ) { if( i != 0 ) std::cout << ", "; std::cout << CN::EntityTypeName( TYPE_FROM_HANDLE( explicit_adjs[i] ) ) << " " << ID_FROM_HANDLE( explicit_adjs[i] ); } std::cout << std::endl; } if( multiple != 0 ) std::cout << " (MULTIPLE = " << multiple << ")" << std::endl; result = print_entity_tags( std::string(), entity, MB_TAG_DENSE ); std::cout << std::endl; return result; }
ErrorCode moab::Core::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_values = 0 , |
||
int | num_set_tag_values = 0 |
||
) | [virtual] |
Load or import a file.
Definition at line 416 of file Core.cpp.
References moab::FileOptions::all_seen(), moab::FileOptions::get_int_option(), moab::FileOptions::get_option(), moab::ParallelComm::get_pcomm(), moab::FileOptions::get_unseen_option(), moab::ReadParallel::load_file(), MB_CHK_ERR, MB_ENTITY_NOT_FOUND, MB_FAILURE, MB_SET_ERR, MB_SET_GLB_ERR, MB_SUCCESS, MB_UNHANDLED_OPTION, and t.
Referenced by convert_file(), dagmc_load_file_dagmc_via_moab(), dagmc_load_file_dagmc_via_moab_build_obb(), get_imesh_mesh(), main(), mb_skin_verts_common(), read_multiple_test(), regression_mmiller_8_2010(), split_quads_test(), split_test_across(), test_ghost_elements(), test_load_file(), test_polygon_mix(), test_polyhedra(), test_read(), test_read_alternate_coord_format(), test_read_and_ghost_after(), test_read_bit_tag(), test_read_containing_sets(), test_read_elements(), test_read_handle_tag(), test_read_int_tag(), test_read_non_adjs_side(), test_read_partial(), test_read_polygons(), test_read_polyhedra(), test_read_real_tag(), test_read_set_contents(), test_read_set_parent_child(), test_read_vertices(), test_read_with_ghost(), test_read_with_ghost_no_augment(), test_read_with_thin_ghost_layer(), test_read_write(), test_sets_fileids(), test_tree_readwrite(), test_write(), test_write_dense_tags(), test_write_elements(), test_write_polygons(), test_write_polyhedra(), and test_write_shared_sets().
{ FileOptions opts( setoptions ); ErrorCode rval; ReaderIface::IDTag t = { set_tag_name, set_tag_vals, num_set_tag_vals }; ReaderIface::SubsetList sl = { &t, 1, 0, 0 }; assert( !file_set || ( *file_set && is_valid( *file_set ) ) ); if( file_set && !*file_set ) { MB_SET_GLB_ERR( MB_FAILURE, "Non-NULL file set pointer should point to non-NULL set" ); } // if reading in parallel, call a different reader std::string parallel_opt; rval = opts.get_option( "PARALLEL", parallel_opt ); if( MB_SUCCESS == rval ) { #ifdef MOAB_HAVE_MPI ParallelComm* pcomm = 0; int pcomm_id; rval = opts.get_int_option( "PARALLEL_COMM", pcomm_id ); if( MB_ENTITY_NOT_FOUND == rval ) rval = opts.get_int_option( "PCOMM", pcomm_id ); if( rval == MB_SUCCESS ) { pcomm = ParallelComm::get_pcomm( this, pcomm_id ); if( !pcomm ) return MB_ENTITY_NOT_FOUND; } else if( rval != MB_ENTITY_NOT_FOUND ) return rval; if( set_tag_name && num_set_tag_vals ) { rval = ReadParallel( this, pcomm ).load_file( file_name, file_set, opts, &sl );MB_CHK_ERR( rval ); } else { rval = ReadParallel( this, pcomm ).load_file( file_name, file_set, opts );MB_CHK_ERR( rval ); } #else MB_SET_GLB_ERR( MB_FAILURE, "PARALLEL option not valid, this instance compiled for serial execution" ); #endif } else { if( set_tag_name && num_set_tag_vals ) { rval = serial_load_file( file_name, file_set, opts, &sl );MB_CHK_ERR( rval ); } else { rval = serial_load_file( file_name, file_set, opts );MB_CHK_ERR( rval ); } } if( MB_SUCCESS == rval && !opts.all_seen() ) { std::string bad_opt; if( MB_SUCCESS == opts.get_unseen_option( bad_opt ) ) { MB_SET_ERR( MB_UNHANDLED_OPTION, "Unrecognized option: \"" << bad_opt << "\"" ); } else { MB_SET_ERR( MB_UNHANDLED_OPTION, "Unrecognized option" ); } } return MB_SUCCESS; }
ErrorCode moab::Core::load_mesh | ( | const char * | file_name, |
const int * | block_id_list = NULL , |
||
const int | num_blocks = 0 |
||
) | [virtual] |
load mesh from data in file NOTE: if there is mesh already present, the new mesh will be added
Definition at line 410 of file Core.cpp.
References load_file(), and MATERIAL_SET_TAG_NAME.
Referenced by main(), merge_all_test(), merge_with_tag_test(), mergesimple_test(), test_moab_v3_poly_format(), test_spectral_hex(), test_spectral_quad(), test_var_length_parallel(), and verdict_test1().
{ const char* name = block_id_list ? MATERIAL_SET_TAG_NAME : 0; return load_file( file_name, 0, 0, name, block_id_list, num_blocks ); }
return various specific tag handles
Definition at line 2458 of file Core.cpp.
References MATERIAL_SET_TAG_NAME, MB_TAG_CREAT, MB_TAG_SPARSE, and MB_TYPE_INTEGER.
{ const int negone = -1; if( 0 == materialTag ) tag_get_handle( MATERIAL_SET_TAG_NAME, 1, MB_TYPE_INTEGER, materialTag, MB_TAG_CREAT | MB_TAG_SPARSE, &negone ); return materialTag; }
ErrorCode moab::Core::merge_entities | ( | EntityHandle | entity_to_keep, |
EntityHandle | entity_to_remove, | ||
bool | auto_merge, | ||
bool | delete_removed_entity | ||
) | [virtual] |
merges two entities
Definition at line 2549 of file Core.cpp.
References conn, moab::CN::ConnectivityMatch(), moab::CN::Dimension(), MB_CHK_ERR, MB_ENTITY_NOT_FOUND, MB_FAILURE, MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, and moab::TYPE_FROM_HANDLE().
{ if( auto_merge ) return MB_FAILURE; // The two entities to merge must not be the same entity. if( entity_to_keep == entity_to_remove ) return MB_FAILURE; // The two entities to merge must be of the same type EntityType type_to_keep = TYPE_FROM_HANDLE( entity_to_keep ); if( type_to_keep != TYPE_FROM_HANDLE( entity_to_remove ) ) return MB_TYPE_OUT_OF_RANGE; // Make sure both entities exist before trying to merge. EntitySequence* seq = 0; ErrorCode result, status; status = sequence_manager()->find( entity_to_keep, seq ); if( seq == 0 || status != MB_SUCCESS ) return MB_ENTITY_NOT_FOUND; status = sequence_manager()->find( entity_to_remove, seq ); if( seq == 0 || status != MB_SUCCESS ) return MB_ENTITY_NOT_FOUND; // If auto_merge is not set, all sub-entities should // be merged if the entities are to be merged. int ent_dim = CN::Dimension( type_to_keep ); if( ent_dim > 0 ) { std::vector< EntityHandle > conn, conn2; result = get_connectivity( &entity_to_keep, 1, conn );MB_CHK_ERR( result ); result = get_connectivity( &entity_to_remove, 1, conn2 );MB_CHK_ERR( result ); // Check to see if we can merge before pulling adjacencies. int dum1, dum2; if( !auto_merge && ( conn.size() != conn2.size() || !CN::ConnectivityMatch( &conn[0], &conn2[0], conn.size(), dum1, dum2 ) ) ) return MB_FAILURE; } result = aEntityFactory->merge_adjust_adjacencies( entity_to_keep, entity_to_remove ); if( MB_SUCCESS == result && delete_removed_entity ) result = delete_entities( &entity_to_remove, 1 ); return result; }
Definition at line 2466 of file Core.cpp.
References MB_TAG_CREAT, MB_TAG_SPARSE, MB_TYPE_INTEGER, and NEUMANN_SET_TAG_NAME.
{ const int negone = -1; if( 0 == neumannBCTag ) tag_get_handle( NEUMANN_SET_TAG_NAME, 1, MB_TYPE_INTEGER, neumannBCTag, MB_TAG_CREAT | MB_TAG_SPARSE, &negone ); return neumannBCTag; }
ErrorCode moab::Core::num_child_meshsets | ( | const EntityHandle | meshset, |
int * | number, | ||
const int | num_hops = 1 |
||
) | const [virtual] |
gets number of child meshsets
Definition at line 3332 of file Core.cpp.
References MB_ENTITY_NOT_FOUND, MB_SUCCESS, and moab::MeshSetSequence::num_children().
Referenced by test_pack_set_parent_child().
{ if( 0 == meshset ) return MB_ENTITY_NOT_FOUND; const EntitySequence* seq; ErrorCode rval = sequence_manager()->find( meshset, seq ); if( MB_SUCCESS != rval ) return MB_ENTITY_NOT_FOUND; const MeshSetSequence* mseq = reinterpret_cast< const MeshSetSequence* >( seq ); return mseq->num_children( sequence_manager(), meshset, *number, num_hops ); }
ErrorCode moab::Core::num_contained_meshsets | ( | const EntityHandle | meshset, |
int * | number, | ||
const int | num_hops = 1 |
||
) | const [virtual] |
gets number of contained meshsets
Definition at line 3344 of file Core.cpp.
References MB_ENTITY_NOT_FOUND, MB_SUCCESS, MBENTITYSET, and moab::MeshSetSequence::num_contained_sets().
{ if( 0 == meshset ) { return get_number_entities_by_type( 0, MBENTITYSET, *number ); } const EntitySequence* seq; ErrorCode rval = sequence_manager()->find( meshset, seq ); if( MB_SUCCESS != rval ) return MB_ENTITY_NOT_FOUND; const MeshSetSequence* mseq = reinterpret_cast< const MeshSetSequence* >( seq ); return mseq->num_contained_sets( sequence_manager(), meshset, *number, num_hops ); }
ErrorCode moab::Core::num_parent_meshsets | ( | const EntityHandle | meshset, |
int * | number, | ||
const int | num_hops = 1 |
||
) | const [virtual] |
gets number of parent meshsets
Definition at line 3320 of file Core.cpp.
References MB_ENTITY_NOT_FOUND, MB_SUCCESS, and moab::MeshSetSequence::num_parents().
Referenced by test_pack_set_parent_child().
{ if( 0 == meshset ) return MB_ENTITY_NOT_FOUND; const EntitySequence* seq; ErrorCode rval = sequence_manager()->find( meshset, seq ); if( MB_SUCCESS != rval ) return MB_ENTITY_NOT_FOUND; const MeshSetSequence* mseq = reinterpret_cast< const MeshSetSequence* >( seq ); return mseq->num_parents( sequence_manager(), meshset, *number, num_hops ); }
void moab::Core::print | ( | const EntityHandle | handle, |
const char * | prefix, | ||
bool | first_call = true |
||
) | const |
Definition at line 3451 of file Core.cpp.
References moab::Range::begin(), moab::Range::clear(), moab::Range::empty(), moab::Range::end(), entities, moab::ID_FROM_HANDLE(), MB_TAG_SPARSE, MBENTITYSET, and moab::Range::print().
{ // get the entities Range entities; if( 0 != ms_handle ) { get_entities_by_handle( ms_handle, entities ); std::cout << prefix << "MBENTITYSET " << ID_FROM_HANDLE( ms_handle ) << std::endl; } else { get_entities_by_dimension( 0, 3, entities ); if( entities.empty() ) get_entities_by_dimension( 0, 2, entities ); if( entities.empty() ) get_entities_by_dimension( 0, 1, entities ); get_entities_by_dimension( 0, 0, entities ); get_entities_by_type( 0, MBENTITYSET, entities ); std::cout << prefix << "--: " << std::endl; } std::string indent_prefix = prefix; indent_prefix += " "; entities.print( indent_prefix.c_str() ); if( !first_call || !ms_handle ) return; // print parent/children Range temp; this->get_parent_meshsets( ms_handle, temp ); std::cout << " Parent sets: "; if( temp.empty() ) std::cout << "(none)" << std::endl; else { for( Range::iterator rit = temp.begin(); rit != temp.end(); ++rit ) { if( rit != temp.begin() ) std::cout << ", "; std::cout << ID_FROM_HANDLE( *rit ); } std::cout << std::endl; } temp.clear(); this->get_child_meshsets( ms_handle, temp ); std::cout << " Child sets: "; if( temp.empty() ) std::cout << "(none)" << std::endl; else { for( Range::iterator rit = temp.begin(); rit != temp.end(); ++rit ) { if( rit != temp.begin() ) std::cout << ", "; std::cout << ID_FROM_HANDLE( *rit ); } std::cout << std::endl; } // print all sparse tags print_entity_tags( indent_prefix, ms_handle, MB_TAG_SPARSE ); }
void moab::Core::print_database | ( | ) | const |
Definition at line 3932 of file Core.cpp.
References MBMesquite::adj(), moab::TypeSequenceManager::begin(), conn, dashes(), moab::EntitySequence::data(), moab::TypeSequenceManager::empty(), moab::TypeSequenceManager::end(), moab::SequenceData::end_handle(), moab::EntitySequence::end_handle(), moab::CN::EntityTypeName(), moab::VertexSequence::get_coordinates(), moab::ID_FROM_HANDLE(), MB_SUCCESS, MBEDGE, MBENTITYSET, MBMAXTYPE, MBVERTEX, n, moab::ElementSequence::nodes_per_element(), moab::SequenceData::start_handle(), moab::EntitySequence::start_handle(), t, and moab::TYPE_FROM_HANDLE().
{ ErrorCode rval; TypeSequenceManager::const_iterator i; const TypeSequenceManager& verts = sequence_manager()->entity_map( MBVERTEX ); if( !verts.empty() ) printf( " Vertex ID X Y Z Adjacencies \n" " ---------- -------- -------- -------- -----------...\n" ); const EntityHandle* adj; int nadj; for( i = verts.begin(); i != verts.end(); ++i ) { const VertexSequence* seq = static_cast< const VertexSequence* >( *i ); printf( "(Sequence [%d,%d] in SequenceData [%d,%d])\n", (int)ID_FROM_HANDLE( seq->start_handle() ), (int)ID_FROM_HANDLE( seq->end_handle() ), (int)ID_FROM_HANDLE( seq->data()->start_handle() ), (int)ID_FROM_HANDLE( seq->data()->end_handle() ) ); double c[3]; for( EntityHandle h = seq->start_handle(); h <= seq->end_handle(); ++h ) { rval = seq->get_coordinates( h, c ); if( MB_SUCCESS == rval ) printf( " %10d %8g %8g %8g", (int)ID_FROM_HANDLE( h ), c[0], c[1], c[2] ); else printf( " %10d < ERROR %4d >", (int)ID_FROM_HANDLE( h ), (int)rval ); rval = a_entity_factory()->get_adjacencies( h, adj, nadj ); if( MB_SUCCESS != rval ) { printf( " <ERROR %d>\n", (int)rval ); continue; } EntityType pt = MBMAXTYPE; for( int j = 0; j < nadj; ++j ) { if( TYPE_FROM_HANDLE( adj[j] ) != pt ) { pt = TYPE_FROM_HANDLE( adj[j] ); printf( " %s", pt >= MBMAXTYPE ? "INVALID TYPE" : CN::EntityTypeName( pt ) ); } printf( " %d", (int)ID_FROM_HANDLE( adj[j] ) ); } printf( "\n" ); } } for( EntityType t = MBEDGE; t < MBENTITYSET; ++t ) { const TypeSequenceManager& elems = sequence_manager()->entity_map( t ); if( elems.empty() ) continue; int clen = 0; for( i = elems.begin(); i != elems.end(); ++i ) { int n = static_cast< const ElementSequence* >( *i )->nodes_per_element(); if( n > clen ) clen = n; } clen *= 5; if( clen < (int)strlen( "Connectivity" ) ) clen = strlen( "Connectivity" ); std::vector< char > dashes( clen, '-' ); dashes.push_back( '\0' ); printf( " %7s ID %-*s Adjacencies\n", CN::EntityTypeName( t ), clen, "Connectivity" ); printf( " ---------- %s -----------...\n", &dashes[0] ); std::vector< EntityHandle > storage; const EntityHandle* conn; int nconn; for( i = elems.begin(); i != elems.end(); ++i ) { const ElementSequence* seq = static_cast< const ElementSequence* >( *i ); printf( "(Sequence [%d,%d] in SequenceData [%d,%d])\n", (int)ID_FROM_HANDLE( seq->start_handle() ), (int)ID_FROM_HANDLE( seq->end_handle() ), (int)ID_FROM_HANDLE( seq->data()->start_handle() ), (int)ID_FROM_HANDLE( seq->data()->end_handle() ) ); for( EntityHandle h = seq->start_handle(); h <= seq->end_handle(); ++h ) { printf( " %10d", (int)ID_FROM_HANDLE( h ) ); rval = get_connectivity( h, conn, nconn, false, &storage ); if( MB_SUCCESS != rval ) printf( " <ERROR %2d>%*s", (int)rval, clen - 10, "" ); else { for( int j = 0; j < nconn; ++j ) printf( " %4d", (int)ID_FROM_HANDLE( conn[j] ) ); printf( "%*s", clen - 5 * nconn, "" ); } rval = a_entity_factory()->get_adjacencies( h, adj, nadj ); if( MB_SUCCESS != rval ) { printf( " <ERROR %d>\n", (int)rval ); continue; } EntityType pt = MBMAXTYPE; for( int j = 0; j < nadj; ++j ) { if( TYPE_FROM_HANDLE( adj[j] ) != pt ) { pt = TYPE_FROM_HANDLE( adj[j] ); printf( " %s", pt >= MBMAXTYPE ? "INVALID TYPE" : CN::EntityTypeName( pt ) ); } printf( " %d", (int)ID_FROM_HANDLE( adj[j] ) ); } printf( "\n" ); } } } }
ErrorCode moab::Core::print_entity_tags | ( | std::string | indent_prefix, |
const EntityHandle | handle, | ||
TagType | tp | ||
) | const |
Definition at line 3512 of file Core.cpp.
References MB_SUCCESS, MB_TAG_SPARSE, MB_TYPE_BIT, MB_TYPE_DOUBLE, MB_TYPE_HANDLE, MB_TYPE_INTEGER, MB_TYPE_OPAQUE, and NAME_TAG_SIZE.
{ std::vector< Tag > set_tags; ErrorCode result = this->tag_get_tags_on_entity( handle, set_tags ); std::cout << indent_prefix << ( tp == MB_TAG_SPARSE ? "Sparse tags:" : "Dense tags:" ) << std::endl; indent_prefix += " "; for( std::vector< Tag >::iterator vit = set_tags.begin(); vit != set_tags.end(); ++vit ) { TagType this_type; result = this->tag_get_type( *vit, this_type ); if( MB_SUCCESS != result || tp != this_type ) continue; DataType this_data_type; result = this->tag_get_data_type( *vit, this_data_type ); if( MB_SUCCESS != result ) continue; int this_size; result = this->tag_get_length( *vit, this_size ); if( MB_SUCCESS != result ) continue; // use double since this is largest single-valued tag std::vector< double > dbl_vals( this_size ); std::vector< int > int_vals( this_size ); std::vector< EntityHandle > hdl_vals( this_size ); std::string tag_name; result = this->tag_get_name( *vit, tag_name ); if( MB_SUCCESS != result ) continue; switch( this_data_type ) { case MB_TYPE_INTEGER: result = this->tag_get_data( *vit, &handle, 1, &int_vals[0] ); if( MB_SUCCESS != result ) continue; std::cout << indent_prefix << tag_name << " = "; if( this_size < 10 ) for( int i = 0; i < this_size; i++ ) std::cout << int_vals[i] << " "; else std::cout << int_vals[0] << "... (mult values)"; std::cout << std::endl; break; case MB_TYPE_DOUBLE: result = this->tag_get_data( *vit, &handle, 1, &dbl_vals[0] ); if( MB_SUCCESS != result ) continue; std::cout << indent_prefix << tag_name << " = "; if( this_size < 10 ) for( int i = 0; i < this_size; i++ ) std::cout << dbl_vals[i] << " "; else std::cout << dbl_vals[0] << "... (mult values)"; std::cout << std::endl; break; case MB_TYPE_HANDLE: result = this->tag_get_data( *vit, &handle, 1, &hdl_vals[0] ); if( MB_SUCCESS != result ) continue; std::cout << indent_prefix << tag_name << " = "; if( this_size < 10 ) for( int i = 0; i < this_size; i++ ) std::cout << hdl_vals[i] << " "; else std::cout << hdl_vals[0] << "... (mult values)"; std::cout << std::endl; break; case MB_TYPE_OPAQUE: if( NAME_TAG_SIZE == this_size ) { char dum_tag[NAME_TAG_SIZE]; result = this->tag_get_data( *vit, &handle, 1, &dum_tag ); if( MB_SUCCESS != result ) continue; // insert NULL just in case there isn't one dum_tag[NAME_TAG_SIZE - 1] = '\0'; std::cout << indent_prefix << tag_name << " = " << dum_tag << std::endl; } break; case MB_TYPE_BIT: break; } } return MB_SUCCESS; }
ErrorCode moab::Core::query_interface_type | ( | const std::type_info & | iface_type, |
void *& | iface | ||
) | [virtual] |
Get a pointer to an internal MOAB interface
Definition at line 306 of file Core.cpp.
References MB_FAILURE, and MB_SUCCESS.
{ if( interface_type == typeid( ReadUtilIface ) ) { if( !mMBReadUtil ) mMBReadUtil = new ReadUtil( this, mError ); ptr = static_cast< ReadUtilIface* >( mMBReadUtil ); } else if( interface_type == typeid( WriteUtilIface ) ) { if( !mMBWriteUtil ) mMBWriteUtil = new WriteUtil( this ); ptr = static_cast< WriteUtilIface* >( mMBWriteUtil ); } else if( interface_type == typeid( ReaderWriterSet ) ) { ptr = reader_writer_set(); } else if( interface_type == typeid( Error ) ) { ptr = mError; } else if( interface_type == typeid( ExoIIInterface ) ) { ptr = static_cast< ExoIIInterface* >( new ExoIIUtil( this ) ); } else if( interface_type == typeid( ScdInterface ) ) { if( !scdInterface ) scdInterface = new ScdInterface( this ); ptr = scdInterface; } else { ptr = 0; return MB_FAILURE; } return MB_SUCCESS; }
int moab::Core::QueryInterface | ( | const MBuuid & | uuid, |
UnknownInterface ** | iface | ||
) | [virtual] |
Definition at line 355 of file Core.cpp.
References moab::IDD_MBUnknown.
Referenced by moab::ComponentFactory::QueryInterface().
{ *iface = 0; if( uuid == IDD_MBUnknown ) *iface = this; if( uuid == IDD_MBCore ) *iface = this; else return 0; return 1; }
ReaderWriterSet* moab::Core::reader_writer_set | ( | ) | [inline] |
return set of registered IO tools
Definition at line 959 of file Core.hpp.
References readerWriterSet.
{ return readerWriterSet; }
ErrorCode moab::Core::release_interface_type | ( | const std::type_info & | iface_type, |
void * | iface | ||
) | [virtual] |
Release reference to MB interface.
Definition at line 343 of file Core.cpp.
References iface, MB_FAILURE, and MB_SUCCESS.
{ if( interface_type == typeid( ExoIIInterface ) ) delete static_cast< ExoIIInterface* >( iface ); else if( interface_type != typeid( ReadUtilIface ) && interface_type != typeid( WriteUtilIface ) && interface_type != typeid( ReaderWriterSet ) && interface_type != typeid( Error ) && interface_type != typeid( ScdInterface ) ) return MB_FAILURE; return MB_SUCCESS; }
ErrorCode moab::Core::remove_child_meshset | ( | EntityHandle | meshset, |
const EntityHandle | child_meshset | ||
) | [virtual] |
remove child meshset
Definition at line 3432 of file Core.cpp.
References moab::get_mesh_set(), MB_ENTITY_NOT_FOUND, MB_SUCCESS, and moab::MeshSet::remove_child().
{ MeshSet* set_ptr = get_mesh_set( sequence_manager(), meshset ); if( !set_ptr ) return MB_ENTITY_NOT_FOUND; set_ptr->remove_child( child_meshset ); return MB_SUCCESS; }
ErrorCode moab::Core::remove_entities | ( | EntityHandle | meshset, |
const Range & | entities | ||
) | [virtual] |
remove entities from meshset
remove a range of entities from a meshset
Definition at line 3206 of file Core.cpp.
References moab::get_mesh_set(), and MB_ENTITY_NOT_FOUND.
Referenced by main(), moab::AEntityFactory::remove_adjacency(), test_remove_entities(), moab::ReorderTool::update_set_contents(), and moab::NestedRefine::update_special_tags().
{ MeshSet* set = get_mesh_set( sequence_manager(), meshset ); if( set ) return set->remove_entities( entities, meshset, a_entity_factory() ); else return MB_ENTITY_NOT_FOUND; }
ErrorCode moab::Core::remove_entities | ( | EntityHandle | meshset, |
const EntityHandle * | entities, | ||
const int | num_entities | ||
) | [virtual] |
remove entities from meshset
remove a vector of entities from a meshset
Definition at line 3216 of file Core.cpp.
References moab::get_mesh_set(), and MB_ENTITY_NOT_FOUND.
{ MeshSet* set = get_mesh_set( sequence_manager(), meshset ); if( set ) return set->remove_entities( entities, num_entities, meshset, a_entity_factory() ); else return MB_ENTITY_NOT_FOUND; }
ErrorCode moab::Core::remove_parent_child | ( | EntityHandle | parent, |
EntityHandle | child | ||
) | [virtual] |
removes 'parent' to child's parent list and removes 'child' to parent's child list
Definition at line 3413 of file Core.cpp.
References moab::get_mesh_set(), MB_ENTITY_NOT_FOUND, MB_SUCCESS, moab::MeshSet::remove_child(), and moab::MeshSet::remove_parent().
{ MeshSet* parent_ptr = get_mesh_set( sequence_manager(), parent ); MeshSet* child_ptr = get_mesh_set( sequence_manager(), child ); if( !parent_ptr || !child_ptr ) return MB_ENTITY_NOT_FOUND; parent_ptr->remove_child( child ); child_ptr->remove_parent( parent ); return MB_SUCCESS; }
ErrorCode moab::Core::remove_parent_meshset | ( | EntityHandle | meshset, |
const EntityHandle | parent_meshset | ||
) | [virtual] |
remove parent meshset
Definition at line 3424 of file Core.cpp.
References moab::get_mesh_set(), MB_ENTITY_NOT_FOUND, MB_SUCCESS, and moab::MeshSet::remove_parent().
{ MeshSet* set_ptr = get_mesh_set( sequence_manager(), meshset ); if( !set_ptr ) return MB_ENTITY_NOT_FOUND; set_ptr->remove_parent( parent_meshset ); return MB_SUCCESS; }
ErrorCode moab::Core::remove_set_iterator | ( | SetIterator * | set_iter | ) |
Remove the set iterator from the instance's list.
Remove the set iterator from the instance's list This function is called from the SetIterator destructor, and should not be called directly from anywhere else.
set_iter | Set iterator being removed |
Definition at line 3723 of file Core.cpp.
References MB_FAILURE, MB_SET_ERR, and MB_SUCCESS.
Referenced by moab::SetIterator::~SetIterator().
{ std::vector< SetIterator* >::iterator vit = std::find( setIterators.begin(), setIterators.end(), set_iter ); if( vit == setIterators.end() ) { MB_SET_ERR( MB_FAILURE, "Didn't find that iterator" ); } setIterators.erase( vit ); return MB_SUCCESS; }
ErrorCode moab::Core::replace_entities | ( | EntityHandle | meshset, |
const EntityHandle * | old_entities, | ||
const EntityHandle * | new_entities, | ||
int | num_entities | ||
) | [virtual] |
replace entities
Definition at line 3238 of file Core.cpp.
References moab::get_mesh_set(), and MB_ENTITY_NOT_FOUND.
Referenced by moab::AEntityFactory::merge_adjust_adjacencies().
{ MeshSet* set = get_mesh_set( sequence_manager(), meshset ); if( set ) return set->replace_entities( meshset, old_entities, new_entities, num_entities, a_entity_factory() ); else return MB_ENTITY_NOT_FOUND; }
SequenceManager* moab::Core::sequence_manager | ( | ) | [inline] |
get/set the number of nodes
get/set the number of elements return a reference to the sequence manager
Definition at line 919 of file Core.hpp.
References sequenceManager.
Referenced by moab::HigherOrderFactory::add_mid_edge_nodes(), moab::HigherOrderFactory::add_mid_face_nodes(), moab::HigherOrderFactory::add_mid_volume_nodes(), moab::ScdInterface::construct_box(), moab::HigherOrderFactory::convert(), moab::HigherOrderFactory::convert_sequence(), create_3dtri_3_sequences(), moab::ReadUtil::create_entity_sets(), moab::ScdInterface::create_scd_sequence(), moab::WriteUtil::gather_nodes_from_elements(), moab::AEntityFactory::get_adjacency_ptr(), moab::ReadUtil::get_element_connect(), moab::WriteUtil::get_element_connect(), moab::ReorderTool::get_entities(), moab::WriteUtil::get_entity_list_pointers(), moab::AEntityFactory::get_memory_use(), moab::ReadUtil::get_node_coords(), moab::WriteUtil::get_node_coords(), get_number_sequences(), moab::ReorderTool::handle_order_from_int_tag(), moab::ParallelComm::initialize(), moab::ReorderTool::reorder_entities(), moab::AEntityFactory::set_adjacency_ptr(), testA(), and moab::AEntityFactory::~AEntityFactory().
{ return sequenceManager; }
const SequenceManager* moab::Core::sequence_manager | ( | ) | const [inline] |
ErrorCode moab::Core::serial_load_file | ( | const char * | file_name, |
const EntityHandle * | file_set, | ||
const FileOptions & | opts, | ||
const ReaderIface::SubsetList * | subset_list = 0 , |
||
const Tag * | file_id_tag = 0 |
||
) |
Load or import a file.
Definition at line 503 of file Core.cpp.
References moab::Range::erase(), moab::ReaderIface::load_file(), MB_CHK_ERR, MB_FAILURE, MB_FILE_DOES_NOT_EXIST, MB_SET_ERR, MB_SET_GLB_ERR, MB_SUCCESS, and moab::subtract().
Referenced by moab::ReadParallel::load_file().
{ int status; #if defined( WIN32 ) || defined( WIN64 ) || defined( MSC_VER ) struct _stat stat_data; status = _stat( file_name, &stat_data ); #else struct stat stat_data; status = stat( file_name, &stat_data ); #endif if( status ) { MB_SET_GLB_ERR( MB_FILE_DOES_NOT_EXIST, file_name << ": " << strerror( errno ) ); } #if defined( WIN32 ) || defined( WIN64 ) || defined( MSC_VER ) else if( stat_data.st_mode & _S_IFDIR ) { #else else if( S_ISDIR( stat_data.st_mode ) ) { #endif MB_SET_GLB_ERR( MB_FILE_DOES_NOT_EXIST, file_name << ": Cannot read directory/folder" ); } const ReaderWriterSet* set = reader_writer_set(); Range initial_ents; ErrorCode rval = get_entities_by_handle( 0, initial_ents );MB_CHK_ERR( rval ); std::vector< Tag > initial_tags; rval = tag_get_tags( initial_tags );MB_CHK_ERR( rval ); // otherwise try using the file extension to select a reader std::string ext = set->extension_from_filename( file_name ); // Try all the readers ReaderWriterSet::iterator iter; rval = MB_FAILURE; bool tried_one = false; for( iter = set->begin(); iter != set->end(); ++iter ) { if( !iter->reads_extension( ext.c_str() ) ) continue; ReaderIface* reader = iter->make_reader( this ); if( NULL != reader ) { tried_one = true; rval = reader->load_file( file_name, file_set, opts, subsets, id_tag ); delete reader; if( MB_SUCCESS == rval ) break; clean_up_failed_read( initial_ents, initial_tags ); } } if( MB_SUCCESS != rval && !tried_one ) { // didn't recognize the extension; try all of them now for( iter = set->begin(); iter != set->end(); ++iter ) { ReaderIface* reader = iter->make_reader( this ); if( !reader ) continue; rval = reader->load_file( file_name, file_set, opts, subsets, id_tag ); delete reader; if( MB_SUCCESS == rval ) break; else clean_up_failed_read( initial_ents, initial_tags ); } } if( MB_SUCCESS != rval ) { clean_up_failed_read( initial_ents, initial_tags ); MB_SET_ERR( rval, "Failed to load file after trying all possible readers" ); } else if( file_set ) { Range new_ents; get_entities_by_handle( 0, new_ents ); new_ents = subtract( new_ents, initial_ents ); // Check if gather set exists EntityHandle gather_set; rval = mMBReadUtil->get_gather_set( gather_set ); if( MB_SUCCESS == rval ) { // Exclude gather set itself new_ents.erase( gather_set ); // Exclude gather set entities Range gather_ents; rval = get_entities_by_handle( gather_set, gather_ents ); if( MB_SUCCESS == rval ) new_ents = subtract( new_ents, gather_ents ); } rval = add_entities( *file_set, new_ents ); } return rval; } // namespace moab
ErrorCode moab::Core::serial_read_tag | ( | const char * | file_name, |
const char * | tag_name, | ||
const FileOptions & | opts, | ||
std::vector< int > & | tag_vals, | ||
const ReaderIface::SubsetList * | subset_list = 0 |
||
) |
Definition at line 602 of file Core.cpp.
References MB_FAILURE, MB_SUCCESS, and moab::ReaderIface::read_tag_values().
{ ErrorCode rval = MB_FAILURE; const ReaderWriterSet* set = reader_writer_set(); // otherwise try using the file extension to select a reader ReaderIface* reader = set->get_file_extension_reader( file_name ); if( reader ) { rval = reader->read_tag_values( file_name, tag_name, opts, vals, subsets ); delete reader; } else { // Try all the readers ReaderWriterSet::iterator iter; for( iter = set->begin(); iter != set->end(); ++iter ) { reader = iter->make_reader( this ); if( NULL != reader ) { rval = reader->read_tag_values( file_name, tag_name, opts, vals, subsets ); delete reader; if( MB_SUCCESS == rval ) break; } } } return rval; }
ErrorCode moab::Core::set_connectivity | ( | const EntityHandle | entity_handle, |
EntityHandle * | connect, | ||
const int | num_connect | ||
) | [virtual] |
Sets the connectivity for an EntityHandle. For non-element handles, return an error.
set the connectivity for element handles. For non-element handles, return an error
Connectivity is stored exactly as it is ordered in vector connectivity.
entity_handle | EntityHandle to set connectivity of. |
connect | Vector containing new connectivity of entity_handle. |
num_connect | Number of vertices in connect |
std::vector<EntityHandle> conn(3); conn[0] = node1; conn[1] = node2; conn[2] = node3; set_connectivity( entity_handle, conn, 3 );
Definition at line 1165 of file Core.cpp.
References MB_CHK_ERR, MB_ENTITY_NOT_FOUND, MB_FAILURE, MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MBENTITYSET, and moab::TYPE_FROM_HANDLE().
Referenced by moab::AEntityFactory::merge_adjust_adjacencies(), and moab::ReorderTool::reorder_entities().
{ ErrorCode status = MB_FAILURE; // Make sure the entity should have a connectivity. // WARNING: This is very dependent on the ordering of the EntityType enum EntityType entity_type = TYPE_FROM_HANDLE( entity_handle ); EntitySequence* seq = 0; if( entity_type < MBVERTEX || entity_type > MBENTITYSET ) return MB_TYPE_OUT_OF_RANGE; status = sequence_manager()->find( entity_handle, seq ); if( seq == 0 || status != MB_SUCCESS ) return ( status != MB_SUCCESS ? status : MB_ENTITY_NOT_FOUND ); const EntityHandle* old_conn; int len; status = static_cast< ElementSequence* >( seq )->get_connectivity( entity_handle, old_conn, len );MB_CHK_ERR( status ); aEntityFactory->notify_change_connectivity( entity_handle, old_conn, connect, num_connect ); status = static_cast< ElementSequence* >( seq )->set_connectivity( entity_handle, connect, num_connect ); if( status != MB_SUCCESS ) aEntityFactory->notify_change_connectivity( entity_handle, connect, old_conn, num_connect ); return status; }
ErrorCode moab::Core::set_coords | ( | const EntityHandle * | entity_handles, |
const int | num_entities, | ||
const double * | coords | ||
) | [virtual] |
set the coordinate information for this handle if it is of type Vertex otherwise, return an error
Definition at line 1006 of file Core.cpp.
References MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MBVERTEX, and moab::TYPE_FROM_HANDLE().
Referenced by main(), perform_laplacian_smoothing(), moab::ReorderTool::reorder_entities(), and MBMesquite::MsqMOAB::vertex_set_coordinates().
{ ErrorCode status = MB_SUCCESS; int i, j = 0; for( i = 0; i < num_entities; i++ ) { if( TYPE_FROM_HANDLE( entity_handles[i] ) == MBVERTEX ) { EntitySequence* seq = 0; status = sequence_manager()->find( entity_handles[i], seq ); if( seq != 0 && status == MB_SUCCESS ) { status = static_cast< VertexSequence* >( seq )->set_coordinates( entity_handles[i], coords[j], coords[j + 1], coords[j + 2] ); j += 3; } } else if( status == MB_SUCCESS ) status = MB_TYPE_OUT_OF_RANGE; } return status; }
ErrorCode moab::Core::set_coords | ( | Range | entity_handles, |
const double * | coords | ||
) | [virtual] |
set the coordinate information for this handle if it is of type Vertex otherwise, return an error
Definition at line 1036 of file Core.cpp.
References moab::Range::begin(), moab::Range::end(), MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MBVERTEX, and moab::TYPE_FROM_HANDLE().
{ ErrorCode status = MB_SUCCESS; int j = 0; for( Range::iterator rit = entity_handles.begin(); rit != entity_handles.end(); ++rit ) { if( TYPE_FROM_HANDLE( *rit ) == MBVERTEX ) { EntitySequence* seq = 0; status = sequence_manager()->find( *rit, seq ); if( seq != 0 && status == MB_SUCCESS ) { status = static_cast< VertexSequence* >( seq )->set_coordinates( *rit, coords[j], coords[j + 1], coords[j + 2] ); j += 3; } } else if( status == MB_SUCCESS ) status = MB_TYPE_OUT_OF_RANGE; } return status; }
ErrorCode moab::Core::set_dimension | ( | const int | dim | ) | [virtual] |
set overall geometric dimension
Returns error if setting to 3 dimensions, mesh has been created, and there are only 2 dimensions on that mesh
Definition at line 744 of file Core.cpp.
References dim, and MB_SUCCESS.
{ // check to see if current dimension is smaller if( geometricDimension < dim ) { // need to check the number of entities int num; /*ErrorCode result = */ get_number_entities_by_dimension( 0, geometricDimension, num ); // test written to be more readable but possibly less efficient // if (MB_SUCCESS != result) return MB_FAILURE; // else if (0 != num && dim == 2 && ycoordTag == 0) return MB_FAILURE; // else if (0 != num && dim == 3 && (ycoordTag == 0 || zcoordTag == 0)) return MB_FAILURE; // TODO -- replace this with not using xcoordTag, etc... } // if we got here, it's ok to set dimension geometricDimension = dim; return MB_SUCCESS; }
ErrorCode moab::Core::set_meshset_options | ( | const EntityHandle | ms_handle, |
const unsigned int | options | ||
) | [virtual] |
set the options of a mesh set
Definition at line 3122 of file Core.cpp.
References moab::get_mesh_set(), and MB_ENTITY_NOT_FOUND.
Referenced by main().
{ MeshSet* set = get_mesh_set( sequence_manager(), ms_handle ); if( !set ) return MB_ENTITY_NOT_FOUND; return set->set_flags( setoptions, ms_handle, a_entity_factory() ); }
void moab::Core::set_sequence_multiplier | ( | double | factor | ) | [virtual] |
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.
meshset | User specified multiplier (should be greater than 1.0) |
Definition at line 1069 of file Core.cpp.
{ assert( factor >= 1.0 ); sequenceManager->set_sequence_multiplier( factor ); }
ErrorCode moab::Core::side_element | ( | const EntityHandle | source_entity, |
const int | dim, | ||
const int | side_number, | ||
EntityHandle & | target_entity | ||
) | const [virtual] |
given an entity and a target dimension & side number, get that entity
Definition at line 3051 of file Core.cpp.
References moab::CN::AdjacentSubEntities(), moab::Range::begin(), moab::Range::empty(), moab::Range::insert(), MB_CHK_ERR, MB_ENTITY_NOT_FOUND, MB_FAILURE, MB_INDEX_OUT_OF_RANGE, MB_MULTIPLE_ENTITIES_FOUND, MB_SUCCESS, MBVERTEX, moab::CN::mConnectivityMap, moab::CN::ConnMap::target_type, and moab::TYPE_FROM_HANDLE().
Referenced by moab::HigherOrderFactory::tag_for_deletion().
{ // get a handle on the connectivity const EntityHandle* verts; int num_verts; ErrorCode result = get_connectivity( source_entity, verts, num_verts );MB_CHK_ERR( result ); // special case for vertices if( dim == 0 ) { if( sd_number < num_verts ) { target_entity = verts[sd_number]; return MB_SUCCESS; } else return MB_INDEX_OUT_OF_RANGE; } // get the vertices comprising the target entity Range side_verts, target_ents; const EntityType source_type = TYPE_FROM_HANDLE( source_entity ); // first get the indices std::vector< int > vertex_indices; int temp_result = CN::AdjacentSubEntities( source_type, &sd_number, 1, dim, 0, vertex_indices ); if( 0 != temp_result ) return MB_FAILURE; // now get the actual vertices for( unsigned int i = 0; i < vertex_indices.size(); i++ ) side_verts.insert( verts[vertex_indices[i]] ); // now look for an entity of the correct type // use const_cast here 'cuz we're in a const function and we're passing 'false' for // create_if_missing, so we know we won't change anything result = ( const_cast< Core* >( this ) )->get_adjacencies( side_verts, dim, false, target_ents ); if( MB_SUCCESS != result && MB_MULTIPLE_ENTITIES_FOUND != result ) return result; if( !target_ents.empty() && TYPE_FROM_HANDLE( *( target_ents.begin() ) ) != MBVERTEX && TYPE_FROM_HANDLE( *( target_ents.begin() ) ) != CN::mConnectivityMap[source_type][dim - 1].target_type[sd_number] ) return MB_ENTITY_NOT_FOUND; if( !target_ents.empty() ) target_entity = *( target_ents.begin() ); return result; }
ErrorCode moab::Core::side_number | ( | const EntityHandle | parent, |
const EntityHandle | child, | ||
int & | sd_number, | ||
int & | sense, | ||
int & | offset | ||
) | const [virtual] |
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
Definition at line 2865 of file Core.cpp.
References moab::CN::ConnectivityMatch(), moab::CN::Dimension(), moab::CN::MAX_NODES_PER_ELEMENT, MB_CHK_ERR, MB_ENTITY_NOT_FOUND, MB_FAILURE, MB_NOT_IMPLEMENTED, MB_SUCCESS, MBEDGE, MBPOLYGON, MBPOLYHEDRON, MBVERTEX, moab::CN::SideNumber(), and moab::TYPE_FROM_HANDLE().
{ // get the connectivity of parent and child const EntityHandle *parent_conn = NULL, *child_conn = NULL; int num_parent_vertices = 0, num_child_vertices = 0; ErrorCode result = get_connectivity( parent, parent_conn, num_parent_vertices, true ); if( MB_NOT_IMPLEMENTED == result ) { static std::vector< EntityHandle > tmp_connect( CN::MAX_NODES_PER_ELEMENT ); result = get_connectivity( parent, parent_conn, num_parent_vertices, true, &tmp_connect ); } if( MB_SUCCESS != result ) return result; if( TYPE_FROM_HANDLE( child ) == MBVERTEX ) { int child_index = std::find( parent_conn, parent_conn + num_parent_vertices, child ) - parent_conn; if( child_index == num_parent_vertices ) { sd_number = -1; sense = 0; return MB_FAILURE; } else { sd_number = child_index; sense = 1; return MB_SUCCESS; } } if( TYPE_FROM_HANDLE( parent ) == MBPOLYHEDRON ) { // find the child in the parent_conn connectivity list, and call it a day .. // it should work only for faces within a conn list for( int i = 0; i < num_parent_vertices; i++ ) if( child == parent_conn[i] ) { sd_number = i; sense = 1; // always offset = 0; return MB_SUCCESS; } return MB_FAILURE; } result = get_connectivity( child, child_conn, num_child_vertices, true );MB_CHK_ERR( result ); // call handle vector-based function if( TYPE_FROM_HANDLE( parent ) != MBPOLYGON && TYPE_FROM_HANDLE( parent ) != MBPOLYHEDRON ) { // find indices into parent_conn for each entry in child_conn int child_conn_indices[10]; assert( (unsigned)num_child_vertices <= sizeof( child_conn_indices ) / sizeof( child_conn_indices[0] ) ); for( int i = 0; i < num_child_vertices; ++i ) { child_conn_indices[i] = std::find( parent_conn, parent_conn + num_parent_vertices, child_conn[i] ) - parent_conn; if( child_conn_indices[i] >= num_parent_vertices ) { sd_number = -1; return MB_FAILURE; } } int temp_result = CN::SideNumber( TYPE_FROM_HANDLE( parent ), child_conn_indices, num_child_vertices, CN::Dimension( TYPE_FROM_HANDLE( child ) ), sd_number, sense, offset ); return ( 0 == temp_result ? MB_SUCCESS : MB_FAILURE ); } else if( TYPE_FROM_HANDLE( parent ) == MBPOLYGON ) { // find location of 1st vertex; this works even for padded vertices const EntityHandle* first_v = std::find( parent_conn, parent_conn + num_parent_vertices, child_conn[0] ); if( first_v == parent_conn + num_parent_vertices ) return MB_ENTITY_NOT_FOUND; sd_number = first_v - parent_conn; offset = sd_number; if( TYPE_FROM_HANDLE( child ) == MBVERTEX ) { sense = 0; return MB_SUCCESS; } else if( TYPE_FROM_HANDLE( child ) == MBPOLYGON ) { bool match = CN::ConnectivityMatch( parent_conn, child_conn, num_parent_vertices, sense, offset ); sd_number = 0; if( match ) return MB_SUCCESS; else return MB_ENTITY_NOT_FOUND; } else if( TYPE_FROM_HANDLE( child ) == MBEDGE ) { // determine the actual number of vertices, for the padded case // the padded case could be like ABCDEFFF; num_parent_vertices=8, // actual_num_parent_vertices=6 int actual_num_parent_vertices = num_parent_vertices; while( actual_num_parent_vertices >= 3 && ( parent_conn[actual_num_parent_vertices - 2] == parent_conn[actual_num_parent_vertices - 1] ) ) actual_num_parent_vertices--; if( parent_conn[( sd_number + 1 ) % num_parent_vertices] == child_conn[1] ) sense = 1; else if( parent_conn[( sd_number + num_parent_vertices - 1 ) % num_parent_vertices] == child_conn[1] ) // this will also cover edge AF for padded case, side will // be 0, sense -1 sense = -1; // if edge FA in above example, we should return sd_number = 5, sense 1 else if( ( sd_number == actual_num_parent_vertices - 1 ) && ( child_conn[1] == parent_conn[0] ) ) sense = 1; else return MB_ENTITY_NOT_FOUND; return MB_SUCCESS; } } return MB_FAILURE; }
ErrorCode moab::Core::subtract_meshset | ( | EntityHandle | meshset1, |
const EntityHandle | meshset2 | ||
) | [virtual] |
subtracts meshset2 from meshset1 - modifies meshset1
Definition at line 3160 of file Core.cpp.
References moab::get_mesh_set(), MB_ENTITY_NOT_FOUND, and moab::MeshSet::subtract().
Referenced by test_boolean().
{ MeshSet* set1 = get_mesh_set( sequence_manager(), meshset1 ); MeshSet* set2 = get_mesh_set( sequence_manager(), meshset2 ); if( !set1 || !set2 ) return MB_ENTITY_NOT_FOUND; return set1->subtract( set2, meshset1, a_entity_factory() ); }
ErrorCode moab::Core::tag_clear_data | ( | Tag | tag_handle, |
const Range & | entity_handles, | ||
const void * | value, | ||
int | value_size = 0 |
||
) | [virtual] |
Set tag data given value.
set the data for given EntityHandles and Tag
For a tag, set the values for a list of passed entity handles to the same, specified value.
tag_handle | The tag |
entity_handles | The entity handles for which to set tag values. |
tag_data | A pointer to the tag value. |
tag_sizes | For variable-length tags, the lenght of the tag value. This argument will be ignored for fixed-length tags. |
Definition at line 2133 of file Core.cpp.
References moab::TagInfo::clear_data(), moab::TagInfo::get_data_type(), and moab::TagInfo::size_from_data_type().
{ assert( valid_tag_handle( tag_handle ) ); return tag_handle->clear_data( sequenceManager, mError, entity_handles, tag_data, tag_size * TagInfo::size_from_data_type( tag_handle->get_data_type() ) ); }
ErrorCode moab::Core::tag_clear_data | ( | Tag | tag_handle, |
const EntityHandle * | entity_handles, | ||
int | num_entity_handles, | ||
const void * | value, | ||
int | value_size = 0 |
||
) | [virtual] |
Set tag data given value.
set the data for given EntityHandles and Tag
For a tag, set the values for a list of passed entity handles to the same, specified value.
tag_handle | The tag |
entity_handles | The entity handles for which to set tag values. |
tag_data | A pointer to the tag value. |
tag_sizes | For variable-length tags, the lenght of the tag value. This argument will be ignored for fixed-length tags. |
Definition at line 2123 of file Core.cpp.
References CHECK_MESH_NULL, moab::TagInfo::clear_data(), moab::TagInfo::get_data_type(), and moab::TagInfo::size_from_data_type().
{ assert( valid_tag_handle( tag_handle ) ); CHECK_MESH_NULL return tag_handle->clear_data( sequenceManager, mError, entity_handles, num_entities, tag_data, tag_size * TagInfo::size_from_data_type( tag_handle->get_data_type() ) ); }
ErrorCode moab::Core::tag_delete | ( | Tag | tag_handle | ) | [virtual] |
Removes the tag from the database and deletes all of its associated data.
removes the tag from MB
Definition at line 2329 of file Core.cpp.
References MB_CHK_ERR, MB_SUCCESS, MB_TAG_NOT_FOUND, and moab::TagInfo::release_all_data().
Referenced by moab::HigherOrderFactory::convert_sequence(), moab::WriteUtil::gather_nodes_from_elements(), moab::ReorderTool::handle_order_from_int_tag(), moab::ReorderTool::handle_order_from_sets_and_adj(), main(), MBMesquite::MsqMOAB::tag_delete(), and MBMesquite::MsqMOAB::~MsqMOAB().
{ std::list< TagInfo* >::iterator i = std::find( tagList.begin(), tagList.end(), tag_handle ); if( i == tagList.end() ) return MB_TAG_NOT_FOUND; ErrorCode rval = tag_handle->release_all_data( sequenceManager, mError, true );MB_CHK_ERR( rval ); tagList.erase( i ); delete tag_handle; return MB_SUCCESS; }
ErrorCode moab::Core::tag_delete_data | ( | Tag | tag_handle, |
const EntityHandle * | entity_handles, | ||
int | num_handles | ||
) | [virtual] |
Delete the data of a vector of entity handles and sparse tag.
removes the tag from the entity
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.
tag_handle | Handle of the (sparse) tag being deleted from entity |
entity_handles | 1d vector of entity handles from which the tag is being deleted |
num_handles | Number of entity handles in 1d vector |
Definition at line 2314 of file Core.cpp.
References CHECK_MESH_NULL, and moab::TagInfo::remove_data().
Referenced by moab::ReorderTool::reorder_tag_data().
{ assert( valid_tag_handle( tag_handle ) ); CHECK_MESH_NULL return tag_handle->remove_data( sequenceManager, mError, entity_handles, num_entities ); }
ErrorCode moab::Core::tag_delete_data | ( | Tag | tag_handle, |
const Range & | entity_range | ||
) | [virtual] |
Delete the data of a range of entity handles and sparse tag.
removes the tag from the entity
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.
tag_handle | Handle of the (sparse) tag being deleted from entity |
entity_range | Range of entities from which the tag is being deleted |
Definition at line 2322 of file Core.cpp.
References moab::TagInfo::remove_data().
{ assert( valid_tag_handle( tag_handle ) ); return tag_handle->remove_data( sequenceManager, mError, entity_handles ); }
ErrorCode moab::Core::tag_get_by_ptr | ( | const Tag | tag_handle, |
const EntityHandle * | entity_handles, | ||
int | num_entities, | ||
const void ** | tag_data, | ||
int * | tag_sizes = 0 |
||
) | const [virtual] |
Get pointers to tag data.
return the tag data for a given EntityHandle and Tag
For a tag, get the values for a list of passed entity handles.
tag_handle | The tag |
entity_handles | An array of entity handles for which to retreive tag values. |
num_entities | The length of the 'entity_handles' array. |
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. |
tag_sizes | The length of each tag value. Optional for fixed-length tags. Required for variable-length tags. |
Definition at line 2056 of file Core.cpp.
References CHECK_MESH_NULL, moab::TagInfo::get_data(), moab::TagInfo::get_data_type(), and moab::TagInfo::size_from_data_type().
Referenced by check_varlen_tag(), moab::ReorderTool::reorder_tag_data(), and test_spectral_hex().
{ assert( valid_tag_handle( tag_handle ) ); CHECK_MESH_NULL ErrorCode result = tag_handle->get_data( sequenceManager, mError, entity_handles, num_entities, tag_data, tag_sizes ); int typesize = TagInfo::size_from_data_type( tag_handle->get_data_type() ); if( tag_sizes && typesize != 1 ) for( int i = 0; i < num_entities; ++i ) tag_sizes[i] /= typesize; return result; }
ErrorCode moab::Core::tag_get_by_ptr | ( | const Tag | tag_handle, |
const Range & | entity_handles, | ||
const void ** | tag_data, | ||
int * | tag_sizes = 0 |
||
) | const [virtual] |
Get pointers to tag data.
return the tag data for a given EntityHandle and Tag
For a tag, get the values for a list of passed entity handles.
tag_handle | The tag |
entity_handles | The entity handles for which to retreive tag values. |
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. |
tag_sizes | The length of each tag value. Optional for fixed-length tags. Required for variable-length tags. |
Definition at line 2071 of file Core.cpp.
References moab::TagInfo::get_data(), moab::TagInfo::get_data_type(), moab::Range::size(), and moab::TagInfo::size_from_data_type().
{ assert( valid_tag_handle( tag_handle ) ); ErrorCode result = tag_handle->get_data( sequenceManager, mError, entity_handles, tag_data, tag_sizes ); int typesize = TagInfo::size_from_data_type( tag_handle->get_data_type() ); if( tag_sizes && typesize != 1 ) { int num_entities = entity_handles.size(); for( int i = 0; i < num_entities; ++i ) tag_sizes[i] /= typesize; } return result; }
ErrorCode moab::Core::tag_get_bytes | ( | const Tag | tag, |
int & | bytes_per_tag | ||
) | const [virtual] |
Get the size of the specified tag in bytes.
get size of tag in bytes
Definition at line 2365 of file Core.cpp.
References moab::TagInfo::get_size(), moab::TagInfo::get_storage_type(), MB_SUCCESS, MB_TAG_BIT, MB_TAG_NOT_FOUND, MB_VARIABLE_DATA_LENGTH, MB_VARIABLE_LENGTH, and moab::TagInfo::variable_length().
Referenced by main(), moab::ParCommGraph::receive_tag_values(), moab::ReorderTool::reorder_tag_data(), moab::ParCommGraph::send_tag_values(), and test_save().
{ if( !valid_tag_handle( tag_handle ) ) return MB_TAG_NOT_FOUND; if( tag_handle->variable_length() ) { tag_size = MB_VARIABLE_LENGTH; return MB_VARIABLE_DATA_LENGTH; } else if( tag_handle->get_storage_type() == MB_TAG_BIT ) { tag_size = 1; return MB_SUCCESS; } else { tag_size = tag_handle->get_size(); return MB_SUCCESS; } }
ErrorCode moab::Core::tag_get_data | ( | const Tag | tag_handle, |
const EntityHandle * | entity_handles, | ||
const int | num_entities, | ||
void * | tag_data | ||
) | const [virtual] |
return the tag data for a given EntityHandle and Tag
Definition at line 2024 of file Core.cpp.
References CHECK_MESH_NULL, and moab::TagInfo::get_data().
Referenced by check_bit_tag(), check_handle_tag(), check_meshset_common(), check_node_coords(), check_order(), check_order_by_sets_and_adj(), check_quad_conn(), check_varlen_tag(), moab::ParCommGraph::compute_partition(), moab::HigherOrderFactory::convert_sequence(), dot_nodes(), dot_write_id_nodes(), moab::WriteUtil::gather_nodes_from_elements(), moab::WriteUtil::get_adjacencies(), moab::WriteUtil::get_element_connect(), MBMesquite::MsqMOAB::get_flag_data(), moab::ReorderTool::get_new_handles(), moab::ReorderTool::get_reordered_handles(), moab::ReorderTool::handle_order_from_int_tag(), hcFilter(), moab::ReorderTool::int_order_from_sets_and_adj(), laplacianFilter(), main(), perform_laplacian_smoothing(), moab::ParCommGraph::receive_tag_values(), moab::ReorderTool::reorder_tag_data(), report_sets(), moab::ParCommGraph::send_tag_values(), MBMesquite::MsqMOAB::tag_get_data(), test_leaf_merge(), test_sets_fileids(), test_spectral_hex(), MBMesquite::MsqMOAB::vertex_get_byte(), and MBMesquite::MsqMOAB::vertices_get_byte().
{ assert( valid_tag_handle( tag_handle ) ); CHECK_MESH_NULL return tag_handle->get_data( sequenceManager, mError, entity_handles, num_entities, tag_data ); }
ErrorCode moab::Core::tag_get_data | ( | const Tag | tag_handle, |
const Range & | entity_handles, | ||
void * | tag_data | ||
) | const [virtual] |
return the tag data for a given EntityHandle and Tag
Definition at line 2033 of file Core.cpp.
References moab::TagInfo::get_data().
{ assert( valid_tag_handle( tag_handle ) ); return tag_handle->get_data( sequenceManager, mError, entity_handles, tag_data ); }
ErrorCode moab::Core::tag_get_data_type | ( | const Tag | tag, |
DataType & | type | ||
) | const [virtual] |
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.
tag | The tag |
type | The type of the specified tag (output). |
Definition at line 2403 of file Core.cpp.
References moab::TagInfo::get_data_type(), MB_SUCCESS, and MB_TAG_NOT_FOUND.
Referenced by MBMesquite::MsqMOAB::check_valid_flag_tag(), MBMesquite::MsqMOAB::init_active_mesh(), main(), moab::ReorderTool::reorder_tag_data(), and MBMesquite::MsqMOAB::tag_properties().
{ if( !valid_tag_handle( handle ) ) return MB_TAG_NOT_FOUND; data_type = handle->get_data_type(); return MB_SUCCESS; }
ErrorCode moab::Core::tag_get_default_value | ( | const Tag | tag, |
void * | def_val | ||
) | const [virtual] |
Get the default value of the specified tag.
get default value of the tag
Definition at line 2412 of file Core.cpp.
References moab::TagInfo::get_default_value(), moab::TagInfo::get_default_value_size(), MB_ENTITY_NOT_FOUND, MB_SUCCESS, MB_TAG_NOT_FOUND, MB_VARIABLE_DATA_LENGTH, and moab::TagInfo::variable_length().
Referenced by moab::ReorderTool::reorder_entities().
{ if( !valid_tag_handle( tag_handle ) ) return MB_TAG_NOT_FOUND; if( tag_handle->variable_length() ) return MB_VARIABLE_DATA_LENGTH; if( !tag_handle->get_default_value() ) return MB_ENTITY_NOT_FOUND; memcpy( def_value, tag_handle->get_default_value(), tag_handle->get_default_value_size() ); return MB_SUCCESS; }
ErrorCode moab::Core::tag_get_default_value | ( | Tag | tag, |
const void *& | def_val, | ||
int & | size | ||
) | const [virtual] |
Definition at line 2424 of file Core.cpp.
References moab::TagInfo::get_data_type(), moab::TagInfo::get_default_value(), moab::TagInfo::get_default_value_size(), MB_ENTITY_NOT_FOUND, MB_SUCCESS, and moab::TagInfo::size_from_data_type().
{ if( !valid_tag_handle( tag ) ) return MB_ENTITY_NOT_FOUND; if( !tag->get_default_value() ) return MB_ENTITY_NOT_FOUND; ptr = tag->get_default_value(); size = tag->get_default_value_size() / TagInfo::size_from_data_type( tag->get_data_type() ); return MB_SUCCESS; }
ErrorCode moab::Core::tag_get_handle | ( | const char * | name, |
int | size, | ||
DataType | type, | ||
Tag & | tag_handle, | ||
unsigned | flags = 0 , |
||
const void * | default_value = 0 , |
||
bool * | created = 0 |
||
) | [virtual] |
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 flags
should contain exactly one of MB_TAG_SPARSE
, MB_TAG_DENSE
, MB_TAG_MESH
unless type
is MB_TYPE_BIT, which implies MB_TAG_BIT
storage.
name | The tag name |
size | Tag size as number of values of of data type per entity (or number of bytes if MB_TAG_BYTES is passed in flags). If 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. |
type | The type of the data (used for IO) |
tag_handle | Output: the resulting tag handle. |
flags | Bitwise OR of values from TagType |
default_value | Optional default value for tag. |
created | Optional returned boolean indicating that the tag was created. |
MB_ALREADY_ALLOCATED
if tag exists and MB_TAG_EXCL
is specified, or default values do not match (and MB_TAG_ANY
or MB_TAG_DFTOK
not specified).MB_TAG_NOT_FOUND
if tag does not exist and MB_TAG_CREAT
is not specifiedMB_INVALID_SIZE
if tag value size is not a multiple of the size of the data type (and MB_TAG_ANY
not specified).MB_TYPE_OUT_OF_RANGE
invalid or inconsistent parameterMB_VARIABLE_DATA_LENGTH
if MB_TAG_VARLEN
and default_value
is non-null and default_value_size
is not specified. Definition at line 2149 of file Core.cpp.
References moab::BitTag::create_tag(), moab::DenseTag::create_tag(), moab::VarLenDenseTag::create_tag(), moab::TagInfo::equals_default_value(), moab::TagInfo::get_data_type(), moab::TagInfo::get_default_value(), moab::TagInfo::get_size(), moab::TagInfo::get_storage_type(), moab::is_zero_bytes(), MB_ALREADY_ALLOCATED, MB_INVALID_SIZE, MB_SUCCESS, MB_TAG_ANY, MB_TAG_BIT, MB_TAG_BYTES, MB_TAG_CREAT, MB_TAG_DENSE, MB_TAG_DFTOK, MB_TAG_EXCL, MB_TAG_MESH, MB_TAG_NOOPQ, MB_TAG_NOT_FOUND, MB_TAG_SPARSE, MB_TAG_STORE, MB_TAG_VARLEN, MB_TYPE_BIT, MB_TYPE_OPAQUE, MB_TYPE_OUT_OF_RANGE, MB_VARIABLE_LENGTH, size, moab::TagInfo::size_from_data_type(), and moab::TagInfo::variable_length().
Referenced by build_mesh(), check_bit_tag(), check_handle_tag(), check_meshset_common(), check_node_coords(), check_order(), check_quad_conn(), check_varlen_tag(), moab::ParCommGraph::compute_partition(), moab::HigherOrderFactory::convert_sequence(), moab::ReadUtil::create_gather_set(), moab::NestedRefine::create_hm_storage_single_level(), create_parallel_mesh(), moab::WriteUtil::gather_nodes_from_elements(), moab::NestedRefine::generate_hm(), moab::ReadUtil::get_gather_set(), get_imesh_mesh(), moab::ReorderTool::handle_order_from_int_tag(), moab::ReorderTool::handle_order_from_sets_and_adj(), MBMesquite::MsqMOAB::init_active_mesh(), moab::ReadParallel::load_file(), main(), mb_memory_use_test(), obbvis_create(), perform_laplacian_smoothing(), moab::ParCommGraph::receive_tag_values(), regression_one_entity_by_var_tag(), regression_tag_on_nonexistent_entity(), report_sets(), moab::ParCommGraph::send_tag_values(), MBMesquite::MsqMOAB::tag_create(), MBMesquite::MsqMOAB::tag_get(), test_linear_tet(), test_meshset_tags_1(), test_meshset_tags_2(), test_read_fgh(), test_sets_fileids(), test_spectral_hex(), test_tet_tags_1(), test_tet_tags_2(), test_tree_readwrite(), test_triangles_tags_1(), test_triangles_tags_2(), test_write_dense_tags(), moab::NestedRefine::update_special_tags(), update_tracer(), and write_tree_blocks().
{ if( created ) *created = false; // we always work with sizes in bytes internally if( !( ( flags & MB_TAG_VARLEN ) && size == MB_VARIABLE_LENGTH ) ) { if( flags & MB_TAG_BYTES ) { if( size % TagInfo::size_from_data_type( data_type ) ) return MB_INVALID_SIZE; } else { size *= TagInfo::size_from_data_type( data_type ); } } const TagType storage = static_cast< TagType >( flags & 3 ); // search for an existing tag tag_handle = 0; if( name && *name ) { // not anonymous tag for( std::list< Tag >::iterator i = tagList.begin(); i != tagList.end(); ++i ) { if( ( *i )->get_name() == name ) { tag_handle = *i; break; } } } if( tag_handle ) { if( flags & MB_TAG_EXCL ) return MB_ALREADY_ALLOCATED; // user asked that we not check anything if( flags & MB_TAG_ANY ) return MB_SUCCESS; // user asked that we also match storage types if( ( flags & MB_TAG_STORE ) && tag_handle->get_storage_type() != storage ) return MB_TYPE_OUT_OF_RANGE; // check if data type matches const DataType extype = tag_handle->get_data_type(); if( extype != data_type ) { if( flags & MB_TAG_NOOPQ ) return MB_TYPE_OUT_OF_RANGE; else if( extype != MB_TYPE_OPAQUE && data_type != MB_TYPE_OPAQUE ) return MB_TYPE_OUT_OF_RANGE; } // Require that the size value be zero or MB_VARIABLE_LENGTH // for variable length tags. The caller passing such a size // value is sufficient to indicate that the caller is aware // that it is requesting a variable-length tag, so no need // to also require/check the MB_TAG_VARLEN bit in the flags. if( tag_handle->variable_length() ) { if( size != 0 && size != MB_VARIABLE_LENGTH && !( flags & MB_TAG_VARLEN ) ) return MB_INVALID_SIZE; } // But /do/ fail if MB_TAG_VARLEN flag is set and tag is // not variable length. else if( flags & MB_TAG_VARLEN ) return MB_TYPE_OUT_OF_RANGE; // check size for fixed-length tag else if( tag_handle->get_size() != size ) return MB_INVALID_SIZE; // If user passed a default value, check that it matches. // If user did not pass a default value, assume they're OK // with the existing one. // If tag does not have a default value but the user passed // one, allow it only if the tag is dense and the passed value // is all zero bytes because dense tags have an implicit default // value of all zeros in some cases. if( default_value && !( flags & MB_TAG_DFTOK ) && !( tag_handle->equals_default_value( default_value, size ) || ( !tag_handle->get_default_value() && tag_handle->get_storage_type() == MB_TAG_DENSE && is_zero_bytes( default_value, size ) ) ) ) return MB_ALREADY_ALLOCATED; return MB_SUCCESS; } // MB_TAG_EXCL implies MB_TAG_CREAT if( !( flags & ( MB_TAG_CREAT | MB_TAG_EXCL ) ) ) return MB_TAG_NOT_FOUND; // if a non-opaque non-bit type was specified, then the size // must be multiple of the size of the type if( ( !( flags & MB_TAG_VARLEN ) || default_value ) && ( size <= 0 || ( size % TagInfo::size_from_data_type( data_type ) ) != 0 ) ) return MB_INVALID_SIZE; // if MB_TYPE_BIT may be used only with MB_TAG_BIT // if (storage != MB_TAG_BIT && data_type == MB_TYPE_BIT) // return MB_INVALID_ARG; if( data_type == MB_TYPE_BIT ) flags &= ~(unsigned)( MB_TAG_DENSE | MB_TAG_SPARSE ); // create the tag switch( flags & ( MB_TAG_DENSE | MB_TAG_SPARSE | MB_TAG_MESH | MB_TAG_VARLEN ) ) { case MB_TAG_DENSE | MB_TAG_VARLEN: tag_handle = VarLenDenseTag::create_tag( sequenceManager, mError, name, data_type, default_value, size ); break; case MB_TAG_DENSE: tag_handle = DenseTag::create_tag( sequenceManager, mError, name, size, data_type, default_value ); break; case MB_TAG_SPARSE | MB_TAG_VARLEN: tag_handle = new VarLenSparseTag( name, data_type, default_value, size ); break; case MB_TAG_SPARSE: tag_handle = new SparseTag( name, size, data_type, default_value ); break; case MB_TAG_MESH | MB_TAG_VARLEN: tag_handle = new MeshTag( name, MB_VARIABLE_LENGTH, data_type, default_value, size ); break; case MB_TAG_MESH: tag_handle = new MeshTag( name, size, data_type, default_value, size ); break; case MB_TAG_BIT: if( MB_TYPE_BIT != data_type && MB_TYPE_OPAQUE != data_type ) return MB_TYPE_OUT_OF_RANGE; tag_handle = BitTag::create_tag( name, size, default_value ); break; default: // some illegal combination (multiple storage types, variable-length bit tag, etc.) return MB_TYPE_OUT_OF_RANGE; } if( !tag_handle ) return MB_INVALID_SIZE; if( created ) *created = true; tagList.push_back( tag_handle ); return MB_SUCCESS; }
ErrorCode moab::Core::tag_get_handle | ( | const char * | name, |
int | size, | ||
DataType | type, | ||
Tag & | tag_handle, | ||
unsigned | flags = 0 , |
||
const void * | default_value = 0 |
||
) | const [virtual] |
same as non-const version, except that TAG_CREAT flag is ignored.
Definition at line 2283 of file Core.cpp.
References MB_ALREADY_ALLOCATED, MB_TAG_CREAT, MB_TAG_EXCL, and MB_TAG_NOT_FOUND.
{ // If caller specified MB_TAG_EXCL, then we must fail because // this const function can never create a tag. We need to test // this here because the non-const version of this function // assumes MB_TAG_CREAT if MB_TAG_EXCL is specified. if( flags & MB_TAG_EXCL ) { // anonymous tag? if( !name || !*name ) return MB_TAG_NOT_FOUND; // search for an existing tag tag_handle = 0; for( std::list< Tag >::const_iterator i = tagList.begin(); i != tagList.end(); ++i ) { if( ( *i )->get_name() == name ) { tag_handle = *i; return MB_ALREADY_ALLOCATED; } } return MB_TAG_NOT_FOUND; } return const_cast< Core* >( this )->tag_get_handle( name, size, data_type, tag_handle, flags & ~(unsigned)MB_TAG_CREAT, default_value ); }
ErrorCode moab::Core::tag_get_handle | ( | const char * | tag_name, |
Tag & | tag_handle | ||
) | const [virtual] |
Gets the tag handle corresponding to a name.
If a tag of that name does not exist, returns MB_TAG_NOT_FOUND
tag_name | Name of the desired tag. |
tag_handle | Tag handle corresponding to tag_name |
Definition at line 2359 of file Core.cpp.
References MB_TAG_ANY, and MB_TYPE_OPAQUE.
{ return tag_get_handle( tag_name, 0, MB_TYPE_OPAQUE, tag_handle, MB_TAG_ANY ); }
ErrorCode moab::Core::tag_get_length | ( | const Tag | tag, |
int & | length | ||
) | const [virtual] |
Get the array length of a tag.
get size of tag in $values
Definition at line 2387 of file Core.cpp.
References moab::TagInfo::get_data_type(), moab::TagInfo::get_size(), MB_SUCCESS, MB_TAG_NOT_FOUND, MB_VARIABLE_DATA_LENGTH, MB_VARIABLE_LENGTH, moab::TagInfo::size_from_data_type(), and moab::TagInfo::variable_length().
Referenced by MBMesquite::MsqMOAB::check_valid_flag_tag(), moab::WriteUtil::get_tag_list(), MBMesquite::MsqMOAB::init_active_mesh(), main(), moab::ParCommGraph::receive_tag_values(), moab::ParCommGraph::send_tag_values(), MBMesquite::MsqMOAB::tag_properties(), and MBMesquite::MsqMOAB::tag_set_data().
{ if( !valid_tag_handle( tag_handle ) ) return MB_TAG_NOT_FOUND; if( tag_handle->variable_length() ) { tag_size = MB_VARIABLE_LENGTH; return MB_VARIABLE_DATA_LENGTH; } else { tag_size = tag_handle->get_size() / TagInfo::size_from_data_type( tag_handle->get_data_type() ); return MB_SUCCESS; } }
ErrorCode moab::Core::tag_get_name | ( | const Tag | tag_handle, |
std::string & | tag_name | ||
) | const [virtual] |
Gets the tag name string of the tag_handle.
gets the tag name string for the tag_handle
tag_handle | Tag you want the name of. |
tag_name | Name string of tag_handle. |
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
Definition at line 2352 of file Core.cpp.
References moab::TagInfo::get_name(), MB_SUCCESS, and MB_TAG_NOT_FOUND.
Referenced by MBMesquite::MsqMOAB::check_valid_flag_tag(), gather_tag_counts(), moab::WriteUtil::get_tag_list(), and MBMesquite::MsqMOAB::tag_properties().
{ if( !valid_tag_handle( tag_handle ) ) return MB_TAG_NOT_FOUND; tag_name = tag_handle->get_name(); return MB_SUCCESS; }
ErrorCode moab::Core::tag_get_tags | ( | std::vector< Tag > & | tag_handles | ) | const [virtual] |
get handles for all tags defined
Definition at line 2444 of file Core.cpp.
References MB_SUCCESS.
Referenced by gather_tag_counts(), moab::WriteUtil::get_tag_list(), and moab::ReorderTool::reorder_entities().
{ std::copy( tagList.begin(), tagList.end(), std::back_inserter( tag_handles ) ); return MB_SUCCESS; }
ErrorCode moab::Core::tag_get_tags_on_entity | ( | const EntityHandle | entity, |
std::vector< Tag > & | tag_handles | ||
) | const [virtual] |
Get handles for all tags defined on this entity.
Definition at line 2451 of file Core.cpp.
References MB_SUCCESS.
{ for( std::list< TagInfo* >::const_iterator i = tagList.begin(); i != tagList.end(); ++i ) if( ( *i )->is_tagged( sequenceManager, entity ) ) tag_handles.push_back( *i ); return MB_SUCCESS; }
ErrorCode moab::Core::tag_get_type | ( | const Tag | tag_handle, |
TagType & | tag_type | ||
) | const [virtual] |
get type of tag (sparse, dense, etc.; 0 = dense, 1 = sparse, 2 = bit, 3 = mesh)
get type of tag (sparse, dense, etc.; 0 = dense, 1 = sparse, 2 = bit, 3 = static)
Definition at line 2436 of file Core.cpp.
References moab::TagInfo::get_storage_type(), and MB_SUCCESS.
Referenced by test_write_dense_tags().
{ assert( valid_tag_handle( tag_handle ) ); tag_type = tag_handle->get_storage_type(); return MB_SUCCESS; }
ErrorCode moab::Core::tag_iterate | ( | Tag | tag_handle, |
Range::const_iterator | begin, | ||
Range::const_iterator | end, | ||
int & | count, | ||
void *& | data_ptr, | ||
bool | allocate = true |
||
) | [virtual] |
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.
tag_handle | The handle of the tag for which to access data |
iter | The first entity for which to return data. |
end | One past the last entity for which data is desired. |
count | The number of entities for which data was returned |
data_ptr | Output: pointer to tag storage. |
allocate | If true, space for this tag will be allocated, if not it wont |
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.
:
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; } *
Definition at line 2341 of file Core.cpp.
References init(), MB_SUCCESS, and moab::TagInfo::tag_iterate().
{ Range::const_iterator init = iter; assert( valid_tag_handle( tag_handle ) ); ErrorCode result = tag_handle->tag_iterate( sequenceManager, mError, iter, end, data_ptr, allocate ); if( MB_SUCCESS == result ) count = iter - init; return result; }
ErrorCode moab::Core::tag_set_by_ptr | ( | Tag | tag_handle, |
const EntityHandle * | entity_handles, | ||
int | num_entities, | ||
void const *const * | tag_data, | ||
const int * | tag_sizes = 0 |
||
) | [virtual] |
Set tag data given an array of pointers to tag values.
set the data for given EntityHandles and Tag
For a tag, set the values for a list of passed entity handles.
tag_handle | The tag |
entity_handles | An array of entity handles for which to set tag values. |
num_entities | The length of the 'entity_handles' array. |
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'. |
tag_sizes | The length of each tag value. Optional for fixed-length tags. Required for variable-length tags. |
Definition at line 2087 of file Core.cpp.
References CHECK_MESH_NULL, moab::TagInfo::get_data_type(), moab::TagInfo::set_data(), and moab::TagInfo::size_from_data_type().
Referenced by build_mesh(), regression_one_entity_by_var_tag(), regression_tag_on_nonexistent_entity(), and moab::ReorderTool::reorder_tag_data().
{ assert( valid_tag_handle( tag_handle ) ); CHECK_MESH_NULL std::vector< int > tmp_sizes; int typesize = TagInfo::size_from_data_type( tag_handle->get_data_type() ); if( typesize != 1 && tag_sizes ) { tmp_sizes.resize( num_entities ); for( int i = 0; i < num_entities; ++i ) tmp_sizes[i] = tag_sizes[i] * typesize; tag_sizes = &tmp_sizes[0]; } return tag_handle->set_data( sequenceManager, mError, entity_handles, num_entities, tag_data, tag_sizes ); }
ErrorCode moab::Core::tag_set_by_ptr | ( | Tag | tag_handle, |
const Range & | entity_handles, | ||
void const *const * | tag_data, | ||
const int * | tag_sizes = 0 |
||
) | [virtual] |
Set tag data given an array of pointers to tag values.
set the data for given EntityHandles and Tag
For a tag, set the values for a list of passed entity handles.
tag_handle | The tag |
entity_handles | The entity handles for which to set tag values. |
tag_data | An array of 'const void*'. Array is expected to contain pointers to tag values for the corresponding EntityHandle in 'entity_handles'. |
tag_sizes | The length of each tag value. Optional for fixed-length tags. Required for variable-length tags. |
Definition at line 2105 of file Core.cpp.
References moab::TagInfo::get_data_type(), moab::TagInfo::set_data(), moab::Range::size(), and moab::TagInfo::size_from_data_type().
{ assert( valid_tag_handle( tag_handle ) ); std::vector< int > tmp_sizes; int typesize = TagInfo::size_from_data_type( tag_handle->get_data_type() ); if( typesize != 1 && tag_sizes ) { int num_entities = entity_handles.size(); tmp_sizes.resize( num_entities ); for( int i = 0; i < num_entities; ++i ) tmp_sizes[i] = tag_sizes[i] * typesize; tag_sizes = &tmp_sizes[0]; } return tag_handle->set_data( sequenceManager, mError, entity_handles, tag_data, tag_sizes ); }
ErrorCode moab::Core::tag_set_data | ( | Tag | tag_handle, |
const EntityHandle * | entity_handles, | ||
int | num_entities, | ||
const void * | tag_data | ||
) | [virtual] |
Sets the data of a given EntityHandle and Tag.
set the data for given EntityHandles and Tag
If the tag_handle and the entity type of entity_handle are not compatible, data of entity_handle never existed and MB_FAILURE is returned.
tag_handle | Tag indicating what data is to be set. |
entity_handle | EntityHandle on which to set tag's data. |
tag_data | Data to set the entity_handle's tag data to. |
int tag_data = 1004; tag_set_data( tag_handle, entity_handle, &tag_data );
Definition at line 2040 of file Core.cpp.
References CHECK_MESH_NULL, and moab::TagInfo::set_data().
Referenced by moab::ReadUtil::assign_ids(), moab::WriteUtil::assign_ids(), build_mesh(), moab::ReadUtil::create_gather_set(), moab::HalfFacetRep::determine_border_vertices(), moab::WriteUtil::gather_nodes_from_elements(), moab::WriteUtil::get_element_connect(), moab::WriteUtil::get_node_coords(), moab::ReorderTool::handle_order_from_int_tag(), moab::ReorderTool::int_order_from_sets_and_adj(), main(), mb_memory_use_test(), obbvis_create(), perform_laplacian_smoothing(), moab::ParCommGraph::receive_tag_values(), regression_tag_on_nonexistent_entity(), moab::HigherOrderFactory::remove_ho_nodes(), moab::ReorderTool::reorder_tag_data(), MBMesquite::MsqMOAB::tag_set_data(), test_filter_pstatus(), test_leaf_merge(), test_linear_tet(), test_write_dense_tags(), MBMesquite::MsqMOAB::vertex_set_byte(), MBMesquite::MsqMOAB::vertices_set_byte(), and write_tree_blocks().
{ assert( valid_tag_handle( tag_handle ) ); CHECK_MESH_NULL return tag_handle->set_data( sequenceManager, mError, entity_handles, num_entities, tag_data ); }
ErrorCode moab::Core::tag_set_data | ( | Tag | tag_handle, |
const Range & | entity_handles, | ||
const void * | tag_data | ||
) | [virtual] |
set the data for given EntityHandles and Tag
Definition at line 2049 of file Core.cpp.
References moab::TagInfo::set_data().
{ assert( valid_tag_handle( tag_handle ) ); return tag_handle->set_data( sequenceManager, mError, entity_handles, tag_data ); }
EntityType moab::Core::type_from_handle | ( | const EntityHandle | handle | ) | const [virtual] |
get the type from a handle, returns type
Definition at line 374 of file Core.cpp.
References MBENTITYSET, and moab::TYPE_FROM_HANDLE().
Referenced by moab::HalfFacetRep::add_cells_of_single_component(), moab::HalfFacetRep::another_halfedge(), moab::NestedRefine::child_to_parent(), moab::HalfFacetRep::collect_and_compare(), moab::NestedRefine::compute_coordinates(), moab::NestedRefine::construct_hm_2D(), moab::NestedRefine::construct_hm_3D(), moab::NestedRefine::create_hm_storage_single_level(), moab::HalfFacetRep::determine_border_vertices(), moab::HalfFacetRep::determine_incident_halfedges(), moab::HalfFacetRep::determine_sibling_halfedges(), moab::HalfFacetRep::determine_sibling_halffaces(), MBMesquite::MsqMOAB::elements_get_topologies(), moab::NestedRefine::estimate_hm_storage(), moab::HalfFacetRep::find_matching_halfedge(), moab::HalfFacetRep::find_matching_halfface(), moab::HalfFacetRep::find_matching_implicit_edge_in_cell(), moab::HalfFacetRep::find_total_edges_2d(), moab::WriteUtil::gather_nodes_from_elements(), moab::NestedRefine::get_connectivity(), moab::HalfFacetRep::get_down_adjacencies_2d(), moab::HalfFacetRep::get_face_edges(), moab::HalfFacetRep::get_half_facet_in_comp(), moab::HalfFacetRep::get_index_in_lmap(), moab::HalfFacetRep::get_neighbor_adjacencies_2d(), moab::HalfFacetRep::get_neighbor_adjacencies_3d(), moab::HalfFacetRep::get_up_adjacencies_2d(), moab::HalfFacetRep::get_up_adjacencies_edg_3d(), moab::HalfFacetRep::get_up_adjacencies_edg_3d_comp(), moab::HalfFacetRep::get_up_adjacencies_face_3d(), moab::HalfFacetRep::get_up_adjacencies_vert_2d(), moab::HalfFacetRep::get_up_adjacencies_vert_3d(), moab::HalfFacetRep::init_surface(), moab::NestedRefine::initialize(), moab::NestedRefine::is_entity_on_boundary(), main(), moab::HalfFacetRep::mark_halfedges(), moab::NestedRefine::parent_to_child(), perform_laplacian_smoothing(), moab::HalfFacetRep::print_tags(), moab::HalfFacetRep::resize_hf_maps(), moab::NestedRefine::update_global_ahf_2D(), moab::NestedRefine::update_global_ahf_2D_sub(), moab::NestedRefine::update_global_ahf_3D(), moab::NestedRefine::update_special_tags(), and moab::NestedRefine::update_tracking_verts().
{ if( !handle ) // root set return MBENTITYSET; else return TYPE_FROM_HANDLE( handle ); }
ErrorCode moab::Core::unite_meshset | ( | EntityHandle | meshset1, |
const EntityHandle | meshset2 | ||
) | [virtual] |
unites meshset2 with meshset1 - modifies meshset1
Definition at line 3178 of file Core.cpp.
References moab::get_mesh_set(), MB_ENTITY_NOT_FOUND, and moab::MeshSet::unite().
Referenced by test_boolean().
{ MeshSet* set1 = get_mesh_set( sequence_manager(), meshset1 ); MeshSet* set2 = get_mesh_set( sequence_manager(), meshset2 ); if( !set1 || !set2 ) return MB_ENTITY_NOT_FOUND; return set1->unite( set2, meshset1, a_entity_factory() ); }
bool moab::Core::valid_tag_handle | ( | const TagInfo * | t | ) | const [inline, private] |
ErrorCode moab::Core::write_file | ( | const char * | file_name, |
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 |
||
) | [virtual] |
Write or export a file.
Definition at line 639 of file Core.cpp.
References write_file().
Referenced by convert_file(), do_test(), main(), obbvis_create(), perform_laplacian_smoothing(), test_read_and_ghost_after(), test_read_with_ghost(), test_read_with_ghost_no_augment(), test_read_with_thin_ghost_layer(), test_sets_fileids(), test_tree_readwrite(), test_write_dense_tags(), and update_tracer().
{ Range range; std::copy( output_sets, output_sets + num_output_sets, range_inserter( range ) ); return write_file( file_name, file_type, options_string, range, tag_list, num_tags ); }
ErrorCode moab::Core::write_file | ( | const char * | file_name, |
const char * | file_type, | ||
const char * | options, | ||
const Range & | output_sets, | ||
const Tag * | tag_list = 0 , |
||
int | num_tags = 0 |
||
) | [virtual] |
Write or export a file
Definition at line 647 of file Core.cpp.
References moab::Range::begin(), DefaultWriterName, moab::Range::end(), moab::ReaderWriterSet::extension_from_filename(), MB_ENTITY_NOT_FOUND, MB_FAILURE, MB_SET_ERR, MB_SET_GLB_ERR, MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MB_UNHANDLED_OPTION, moab::Range::size(), moab::WriteVtk::write_file(), and moab::WriterIface::write_file().
{ // convert range to vector std::vector< EntityHandle > list( output_sets.size() ); std::copy( output_sets.begin(), output_sets.end(), list.begin() ); // parse some options FileOptions opts( options_string ); ErrorCode rval; rval = opts.get_null_option( "CREATE" ); if( rval == MB_TYPE_OUT_OF_RANGE ) { MB_SET_GLB_ERR( MB_FAILURE, "Unexpected value for CREATE option" ); } bool overwrite = ( rval == MB_ENTITY_NOT_FOUND ); // Get the file writer std::string ext = ReaderWriterSet::extension_from_filename( file_name ); std::vector< std::string > qa_records; const EntityHandle* list_ptr = list.empty() ? (EntityHandle*)0 : &list[0]; rval = MB_TYPE_OUT_OF_RANGE; // Try all possible writers for( ReaderWriterSet::iterator i = reader_writer_set()->begin(); i != reader_writer_set()->end(); ++i ) { if( ( file_type && !i->name().compare( file_type ) ) || i->writes_extension( ext.c_str() ) ) { WriterIface* writer = i->make_writer( this ); // write the file rval = writer->write_file( file_name, overwrite, opts, list_ptr, list.size(), qa_records, tag_list, num_tags ); delete writer; if( MB_SUCCESS == rval ) break; printf( "Writer with name %s for file %s using extension %s (file type \"%s\") was " "unsuccessful\n", i->name().c_str(), file_name, ext.c_str(), file_type ); } } if( file_type && rval == MB_TYPE_OUT_OF_RANGE ) { MB_SET_ERR( rval, "Unrecognized file type \"" << file_type << "\"" ); } // Should we use default writer (e.g. HDF5)? else if( MB_SUCCESS != rval ) { DefaultWriter writer( this ); printf( "Using default writer %s for file %s \n", DefaultWriterName, file_name ); rval = writer.write_file( file_name, overwrite, opts, list_ptr, list.size(), qa_records, tag_list, num_tags ); } if( MB_SUCCESS == rval && !opts.all_seen() ) { std::string bad_opt; if( MB_SUCCESS == opts.get_unseen_option( bad_opt ) ) { MB_SET_ERR( MB_UNHANDLED_OPTION, "Unrecognized option: \"" << bad_opt << "\"" ); } else { MB_SET_ERR( MB_UNHANDLED_OPTION, "Unrecognized option" ); } } return MB_SUCCESS; }
ErrorCode moab::Core::write_mesh | ( | const char * | file_name, |
const EntityHandle * | output_list = NULL , |
||
const int | num_sets = 0 |
||
) | [virtual] |
Definition at line 634 of file Core.cpp.
References write_file().
Referenced by main(), and write_tree_blocks().
{ return write_file( file_name, 0, 0, output_list, num_sets ); }
friend class SetIterator [friend] |
AEntityFactory* moab::Core::aEntityFactory [private] |
Definition at line 1174 of file Core.hpp.
Referenced by a_entity_factory().
HalfFacetRep* moab::Core::ahfRep [private] |
Definition at line 1187 of file Core.hpp.
Referenced by a_half_facet_rep().
Tag moab::Core::dirichletBCTag [private] |
Tag moab::Core::geomDimensionTag [private] |
int moab::Core::geometricDimension [private] |
Tag moab::Core::globalIdTag [private] |
bool moab::Core::initErrorHandlerInCore [private] |
Tag moab::Core::materialTag [private] |
Error* moab::Core::mError [private] |
bool moab::Core::mesh_modified [private] |
ReadUtil* moab::Core::mMBReadUtil [private] |
WriteUtil* moab::Core::mMBWriteUtil [private] |
bool moab::Core::mpiFinalize [private] |
Tag moab::Core::neumannBCTag [private] |
ReaderWriterSet* moab::Core::readerWriterSet [private] |
Definition at line 1176 of file Core.hpp.
Referenced by reader_writer_set().
ScdInterface* moab::Core::scdInterface [private] |
SequenceManager* moab::Core::sequenceManager [private] |
Definition at line 1172 of file Core.hpp.
Referenced by sequence_manager().
std::vector< SetIterator* > moab::Core::setIterators [private] |
std::list< TagInfo* > moab::Core::tagList [private] |
tag server for this interface
Definition at line 1166 of file Core.hpp.
Referenced by valid_tag_handle().
int moab::Core::writeMPELog [private] |