Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
#include <ParallelComm.hpp>
Public Member Functions | |
Buffer (unsigned int sz=0) | |
Buffer (const Buffer &) | |
~Buffer () | |
void | reset_buffer (size_t buff_pos=0) |
void | reset_ptr (size_t buff_pos=0) |
void | reserve (unsigned int new_size) |
void | set_stored_size () |
int | get_stored_size () |
int | get_current_size () |
void | check_space (unsigned int addl_space) |
Public Attributes | |
unsigned char * | mem_ptr |
unsigned char * | buff_ptr |
unsigned int | alloc_size |
Definition at line 786 of file ParallelComm.hpp.
moab::ParallelComm::Buffer::Buffer | ( | unsigned int | sz = 0 | ) | [inline] |
Definition at line 1492 of file ParallelComm.hpp.
References reserve().
: mem_ptr( NULL ), buff_ptr( NULL ), alloc_size( 0 ) { if( new_size ) this->reserve( new_size ); }
moab::ParallelComm::Buffer::Buffer | ( | const Buffer & | other_buff | ) | [inline] |
Definition at line 1484 of file ParallelComm.hpp.
References alloc_size, buff_ptr, and mem_ptr.
{ alloc_size = other_buff.alloc_size; mem_ptr = (unsigned char*)malloc( alloc_size ); memcpy( mem_ptr, other_buff.mem_ptr, alloc_size ); buff_ptr = mem_ptr + ( other_buff.buff_ptr - other_buff.mem_ptr ); }
moab::ParallelComm::Buffer::~Buffer | ( | ) | [inline] |
Definition at line 1497 of file ParallelComm.hpp.
void moab::ParallelComm::Buffer::check_space | ( | unsigned int | addl_space | ) | [inline] |
Definition at line 1541 of file ParallelComm.hpp.
Referenced by moab::ParallelComm::pack_buffer(), moab::ParallelComm::pack_entities(), moab::ParallelComm::pack_entity_seq(), moab::ParallelComm::pack_remote_handles(), moab::ParallelComm::pack_sets(), moab::ParallelComm::pack_tag(), moab::ParallelComm::pack_tags(), and moab::ParallelComm::settle_intersection_points().
{ assert( buff_ptr >= mem_ptr && buff_ptr <= mem_ptr + alloc_size ); unsigned int new_size = buff_ptr - mem_ptr + addl_space; if( new_size > alloc_size ) reserve( 3 * new_size / 2 ); }
int moab::ParallelComm::Buffer::get_current_size | ( | ) | [inline] |
Definition at line 815 of file ParallelComm.hpp.
References buff_ptr, and mem_ptr.
Referenced by moab::ParallelComm::pack_entity_seq(), and moab::ParCommGraph::send_mesh_parts().
int moab::ParallelComm::Buffer::get_stored_size | ( | ) | [inline] |
Definition at line 811 of file ParallelComm.hpp.
References mem_ptr.
Referenced by moab::ParallelComm::recv_buffer(), and moab::ParallelComm::send_buffer().
{ return *( (int*)mem_ptr ); }
void moab::ParallelComm::Buffer::reserve | ( | unsigned int | new_size | ) | [inline] |
Definition at line 1508 of file ParallelComm.hpp.
Referenced by moab::ParallelComm::broadcast_entities(), Buffer(), moab::ParallelComm::recv_buffer(), reset_buffer(), and moab::ParallelComm::scatter_entities().
{ #ifdef DEBUG_BUFFER int tmp_pos = 0; if( mem_ptr ) { tmp_pos = buff_ptr - mem_ptr; } buff_ptr = (unsigned char*)malloc( new_size ); assert( 0 <= tmp_pos && tmp_pos <= (int)alloc_size ); if( tmp_pos ) memcpy( buff_ptr, mem_ptr, tmp_pos ); if( mem_ptr ) free( mem_ptr ); mem_ptr = buff_ptr; alloc_size = new_size; buff_ptr = mem_ptr + tmp_pos; #else if( mem_ptr && alloc_size < new_size ) { size_t tmp_pos = mem_ptr ? buff_ptr - mem_ptr : 0; mem_ptr = (unsigned char*)realloc( mem_ptr, new_size ); alloc_size = new_size; buff_ptr = mem_ptr + tmp_pos; } else if( !mem_ptr ) { mem_ptr = (unsigned char*)malloc( new_size ); alloc_size = new_size; buff_ptr = mem_ptr; } #endif }
void moab::ParallelComm::Buffer::reset_buffer | ( | size_t | buff_pos = 0 | ) | [inline] |
Definition at line 796 of file ParallelComm.hpp.
References moab::ParallelComm::INITIAL_BUFF_SIZE, reserve(), and reset_ptr().
{ reset_ptr( buff_pos ); reserve( INITIAL_BUFF_SIZE ); }
void moab::ParallelComm::Buffer::reset_ptr | ( | size_t | buff_pos = 0 | ) | [inline] |
Definition at line 801 of file ParallelComm.hpp.
References alloc_size, buff_ptr, and mem_ptr.
Referenced by moab::ParallelComm::broadcast_entities(), moab::ParCommGraph::receive_mesh(), moab::ParCommGraph::receive_tag_values(), moab::ParallelComm::recv_buffer(), reset_buffer(), moab::ParallelComm::scatter_entities(), moab::ParCommGraph::send_mesh_parts(), moab::ParCommGraph::send_tag_values(), and moab::ParallelComm::settle_intersection_points().
{ assert( ( !mem_ptr && !buff_pos ) || ( alloc_size >= buff_pos ) ); buff_ptr = mem_ptr + buff_pos; }
void moab::ParallelComm::Buffer::set_stored_size | ( | ) | [inline] |
Definition at line 807 of file ParallelComm.hpp.
References buff_ptr, and mem_ptr.
Referenced by moab::ParallelComm::broadcast_entities(), moab::ParallelComm::pack_buffer(), moab::ParallelComm::pack_entities(), moab::ParallelComm::pack_remote_handles(), moab::ParallelComm::pack_sets(), moab::ParallelComm::pack_tags(), moab::ParallelComm::scatter_entities(), and moab::ParallelComm::settle_intersection_points().
unsigned int moab::ParallelComm::Buffer::alloc_size |
Definition at line 791 of file ParallelComm.hpp.
Referenced by Buffer(), moab::ParallelComm::recv_buffer(), reset_ptr(), and moab::ParallelComm::send_buffer().
unsigned char* moab::ParallelComm::Buffer::buff_ptr |
Definition at line 790 of file ParallelComm.hpp.
Referenced by moab::ParallelComm::broadcast_entities(), Buffer(), get_current_size(), moab::ParallelComm::pack_buffer(), moab::ParallelComm::pack_entities(), moab::ParallelComm::pack_entity_seq(), moab::ParallelComm::pack_remote_handles(), moab::ParallelComm::pack_sets(), moab::ParallelComm::pack_tag(), moab::ParallelComm::pack_tags(), moab::ParCommGraph::receive_mesh(), moab::ParCommGraph::receive_tag_values(), reset_ptr(), moab::ParallelComm::scatter_entities(), moab::ParCommGraph::send_tag_values(), set_stored_size(), and moab::ParallelComm::settle_intersection_points().
unsigned char* moab::ParallelComm::Buffer::mem_ptr |
Definition at line 789 of file ParallelComm.hpp.
Referenced by moab::ParallelComm::broadcast_entities(), Buffer(), get_current_size(), get_stored_size(), moab::ParCommGraph::receive_mesh(), moab::ParCommGraph::receive_tag_values(), moab::ParallelComm::recv_buffer(), reset_ptr(), moab::ParallelComm::scatter_entities(), moab::ParallelComm::send_buffer(), moab::ParCommGraph::send_mesh_parts(), moab::ParCommGraph::send_tag_values(), and set_stored_size().