Public Member Functions | Private Attributes

LibGeoDecomp::Selector< CELL > Class Template Reference

A Selector can be used by library code to extract data from user code, e.g. More...

#include <selector.h>

Collaboration diagram for LibGeoDecomp::Selector< CELL >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Selector ()
template<typename MEMBER >
 Selector (MEMBER CELL::*memberPointer, const std::string &memberName)
template<typename MEMBER >
 Selector (MEMBER CELL::*memberPointer, const std::string &memberName, const boost::shared_ptr< FilterBase< CELL > > &filter)
const std::string & name () const
std::size_t sizeOfMember () const
std::size_t sizeOfExternal () const
template<typename MEMBER >
bool checkTypeID () const
int offset () const
 The member's offset in LibFlatArray's SoA memory layout.
void copyMemberIn (const char *source, CELL *target, int num) const
 Read the data from source and set the corresponding member of each CELL at target.
void copyMemberOut (const CELL *source, char *target, int num) const
 Read the member of all CELLs at source and store them contiguously at target.
void copyStreakIn (const char *first, const char *last, char *target) const
 This is a helper function for writing members of a SoA memory layout.
void copyStreakOut (const char *first, const char *last, char *target) const
 This is a helper function for reading members from a SoA memory layout.
MPI_Datatype mpiDatatype () const
std::string typeName () const
int arity () const
template<class ARCHIVE >
void serialize (ARCHIVE &archive, const unsigned int version)

Private Attributes

char CELL::* memberPointer
std::size_t memberSize
std::size_t externalSize
int memberOffset
std::string memberName
boost::shared_ptr< FilterBase
< CELL > > 
filter

Detailed Description

template<typename CELL>
class LibGeoDecomp::Selector< CELL >

A Selector can be used by library code to extract data from user code, e.g.

so that writers can access a cell's member variable.

The code is based on a rather obscure C++ feature. Thanks to Evan Wallace for pointing this out: http://madebyevan.com/obscure-cpp-features/#pointer-to-member-operators

fixme: use this class in RemoteSteerer...


Constructor & Destructor Documentation

template<typename CELL>
LibGeoDecomp::Selector< CELL >::Selector (  )  [inline]
template<typename CELL>
template<typename MEMBER >
LibGeoDecomp::Selector< CELL >::Selector ( MEMBER CELL::*  memberPointer,
const std::string &  memberName 
) [inline]
template<typename CELL>
template<typename MEMBER >
LibGeoDecomp::Selector< CELL >::Selector ( MEMBER CELL::*  memberPointer,
const std::string &  memberName,
const boost::shared_ptr< FilterBase< CELL > > &  filter 
) [inline]

Member Function Documentation

template<typename CELL>
int LibGeoDecomp::Selector< CELL >::arity (  )  const [inline]
template<typename CELL>
template<typename MEMBER >
bool LibGeoDecomp::Selector< CELL >::checkTypeID (  )  const [inline]
template<typename CELL>
void LibGeoDecomp::Selector< CELL >::copyMemberIn ( const char *  source,
CELL *  target,
int  num 
) const [inline]

Read the data from source and set the corresponding member of each CELL at target.

Only useful for AoS memory layout.

Referenced by LibGeoDecomp::Grid< Color >::loadMemberImplementation(), and LibGeoDecomp::DisplacedGrid< CELL_TYPE, Topology >::loadMemberImplementation().

template<typename CELL>
void LibGeoDecomp::Selector< CELL >::copyMemberOut ( const CELL *  source,
char *  target,
int  num 
) const [inline]

Read the member of all CELLs at source and store them contiguously at target.

Only useful for AoS memory layout.

Referenced by LibGeoDecomp::SimpleCellPlotter< CELL_TYPE >::operator()(), LibGeoDecomp::Grid< Color >::saveMemberImplementation(), and LibGeoDecomp::DisplacedGrid< CELL_TYPE, Topology >::saveMemberImplementation().

template<typename CELL>
void LibGeoDecomp::Selector< CELL >::copyStreakIn ( const char *  first,
const char *  last,
char *  target 
) const [inline]

This is a helper function for writing members of a SoA memory layout.

template<typename CELL>
void LibGeoDecomp::Selector< CELL >::copyStreakOut ( const char *  first,
const char *  last,
char *  target 
) const [inline]

This is a helper function for reading members from a SoA memory layout.

template<typename CELL>
MPI_Datatype LibGeoDecomp::Selector< CELL >::mpiDatatype (  )  const [inline]
template<typename CELL>
const std::string& LibGeoDecomp::Selector< CELL >::name (  )  const [inline]
template<typename CELL>
int LibGeoDecomp::Selector< CELL >::offset (  )  const [inline]

The member's offset in LibFlatArray's SoA memory layout.

template<typename CELL>
template<class ARCHIVE >
void LibGeoDecomp::Selector< CELL >::serialize ( ARCHIVE &  archive,
const unsigned int  version 
) [inline]
template<typename CELL>
std::size_t LibGeoDecomp::Selector< CELL >::sizeOfExternal (  )  const [inline]
template<typename CELL>
std::size_t LibGeoDecomp::Selector< CELL >::sizeOfMember (  )  const [inline]
template<typename CELL>
std::string LibGeoDecomp::Selector< CELL >::typeName (  )  const [inline]

Member Data Documentation

template<typename CELL>
std::size_t LibGeoDecomp::Selector< CELL >::externalSize [private]
template<typename CELL>
boost::shared_ptr<FilterBase<CELL> > LibGeoDecomp::Selector< CELL >::filter [private]
template<typename CELL>
std::string LibGeoDecomp::Selector< CELL >::memberName [private]
template<typename CELL>
int LibGeoDecomp::Selector< CELL >::memberOffset [private]
template<typename CELL>
char CELL::* LibGeoDecomp::Selector< CELL >::memberPointer [private]
template<typename CELL>
std::size_t LibGeoDecomp::Selector< CELL >::memberSize [private]

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