Loading [MathJax]/extensions/tex2jax.js
Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
moab::ParallelData Class Reference

Parallel data in MOAB. More...

#include <ParallelData.hpp>

+ Collaboration diagram for moab::ParallelData:

Public Member Functions

 ParallelData (Interface *impl, ParallelComm *pcomm=NULL)
 constructor; if non-null parallelcomm, that is used to determine rank, otherwise rank is taken from impl More...
 
ErrorCode get_partition_sets (Range &part_sets, const char *tag_name=NULL)
 return partition sets; if tag_name is input, gets sets with that tag name, otherwise uses PARALLEL_PARTITION tag More...
 
ErrorCode get_interface_sets (std::vector< EntityHandle > &iface_sets, std::vector< int > &iface_procs)
 get communication interface sets and the processors with which this processor communicates; sets are sorted by processor More...
 

Private Attributes

InterfacembImpl
 interface instance to which this instance corresponds More...
 
ParallelCommparallelComm
 ParallelComm object to which this is bound. More...
 

Detailed Description

Parallel data in MOAB.

Author
Tim Tautges

This class implements methods to retrieve information about the parallel mesh from MOAB. Most of this data can be retrieved directly from MOAB as sets and tags; this class provides convenience methods implemented on top of other MOAB functions.

Definition at line 22 of file ParallelData.hpp.

Constructor & Destructor Documentation

◆ ParallelData()

moab::ParallelData::ParallelData ( Interface impl,
ParallelComm pcomm = NULL 
)
inline

constructor; if non-null parallelcomm, that is used to determine rank, otherwise rank is taken from impl

Definition at line 45 of file ParallelData.hpp.

45 : mbImpl( impl ), parallelComm( pcomm ) {}

Member Function Documentation

◆ get_interface_sets()

ErrorCode moab::ParallelData::get_interface_sets ( std::vector< EntityHandle > &  iface_sets,
std::vector< int > &  iface_procs 
)

get communication interface sets and the processors with which this processor communicates; sets are sorted by processor

Definition at line 34 of file ParallelData.cpp.

35 { 36 #define CONTINUE \ 37  { \ 38  result = tmp_result; \ 39  continue; \ 40  } 41  iface_sets.clear(); 42  iface_procs.clear(); 43  44  Tag proc_tag = 0, procs_tag = 0; 45  ErrorCode result = MB_SUCCESS; 46  int my_rank; 47  if( parallelComm ) 48  my_rank = parallelComm->proc_config().proc_rank(); 49  else 50  return MB_FAILURE; 51  52  std::multimap< int, EntityHandle > iface_data; 53  54  for( int i = 0; i < 2; i++ ) 55  { 56  ErrorCode tmp_result; 57  58  if( 0 == i ) 59  tmp_result = mbImpl->tag_get_handle( PARALLEL_SHARED_PROC_TAG_NAME, 1, MB_TYPE_INTEGER, proc_tag ); 60  else 61  tmp_result = 62  mbImpl->tag_get_handle( PARALLEL_SHARED_PROCS_TAG_NAME, MAX_SHARING_PROCS, MB_TYPE_INTEGER, proc_tag ); 63  if( MB_SUCCESS != tmp_result ) CONTINUE; 64  65  int tsize; 66  tmp_result = mbImpl->tag_get_length( proc_tag, tsize ); 67  if( 0 == tsize || MB_SUCCESS != tmp_result ) CONTINUE; 68  69  Range proc_sets; 70  tmp_result = 71  mbImpl->get_entities_by_type_and_tag( 0, MBENTITYSET, &proc_tag, NULL, 1, proc_sets, Interface::UNION ); 72  if( MB_SUCCESS != tmp_result ) CONTINUE; 73  74  if( proc_sets.empty() ) CONTINUE; 75  76  std::vector< int > proc_tags( proc_sets.size() * tsize ); 77  tmp_result = mbImpl->tag_get_data( procs_tag, proc_sets, &proc_tags[0] ); 78  if( MB_SUCCESS != tmp_result ) CONTINUE; 79  int k; 80  Range::iterator rit; 81  82  for( k = 0, rit = proc_sets.begin(); rit != proc_sets.end(); ++rit, k++ ) 83  { 84  for( int j = 0; j < tsize; j++ ) 85  { 86  if( my_rank != proc_tags[2 * k + j] && proc_tags[2 * k + j] >= 0 ) 87  iface_data.insert( std::pair< int, EntityHandle >( proc_tags[2 * k + j], *rit ) ); 88  } 89  } 90  } 91  92  // now get the results in sorted order 93  std::multimap< int, EntityHandle >::iterator mit; 94  for( mit = iface_data.begin(); mit != iface_data.end(); ++mit ) 95  iface_procs.push_back( ( *mit ).first ), iface_sets.push_back( ( *mit ).second ); 96  97  return result; 98 }

References moab::Range::begin(), CONTINUE, moab::Range::empty(), moab::Range::end(), ErrorCode, moab::Interface::get_entities_by_type_and_tag(), MAX_SHARING_PROCS, MB_SUCCESS, MB_TYPE_INTEGER, MBENTITYSET, mbImpl, PARALLEL_SHARED_PROC_TAG_NAME, PARALLEL_SHARED_PROCS_TAG_NAME, parallelComm, moab::ParallelComm::proc_config(), moab::ProcConfig::proc_rank(), moab::Range::size(), moab::Interface::tag_get_data(), moab::Interface::tag_get_handle(), moab::Interface::tag_get_length(), and moab::Interface::UNION.

◆ get_partition_sets()

ErrorCode moab::ParallelData::get_partition_sets ( Range part_sets,
const char *  tag_name = NULL 
)

return partition sets; if tag_name is input, gets sets with that tag name, otherwise uses PARALLEL_PARTITION tag

Definition at line 13 of file ParallelData.cpp.

14 { 15  Tag part_tag = 0; 16  ErrorCode result; 17  18  if( NULL != tag_name ) 19  result = mbImpl->tag_get_handle( tag_name, 1, MB_TYPE_INTEGER, part_tag ); 20  else 21  result = mbImpl->tag_get_handle( PARALLEL_PARTITION_TAG_NAME, 1, MB_TYPE_INTEGER, part_tag ); 22  23  if( MB_SUCCESS != result ) 24  return result; 25  else if( 0 == part_tag ) 26  return MB_TAG_NOT_FOUND; 27  28  result = mbImpl->get_entities_by_type_and_tag( 0, MBENTITYSET, &part_tag, NULL, 1, part_sets, Interface::UNION ); 29  return result; 30 }

References ErrorCode, moab::Interface::get_entities_by_type_and_tag(), MB_SUCCESS, MB_TAG_NOT_FOUND, MB_TYPE_INTEGER, MBENTITYSET, mbImpl, PARALLEL_PARTITION_TAG_NAME, moab::Interface::tag_get_handle(), and moab::Interface::UNION.

Member Data Documentation

◆ mbImpl

Interface* moab::ParallelData::mbImpl
private

interface instance to which this instance corresponds

Definition at line 39 of file ParallelData.hpp.

Referenced by get_interface_sets(), and get_partition_sets().

◆ parallelComm

ParallelComm* moab::ParallelData::parallelComm
private

ParallelComm object to which this is bound.

Definition at line 42 of file ParallelData.hpp.

Referenced by get_interface_sets().


The documentation for this class was generated from the following files: