Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFC_Window_transfer Class Reference

#include <RFC_Window_transfer.h>

Inheritance diagram for RFC_Window_transfer:
Collaboration diagram for RFC_Window_transfer:

Public Types

typedef RFC_Window_transfer Self
 
typedef RFC_Window_derived
< RFC_Pane_transfer
Base
 
- Public Types inherited from RFC_Window_base
typedef RFC_Window_base Self
 
typedef COM::Window Base
 
typedef COM::Attribute Attribute
 
typedef RFC_Pane_base Pane
 
typedef std::map< int, Pane * > Pane_set
 

Public Member Functions

 RFC_Window_transfer (COM::Window *b, int color, MPI_Comm com, const char *pre=NULL, const char *format=NULL)
 
virtual ~RFC_Window_transfer ()
 
RFC_Pane_transferpane (const int pid)
 
const RFC_Pane_transferpane (const int pid) const
 
void init_facial_buffers (const Facial_data &nd, int)
 
Facial_data facial_buffer (int)
 
void delete_facial_buffers ()
 
void init_nodal_buffers (const Nodal_data &nd, int n, bool init_emm)
 
Nodal_data nodal_buffer (int)
 
void delete_nodal_buffers ()
 
void set_tags (const COM::Attribute *tag)
 
bool replicated () const
 Returns whether replication has been performed. More...
 
void replicate_metadata (int *pane_ids, int n)
 Replicate the metadata of a remote pane only the local process. More...
 
void clear_replicated_data ()
 Clear all the replicate data but keep metadata. More...
 
void incident_panes (std::vector< int > &pane_ids)
 Determine the remote panes that are incident with local panes. More...
 
void incident_faces (std::map< int, std::vector< int > > &) const
 Obtain the list of incident faces in each pane of the opposite mesh. More...
 
void replicate_metadata (const RFC_Window_transfer &opp_win)
 Replicate the remote panes that are in contact with the local panes in opp_win. More...
 
void replicate_data (const Facial_data_const &data, bool replicate_coor)
 Replicate the given data from remote processes onto local process. More...
 
void replicate_data (const Nodal_data_const &data, bool replicate_coor)
 
void reduce_to_all (Nodal_data &, MPI_Op)
 
void reduce_maxabs_to_all (Nodal_data &)
 
void barrier () const
 Block until all processes of the window have reached here. More...
 
bool is_root () const
 Check whether the process has rank 0. More...
 
int comm_rank () const
 
int comm_size () const
 
void wait_all (int n, MPI_Request *requests)
 
void wait_any (int n, MPI_Request *requests, int *index, MPI_Status *stat=NULL)
 
void allreduce (Array_n &arr, MPI_Op op) const
 
void allreduce (Real *x, MPI_Op op) const
 
- Public Member Functions inherited from RFC_Window_derived< RFC_Pane_transfer >
const Panepane (const int pid) const
 Get a reference to the pane with give id pid. More...
 
Panepane (const int pid)
 
std::pair< Pane *, int > get_primary (Pane *p, int vid)
 Get a handle to the primary copy of a node contained in the pane p with local id vid. More...
 
std::pair< const Pane *, int > get_primary (const Pane *p, int vid) const
 
void panes (std::vector< Pane * > &ps)
 Get a vector of local panes contained in the window. More...
 
void panes (std::vector< const Pane * > &ps) const
 
- Public Member Functions inherited from RFC_Window_base
 RFC_Window_base (Base *b, int c, MPI_Comm)
 Construct an object with base b and color c. More...
 
virtual ~RFC_Window_base ()
 Default destructor. More...
 
std::string name () const
 The name of the window. More...
 
const RFC_Pane_basepane (const int pid) const
 
RFC_Pane_basepane (const int pid)
 
const COM::Window * base () const
 Get a reference to the base COM::Window object. More...
 
int color () const
 The color of the window for overlay or for data transfer (BLUE or GREEN). More...
 
int size_of_nodes () const
 Get the total number of nodes contained the window. More...
 
int size_of_faces () const
 Get the total number of faces contained the window. More...
 
int size_of_primary_nodes () const
 Get the total number of nodes contained the window. More...
 
Bbox_3 get_bounding_box () const
 Get the bounding box of the window. More...
 
int size_of_panes () const
 Number of local panes in the window. More...
 
const Attributeattribute (const char *f) const
 Retrieve an attribute object from the base using the attribute name. More...
 
void export_window (RFC_Window_base *) const
 
void write_tec_ascii (const char *prefix) const
 Ouptut a mesh in Tecplot format. More...
 
void write_tec_sub (const char *prefix) const
 Ouptut a subdivision of a mesh in Tecplot format. More...
 
void new_sdv_attributes (const std::string &wname) const
 New attributes. More...
 
void read_sdv (const char *prefix, const char *format=NULL)
 Read in local panes in native binary format or using Rocin. More...
 
void write_sdv (const char *prefix, const char *format=NULL) const
 Write out panes in native binary format or using Rocout. More...
 
void build_pc_tables ()
 Build the pane connectivity table. More...
 

Private Member Functions

void allreduce (Real *, int n, MPI_Op op) const
 
void counts_to_displs (const std::vector< int > &counts, std::vector< int > &displs) const
 
void init_send_buffer (int pane_id, int to_rank)
 
void init_recv_buffer (int pane_id, int from_rank)
 

Private Attributes

int _buf_dim
 
MPI_Comm _comm
 
std::map< int, std::pair< int,
int > > 
_pane_map
 
std::vector< int > _num_panes
 
std::map< int,
RFC_Pane_transfer * > 
_replic_panes
 
bool _replicated
 
std::set< std::pair< int,
RFC_Pane_transfer * > > 
_panes_to_send
 
const std::string _prefix
 
const int _IO_format
 

Additional Inherited Members

- Protected Types inherited from RFC_Window_derived< RFC_Pane_transfer >
typedef RFC_Window_derived
< RFC_Pane_transfer
Self
 
typedef RFC_Window_base Base
 
typedef RFC_Pane_transfer Pane
 
- Protected Types inherited from RFC_Window_base
enum  { SDV_BINARY, SDV_HDF, SDV_CGNS }
 
- Protected Member Functions inherited from RFC_Window_derived< RFC_Pane_transfer >
 RFC_Window_derived (COM::Window *b, int c, MPI_Comm comm)
 A constructor. More...
 
virtual ~RFC_Window_derived ()
 A destructor. More...
 
void init ()
 
- Static Protected Member Functions inherited from RFC_Window_base
static std::string get_sdv_fname (const char *prefix, int pane_id, const int format=SDV_BINARY)
 
static const char * get_prefix_base (const char *prefix)
 
static int get_sdv_format (const char *format)
 
- Protected Attributes inherited from RFC_Window_base
Base_base
 A reference to its base COM::Window object. More...
 
Pane_set _pane_set
 The set of panes contained in the window. More...
 
int _verbose
 
int _color
 
MAP::Pane_communicator _map_comm
 
- Static Protected Attributes inherited from RFC_Window_base
static const char * _bufwin_prefix = "buf_"
 

Detailed Description

Definition at line 133 of file RFC_Window_transfer.h.

Member Typedef Documentation

Definition at line 136 of file RFC_Window_transfer.h.

Definition at line 135 of file RFC_Window_transfer.h.

Constructor & Destructor Documentation

RFC_Window_transfer ( COM::Window *  b,
int  color,
MPI_Comm  com,
const char *  pre = NULL,
const char *  format = NULL 
)

Definition at line 40 of file RFC_Window_transfer.C.

References RFC_Window_base::_base, _num_panes, _pane_map, comm_size(), iend, and RFC_Window_derived< RFC_Pane_transfer >::panes().

44  : Base(b,c,com), _buf_dim(0), _comm( com), _replicated(false),
45  _prefix( pre==NULL?b->name():pre), _IO_format( get_sdv_format(format)) {
46 
47  std::vector< Pane*> pns; panes(pns);
48  std::vector< Pane*>::iterator pit=pns.begin(), piend=pns.end();
49  for ( ; pit != piend; ++pit) {
50  (*pit)->_window = this;
51  }
52 
53  // Initialize pane_map
54  int nprocs = comm_size();
55  _num_panes.resize( nprocs,int(0));
56 
57  const COM::Window::Proc_map &proc_map = _base->proc_map();
58 
59  for ( COM::Window::Proc_map::const_iterator
60  it=proc_map.begin(), iend=proc_map.end(); it!=iend; ++it) {
61  int p=it->second;
62  _pane_map[ it->first] = std::pair<int,int>(p, _num_panes[p]++);
63  }
64 }
std::vector< int > _num_panes
const std::string _prefix
void panes(std::vector< Pane * > &ps)
Get a vector of local panes contained in the window.
Base * _base
A reference to its base COM::Window object.
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend
std::map< int, std::pair< int, int > > _pane_map
RFC_Window_derived< RFC_Pane_transfer > Base
static int get_sdv_format(const char *format)

Here is the call graph for this function:

~RFC_Window_transfer ( )
virtual

Definition at line 66 of file RFC_Window_transfer.C.

References _replic_panes.

66  {
67  while ( !_replic_panes.empty()) {
68  delete _replic_panes.begin()->second;
69  _replic_panes.erase( _replic_panes.begin());
70  }
71 }
std::map< int, RFC_Pane_transfer * > _replic_panes

Member Function Documentation

void allreduce ( Array_n arr,
MPI_Op  op 
) const
inline

Definition at line 199 of file RFC_Window_transfer.h.

References Array_n::begin(), and Array_n::end().

Referenced by allreduce(), Transfer_base::dot(), Transfer_base::dot2(), Transfer_base::integrate(), Transfer_base::minmax(), and Transfer_base::norm2().

200  { allreduce( arr.begin(), arr.end()-arr.begin(), op); }
Const_pointer end() const
Definition: Vector_n.h:122
Const_pointer begin() const
Definition: Vector_n.h:121
void allreduce(Array_n &arr, MPI_Op op) const

Here is the call graph for this function:

Here is the caller graph for this function:

void allreduce ( Real x,
MPI_Op  op 
) const
inline

Definition at line 201 of file RFC_Window_transfer.h.

References allreduce().

202  { allreduce( x, 1, op); }
void int int REAL * x
Definition: read.cpp:74
void allreduce(Array_n &arr, MPI_Op op) const

Here is the call graph for this function:

void allreduce ( Real data,
int  n,
MPI_Op  op 
) const
private

Definition at line 524 of file RFC_Window_transfer_comm.C.

References _comm, and RFC_assertion.

524  {
525  std::vector<Real> buf( data, data+n);
526  RFC_assertion( sizeof( Real) == sizeof( double));
527  MPI_Allreduce( &buf[0], data, n, MPI_DOUBLE, op, _comm);
528 }
double Real
Definition: mapbasic.h:322
const NT & n
#define RFC_assertion
Definition: rfc_basic.h:65
void barrier ( ) const

Block until all processes of the window have reached here.

Definition at line 494 of file RFC_Window_transfer_comm.C.

References _comm, and RFC_assertion.

Referenced by Transfer_base::interpolate_fe(), Transfer_base::loadtransfer(), Interpolator::transfer(), Transfer_base::transfer_2f(), and Transfer_base::transfer_2n().

494  {
495  int ierr = MPI_Barrier( _comm); RFC_assertion( ierr==0);
496 }
#define RFC_assertion
Definition: rfc_basic.h:65

Here is the caller graph for this function:

void clear_replicated_data ( )

Clear all the replicate data but keep metadata.

Definition at line 590 of file RFC_Window_transfer_comm.C.

References _replic_panes, and iend.

Referenced by Transfer_base::loadtransfer(), Interpolator::transfer(), Transfer_base::transfer_2f(), and Transfer_base::transfer_2n().

590  {
591  // Loop through the replicated panes
592  std::map< int, RFC_Pane_transfer*>::iterator it=_replic_panes.begin();
593  std::map< int, RFC_Pane_transfer*>::iterator iend=_replic_panes.end();
594  for ( ; it != iend; ++it) {
595  it->second->_data_buf_id = -1;
596  std::vector<Real> t;
597  it->second->_data_buf.swap( t); // clear up the memory space
598  }
599 }
std::map< int, RFC_Pane_transfer * > _replic_panes
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend

Here is the caller graph for this function:

int comm_rank ( ) const
inline

Definition at line 191 of file RFC_Window_transfer.h.

References _comm, COMMPI_Comm_rank(), and COMMPI_Initialized().

Referenced by replicate_metadata().

192  { return COMMPI_Initialized()?COMMPI_Comm_rank( _comm):0; }
int COMMPI_Comm_rank(MPI_Comm c)
Definition: commpi.h:162
int COMMPI_Initialized()
Definition: commpi.h:168

Here is the call graph for this function:

Here is the caller graph for this function:

int comm_size ( ) const
inline

Definition at line 193 of file RFC_Window_transfer.h.

References _comm, COMMPI_Comm_size(), and COMMPI_Initialized().

Referenced by replicate_metadata(), and RFC_Window_transfer().

194  { return COMMPI_Initialized()?COMMPI_Comm_size( _comm):1; }
int COMMPI_Comm_size(MPI_Comm c)
Definition: commpi.h:165
int COMMPI_Initialized()
Definition: commpi.h:168

Here is the call graph for this function:

Here is the caller graph for this function:

void counts_to_displs ( const std::vector< int > &  counts,
std::vector< int > &  displs 
) const
inlineprivate

Definition at line 208 of file RFC_Window_transfer.h.

References i, and RFC_assertion.

Referenced by replicate_metadata().

209  {
210  RFC_assertion( !displs.empty() && counts.size()>=displs.size()-1);
211  displs[0]=0;
212  for ( int i=1, size=displs.size(); i<size; ++i) {
213  displs[i] = displs[i-1]+counts[i-1];
214  }
215  }
blockLoc i
Definition: read.cpp:79
#define RFC_assertion
Definition: rfc_basic.h:65

Here is the caller graph for this function:

void delete_facial_buffers ( )

Definition at line 193 of file RFC_Window_transfer.C.

References RFC_Pane_transfer::_buffer, RFC_Window_base::_pane_set, free_vector(), pane(), and pi.

Referenced by Transfer_base::transfer_2f().

193  {
194  // Loop through the panes to remove the buffer spaces
195  for (Pane_set::iterator pi=_pane_set.begin(); pi != _pane_set.end(); ++pi) {
197 
198  free_vector( pane._buffer);
199  }
200 }
RFC_Pane_transfer & pane(const int pid)
void free_vector(std::vector< _TT > &v)
Definition: rfc_basic.h:54
Pane_set _pane_set
The set of panes contained in the window.
const double pi
std::vector< std::vector< Real > > _buffer

Here is the call graph for this function:

Here is the caller graph for this function:

void delete_nodal_buffers ( )

Definition at line 148 of file RFC_Window_transfer.C.

References RFC_Pane_transfer::_buffer, RFC_Pane_transfer::_emm_buffer, RFC_Pane_transfer::_emm_offset, RFC_Window_base::_pane_set, free_vector(), pane(), and pi.

Referenced by Transfer_base::transfer_2n().

148  {
149  // Loop through the panes to remove the buffer spaces
150  for (Pane_set::iterator pi=_pane_set.begin(); pi != _pane_set.end(); ++pi) {
152 
153  free_vector( pane._buffer);
154  free_vector( pane._emm_offset);
155  free_vector( pane._emm_buffer);
156  }
157 }
RFC_Pane_transfer & pane(const int pid)
void free_vector(std::vector< _TT > &v)
Definition: rfc_basic.h:54
Pane_set _pane_set
The set of panes contained in the window.
const double pi
std::vector< Real > _emm_buffer
std::vector< std::vector< Real > > _buffer
std::vector< int > _emm_offset

Here is the call graph for this function:

Here is the caller graph for this function:

Facial_data facial_buffer ( int  index)

Definition at line 187 of file RFC_Window_transfer.C.

References _buf_dim, and RFC_assertion.

Referenced by Transfer_base::transfer_2f().

187  {
188  RFC_assertion( index >= 0);
189  return Facial_data( -index-1, _buf_dim);
190 }
RFC_Data< Tag_facial > Facial_data
#define RFC_assertion
Definition: rfc_basic.h:65

Here is the caller graph for this function:

RFC_BEGIN_NAME_SPACE void incident_faces ( std::map< int, std::vector< int > > &  opp_subface_lists) const

Obtain the list of incident faces in each pane of the opposite mesh.

Definition at line 36 of file RFC_Window_transfer_comm.C.

References RFC_Window_base::_pane_set, RFC_Pane_base::_subface_counterparts, Face_ID::face_id, for(), i, pane(), Face_ID::pane_id, pi, RFC_assertion, and RFC_Pane_base::size_of_subfaces().

Referenced by replicate_metadata().

36  {
37  RFC_assertion(opp_subface_lists.empty());
38 
39  // Loop through the panes to generate subface list
40  for (Pane_set::const_iterator
41  pi=_pane_set.begin(); pi != _pane_set.end(); ++pi) {
42  const RFC_Pane_transfer &pane = (const RFC_Pane_transfer &)*pi->second;
43 
44  for ( int i=0, size=pane.size_of_subfaces(); i<size; ++i) {
45  Face_ID oppf = pane._subface_counterparts[i];
46  opp_subface_lists[ oppf.pane_id].push_back( oppf.face_id);
47  }
48  }
49 }
RFC_Pane_transfer & pane(const int pid)
int face_id
the local id within the pane starting from 1.
int pane_id
the id of the owner pane.
blockLoc i
Definition: read.cpp:79
int size_of_subfaces() const
The total number of faces in the subdivision of the pane.
Pane_set _pane_set
The set of panes contained in the window.
const double pi
for(;;)
#define RFC_assertion
Definition: rfc_basic.h:65
std::vector< Face_ID > _subface_counterparts
Ids of counterparts of faces.
A global ID of a face.

Here is the call graph for this function:

Here is the caller graph for this function:

void incident_panes ( std::vector< int > &  pane_ids)

Determine the remote panes that are incident with local panes.

Definition at line 203 of file RFC_Window_transfer.C.

References RFC_Window_base::_pane_set, RFC_Pane_base::_subface_counterparts, RFC_Pane_base::_subnode_counterparts, for(), i, pane(), pi, and RFC_assertion.

203  {
204  std::set<int> ids;
205 
206  // Loop through the panes to detect incident panes
207  for (Pane_set::iterator pi=_pane_set.begin(); pi != _pane_set.end(); ++pi) {
209 
210  for ( int i=0, size=pane._subface_counterparts.size(); i<size; ++i) {
211  ids.insert( pane._subface_counterparts[i].pane_id);
212  }
213  for ( int i=0, size=pane._subnode_counterparts.size(); i<size; ++i) {
214  RFC_assertion(ids.find( pane._subnode_counterparts[i].pane_id) != ids.end());
215  }
216  }
217 
218  pane_ids.resize(0); pane_ids.reserve( ids.size());
219  pane_ids.insert( pane_ids.end(), ids.begin(), ids.end());
220 }
RFC_Pane_transfer & pane(const int pid)
blockLoc i
Definition: read.cpp:79
std::vector< Node_ID > _subnode_counterparts
Ids of counterparts of subnodes.
Pane_set _pane_set
The set of panes contained in the window.
const double pi
for(;;)
#define RFC_assertion
Definition: rfc_basic.h:65
std::vector< Face_ID > _subface_counterparts
Ids of counterparts of faces.

Here is the call graph for this function:

void init_facial_buffers ( const Facial_data nd,
int  size 
)

Definition at line 172 of file RFC_Window_transfer.C.

References _buf_dim, RFC_Pane_transfer::_buffer, RFC_Window_base::_pane_set, RFC_Data_const< _Tag >::dimension(), i, pane(), pi, and RFC_Pane_base::size_of_faces().

Referenced by Transfer_base::transfer_2f().

172  {
173  _buf_dim = nd.dimension();
174 
175  // Loop through the panes
176  for (Pane_set::iterator pi=_pane_set.begin(); pi != _pane_set.end(); ++pi) {
178 
179  pane._buffer.resize( size);
180 
181  for ( int i=0; i<size; ++i)
182  pane._buffer[i].resize(pane.size_of_faces()*_buf_dim);
183  }
184 }
RFC_Pane_transfer & pane(const int pid)
Size dimension() const
int size_of_faces() const
The total number of faces in the pane.
blockLoc i
Definition: read.cpp:79
Pane_set _pane_set
The set of panes contained in the window.
const double pi
std::vector< std::vector< Real > > _buffer

Here is the call graph for this function:

Here is the caller graph for this function:

void init_nodal_buffers ( const Nodal_data nd,
int  n,
bool  init_emm 
)

Definition at line 97 of file RFC_Window_transfer.C.

References RFC_Pane_base::_base, _buf_dim, RFC_Pane_transfer::_buffer, RFC_Pane_transfer::_emm_buffer, RFC_Pane_transfer::_emm_offset, RFC_Window_base::_pane_set, RFC_Data_const< _Tag >::dimension(), i, k, n, pane(), pi, RFC_Pane_base::size_of_faces(), and RFC_Window_base::size_of_nodes().

Referenced by Transfer_base::transfer_2n().

97  {
98  _buf_dim = nd.dimension();
99 
100  // Loop through the panes
101  for (Pane_set::iterator pi=_pane_set.begin(); pi != _pane_set.end(); ++pi) {
103 
104  pane._buffer.resize( size);
105 
106  for ( int i=0; i<size; ++i)
107  pane._buffer[i].resize(pane._base->size_of_nodes()*_buf_dim);
108 
109  int n=pane.size_of_faces();
110 
111  if ( !init_emm) continue;
112 
113  pane._emm_offset.resize( n+1);
114  // Initialize space for the mass matrix
115  pane._emm_offset[0] = 0;
116 
117  int k=0;
118  // Loop through the connectivity table to mark their nodes as false.
119  if ( pane._base->is_structured()) {
120  for ( int i=0; i<n; ++i, ++k) {
121  pane._emm_offset[k+1] = pane._emm_offset[k] + 16;
122  }
123  }
124  else {
125  std::vector< const COM::Connectivity*> elems;
126  pane._base->elements( elems);
127 
128  for ( std::vector<const COM::Connectivity*>::const_iterator
129  it = elems.begin(); it != elems.end(); ++it) {
130  const int nn = (*it)->size_of_nodes_pe();
131  for ( int i=1,size=(*it)->size_of_elements(); i<=size; ++i, ++k) {
132  pane._emm_offset[k+1] = pane._emm_offset[k] + nn*nn;
133  }
134  }
135  }
136 
137  pane._emm_buffer.resize( pane._emm_offset[n], 0);
138  }
139 }
RFC_Pane_transfer & pane(const int pid)
Size dimension() const
j indices k indices k
Definition: Indexing.h:6
Base * _base
Reference to its base object.
int size_of_faces() const
The total number of faces in the pane.
blockLoc i
Definition: read.cpp:79
const NT & n
int size_of_nodes() const
Get the total number of nodes contained the window.
Pane_set _pane_set
The set of panes contained in the window.
const double pi
std::vector< Real > _emm_buffer
std::vector< std::vector< Real > > _buffer
std::vector< int > _emm_offset

Here is the call graph for this function:

Here is the caller graph for this function:

void init_recv_buffer ( int  pane_id,
int  from_rank 
)
private

Definition at line 539 of file RFC_Window_transfer_comm.C.

References RFC_Window_base::_bufwin_prefix, _IO_format, RFC_Window_base::_pane_set, _prefix, _replic_panes, RFC_Window_base::color(), COM_call_function(), COM_delete_window(), COM_get_attribute_handle(), COM_get_function_handle(), COM_LOAD_MODULE_STATIC_DYNAMIC, COM_UNLOAD_MODULE_STATIC_DYNAMIC, RFC_Window_base::get_prefix_base(), RFC_Window_base::get_sdv_fname(), RFC_Pane_base::init(), MPI_COMM_SELF, pane(), RFC_Pane_base::read_binary(), RFC_Pane_base::read_rocin(), RFC_assertion, and RFC_Window_base::SDV_BINARY.

Referenced by replicate_metadata().

539  {
540 
541  RFC_assertion( _pane_set.find( pane_id) == _pane_set.end());
542 
543  COM::Pane *base_pane = new COM::Pane( (COM::Window*)NULL, pane_id);
544  RFC_Pane_transfer *pane = new RFC_Pane_transfer( base_pane, color());
545  _replic_panes[ pane_id] = pane;
546 
547  std::string fname = get_sdv_fname( _prefix.c_str(), pane_id, _IO_format);
548  if ( _IO_format == SDV_BINARY) {
549  std::ifstream is( fname.c_str()); RFC_assertion( is);
550 
551  pane->read_binary( is, NULL, base_pane);
552  }
553  else {
554  // Read in using Rocin.
556  int hdl_read = COM_get_function_handle( "RFC_IN.read_windows");
557  int hdl_obtain = COM_get_function_handle( "RFC_IN.obtain_attribute");
558 
559  // Define the base-window and sdv-window names
560  std::string base_material = get_prefix_base( _prefix.c_str());
561  std::string sdv_material = base_material+"_sdv";
562 
563  std::string buf_wname(_bufwin_prefix); buf_wname.append( base_material);
564  std::string sdv_wname=buf_wname+"_sdv";
565 
566  // Read the parent pane and the subdivided pane from the given file.
567  MPI_Comm comm_self = MPI_COMM_SELF;
568  COM_call_function( hdl_read, fname.c_str(), _bufwin_prefix,
569  (base_material+" "+sdv_material).c_str(), &comm_self);
570 
571  int hdl_all = COM_get_attribute_handle( (buf_wname+".all").c_str());
572  COM_call_function( hdl_obtain, &hdl_all, &hdl_all, &pane_id);
573  hdl_all = COM_get_attribute_handle( (sdv_wname+".all").c_str());
574  COM_call_function( hdl_obtain, &hdl_all, &hdl_all, &pane_id);
575 
576  pane->read_rocin( sdv_wname, buf_wname, base_pane);
577 
578  // Delete the windows created by Rocin.
579  COM_delete_window( buf_wname.c_str());
580  COM_delete_window( sdv_wname.c_str());
581 
582  // Unload Rocin
584  }
585 
586  pane->init();
587 }
RFC_Pane_transfer & pane(const int pid)
std::map< int, RFC_Pane_transfer * > _replic_panes
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_COMM_SELF
void COM_delete_window(const char *wname)
Definition: roccom_c++.h:94
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
int color() const
The color of the window for overlay or for data transfer (BLUE or GREEN).
const std::string _prefix
static const char * _bufwin_prefix
#define COM_UNLOAD_MODULE_STATIC_DYNAMIC(moduleName, windowString)
Definition: roccom_basic.h:113
void read_binary(std::istream &is, std::vector< int > *b2v_all=NULL, COM::Pane *p=NULL)
Definition: Rocin.h:64
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
Pane_set _pane_set
The set of panes contained in the window.
static const char * get_prefix_base(const char *prefix)
void read_rocin(const std::string &sdv_wname, const std::string &parent_wname="", COM::Pane *p=NULL)
Read in using Rocin.
#define RFC_assertion
Definition: rfc_basic.h:65
static std::string get_sdv_fname(const char *prefix, int pane_id, const int format=SDV_BINARY)
#define COM_LOAD_MODULE_STATIC_DYNAMIC(moduleName, windowString)
Definition: roccom_basic.h:111
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428

Here is the call graph for this function:

Here is the caller graph for this function:

void init_send_buffer ( int  pane_id,
int  to_rank 
)
private

Definition at line 531 of file RFC_Window_transfer_comm.C.

References _panes_to_send, and pane().

Referenced by replicate_metadata().

531  {
532  _panes_to_send.insert( std::pair<int,RFC_Pane_transfer*>( to_rank,
533  &pane(pane_id)));
534 }
RFC_Pane_transfer & pane(const int pid)
std::set< std::pair< int, RFC_Pane_transfer * > > _panes_to_send

Here is the call graph for this function:

Here is the caller graph for this function:

bool is_root ( ) const

Check whether the process has rank 0.

Definition at line 499 of file RFC_Window_transfer_comm.C.

References _comm, and rank.

Referenced by Transfer_base::interpolate_fe(), Transfer_base::loadtransfer(), Interpolator::transfer(), Transfer_base::transfer_2f(), and Transfer_base::transfer_2n().

499  {
500  int rank; MPI_Comm_rank( _comm, &rank);
501  return (rank==0);
502 }
static int rank
Definition: advectest.C:66

Here is the caller graph for this function:

Nodal_data nodal_buffer ( int  index)

Definition at line 142 of file RFC_Window_transfer.C.

References _buf_dim, and RFC_assertion.

Referenced by Transfer_base::transfer_2n().

142  {
143  RFC_assertion( index >= 0);
144  return Nodal_data( -index-1, _buf_dim);
145 }
RFC_Data< Tag_nodal > Nodal_data
#define RFC_assertion
Definition: rfc_basic.h:65

Here is the caller graph for this function:

RFC_Pane_transfer & pane ( const int  pid)

Definition at line 74 of file RFC_Window_transfer.C.

References RFC_Window_base::_pane_set, and _replic_panes.

Referenced by delete_facial_buffers(), delete_nodal_buffers(), Transfer_base::get_src_pane(), Transfer_base::get_trg_pane(), incident_faces(), incident_panes(), init_facial_buffers(), init_nodal_buffers(), init_recv_buffer(), init_send_buffer(), reduce_maxabs_to_all(), reduce_to_all(), replicate_metadata(), and set_tags().

74  {
75  Pane_set::iterator pit = _pane_set.find( pid);
76  if ( pit != _pane_set.end()) {
77  return reinterpret_cast<RFC_Pane_transfer&>(*pit->second);
78  }
79  else {
80  return *_replic_panes.find( pid)->second;
81  }
82 }
std::map< int, RFC_Pane_transfer * > _replic_panes
Pane_set _pane_set
The set of panes contained in the window.

Here is the caller graph for this function:

const RFC_Pane_transfer & pane ( const int  pid) const

Definition at line 85 of file RFC_Window_transfer.C.

References RFC_Window_base::_pane_set, and _replic_panes.

85  {
86  Pane_set::const_iterator pit = _pane_set.find( pid);
87  if ( pit != _pane_set.end()) {
88  return reinterpret_cast<const RFC_Pane_transfer&>(*pit->second);
89  }
90  else {
91  return *_replic_panes.find( pid)->second;
92  }
93 }
std::map< int, RFC_Pane_transfer * > _replic_panes
Pane_set _pane_set
The set of panes contained in the window.
void reduce_maxabs_to_all ( Nodal_data data)

Definition at line 476 of file RFC_Window_transfer_comm.C.

References RFC_Window_base::_map_comm, RFC_Window_base::_pane_set, COM_DOUBLE, RFC_Data_const< _Tag >::dimension(), RFC_Data_const< _Tag >::id(), pane(), pi, and RFC_Pane_transfer::pointer().

Referenced by Transfer_base::interpolate_fe(), and Transfer_base::transfer_2n().

476  {
477  std::vector<void *> ptrs; ptrs.reserve( _pane_set.size());
478 
479  for (Pane_set::iterator pi=_pane_set.begin(); pi != _pane_set.end(); ++pi) {
481 
482  ptrs.push_back( pane.pointer( data.id()));
483  }
484 
485  _map_comm.init( &ptrs[0], COM_DOUBLE, data.dimension());
486 
487  _map_comm.begin_update_shared_nodes();
488  _map_comm.reduce_maxabs_on_shared_nodes();
489  _map_comm.end_update_shared_nodes();
490 }
MAP::Pane_communicator _map_comm
RFC_Pane_transfer & pane(const int pid)
Size dimension() const
Pane_set _pane_set
The set of panes contained in the window.
const double pi

Here is the call graph for this function:

Here is the caller graph for this function:

void reduce_to_all ( Nodal_data data,
MPI_Op  op 
)

Definition at line 459 of file RFC_Window_transfer_comm.C.

References RFC_Window_base::_map_comm, RFC_Window_base::_pane_set, COM_DOUBLE, RFC_Data_const< _Tag >::dimension(), RFC_Data_const< _Tag >::id(), pane(), pi, and RFC_Pane_transfer::pointer().

Referenced by Transfer_base::init_load_vector(), and Transfer_base::multiply_mass_mat_and_x().

459  {
460  std::vector<void *> ptrs; ptrs.reserve( _pane_set.size());
461 
462  for (Pane_set::iterator pi=_pane_set.begin(); pi != _pane_set.end(); ++pi) {
464 
465  ptrs.push_back( pane.pointer( data.id()));
466  }
467 
468  _map_comm.init( &ptrs[0], COM_DOUBLE, data.dimension());
469 
470  _map_comm.begin_update_shared_nodes();
471  _map_comm.reduce_on_shared_nodes( op);
472  _map_comm.end_update_shared_nodes();
473 }
MAP::Pane_communicator _map_comm
RFC_Pane_transfer & pane(const int pid)
Size dimension() const
Pane_set _pane_set
The set of panes contained in the window.
const double pi

Here is the call graph for this function:

Here is the caller graph for this function:

void replicate_data ( const Facial_data_const data,
bool  replicate_coor 
)

Replicate the given data from remote processes onto local process.

Replicate coordinates only if replicate_coor is true.

Definition at line 228 of file RFC_Window_transfer_comm.C.

References _comm, RFC_Pane_transfer::_coor_buf, RFC_Pane_transfer::_data_buf, RFC_Pane_transfer::_data_buf_id, _pane_map, _panes_to_send, RFC_Pane_transfer::_recv_faces, _replic_panes, RFC_Pane_transfer::_send_buffers, RFC_Pane_transfer::_send_faces, RFC_Pane_transfer::coordinates(), d, RFC_Data_const< _Tag >::dimension(), i, RFC_Pane_base::id(), RFC_Data_const< _Tag >::id(), iend, j, MPI_BYTE, RFC_Pane_transfer::pointer(), QUIET_NAN, RFC_assertion, s, RFC_Pane_base::size_of_faces(), RFC_Pane_base::size_of_nodes(), and wait_all().

Referenced by Transfer_base::loadtransfer(), Interpolator::transfer(), Transfer_base::transfer_2f(), and Transfer_base::transfer_2n().

229  {
230  std::vector< MPI_Request> other_requests, recv_requests;
231 
232  other_requests.reserve( _replic_panes.size()+_panes_to_send.size());
233  recv_requests.reserve( _replic_panes.size());
234 
235  std::vector< RFC_Pane_transfer*> recv_panes;
236  recv_panes.reserve(_replic_panes.size());
237 
238  int totalNumPanes = _pane_map.size();
239  int d = data.dimension(), ierr;
240 
241  // Loop through the replicated panes
242  // Initiate receive of data buffers from remote processes
243  for (std::map< int, RFC_Pane_transfer*>::iterator
244  it=_replic_panes.begin(),iend=_replic_panes.end(); it != iend; ++it) {
245  RFC_Pane_transfer *p=it->second;
246  p->_data_buf_id = data.id();
247 
248  p->_data_buf.reserve( p->size_of_faces()*d);
249  p->_data_buf.resize( p->_recv_faces.size()*d, QUIET_NAN);
250 
251  std::pair< int, int> s = _pane_map.find( p->id())->second;
252  MPI_Request req;
253  ierr = MPI_Irecv( &p->_data_buf[0], p->_data_buf.size()*sizeof(Real),
254  MPI_BYTE, s.first, 100+s.second, _comm, &req);
255  RFC_assertion( ierr==0);
256  recv_requests.push_back( req);
257  recv_panes.push_back( it->second);
258 
259  if ( replicate_coor) {
260  p->_coor_buf.resize( p->size_of_faces()*3);
261  ierr = MPI_Irecv( &p->_coor_buf[0],
262  p->_recv_faces.size()*3*sizeof(Real), MPI_BYTE,
263  s.first, 100+totalNumPanes+s.second, _comm, &req);
264  RFC_assertion( ierr==0);
265  other_requests.push_back( req);
266  }
267  }
268 
269  // Initiate send of data buffers to remote processes
270  for (std::set< std::pair<int, RFC_Pane_transfer*> >::const_iterator
271  it=_panes_to_send.begin(),iend=_panes_to_send.end(); it!=iend; ++it){
272  RFC_Pane_transfer *p=it->second;
273 
274  std::pair< int, int> s = _pane_map.find( p->id())->second;
275 
276  // Initialize the send buffer
277  std::vector<int> &send_faces=p->_send_faces[it->first];
278  std::vector<Real> &data_buf=p->_send_buffers[it->first];
279  const Real *addr = p->pointer(data.id());
280 
281  // We only allocate buffer if all entries are not sent
282  if ( int(p->_send_faces.size()) != p->size_of_faces()) {
283  data_buf.resize( send_faces.size()*d, QUIET_NAN);
284 
285  for ( int i=send_faces.size()-1; i>=0; --i) {
286  for ( int j=d-1; j>=0; --j) {
287  data_buf[i*d+j] = addr[(send_faces[i]-1)*d+j];
288  }
289  }
290  addr = &data_buf[0];
291  }
292 
293  MPI_Request req;
294  ierr = MPI_Isend( const_cast<Real*>(addr), send_faces.size()*d*sizeof(Real),
295  MPI_BYTE, it->first, 100+s.second, _comm, &req);
296 
297  RFC_assertion( ierr==0);
298  other_requests.push_back( req);
299 
300  if ( replicate_coor) {
301  ierr = MPI_Isend( const_cast<Real*>(p->coordinates()),
302  p->_send_faces[it->first].size()*3*sizeof(Real), MPI_BYTE,
303  it->first, 100+totalNumPanes+s.second, _comm, &req);
304  RFC_assertion( ierr==0);
305  other_requests.push_back( req);
306  }
307  }
308 
309  // Processing received data arrays
310  while ( !recv_requests.empty()) {
311  int index;
312  MPI_Status stat;
313 
314  ierr = MPI_Waitany(recv_requests.size(), &recv_requests[0], &index, &stat);
315  RFC_assertion( ierr==0);
316  RFC_Pane_transfer *p=recv_panes[index];
317 
318  // Reorganize the data buffer as a dense array, and fill
319  // unused entries by NaN.
320  std::vector<Real> &buf = p->_data_buf;
321  buf.resize( p->size_of_nodes()*d, QUIET_NAN);
322 
323  std::vector<int> &faces = p->_recv_faces;
324  for ( int i=faces.size()-1; i>=0; --i) {
325  if ( i==faces[i]-1) break;
326  for ( int j=d-1; j>=0; --j) {
327  buf[(faces[i]-1)*d+j] = buf[i*d+j];
328  buf[i*d+j] = QUIET_NAN;
329  }
330  }
331 
332  // Remove the received message from the list
333  recv_requests.erase( recv_requests.begin()+index);
334  recv_panes.erase( recv_panes.begin()+index);
335  }
336 
337  // Wait for all send requests to finish
338  wait_all( other_requests.size(), &other_requests[0]);
339 }
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_BYTE
#define QUIET_NAN
std::map< int, RFC_Pane_transfer * > _replic_panes
const NT & d
Size dimension() const
const Real * coordinates() const
std::vector< int > _recv_faces
double s
Definition: blastest.C:80
void wait_all(int n, MPI_Request *requests)
std::vector< Real > _coor_buf
double Real
Definition: mapbasic.h:322
std::map< int, std::vector< Real > > _send_buffers
int size_of_faces() const
The total number of faces in the pane.
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend
std::map< int, std::pair< int, int > > _pane_map
int size_of_nodes() const
The total number of nodes in the pane.
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
int id() const
std::set< std::pair< int, RFC_Pane_transfer * > > _panes_to_send
#define RFC_assertion
Definition: rfc_basic.h:65
std::map< int, std::vector< int > > _send_faces
std::vector< Real > _data_buf

Here is the call graph for this function:

Here is the caller graph for this function:

void replicate_data ( const Nodal_data_const data,
bool  replicate_coor 
)

Definition at line 344 of file RFC_Window_transfer_comm.C.

References _comm, RFC_Pane_transfer::_coor_buf, RFC_Pane_transfer::_data_buf, RFC_Pane_transfer::_data_buf_id, _pane_map, _panes_to_send, RFC_Pane_transfer::_recv_nodes, _replic_panes, RFC_Pane_transfer::_send_buffers, RFC_Pane_transfer::_send_nodes, RFC_Pane_transfer::coordinates(), d, RFC_Data_const< _Tag >::dimension(), i, RFC_Pane_base::id(), RFC_Data_const< _Tag >::id(), iend, j, MPI_BYTE, RFC_Pane_transfer::pointer(), QUIET_NAN, RFC_assertion, s, RFC_Pane_base::size_of_nodes(), and wait_all().

345  {
346  std::vector< MPI_Request> other_requests, recv_requests;
347 
348  other_requests.reserve( _replic_panes.size()+_panes_to_send.size());
349  recv_requests.reserve( _replic_panes.size());
350 
351  std::vector< RFC_Pane_transfer*> recv_panes;
352  recv_panes.reserve(_replic_panes.size());
353 
354  int totalNumPanes = _pane_map.size();
355  int d = data.dimension(), ierr;
356 
357  // Loop through the replicated panes
358  // Initiate receive of data buffers from remote processes
359  for (std::map< int, RFC_Pane_transfer*>::iterator
360  it=_replic_panes.begin(),iend=_replic_panes.end(); it != iend; ++it) {
361  RFC_Pane_transfer *p=it->second;
362  p->_data_buf_id = data.id();
363 
364  p->_data_buf.reserve( p->size_of_nodes()*d);
365  p->_data_buf.resize( p->_recv_nodes.size()*d);
366 
367  std::pair< int, int> s = _pane_map.find( p->id())->second;
368  MPI_Request req;
369  ierr = MPI_Irecv( &p->_data_buf[0], p->_data_buf.size()*sizeof(Real),
370  MPI_BYTE, s.first, 100+s.second, _comm, &req);
371  RFC_assertion( ierr==0);
372  recv_requests.push_back( req);
373  recv_panes.push_back( it->second);
374 
375  if ( replicate_coor) {
376  p->_coor_buf.resize( p->size_of_nodes()*3);
377  ierr = MPI_Irecv( &p->_coor_buf[0],
378  p->_recv_nodes.size()*3*sizeof(Real), MPI_BYTE,
379  s.first, 100+totalNumPanes+s.second, _comm, &req);
380  RFC_assertion( ierr==0);
381  other_requests.push_back( req);
382  }
383  }
384 
385  // Initiate send of data buffers to remote processes
386  for (std::set< std::pair<int, RFC_Pane_transfer*> >::const_iterator
387  it=_panes_to_send.begin(),iend=_panes_to_send.end(); it!=iend; ++it){
388  RFC_Pane_transfer *p=it->second;
389 
390  std::pair< int, int> s = _pane_map.find( p->id())->second;
391 
392  // Initialize the send buffer
393  std::vector<int> &send_nodes=p->_send_nodes[it->first];
394  std::vector<Real> &data_buf=p->_send_buffers[it->first];
395  const Real *addr = p->pointer(data.id());
396 
397  // We only allocate buffer if all entries are not sent
398  if ( int(p->_send_nodes.size()) != p->size_of_nodes()) {
399  data_buf.resize( send_nodes.size()*d);
400 
401  for ( int i=send_nodes.size()-1; i>=0; --i) {
402  for ( int j=d-1; j>=0; --j) {
403  data_buf[i*d+j] = addr[(send_nodes[i]-1)*d+j];
404  }
405  }
406  addr = &data_buf[0];
407  }
408 
409  MPI_Request req;
410  ierr = MPI_Isend( const_cast<Real*>(addr), send_nodes.size()*d*sizeof(Real),
411  MPI_BYTE, it->first, 100+s.second, _comm, &req);
412  RFC_assertion( ierr==0);
413  other_requests.push_back( req);
414 
415  if ( replicate_coor) {
416  ierr = MPI_Isend( const_cast<Real*>(p->coordinates()),
417  p->_send_nodes[it->first].size()*3*sizeof(Real), MPI_BYTE,
418  it->first, 100+totalNumPanes+s.second, _comm, &req);
419  RFC_assertion( ierr==0);
420  other_requests.push_back( req);
421  }
422  }
423 
424  // Processing received data arrays
425  while ( !recv_requests.empty()) {
426  int index;
427  MPI_Status stat;
428 
429  ierr = MPI_Waitany(recv_requests.size(), &recv_requests[0], &index, &stat);
430  RFC_assertion( ierr==0);
431 
432  RFC_Pane_transfer *p=recv_panes[index];
433  std::vector<Real> &buf = p->_data_buf;
434 
435  // Reorganize the data buffer as a dense array, and fill
436  // unused entries by NaN.
437  std::vector<int> &nodes = p->_recv_nodes;
438  buf.resize( p->size_of_nodes()*d, QUIET_NAN);
439 
440  for ( int i=nodes.size()-1; i>=0; --i) {
441  int lid = nodes[i]-1;
442  if ( i==lid) break;
443  for ( int j=d-1; j>=0; --j) {
444  buf[lid*d+j] = buf[i*d+j];
445  buf[i*d+j] = QUIET_NAN;
446  }
447  }
448 
449  // Remove the received message from the list
450  recv_requests.erase( recv_requests.begin()+index);
451  recv_panes.erase( recv_panes.begin()+index);
452  }
453 
454  // Wait for all send requests to finish
455  wait_all( other_requests.size(), &other_requests[0]);
456 }
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_BYTE
#define QUIET_NAN
std::map< int, RFC_Pane_transfer * > _replic_panes
const NT & d
Size dimension() const
const Real * coordinates() const
double s
Definition: blastest.C:80
void wait_all(int n, MPI_Request *requests)
std::vector< Real > _coor_buf
double Real
Definition: mapbasic.h:322
std::map< int, std::vector< Real > > _send_buffers
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend
std::map< int, std::pair< int, int > > _pane_map
int size_of_nodes() const
The total number of nodes in the pane.
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
std::map< int, std::vector< int > > _send_nodes
int id() const
std::set< std::pair< int, RFC_Pane_transfer * > > _panes_to_send
#define RFC_assertion
Definition: rfc_basic.h:65
std::vector< Real > _data_buf
std::vector< int > _recv_nodes

Here is the call graph for this function:

void replicate_metadata ( int *  pane_ids,
int  n 
)

Replicate the metadata of a remote pane only the local process.

Definition at line 174 of file RFC_Window_transfer_comm.C.

References _comm, _pane_map, _replicated, comm_rank(), comm_size(), counts_to_displs(), i, init_recv_buffer(), init_send_buffer(), j, k, n, rank, and RFC_assertion.

Referenced by replicate_metadata().

174  {
175  // Determine the owners of the panes
176  std::vector< int> npanes_recv( comm_size(), 0);
177  std::vector< int> npanes_send( comm_size(), 0);
178  int rank=comm_rank();
179 
180  for ( int i=0; i<n; ++i) {
181  RFC_assertion( _pane_map.find(pane_ids[i]) != _pane_map.end());
182  std::pair< int, int> p = _pane_map.find( pane_ids[i])->second;
183  if ( p.first != rank) ++npanes_recv[ p.first];
184  }
185 
186  MPI_Alltoall( &npanes_recv[0], 1, MPI_INT,
187  &npanes_send[0], 1, MPI_INT, _comm);
188 
189  // Create a buffer for the displacements of the buffer for pane ids.
190  std::vector<int> displs_recv( npanes_recv.size()+1);
191  counts_to_displs( npanes_recv, displs_recv);
192  std::vector<int> displs_send( npanes_send.size()+1);
193  counts_to_displs( npanes_send, displs_send);
194 
195  std::vector< int> ids_recv( displs_recv.back());
196  for ( int i=0; i<n; ++i) {
197  std::pair< int, int> p = _pane_map.find( pane_ids[i])->second;
198  if ( p.first != rank) ids_recv[ displs_recv[p.first]++] = pane_ids[i];
199  }
200  counts_to_displs( npanes_recv, displs_recv);
201 
202  std::vector< int> ids_send( displs_send.back());
203 
204  MPI_Alltoallv(&ids_recv[0], &npanes_recv[0],&displs_recv[0], MPI_INT,
205  &ids_send[0], &npanes_send[0],&displs_send[0], MPI_INT, _comm);
206 
207 
208  // Prepare the data structures for sending.
209  for ( int i=0, size=npanes_send.size(), k=0; i<size; ++i) {
210  for ( int j=0; j<npanes_send[i]; ++j, ++k) {
211  init_send_buffer( ids_send[k], i);
212  }
213  }
214 
215  // Prepare the data structures for receiving data (replication)
216  for ( int i=0, size=npanes_recv.size(), k=0; i<size; ++i) {
217  for ( int j=0; j<npanes_recv[i]; ++j, ++k) {
218  init_recv_buffer( ids_recv[k], i);
219  }
220  }
221 
222  _replicated = true;
223 }
j indices k indices k
Definition: Indexing.h:6
void counts_to_displs(const std::vector< int > &counts, std::vector< int > &displs) const
std::map< int, std::pair< int, int > > _pane_map
blockLoc i
Definition: read.cpp:79
const NT & n
j indices j
Definition: Indexing.h:6
static int rank
Definition: advectest.C:66
void init_recv_buffer(int pane_id, int from_rank)
#define RFC_assertion
Definition: rfc_basic.h:65
void init_send_buffer(int pane_id, int to_rank)

Here is the call graph for this function:

Here is the caller graph for this function:

void replicate_metadata ( const RFC_Window_transfer opp_win)

Replicate the remote panes that are in contact with the local panes in opp_win.

Definition at line 54 of file RFC_Window_transfer_comm.C.

References _pane_map, RFC_Window_base::_pane_set, RFC_Pane_transfer::_recv_faces, RFC_Pane_transfer::_recv_nodes, RFC_Pane_transfer::_send_faces, RFC_Pane_transfer::_send_nodes, RFC_Pane_base::_subface_counterparts, RFC_Pane_base::_subface_parents, RFC_Pane_base::_subfaces, RFC_Pane_base::_subnode_parents, RFC_Pane_base::base(), comm_rank(), for(), i, incident_faces(), RFC_Pane_transfer::is_master(), j, k, pane(), Face_ID::pane_id, pi, rank, replicate_metadata(), RFC_assertion, and RFC_Pane_base::size_of_subfaces().

54  {
55 
56  std::map< int, std::vector<int> > opp_subface_lists;
57  opp_win.incident_faces( opp_subface_lists);
58 
59  // First, make local copies of topology information of remote panes.
60  std::vector< int> pane_ids; pane_ids.reserve( opp_subface_lists.size());
61 
62  for ( std::map< int, std::vector<int> >::const_iterator
63  it=opp_subface_lists.begin(); it!=opp_subface_lists.end(); ++it) {
64  pane_ids.push_back( it->first);
65  }
66  replicate_metadata( &pane_ids[0], pane_ids.size());
67 
68  // Fill in _recv_faces and _recv_nodes for each remote pane.
69  // Loop through the subface_lists
70  for ( std::map< int, std::vector<int> >::const_iterator
71  it=opp_subface_lists.begin(); it!=opp_subface_lists.end(); ++it) {
72 
73  RFC_Pane_transfer &pn = pane( it->first);
74  if (pn.is_master()) continue;
75 
76  RFC_assertion(pn._recv_faces.empty());
77  // Loop through the subfaces of pn
78  const std::vector< int> &subface_list = it->second;
79  std::set<int> face_list;
80  std::set<int> node_list;
81  for ( int i=0, size=subface_list.size(); i<size; ++i) {
82  int parent = pn._subface_parents[ subface_list[i]-1];
83  face_list.insert( parent);
84 
85  Element_node_enumerator ene( pn.base(), parent);
86 
87  for ( int k=0, kn=ene.size_of_nodes(); k<kn; ++k)
88  node_list.insert( ene[k]);
89 
90  // Loop through the subnodes of the subface, and insert the nodes
91  // in their host facets.
92  Three_tuple<int> &f = pn._subfaces[ subface_list[i]-1];
93  for ( int j=0; j<3; ++j) {
94  int parent = pn._subnode_parents[ f[j]-1].face_id;
95  Element_node_enumerator ene( pn.base(), parent);
96 
97  for ( int k=0, kn=ene.size_of_nodes(); k<kn; ++k)
98  node_list.insert( ene[k]);
99  }
100  }
101 
102  pn._recv_faces.reserve( face_list.size());
103  pn._recv_faces.insert( pn._recv_faces.end(), face_list.begin(), face_list.end());
104  pn._recv_nodes.reserve( node_list.size());
105  pn._recv_nodes.insert( pn._recv_nodes.end(), node_list.begin(), node_list.end());
106  }
107 
108  // Fill in _send_faces and _send_nodes for each local pane.
109  const std::map<int, std::pair<int, int> > &opp_panemap = opp_win._pane_map;
110  int rank=comm_rank();
111 
112  // Loop through the panes.
113  for (Pane_set::iterator pi=_pane_set.begin(); pi!=_pane_set.end(); ++pi) {
114 
115  // For the current pane, obtain a list of its faces that
116  // need to be sent to each remote process.
118 
119  // Creaet a list and put into the following object
120  std::map< int, std::set<int> > sfs;
121  std::map< int, std::set<int> > sns;
122 
123  for ( int i=0, size=pane.size_of_subfaces(); i<size; ++i) {
124  // If the counterpart of a subface is owned by a remote process P,
125  // insert the parent of the subface into the face list for P.
126  Face_ID oppf = pane._subface_counterparts[i];
127  int remote_rank = opp_panemap.find( oppf.pane_id)->second.first;
128 
129  if ( remote_rank != rank) {
130  int parent = pane._subface_parents[i];
131  sfs[ remote_rank].insert( parent);
132 
133  std::set<int> &ns=sns[remote_rank];
134  Element_node_enumerator ene( pane.base(), parent);
135 
136  for ( int k=0, kn=ene.size_of_nodes(); k<kn; ++k)
137  ns.insert( ene[k]);
138 
139  // Loop through the subnodes of the subface, and insert the nodes
140  // in their host facets.
141  Three_tuple<int> &f = pane._subfaces[ i];
142  for ( int j=0; j<3; ++j) {
143  int parent = pane._subnode_parents[ f[j]-1].face_id;
144  Element_node_enumerator ene( pane.base(), parent);
145 
146  for ( int k=0, kn=ene.size_of_nodes(); k<kn; ++k)
147  ns.insert( ene[k]);
148  }
149  }
150  }
151 
152  // Copy from sfs to pane._send_faces
153  RFC_assertion(pane._send_faces.empty());
154  for ( std::map<int, std::set<int> >::const_iterator
155  it=sfs.begin(); it!=sfs.end(); ++it) {
156  std::vector<int> &vec=pane._send_faces[ it->first];
157  vec.reserve(it->second.size());
158  vec.insert( vec.end(), it->second.begin(), it->second.end());
159  }
160 
161  // Copy from sns to pane._send_nodes
162  RFC_assertion(pane._send_nodes.empty());
163  for ( std::map<int, std::set<int> >::const_iterator
164  it=sns.begin(); it!=sns.end(); ++it) {
165  std::vector<int> &vec=pane._send_nodes[ it->first];
166  vec.reserve(it->second.size());
167  vec.insert( vec.end(), it->second.begin(), it->second.end());
168  }
169  }
170 }
RFC_Pane_transfer & pane(const int pid)
An adaptor for enumerating node IDs of an element.
j indices k indices k
Definition: Indexing.h:6
std::vector< int > _recv_faces
Base * base()
The id of its base COM::Pane object.
int pane_id
the id of the owner pane.
std::vector< Three_tuple< int > > _subfaces
std::vector< Edge_ID > _subnode_parents
Edge ids of parents.
void incident_faces(std::map< int, std::vector< int > > &) const
Obtain the list of incident faces in each pane of the opposite mesh.
std::map< int, std::pair< int, int > > _pane_map
blockLoc i
Definition: read.cpp:79
int size_of_subfaces() const
The total number of faces in the subdivision of the pane.
Pane_set _pane_set
The set of panes contained in the window.
j indices j
Definition: Indexing.h:6
const double pi
std::vector< int > _subface_parents
Face ids of the parents of the subfaces.
void replicate_metadata(int *pane_ids, int n)
Replicate the metadata of a remote pane only the local process.
std::map< int, std::vector< int > > _send_nodes
static int rank
Definition: advectest.C:66
for(;;)
#define RFC_assertion
Definition: rfc_basic.h:65
std::map< int, std::vector< int > > _send_faces
std::vector< Face_ID > _subface_counterparts
Ids of counterparts of faces.
A global ID of a face.
std::vector< int > _recv_nodes

Here is the call graph for this function:

bool replicated ( ) const
inline

Returns whether replication has been performed.

Definition at line 161 of file RFC_Window_transfer.h.

References _replicated.

161 { return _replicated; }
void set_tags ( const COM::Attribute *  tag)

Definition at line 160 of file RFC_Window_transfer.C.

References RFC_Pane_base::_base, RFC_Window_base::_pane_set, RFC_Pane_transfer::_to_recv, RFC_Window_base::attribute(), pane(), and pi.

160  {
161  // Loop through the panes to set the tags
162  for (Pane_set::iterator pi=_pane_set.begin(); pi != _pane_set.end(); ++pi) {
164 
165  pane._to_recv = ( tag == NULL) ? (int *)NULL :
166  (int *)(pane._base->attribute( tag->id())->pointer());
167  }
168 }
RFC_Pane_transfer & pane(const int pid)
const Attribute * attribute(const char *f) const
Retrieve an attribute object from the base using the attribute name.
Base * _base
Reference to its base object.
Pane_set _pane_set
The set of panes contained in the window.
const double pi

Here is the call graph for this function:

void wait_all ( int  n,
MPI_Request *  requests 
)

Definition at line 505 of file RFC_Window_transfer_comm.C.

References RFC_assertion.

Referenced by replicate_data().

505  {
506  if ( n>0) {
507  std::vector<MPI_Status> statuses(n);
508  int ierr = MPI_Waitall( n, requests, &statuses[0]);
509  RFC_assertion( ierr==0);
510  }
511 }
const NT & n
#define RFC_assertion
Definition: rfc_basic.h:65

Here is the caller graph for this function:

void wait_any ( int  n,
MPI_Request *  requests,
int *  index,
MPI_Status *  stat = NULL 
)

Definition at line 514 of file RFC_Window_transfer_comm.C.

References RFC_assertion, and s.

515  {
516  if ( n>0) {
517  MPI_Status s; if ( stat==NULL) stat = &s;
518  int ierr = MPI_Waitany( n, requests, index, stat);
519  RFC_assertion( ierr==0);
520  }
521 }
double s
Definition: blastest.C:80
const NT & n
#define RFC_assertion
Definition: rfc_basic.h:65

Member Data Documentation

int _buf_dim
private
MPI_Comm _comm
private
const int _IO_format
private

Definition at line 230 of file RFC_Window_transfer.h.

Referenced by init_recv_buffer().

std::vector<int> _num_panes
private

Definition at line 224 of file RFC_Window_transfer.h.

Referenced by RFC_Window_transfer().

std::map< int, std::pair<int, int> > _pane_map
private

Definition at line 223 of file RFC_Window_transfer.h.

Referenced by replicate_data(), replicate_metadata(), and RFC_Window_transfer().

std::set< std::pair<int, RFC_Pane_transfer*> > _panes_to_send
private

Definition at line 228 of file RFC_Window_transfer.h.

Referenced by init_send_buffer(), and replicate_data().

const std::string _prefix
private

Definition at line 229 of file RFC_Window_transfer.h.

Referenced by init_recv_buffer().

std::map< int, RFC_Pane_transfer*> _replic_panes
private
bool _replicated
private

Definition at line 226 of file RFC_Window_transfer.h.

Referenced by replicate_metadata(), and replicated().


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