#include <WriteUtil.hpp>
Public Member Functions | |
WriteUtil (Core *mdb) | |
Constructor takes Core pointer. More... | |
~WriteUtil () | |
Destructor. More... | |
virtual ErrorCode | check_doesnt_exist (const char *file_name) |
Check if the specified file already exists. Returns MB_SUCCESS if file does not exist, MB_ALREADY_ALLOCATED if file does exist, or MB_FAILURE for some other error condition. More... | |
virtual ErrorCode | gather_entities (Range &all_ents, const EntityHandle *ent_sets=NULL, const int num_sets=0) |
Gather all entities in the mesh, or in the sets specified. More... | |
ErrorCode | get_node_coords (const int num_arrays, const int num_nodes, const Range &entities, Tag node_id_tag, const int start_node_id, std::vector< double * > &arrays) |
Gets arrays for coordinate data from the MB. More... | |
ErrorCode | get_node_coords (const int which_array, Range::const_iterator begin, const Range::const_iterator &end, const size_t output_size, double *const output_array) |
ErrorCode | get_element_connect (const int num_elements, const int verts_per_element, Tag node_id_tag, const Range &entities, Tag element_id_tag, int start_element_id, int *array, bool add_sizes=false) |
ErrorCode | get_element_connect (Range::const_iterator begin, const Range::const_iterator &end, const int vertices_per_elem, Tag node_id_tag, const size_t array_size, int *const element_array, bool add_sizes=false) |
virtual ErrorCode | get_element_connect (Range::const_iterator begin, const Range::const_iterator &end, const int vertices_per_elem, const size_t array_size, EntityHandle *const element_array) |
virtual ErrorCode | get_poly_connect_size (Range::const_iterator begin, const Range::const_iterator &end, int &connectivity_size) |
virtual ErrorCode | get_poly_connect (Range::const_iterator &iter, const Range::const_iterator &end, const Tag node_id_tag, size_t &handle_array_len, int *const handle_array, size_t &index_array_len, int *const index_array, int &index_offset) |
ErrorCode | gather_nodes_from_elements (const Range &elements, const Tag node_bit_mark_tag, Range &nodes) |
Get a set of nodes that represent a set of elements. More... | |
ErrorCode | assign_ids (Range &elements, Tag id_tag, const int start_id) |
Assign ids to input elements starting with start_id, written to id_tag if zero, assigns to GLOBAL_ID_TAG_NAME. More... | |
ErrorCode | get_adjacencies (EntityHandle entity, Tag id_tag, std::vector< int > &adj) |
ErrorCode | get_adjacencies (EntityHandle entity, const EntityHandle *&adj_array, int &num_adj) |
virtual ErrorCode | get_tag_list (std::vector< Tag > &result_list, const Tag *user_tag_list=0, int user_tag_list_length=0, bool include_variable_length_tags=true) |
Get list of tags to write. More... | |
virtual ErrorCode | get_entity_list_pointers (Range::const_iterator query_begin, Range::const_iterator query_end, EntityHandle const **output_pointer_array, EntityListType relation=CONTENTS, int *lengths=0, unsigned char *flags=0) |
virtual ErrorCode | get_entity_list_pointers (EntityHandle const *entities, int num_entities, EntityHandle const **output_pointer_array, EntityListType relation=CONTENTS, int *lengths=0, unsigned char *flags=0) |
Public Member Functions inherited from moab::WriteUtilIface | |
WriteUtilIface () | |
Constructor. More... | |
virtual | ~WriteUtilIface () |
Destructor. More... | |
Private Attributes | |
Core * | mMB |
Pointer to the Core. More... | |
Additional Inherited Members | |
Public Types inherited from moab::WriteUtilIface | |
enum | EntityListType { CONTENTS = 0 , CHILDREN = 1 , PARENTS = 2 , TOPOLOGICAL = 1 } |
Static Public Member Functions inherited from moab::WriteUtilIface | |
template<typename T > | |
static void | reorder (const int *order, T *conn, int num_elem, int node_per_elem) |
Re-order outgoing element connectivity. More... | |
Definition at line 30 of file WriteUtil.hpp.
moab::WriteUtil::WriteUtil | ( | Core * | mdb | ) |
|
inline |
Assign ids to input elements starting with start_id, written to id_tag if zero, assigns to GLOBAL_ID_TAG_NAME.
Implements moab::WriteUtilIface.
Definition at line 654 of file WriteUtil.cpp.
References moab::Range::begin(), moab::Range::end(), ErrorCode, moab::Core::globalId_tag(), MB_SUCCESS, mMB, and moab::Core::tag_set_data().
|
virtual |
Check if the specified file already exists. Returns MB_SUCCESS if file does not exist, MB_ALREADY_ALLOCATED if file does exist, or MB_FAILURE for some other error condition.
Implements moab::WriteUtilIface.
Definition at line 51 of file WriteUtil.cpp.
References MB_ALREADY_ALLOCATED, MB_SET_ERR, and MB_SUCCESS.
|
virtual |
Gather all entities in the mesh, or in the sets specified.
all_ents | range in which entities are returned |
ent_sets | entity sets whose contents are to be gathered |
num_sets | number of sets in list |
Implements moab::WriteUtilIface.
Definition at line 65 of file WriteUtil.cpp.
References ErrorCode, moab::Core::get_entities_by_handle(), MB_SUCCESS, and mMB.
|
virtual |
Get a set of nodes that represent a set of elements.
Implements moab::WriteUtilIface.
Definition at line 515 of file WriteUtil.cpp.
References moab::Range::back(), moab::Range::begin(), moab::Range::empty(), moab::Range::end(), moab::EntitySequence::end_handle(), ErrorCode, moab::Range::front(), moab::Core::get_connectivity(), moab::ElementSequence::get_connectivity(), moab::ElementSequence::get_connectivity_array(), moab::RangeSeqIntersectIter::get_end_handle(), moab::RangeSeqIntersectIter::get_sequence(), moab::RangeSeqIntersectIter::get_start_handle(), moab::RangeSeqIntersectIter::init(), moab::Range::insert(), MB_ENTITY_NOT_FOUND, MB_SUCCESS, MB_TAG_CREAT, MB_TYPE_BIT, MB_TYPE_OUT_OF_RANGE, MBENTITYSET, MBPOLYHEDRON, MBVERTEX, mMB, moab::ElementSequence::nodes_per_element(), moab::Core::sequence_manager(), moab::EntitySequence::start_handle(), moab::RangeSeqIntersectIter::step(), moab::Core::tag_delete(), moab::Core::tag_get_data(), moab::Core::tag_get_handle(), moab::Core::tag_set_data(), moab::Core::type_from_handle(), and moab::TYPE_FROM_HANDLE().
|
virtual |
Implements moab::WriteUtilIface.
Definition at line 709 of file WriteUtil.cpp.
References moab::Core::a_entity_factory(), moab::AEntityFactory::get_adjacencies(), and mMB.
|
virtual |
Get explicit adjacencies
Get explicit adjacences stored in database. Does not create any explicit adjacencies or search for implicit ones.
entity | The entity to retrieve adjacencies for. |
id_tag | The global ID tag |
adj | The output list of global IDs of adjacent entities. |
Implements moab::WriteUtilIface.
Definition at line 677 of file WriteUtil.cpp.
References moab::Core::a_entity_factory(), ErrorCode, moab::AEntityFactory::get_adjacencies(), MB_SUCCESS, MBENTITYSET, mMB, moab::Core::tag_get_data(), and moab::TYPE_FROM_HANDLE().
|
virtual |
Get connectivity for elements
Get the connectivity list for a range of elements.
num_elements | Number of elements for which connectivity is needed |
vertices_per_elem | Number of vertices to retrieve for each element. |
node_id_tag | A tag with integer values. |
entities | Entities being queried |
element_id_tag | If non-zero, elements are tagged with an id starting at start_element_id |
start_element_id | Starting id value for element_id_tag |
add_sizes | If true, writes size of connect array before connectivity in array |
Implements moab::WriteUtilIface.
Definition at line 215 of file WriteUtil.cpp.
References moab::Range::begin(), moab::TypeSequenceManager::begin(), moab::Range::empty(), moab::Range::end(), moab::TypeSequenceManager::end(), moab::SequenceManager::entity_map(), moab::ElementSequence::get_connectivity_array(), MB_SUCCESS, mMB, moab::ElementSequence::nodes_per_element(), moab::Core::sequence_manager(), moab::Core::tag_get_data(), moab::Core::tag_set_data(), and moab::TYPE_FROM_HANDLE().
|
virtual |
Get connectivity for elements
Get the connectivity list for a range of elements.
Failure cases:
begin == end
).vertices_per_elem
is less than oneelement_array
is null.begin | The first element handle |
end | One past the last element handle |
vertices_per_elem | Number of vertices to retrieve for each element. If the element has more vertices, the element connectivity will be truncated. If vertices_per_elem is greater than the number of nodes for an element, the data will be padded with zeros. |
array_size | The length of element_array |
element_array | The memory location at which to store the connectivity list. |
Implements moab::WriteUtilIface.
Definition at line 407 of file WriteUtil.cpp.
References moab::TypeSequenceManager::begin(), moab::TypeSequenceManager::end(), moab::SequenceManager::entity_map(), ErrorCode, moab::ElementSequence::get_connectivity(), moab::ElementSequence::get_connectivity_array(), MB_SUCCESS, MBEDGE, MBENTITYSET, MBMAXTYPE, mMB, moab::ElementSequence::nodes_per_element(), moab::Core::sequence_manager(), and moab::TYPE_FROM_HANDLE().
|
virtual |
Get connectivity for elements
Get the connectivity list for a range of elements.
Failure cases:
begin == end
).vertices_per_elem
is less than oneelement_array
is null.begin | The first element handle |
end | One past the last element handle |
vertices_per_elem | Number of vertices to retrieve for each element. If the element has more vertices, the element connectivity will be truncated. If vertices_per_elem is greater than the number of nodes for an element, the data will be padded with zeros. |
node_id_tag | A tag with integer values. |
array_size | The length of element_array |
element_array | The memory location at which to store the connectivity list. |
add_sizes | If true, writes size of connect array before connectivity in array |
Implements moab::WriteUtilIface.
Definition at line 309 of file WriteUtil.cpp.
References moab::TypeSequenceManager::begin(), moab::TypeSequenceManager::end(), moab::SequenceManager::entity_map(), ErrorCode, moab::ElementSequence::get_connectivity_array(), MB_SUCCESS, MBEDGE, MBENTITYSET, MBMAXTYPE, mMB, moab::ElementSequence::nodes_per_element(), moab::Core::sequence_manager(), moab::Core::tag_get_data(), and moab::TYPE_FROM_HANDLE().
|
virtual |
Implements moab::WriteUtilIface.
Definition at line 860 of file WriteUtil.cpp.
References moab::WriteUtilIface::CHILDREN, moab::WriteUtilIface::CONTENTS, entities, ErrorCode, moab::SequenceManager::find(), moab::MeshSet::flags(), moab::MeshSet::get_children(), moab::ElementSequence::get_connectivity(), moab::MeshSet::get_contents(), moab::MeshSet::get_parents(), moab::MeshSetSequence::get_set(), MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MBENTITYSET, MBVERTEX, mMB, moab::WriteUtilIface::PARENTS, moab::Core::sequence_manager(), moab::WriteUtilIface::TOPOLOGICAL, and moab::TYPE_FROM_HANDLE().
|
virtual |
Implements moab::WriteUtilIface.
Definition at line 776 of file WriteUtil.cpp.
References moab::WriteUtilIface::CHILDREN, moab::WriteUtilIface::CONTENTS, ErrorCode, moab::MeshSet::flags(), moab::MeshSet::get_children(), moab::ElementSequence::get_connectivity(), moab::MeshSet::get_contents(), moab::RangeSeqIntersectIter::get_end_handle(), moab::MeshSet::get_parents(), moab::RangeSeqIntersectIter::get_sequence(), moab::MeshSetSequence::get_set(), moab::RangeSeqIntersectIter::get_start_handle(), moab::RangeSeqIntersectIter::init(), MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MBENTITYSET, MBVERTEX, mMB, moab::WriteUtilIface::PARENTS, moab::Core::sequence_manager(), moab::RangeSeqIntersectIter::step(), moab::WriteUtilIface::TOPOLOGICAL, and moab::TYPE_FROM_HANDLE().
|
virtual |
Gets arrays for coordinate data from the MB.
Implements moab::WriteUtilIface.
Definition at line 90 of file WriteUtil.cpp.
References entities, ErrorCode, moab::Core::get_coords(), MB_SUCCESS, mMB, and moab::Core::tag_set_data().
|
virtual |
Get an array of coordinate values for nodes
Given a range of node handles, retrieve a single or multiple coordinate value(s) for each.
Failure conditions:
iter == end
)output_array
is nulloutput_array
which_array | The coordinate to retrieve (0->X, 1->Y, 2->Z, -1->all) |
begin | The first node handle. |
end | One past the last node handle. |
output_size | The size of output_array . |
output_array | The memory in which to write the node coordinates. |
Implements moab::WriteUtilIface.
Definition at line 137 of file WriteUtil.cpp.
References moab::TypeSequenceManager::begin(), moab::TypeSequenceManager::end(), moab::SequenceManager::entity_map(), moab::VertexSequence::get_coordinate_arrays(), MB_SUCCESS, MBVERTEX, mMB, and moab::Core::sequence_manager().
|
virtual |
Get poly (polygon or polyhedron) connectivity.
This function will add as many polys as possible to the passed arrays given the sizes of those arrays. It will then pass back position at which it stopped and the sizes of the data written to the arrays.
iter | As input, the first element handle. As output, one past the last element handle for which data was written to the arrays. |
end | The iterator at which to stop. |
node_id_tag | A tag with integer values. |
element_array_len | As input, length of element_array . As output, the number of entries written in that array. |
element_array | The memory location at which to store the connectivity list. |
index_array_len | As input, the length of index_array . As output, the number of entries written in that array. |
index_array | The memory location at which to store offsets. |
index_offset | Value to offset (add to) index values. As output the input value plus the amount of data written to the element array. (The value you presumably want to pass to the next call.) |
Implements moab::WriteUtilIface.
Definition at line 503 of file WriteUtil.cpp.
References MB_NOT_IMPLEMENTED.
|
virtual |
Get poly (polygon or polyhedron) connectivity size
begin | First iterator in range of poly |
end | One past last in range of poly. |
connectivity_size | The length of the connectivity list For the specified range of polyhedra. |
Implements moab::WriteUtilIface.
Definition at line 496 of file WriteUtil.cpp.
References MB_NOT_IMPLEMENTED.
|
virtual |
Get list of tags to write.
Get the list of tags to write to the file, possibly using an optional user-specified tag list. This function consolidates some common code for file writers to use to figure out what tag data to write to the file. It provides the following features: o filter list based on user-specified array of tag handles o filter internal tags (those for which the name is prefixed with two underscore characters) o filter anonymous tags o optionally filter variable-length tags.
result_list | List of tag handles for which to write data |
user_tag_list | Optional array of tag handles passed by user to write to file. |
include_variable_length_tags | If false, return only fixed-length tags. |
Implements moab::WriteUtilIface.
Definition at line 714 of file WriteUtil.cpp.
References ErrorCode, MB_CHK_SET_ERR, MB_SET_ERR, MB_SUCCESS, MB_TAG_NOT_FOUND, MB_TYPE_OUT_OF_RANGE, MB_VARIABLE_DATA_LENGTH, mMB, size, moab::Core::tag_get_length(), moab::Core::tag_get_name(), and moab::Core::tag_get_tags().
|
private |
Pointer to the Core.
Definition at line 34 of file WriteUtil.hpp.
Referenced by assign_ids(), gather_entities(), gather_nodes_from_elements(), get_adjacencies(), get_element_connect(), get_entity_list_pointers(), get_node_coords(), and get_tag_list().