Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
Interface implemented in MOAB which provides memory for mesh reading utilities. More...
#include <WriteUtilIface.hpp>
Public Types | |
enum | EntityListType { CONTENTS = 0, CHILDREN = 1, PARENTS = 2, TOPOLOGICAL = 1 } |
Public Member Functions | |
WriteUtilIface () | |
Constructor. | |
virtual | ~WriteUtilIface () |
Destructor. | |
virtual ErrorCode | check_doesnt_exist (const char *file_name)=0 |
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. | |
virtual ErrorCode | gather_entities (Range &all_ents, const EntityHandle *ent_sets=NULL, int num_sets=0)=0 |
Gather all entities in the mesh, or in the sets specified. | |
virtual 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)=0 |
Given information about the nodes to be written, and pointers to memory to which coordinates will be written, writes coordinate data there, and also assigns global ids to nodes & writes to a tag, if a tag is specified. | |
virtual 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)=0 |
virtual 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)=0 |
Given information about elements to be written and a pointer to memory where connectivity for those elements should be written, writes connectivity to that memory; uses node ids stored in a tag during call to get_node_coords function. | |
virtual 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)=0 |
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)=0 |
virtual ErrorCode | get_poly_connect_size (Range::const_iterator begin, const Range::const_iterator &end, int &connectivity_size)=0 |
virtual ErrorCode | get_poly_connect (Range::const_iterator &iter, const Range::const_iterator &end, const Tag node_id_tag, size_t &element_array_len, int *const element_array, size_t &index_array_len, int *const index_array, int &index_offset)=0 |
virtual ErrorCode | gather_nodes_from_elements (const Range &elements, const Tag node_bit_mark_tag, Range &nodes)=0 |
Given elements to be written, gather all the nodes which define those elements. | |
virtual ErrorCode | assign_ids (Range &elements, Tag id_tag, const int start_id)=0 |
assign ids to input entities starting with start_id, written to id_tag if id_tag is zero, assigns to GLOBAL_ID_TAG_NAME | |
virtual ErrorCode | get_adjacencies (EntityHandle entity, Tag id_tag, std::vector< int > &adj)=0 |
virtual ErrorCode | get_adjacencies (EntityHandle entity, const EntityHandle *&adj_array, int &num_adj)=0 |
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)=0 |
Get list of tags to write. | |
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)=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)=0 |
Static Public Member Functions | |
template<typename T > | |
static void | reorder (const int *order, T *conn, int num_elem, int node_per_elem) |
Re-order outgoing element connectivity. |
Interface implemented in MOAB which provides memory for mesh reading utilities.
Definition at line 27 of file WriteUtilIface.hpp.
Definition at line 307 of file WriteUtilIface.hpp.
{ CONTENTS = 0, CHILDREN = 1, PARENTS = 2, TOPOLOGICAL = 1 };
moab::WriteUtilIface::WriteUtilIface | ( | ) | [inline] |
virtual moab::WriteUtilIface::~WriteUtilIface | ( | ) | [inline, virtual] |
virtual ErrorCode moab::WriteUtilIface::assign_ids | ( | Range & | elements, |
Tag | id_tag, | ||
const int | start_id | ||
) | [pure virtual] |
assign ids to input entities starting with start_id, written to id_tag if id_tag is zero, assigns to GLOBAL_ID_TAG_NAME
elements | Entities to be written |
id_tag | Tag used to store entity id |
start_id | Starting value for entity ids |
Implemented in moab::WriteUtil.
Referenced by moab::WriteGMV::local_write_mesh(), moab::WriteCCMIO::write_cells_and_faces(), and moab::WriteCCMIO::write_file().
virtual ErrorCode moab::WriteUtilIface::check_doesnt_exist | ( | const char * | file_name | ) | [pure 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.
Implemented in moab::WriteUtil.
Referenced by moab::WriteSmf::write_file(), moab::WriteVtk::write_file(), moab::WriteGmsh::write_file(), and moab::WriteCGNS::write_file().
virtual ErrorCode moab::WriteUtilIface::gather_entities | ( | Range & | all_ents, |
const EntityHandle * | ent_sets = NULL , |
||
int | num_sets = 0 |
||
) | [pure 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 |
Implemented in moab::WriteUtil.
Referenced by moab::WriteDamsel::write_file().
virtual ErrorCode moab::WriteUtilIface::gather_nodes_from_elements | ( | const Range & | elements, |
const Tag | node_bit_mark_tag, | ||
Range & | nodes | ||
) | [pure virtual] |
Given elements to be written, gather all the nodes which define those elements.
elements | Range of elements to be written |
node_bit_mark_tag | Bit tag to use to identify nodes |
nodes | Range of nodes gathered from elements (returned) |
Implemented in moab::WriteUtil.
Referenced by moab::WriteCCMIO::gather_matset_info(), moab::WriteHDF5::gather_mesh_info(), moab::WriteTemplate::gather_mesh_information(), moab::WriteSLAC::gather_mesh_information(), and moab::WriteNCDF::gather_mesh_information().
virtual ErrorCode moab::WriteUtilIface::get_adjacencies | ( | EntityHandle | entity, |
Tag | id_tag, | ||
std::vector< int > & | adj | ||
) | [pure 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. |
Implemented in moab::WriteUtil.
Referenced by moab::WriteHDF5::get_adjacencies().
virtual ErrorCode moab::WriteUtilIface::get_adjacencies | ( | EntityHandle | entity, |
const EntityHandle *& | adj_array, | ||
int & | num_adj | ||
) | [pure virtual] |
Implemented in moab::WriteUtil.
virtual ErrorCode moab::WriteUtilIface::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 |
||
) | [pure virtual] |
Given information about elements to be written and a pointer to memory where connectivity for those elements should be written, writes connectivity to that memory; uses node ids stored in a tag during call to get_node_coords function.
num_elements | Number of elements to be written |
verts_per_element | Number of vertices per element |
node_id_tag | Tag used to store node ids |
entities | Range of elements to be written |
element_id_tag | Tag which should be used to store element ids |
start_element_id | Starting value for element ids |
array | Pointer to memory where connectivity data will be written |
Implemented in moab::WriteUtil.
Referenced by moab::WriteGMV::local_write_mesh(), moab::WriteNCDF::write_elementblocks(), moab::WriteHDF5::write_elems(), and moab::WriteCCMIO::write_external_faces().
virtual ErrorCode moab::WriteUtilIface::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 |
||
) | [pure 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 |
Implemented in moab::WriteUtil.
virtual ErrorCode moab::WriteUtilIface::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 | ||
) | [pure 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. |
Implemented in moab::WriteUtil.
virtual ErrorCode moab::WriteUtilIface::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 |
||
) | [pure virtual] |
Implemented in moab::WriteUtil.
Referenced by moab::RangeSetIterator::get_next_arr(), moab::VectorSetIterator::get_next_arr(), moab::WriteHDF5Parallel::pack_set(), and moab::WriteHDF5::write_set_data().
virtual ErrorCode moab::WriteUtilIface::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 |
||
) | [pure virtual] |
Implemented in moab::WriteUtil.
virtual ErrorCode moab::WriteUtilIface::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 | ||
) | [pure virtual] |
Given information about the nodes to be written, and pointers to memory to which coordinates will be written, writes coordinate data there, and also assigns global ids to nodes & writes to a tag, if a tag is specified.
num_arrays | Number of coordinate arrays requested |
num_nodes | Number of nodes to be written |
entities | Range of nodes to be written |
node_id_tag | Tag used to write ids to nodes |
start_node_id | Starting value for node ids |
arrays | Pointers to memory where coordinate data will be written |
Implemented in moab::WriteUtil.
Referenced by moab::WriteGMV::local_write_mesh(), moab::WriteTemplate::write_nodes(), moab::WriteSLAC::write_nodes(), moab::WriteCCMIO::write_nodes(), moab::WriteNCDF::write_nodes(), and moab::WriteHDF5::write_nodes().
virtual ErrorCode moab::WriteUtilIface::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 | ||
) | [pure virtual] |
Get 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. |
Implemented in moab::WriteUtil.
virtual ErrorCode moab::WriteUtilIface::get_poly_connect | ( | Range::const_iterator & | iter, |
const Range::const_iterator & | end, | ||
const Tag | node_id_tag, | ||
size_t & | element_array_len, | ||
int *const | element_array, | ||
size_t & | index_array_len, | ||
int *const | index_array, | ||
int & | index_offset | ||
) | [pure virtual] |
Get poly (polygon or polyhedron) connectivity.
Connectivity is returned in two arrays. The first is an array of global IDs that is the concatenation of the connectivity for the entire range of polys. The second is the last index of the connectivity data for each poly in the global ID array.
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.
Failure cases:
begin == end
).element_array
or index_array
is null.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.) |
Implemented in moab::WriteUtil.
virtual ErrorCode moab::WriteUtilIface::get_poly_connect_size | ( | Range::const_iterator | begin, |
const Range::const_iterator & | end, | ||
int & | connectivity_size | ||
) | [pure 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. |
Implemented in moab::WriteUtil.
virtual ErrorCode moab::WriteUtilIface::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 |
||
) | [pure 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. |
Implemented in moab::WriteUtil.
Referenced by moab::WriteHDF5::gather_tags(), and moab::WriteVtk::write_tags().
void moab::WriteUtilIface::reorder | ( | const int * | order, |
T * | conn, | ||
int | num_elem, | ||
int | node_per_elem | ||
) | [inline, static] |
Re-order outgoing element connectivity.
Permute the connectivity of each element such that the node order is that of the target file format rather than that of MBCN.
order | The permutation to use. Must be an array of 'node_per_elem' integers and be a permutation of the values [0..node_per_elem-1]. Such that for a single element: target_conn[i] == mbcn_conn[order[i]] |
conn | The connectivity array to re-order |
num_elem | The number of elements in the connectivity array |
node_per_elem | The number of nodes in each element's connectivity list. |
Definition at line 375 of file WriteUtilIface.hpp.
References T.
Referenced by moab::WriteNCDF::write_elementblocks().
{ std::vector< T > elem( node_per_elem ); T* const end = conn + num_elem * node_per_elem; while( conn != end ) { std::copy( conn, conn + node_per_elem, elem.begin() ); for( int j = 0; j < node_per_elem; ++j, ++conn ) *conn = elem[order[j]]; } }