Poster of Linux kernelThe best gift for a Linux geek
Node::PackedNode

Node::PackedNode

Section: C Library Functions (3) Updated: Thu Apr 7 2011
Local index Up
 

NAME

Node::PackedNode -  

SYNOPSIS


#include <node.h>  

Public Member Functions


PackedNode ()

PackedNode (const Node &node)

AutoPtr< Node > build_node () const

Point build_point () const
 

Static Public Member Functions


static MPI_Datatype create_mpi_datatype ()
 

Public Attributes


unsigned int id

unsigned int pid

Real x

Real y

Real z
 

Detailed Description

Convenient way to communicate nodes. This struct defines a packed up node which can be easily communicated through a derived MPI datatype.

Author:

Benjamin S. Kirk

Date:

2008

Definition at line 136 of file node.h.  

Constructor & Destructor Documentation

 

Node::PackedNode::PackedNode () [inline]

Definition at line 144 of file node.h.

                  :
      id(0),
      x(0.),
      y(0.),
      z(0.)
    {}
 

Node::PackedNode::PackedNode (const Node &node) [inline]

Definition at line 151 of file node.h.

                                  :
      id(node.id()),
      pid(node.processor_id()),
      x(node(0)),
      y(node(1)),
      z(node(2))
    {}
 

Member Function Documentation

 

AutoPtr<Node> Node::PackedNode::build_node () const [inline]

Definition at line 159 of file node.h.

References Node::Node(), and pid.

    {
      AutoPtr<Node> node(new Node(x,y,z,id));
      node->processor_id() = pid;
      return node;
    }
 

Point Node::PackedNode::build_point () const [inline]

Definition at line 166 of file node.h.

References Point::Point().

    {
      return Point(x,y,z);
    }
 

MPI_Datatype Node::PackedNode::create_mpi_datatype () [static]

Definition at line 50 of file node.C.

References id, and x.

{
  MPI_Datatype packed_node_type;
  MPI_Datatype types[] = { MPI_UNSIGNED, MPI_REAL };
  int blocklengths[] = { 2, 3 };
  MPI_Aint displs[2];
  
  // create a Packed node and get the addresses of the elements.
  // this will properly handle id/pid getting padded, for example,
  // in which case id and x may not be 2*sizeof(unsigned int) apart.
  Node::PackedNode pn;
  
  MPI_Address (&pn.id, &displs[0]);
  MPI_Address (&pn.x,  &displs[1]);
  displs[1] -= displs[0];
  displs[0] = 0;
  
#if MPI_VERSION > 1
  MPI_Type_create_struct (2, blocklengths, displs, types, &packed_node_type);
#else
  MPI_Type_struct (2, blocklengths, displs, types, &packed_node_type);
#endif // #if MPI_VERSION > 1

  return packed_node_type;
}
 

Member Data Documentation

 

unsigned int Node::PackedNode::id

Definition at line 138 of file node.h.

Referenced by create_mpi_datatype().  

unsigned int Node::PackedNode::pid

Definition at line 139 of file node.h.

Referenced by build_node().  

Real Node::PackedNode::x

Definition at line 140 of file node.h.

Referenced by create_mpi_datatype().  

Real Node::PackedNode::y

Definition at line 141 of file node.h.  

Real Node::PackedNode::z

Definition at line 142 of file node.h.

 

Author

Generated automatically by Doxygen for libMesh from the source code.


 

Index

NAME
SYNOPSIS
Public Member Functions
Static Public Member Functions
Public Attributes
Detailed Description
Constructor & Destructor Documentation
Node::PackedNode::PackedNode () [inline]
Node::PackedNode::PackedNode (const Node &node) [inline]
Member Function Documentation
AutoPtr<Node> Node::PackedNode::build_node () const [inline]
Point Node::PackedNode::build_point () const [inline]
MPI_Datatype Node::PackedNode::create_mpi_datatype () [static]
Member Data Documentation
unsigned int Node::PackedNode::id
unsigned int Node::PackedNode::pid
Real Node::PackedNode::x
Real Node::PackedNode::y
Real Node::PackedNode::z
Author

This document was created by man2html, using the manual pages.
Time: 21:51:27 GMT, April 16, 2011