MOAB: Mesh Oriented datABase  (version 5.3.1)
moab::WriteUtilIface Class Reference

Interface implemented in MOAB which provides memory for mesh reading utilities. More...

#include <WriteUtilIface.hpp>

+ Inheritance diagram for moab::WriteUtilIface:

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
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
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
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
virtual ErrorCode assign_ids (Range &elements, Tag id_tag, const int start_id)=0
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.

Detailed Description

Interface implemented in MOAB which provides memory for mesh reading utilities.

Definition at line 27 of file WriteUtilIface.hpp.


Member Enumeration Documentation

Enumerator:
CONTENTS 
CHILDREN 
PARENTS 
TOPOLOGICAL 

Definition at line 281 of file WriteUtilIface.hpp.

    {
        CONTENTS    = 0,
        CHILDREN    = 1,
        PARENTS     = 2,
        TOPOLOGICAL = 1
    };

Constructor & Destructor Documentation

Constructor.

Definition at line 31 of file WriteUtilIface.hpp.

{}
virtual moab::WriteUtilIface::~WriteUtilIface ( ) [inline, virtual]

Destructor.

Definition at line 34 of file WriteUtilIface.hpp.

{}

Member Function Documentation

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

Parameters:
elementsEntities to be written
id_tagTag used to store entity id
start_idStarting value for entity ids
Returns:
status Return status

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.

Parameters:
all_entsrange in which entities are returned
ent_setsentity sets whose contents are to be gathered
num_setsnumber 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

Parameters:
elementsRange of elements to be written
node_bit_mark_tagBit tag to use to identify nodes
nodesRange of nodes gathered from elements (returned)
Returns:
status Return status

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.

Parameters:
entityThe entity to retrieve adjacencies for.
id_tagThe global ID tag
adjThe output list of global IDs of adjacent entities.
Author:
Jason Kraftcheck

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

Parameters:
num_elementsNumber of elements to be written
verts_per_elementNumber of vertices per element
node_id_tagTag used to store node ids
entitiesRange of elements to be written
element_id_tagTag which should be used to store element ids
start_element_idStarting value for element ids
arrayPointer to memory where connectivity data will be written
Returns:
status Return status

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:

  • Passed range is empty (begin == end).
  • vertices_per_elem is less than one
  • element_array is null.
  • The range contains invalid handles (non-existent entities, not an element, etc.)
  • Retrieving ID tag for an entity failed.
  • Insufficient space in passed array.
Parameters:
beginThe first element handle
endOne past the last element handle
vertices_per_elemNumber 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_tagA tag with integer values.
array_sizeThe length of element_array
element_arrayThe memory location at which to store the connectivity list.
add_sizesIf true, writes size of connect array before connectivity in array
Author:
Jason Kraftcheck

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:

  • Passed range is empty (begin == end).
  • vertices_per_elem is less than one
  • element_array is null.
  • The range contains invalid handles (non-existent entities, not an element, etc.)
  • Insufficient space in passed array.
Parameters:
beginThe first element handle
endOne past the last element handle
vertices_per_elemNumber 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_sizeThe length of element_array
element_arrayThe memory location at which to store the connectivity list.
Author:
Jason Kraftcheck

Implemented in moab::WriteUtil.

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

Parameters:
num_arraysNumber of coordinate arrays requested
num_nodesNumber of nodes to be written
entitiesRange of nodes to be written
node_id_tagTag used to write ids to nodes
start_node_idStarting value for node ids
arraysPointers to memory where coordinate data will be written
Returns:
status Return status

Implemented in moab::WriteUtil.

Referenced by moab::WriteGMV::local_write_mesh(), moab::WriteTemplate::write_nodes(), moab::WriteSLAC::write_nodes(), moab::WriteNCDF::write_nodes(), moab::WriteCCMIO::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:

  • invalid entity handles (not vertices, non-existent entity, etc.)
  • range is empty (iter == end)
  • output_array is null
  • insufficient space in output_array
Parameters:
which_arrayThe coordinate to retrieve (0->X, 1->Y, 2->Z, -1->all)
beginThe first node handle.
endOne past the last node handle.
output_sizeThe size of output_array.
output_arrayThe memory in which to write the node coordinates.
Author:
Jason Kraftcheck

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:

  • Passed range is empty (begin == end).
  • element_array or index_array is null.
  • The range contains invalid handles (non-existent entities, not an poly, etc.)
  • Retrieving ID tag for an entity failed.
Parameters:
iterAs input, the first element handle. As output, one past the last element handle for which data was written to the arrays.
endThe iterator at which to stop.
node_id_tagA tag with integer values.
element_array_lenAs input, length of element_array. As output, the number of entries written in that array.
element_arrayThe memory location at which to store the connectivity list.
index_array_lenAs input, the length of index_array. As output, the number of entries written in that array.
index_arrayThe memory location at which to store offsets.
index_offsetValue 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.)
Author:
Jason Kraftcheck

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

Parameters:
beginFirst iterator in range of poly
endOne past last in range of poly.
connectivity_sizeThe length of the connectivity list For the specified range of polyhedra.
Author:
Jason Kraftcheck

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.

Author:
Jason Kraftcheck
Parameters:
result_listList of tag handles for which to write data
user_tag_listOptional array of tag handles passed by user to write to file.
include_variable_length_tagsIf false, return only fixed-length tags.

Implemented in moab::WriteUtil.

Referenced by moab::WriteHDF5::gather_tags(), and moab::WriteVtk::write_tags().

template<typename T >
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.

Parameters:
orderThe 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]]
connThe connectivity array to re-order
num_elemThe number of elements in the connectivity array
node_per_elemThe number of nodes in each element's connectivity list.

Definition at line 345 of file WriteUtilIface.hpp.

References conn, node_per_elem, and 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]];
    }
}

List of all members.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines