Chombo + EB + MF  3.2
Public Member Functions | Private Attributes | Friends | List of all members
ReductionCopier Class Reference

Specialized copier for doing reductions in dimensionality. More...

#include <ReductionCopier.H>

Inheritance diagram for ReductionCopier:
Inheritance graph
[legend]

Public Member Functions

 ReductionCopier ()
 null constructor, copy constructor and operator= can be compiler defined. More...
 
 ReductionCopier (const bool &a_usingFaceSumOp, const DisjointBoxLayout &a_sourceLayout, const BoxLayout &a_destLayout, const ProblemDomain &a_domain, const IntVect &a_destGhost, const IntVect &a_reduceDir, bool a_exchange=false)
 face sum op requires that destGhost -> destGhost + Unit; this helps cell-centerd box calculus work for face-centered data More...
 
 ReductionCopier (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, int a_transverseDir, bool a_exchange=false)
 
 ReductionCopier (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const ProblemDomain &a_domain, int a_transverseDir, bool a_exchange=false)
 this constructor contains support for periodic BC's More...
 
 ReductionCopier (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const IntVect &a_destGhost, int a_transverseDir, bool a_exchange=false)
 Copier to copy data into the valid and invalid regions of a_dest from a_level. More...
 
 ReductionCopier (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const ProblemDomain &a_domain, const IntVect &a_destGhost, int a_transverseDir, bool a_exchange=false)
 Copier to copy data into the valid and invalid regions of a_dest from a_level with support for periodic BCs. More...
 
 ReductionCopier (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const Vector< int > &a_transverseDir, bool a_exchange=false)
 
 ReductionCopier (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const ProblemDomain &a_domain, const Vector< int > &a_transverseDir, bool a_exchange=false)
 this constructor contains support for periodic BC's More...
 
 ReductionCopier (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const IntVect &a_destGhost, const Vector< int > &a_transverseDir, bool a_exchange=false)
 Copier to copy data into the valid and invalid regions of a_dest from a_level. More...
 
 ReductionCopier (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const ProblemDomain &a_domain, const IntVect &a_destGhost, const Vector< int > &a_transverseDir, bool a_exchange=false)
 Copier to copy data into the valid and invalid regions of a_dest from a_level with support for periodic BCs. More...
 
virtual ~ReductionCopier ()
 
virtual void define (const bool &a_usingFaceSumOp, const DisjointBoxLayout &a_sourceLayout, const BoxLayout &a_destLayout, const ProblemDomain &a_domain, const IntVect &a_ghostVect, const Vector< int > &a_reduceDir, bool a_exchange=false)
 
virtual void setMotionItems (const int &a_itemProcID, const Box &a_fromBox, const Box &a_toBox, const bool &a_firstLoop, const DataIndex &a_fromdi, const DataIndex &a_todi, const bool &a_exchange=false)
 
virtual void nestedDILoops (const bool &a_firstLoop, const BoxLayout &a_sourceLayout, const BoxLayout &a_destLayout, const IntVect &a_ghostVect, const Box &a_domainBox, vector< DataIndex > &a_outerLoop, vector< DataIndex > &a_innerLoop, const Vector< int > &a_reduceLo, const Vector< int > &a_reduceHi, bool a_exchange=false)
 
virtual void define (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, int a_transverseDir, bool a_exchange=false)
 
virtual void define (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const ProblemDomain &a_domain, int a_transverseDir, bool a_exchange=false)
 contains support for periodic BCs More...
 
virtual void define (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const IntVect &a_destGhost, int a_transverseDir, bool a_exchange=false)
 
virtual void define (const BoxLayout &a_level, const BoxLayout &a_dest, const ProblemDomain &a_domain, const IntVect &a_destGhost, int a_transverseDir, bool a_exchange=false)
 contains support for periodic BCs More...
 
virtual void define (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const Vector< int > &a_transverseDir, bool a_exchange=false)
 
virtual void define (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const ProblemDomain &a_domain, const Vector< int > &a_transverseDir, bool a_exchange=false)
 contains support for periodic BCs More...
 
virtual void define (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const IntVect &a_destGhost, const Vector< int > &a_transverseDir, bool a_exchange=false)
 
virtual void define (const BoxLayout &a_level, const BoxLayout &a_dest, const ProblemDomain &a_domain, const IntVect &a_destGhost, const Vector< int > &a_transverseDir, bool a_exchange=false)
 contains support for periodic BCs More...
 
void reverse ()
 reverse the direction of copy for an already-defined ReductionCopier More...
 
bool check (const DisjointBoxLayout &from, const BoxLayout &to) const
 check that this Copier object corresponds to these two BoxLayouts. More...
 
int print () const
 
- Public Member Functions inherited from Copier
 Copier ()
 null constructor, copy constructor and operator= can be compiler defined. More...
 
 Copier (const Copier &a_rhs)
 
 Copier (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, bool a_exchange=false, IntVect a_shift=IntVect::Zero)
 
 Copier (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const ProblemDomain &a_domain, bool a_exchange=false, IntVect a_shift=IntVect::Zero)
 this constructor contains support for periodic BC's More...
 
 Copier (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const IntVect &a_destGhost, bool a_exchange=false, IntVect a_shift=IntVect::Zero)
 Copier to copy data into the valid and invalid regions of a_dest from a_level. More...
 
 Copier (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const ProblemDomain &a_domain, const IntVect &a_destGhost, bool a_exchange=false, IntVect a_shift=IntVect::Zero)
 Copier to copy data into the valid and invalid regions of a_dest from a_level with support for periodic BCs. More...
 
virtual ~Copier ()
 
virtual void define (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, bool a_exchange=false, IntVect a_shift=IntVect::Zero)
 
virtual void define (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const ProblemDomain &a_domain, bool a_exchange=false, IntVect a_shift=IntVect::Zero)
 contains support for periodic BCs More...
 
virtual void define (const DisjointBoxLayout &a_level, const BoxLayout &a_dest, const IntVect &a_destGhost, bool a_exchange=false, IntVect a_shift=IntVect::Zero)
 
virtual void define (const BoxLayout &a_level, const BoxLayout &a_dest, const ProblemDomain &a_domain, const IntVect &a_destGhost, bool a_exchange=false, IntVect a_shift=IntVect::Zero)
 contains support for periodic BCs More...
 
virtual void exchangeDefine (const DisjointBoxLayout &a_grids, const IntVect &a_ghost, bool a_includeSelf=false)
 alternative version of define for exchange copiers that uses new optimized neighborIterator More...
 
void defineFixedBoxSize (const DisjointBoxLayout &a_src, const LMap &a_lmap, const IntVect &a_ghost, const ProblemDomain &a_domain, bool a_includeSelf=false, bool a_reverse=false)
 
void defineFixedBoxSize (const DisjointBoxLayout &a_src, const LMap &a_lmapSrc, const IntVect &a_refRatioSrc, const DisjointBoxLayout &a_dst, const LMap &a_lmapDst, const IntVect &a_refRatioDst, const IntVect &a_ghost, const ProblemDomain &a_domain, bool a_reverse=false)
 
void defineFixedSizeNodesCollect (const DisjointBoxLayout &a_layout, const LMap &a_lmap, const IntVect &a_ghostSrc, const IntVect &a_ghostDst, const ProblemDomain &a_domain)
 
void defineFixedSizeNodesCollect (const DisjointBoxLayout &a_src, const LMap &a_lmapSrc, const IntVect &a_refRatioSrc, const IntVect &a_ghostSrc, const DisjointBoxLayout &a_dst, const LMap &a_lmapDst, const IntVect &a_refRatioDst, const IntVect &a_ghostDst, const ProblemDomain &a_domain)
 
void ghostDefine (const DisjointBoxLayout &a_src, const DisjointBoxLayout &a_dest, const ProblemDomain &a_domain, const IntVect &a_srcGhost)
 performs the computation necessary for moving from ghost+valid cells to all valid cells in a_dest More...
 
void ghostDefine (const DisjointBoxLayout &a_src, const DisjointBoxLayout &a_dest, const ProblemDomain &a_domain, const IntVect &a_srcGhost, const IntVect &a_destGhost)
 performs the computation necessary for moving from ghost+valid cells to all valid+ghost cells in a_dest More...
 
virtual void clear ()
 
Copieroperator= (const Copier &b)
 
void reverse ()
 
void trimEdges (const DisjointBoxLayout &a_exchangedLayout, const IntVect &ghost)
 
void coarsen (int a_refRatio)
 
bool operator== (const Copier &rhs) const
 
int print () const
 
bool bufferAllocated () const
 
void setBufferAllocated (bool arg) const
 
int numLocalCellsToCopy () const
 
int numFromCellsToCopy () const
 
int numToCellsToCopy () const
 
bool isDefined () const
 

Private Attributes

Vector< int > m_transverseDir
 
Vector< int > m_reduceDir
 

Friends

class CopyIterator
 
void dumpmemoryatexit ()
 

Additional Inherited Members

- Public Attributes inherited from Copier
CopierBuffer m_buffers
 
std::vector< IndexTM< int, 2 > > m_range
 
- Protected Member Functions inherited from Copier
void trimMotion (const DisjointBoxLayout &a_exchangedLayout, const IntVect &a_ghost, const Vector< MotionItem *> &a_oldItems, Vector< MotionItem *> &a_newItems)
 
void sort ()
 
const ProblemDomaingetPhysDomain (const DisjointBoxLayout &a_level) const
 
- Protected Attributes inherited from Copier
Vector< MotionItem * > m_localMotionPlan
 
Vector< MotionItem * > m_fromMotionPlan
 
Vector< MotionItem * > m_toMotionPlan
 
bool buffersAllocated
 
DisjointBoxLayout m_originPlan
 
BoxLayout m_dest
 
bool m_isDefined
 
- Static Protected Attributes inherited from Copier
static Pool s_motionItemPool
 

Detailed Description

Specialized copier for doing reductions in dimensionality.

This is a specialized Copier designed to copy from a multi-dimensional DisjointBoxLayout to a smaller-dimensional one by copying all of the data in the transverse direction to the destination boxLayout. It is assumed that this will be used with a different sort of operator (like a summation operator, for example), since a straight copy operation wouldn't make much sense. Anyway, this just defines the intersection regions; what you do with them is your problem.

Note also that both the Spreading and Reduction Copiers ignore periodicity, since it can lead to unintended side-effects and multiple-counting of data. The way to handle periodicity is to do an exchange on the source data before calling the copyTo which does the reduction.

Constructor & Destructor Documentation

◆ ReductionCopier() [1/10]

ReductionCopier::ReductionCopier ( )
inline

null constructor, copy constructor and operator= can be compiler defined.

References check(), define(), nestedDILoops(), print(), reverse(), setMotionItems(), and ~ReductionCopier().

◆ ReductionCopier() [2/10]

ReductionCopier::ReductionCopier ( const bool &  a_usingFaceSumOp,
const DisjointBoxLayout a_sourceLayout,
const BoxLayout a_destLayout,
const ProblemDomain a_domain,
const IntVect a_destGhost,
const IntVect a_reduceDir,
bool  a_exchange = false 
)

face sum op requires that destGhost -> destGhost + Unit; this helps cell-centerd box calculus work for face-centered data

◆ ReductionCopier() [3/10]

ReductionCopier::ReductionCopier ( const DisjointBoxLayout a_level,
const BoxLayout a_dest,
int  a_transverseDir,
bool  a_exchange = false 
)

◆ ReductionCopier() [4/10]

ReductionCopier::ReductionCopier ( const DisjointBoxLayout a_level,
const BoxLayout a_dest,
const ProblemDomain a_domain,
int  a_transverseDir,
bool  a_exchange = false 
)

this constructor contains support for periodic BC's

◆ ReductionCopier() [5/10]

ReductionCopier::ReductionCopier ( const DisjointBoxLayout a_level,
const BoxLayout a_dest,
const IntVect a_destGhost,
int  a_transverseDir,
bool  a_exchange = false 
)

Copier to copy data into the valid and invalid regions of a_dest from a_level.

◆ ReductionCopier() [6/10]

ReductionCopier::ReductionCopier ( const DisjointBoxLayout a_level,
const BoxLayout a_dest,
const ProblemDomain a_domain,
const IntVect a_destGhost,
int  a_transverseDir,
bool  a_exchange = false 
)

Copier to copy data into the valid and invalid regions of a_dest from a_level with support for periodic BCs.

◆ ReductionCopier() [7/10]

ReductionCopier::ReductionCopier ( const DisjointBoxLayout a_level,
const BoxLayout a_dest,
const Vector< int > &  a_transverseDir,
bool  a_exchange = false 
)

◆ ReductionCopier() [8/10]

ReductionCopier::ReductionCopier ( const DisjointBoxLayout a_level,
const BoxLayout a_dest,
const ProblemDomain a_domain,
const Vector< int > &  a_transverseDir,
bool  a_exchange = false 
)

this constructor contains support for periodic BC's

◆ ReductionCopier() [9/10]

ReductionCopier::ReductionCopier ( const DisjointBoxLayout a_level,
const BoxLayout a_dest,
const IntVect a_destGhost,
const Vector< int > &  a_transverseDir,
bool  a_exchange = false 
)

Copier to copy data into the valid and invalid regions of a_dest from a_level.

◆ ReductionCopier() [10/10]

ReductionCopier::ReductionCopier ( const DisjointBoxLayout a_level,
const BoxLayout a_dest,
const ProblemDomain a_domain,
const IntVect a_destGhost,
const Vector< int > &  a_transverseDir,
bool  a_exchange = false 
)

Copier to copy data into the valid and invalid regions of a_dest from a_level with support for periodic BCs.

◆ ~ReductionCopier()

virtual ReductionCopier::~ReductionCopier ( )
virtual

Referenced by ReductionCopier().

Member Function Documentation

◆ define() [1/9]

virtual void ReductionCopier::define ( const bool &  a_usingFaceSumOp,
const DisjointBoxLayout a_sourceLayout,
const BoxLayout a_destLayout,
const ProblemDomain a_domain,
const IntVect a_ghostVect,
const Vector< int > &  a_reduceDir,
bool  a_exchange = false 
)
virtual

Referenced by ReductionCopier().

◆ setMotionItems()

virtual void ReductionCopier::setMotionItems ( const int &  a_itemProcID,
const Box a_fromBox,
const Box a_toBox,
const bool &  a_firstLoop,
const DataIndex a_fromdi,
const DataIndex a_todi,
const bool &  a_exchange = false 
)
virtual

Referenced by ReductionCopier().

◆ nestedDILoops()

virtual void ReductionCopier::nestedDILoops ( const bool &  a_firstLoop,
const BoxLayout a_sourceLayout,
const BoxLayout a_destLayout,
const IntVect a_ghostVect,
const Box a_domainBox,
vector< DataIndex > &  a_outerLoop,
vector< DataIndex > &  a_innerLoop,
const Vector< int > &  a_reduceLo,
const Vector< int > &  a_reduceHi,
bool  a_exchange = false 
)
virtual

Referenced by ReductionCopier().

◆ define() [2/9]

virtual void ReductionCopier::define ( const DisjointBoxLayout a_level,
const BoxLayout a_dest,
int  a_transverseDir,
bool  a_exchange = false 
)
virtual

◆ define() [3/9]

virtual void ReductionCopier::define ( const DisjointBoxLayout a_level,
const BoxLayout a_dest,
const ProblemDomain a_domain,
int  a_transverseDir,
bool  a_exchange = false 
)
virtual

contains support for periodic BCs

◆ define() [4/9]

virtual void ReductionCopier::define ( const DisjointBoxLayout a_level,
const BoxLayout a_dest,
const IntVect a_destGhost,
int  a_transverseDir,
bool  a_exchange = false 
)
virtual

◆ define() [5/9]

virtual void ReductionCopier::define ( const BoxLayout a_level,
const BoxLayout a_dest,
const ProblemDomain a_domain,
const IntVect a_destGhost,
int  a_transverseDir,
bool  a_exchange = false 
)
virtual

contains support for periodic BCs

◆ define() [6/9]

virtual void ReductionCopier::define ( const DisjointBoxLayout a_level,
const BoxLayout a_dest,
const Vector< int > &  a_transverseDir,
bool  a_exchange = false 
)
virtual

◆ define() [7/9]

virtual void ReductionCopier::define ( const DisjointBoxLayout a_level,
const BoxLayout a_dest,
const ProblemDomain a_domain,
const Vector< int > &  a_transverseDir,
bool  a_exchange = false 
)
virtual

contains support for periodic BCs

◆ define() [8/9]

virtual void ReductionCopier::define ( const DisjointBoxLayout a_level,
const BoxLayout a_dest,
const IntVect a_destGhost,
const Vector< int > &  a_transverseDir,
bool  a_exchange = false 
)
virtual

◆ define() [9/9]

virtual void ReductionCopier::define ( const BoxLayout a_level,
const BoxLayout a_dest,
const ProblemDomain a_domain,
const IntVect a_destGhost,
const Vector< int > &  a_transverseDir,
bool  a_exchange = false 
)
virtual

contains support for periodic BCs

◆ reverse()

void ReductionCopier::reverse ( )

reverse the direction of copy for an already-defined ReductionCopier

This function simply replaces the from data with the to-data for the already-defined copy operation. For now, this function heads right into a MayDay::Error, since what you probably want is to use a SpreadingCopier rather than a reversed ReductionCopier

Referenced by ReductionCopier().

◆ check()

bool ReductionCopier::check ( const DisjointBoxLayout from,
const BoxLayout to 
) const

check that this Copier object corresponds to these two BoxLayouts.

Referenced by ReductionCopier().

◆ print()

int ReductionCopier::print ( ) const

Referenced by ReductionCopier().

Friends And Related Function Documentation

◆ CopyIterator

friend class CopyIterator
friend

◆ dumpmemoryatexit

void dumpmemoryatexit ( )
friend

Member Data Documentation

◆ m_transverseDir

Vector<int> ReductionCopier::m_transverseDir
private

◆ m_reduceDir

Vector<int> ReductionCopier::m_reduceDir
private

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