11 #ifndef _BINFABIMPLEM_H_ 12 #define _BINFABIMPLEM_H_ 18 #include "NamespaceHeader.H" 29 m_mesh_spacing(
D_DECL6(0,0,0,0,0,0))
38 define(a_domain, a_meshSpacing, a_origin);
124 this->
operator()(a_binLoc,comp).append(a_item);
139 for (lit.
rewind(); lit; ++lit)
141 const T& thisItem = a_List[lit];
146 this->
operator()(binLoc,comp).append(thisItem);
169 const T& thisItem = a_List[lit];
203 const T& thisItem = a_List[lit];
224 this->
operator()(binLoc,comp).append(thisItem);
232 this->
operator()(binLoc,comp).append(thisItem);
279 T& thisItem = thisList[thisLit];
282 if (binLoc != thisIV)
290 this->
operator()(binLoc,comp).transfer(thisLit);
331 T& thisItem = thisList[thisLit];
333 if (binLoc != thisIV)
338 if (a_in) a_lost.
transfer(thisLit) ;
339 else this->
operator()(binLoc,comp).transfer(thisLit);
343 this->
operator()(binLoc,comp).transfer(thisLit);
347 if (!a_in) a_lost.
transfer(thisLit);
348 else thisList.
remove(thisLit);
371 const Box& a_destBox)
377 const int comp = 0, ncomps = 1;
381 ForAllThisBNNXCBN(
List<T>,a_destBox,comp,ncomps,a_src,a_srcBox,comp)
383 if (a_srcR.isNotEmpty())
428 totalSize += this->
operator()(bi(),comp).length();
442 const int ncomps = 1 ;
452 sizeOfT = tmp.size();
454 totalSize *= sizeOfT;
461 size_t numBins = a_box.
numPts() * ncomps ;
462 totalSize += numBins*
sizeof(int);
477 char* buf_ch = (
char*)a_buf;
484 int *intBuffer = (
int*)buf_ch;
485 *intBuffer = thisList.
length();
486 buf_ch +=
sizeof(int);
490 thisList[lit].linearOut(buf_ch);
491 buf_ch += thisList[lit].size();
506 char* buf_ch = (
char*)a_buf;
510 int *intBuffer = (
int*)buf_ch;
511 *intBuffer = thisList.
length();
512 buf_ch +=
sizeof(int);
515 thisList[lit].linearOut(buf_ch);
516 buf_ch += thisList[lit].size();
535 char *buf_ch = (
char*)a_buf;
546 buf_ch +=
sizeof(int);
551 thisBinItem.linearIn( buf_ch );
552 thisList.
append(thisBinItem);
553 buf_ch += thisBinItem.size();
585 RealVect thisPos = a_binItem.position();
591 binLoc[d] = (int)floor(thisPos[d]);
596 #include "NamespaceFooter.H" #define D_DECL6(a, b, c, d, e, f)
Definition: CHArray.H:39
void catenate(List< T > &src)
Appends a copy of all items in List<T> src to this List<T>.
Definition: ListImplem.H:211
bool ok()
Definition: BoxIterator.H:281
virtual void addItem(const T &a_item)
Copy one item into the appropriate bin.
Definition: BinFabImplem.H:107
virtual void linearOut(void *a_buf, const Box &a_box, const Interval &a_comps) const
Write a serialized (packed) representation into a_buf.
Definition: BinFabImplem.H:470
#define CH_assert(cond)
Definition: CHArray.H:37
void transfer(ListIterator< T > &lit)
Transfer the object pointed to by lit from the List<T> lit is associated with to this one...
Definition: ListImplem.H:317
void remove(const T &value)
Removes all objects in the List<T> equal to value.
Definition: ListImplem.H:356
virtual int numItems(const Box &a_box=Box()) const
Count the number of items in this BinFab in the specified Box.
Definition: BinFabImplem.H:412
bool cellCentered() const
Definition: Box.H:1939
bool sameSize(const Box &b) const
Definition: Box.H:1912
void append(const T &value)
Adds a copy of the value to the end of the List<T>.
Definition: List.H:582
IntVect size() const
Should be inherited from BaseFab but it isn't, sigh; code is the same.
Definition: BinFab.H:160
void clear()
Removes all objects from the List<T>.
Definition: ListImplem.H:263
void rewind()
Reset this ListIterator<T> to point to the first element in the List<T>.
Definition: List.H:422
bool contains(const IntVect &p) const
Definition: Box.H:1887
Box m_domain
Definition: BaseFab.H:632
iterates through the IntVects of a Box
Definition: BoxIterator.H:37
virtual RealVect meshSpacing() const
Retrieve the mesh cell size, in physical coordinates.
Definition: BinFabImplem.H:83
int m_nvar
Definition: BaseFab.H:633
const Box & box() const
Definition: BaseFabImplem.H:271
virtual void reBin()
Sort all the items into the appropriate bins, losing items not in the FAB's domain.
Definition: BinFabImplem.H:259
const int SpaceDim
Definition: SPACE.H:38
virtual void linearIn(void *a_buf, const Box &a_box, const Interval &a_comps=Interval(0, 0))
Extract a serialized (packed) representation from a_buf.
Definition: BinFabImplem.H:527
bool ok() const
Return true if the iterator is not past the end of the list.
Definition: List.H:465
static const RealVect Zero
Definition: RealVect.H:421
Structure for passing component ranges in code.
Definition: Interval.H:23
A Doubly-Linked List Class.
Definition: List.H:21
Iterator over a List.
Definition: List.H:20
RealVect origin() const
Retrieve the physical coordinates of the lower corner of cell zero.
Definition: BinFabImplem.H:98
void define()
Definition: BaseFabImplem.H:672
virtual ~BinFab()
Destructor.
Definition: BinFabImplem.H:53
bool isNotEmpty() const
Returns true if the List<T> is not empty.
Definition: List.H:627
virtual IntVect locateBin(const T &a_item) const
compute the cell index containing the physical position of the item
Definition: BinFabImplem.H:582
RealVect m_origin
location in physical space of the 0 index
Definition: BinFab.H:167
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
virtual void linearOutDestructive(void *buf, const Box &a_box, const Interval &a_comps=Interval(0, 0))
Write a serialized (packed) representation into a_buf and remove from *this.
Definition: BinFabImplem.H:501
virtual void clear()
Delete all the items in this BinFab and reset it to the null Box.
Definition: BinFabImplem.H:398
BinFab()
Null constructor, copy constructor and operator= can be compiler defined.
Definition: BinFabImplem.H:25
int length() const
Returns the number of objects in the List<T>.
Definition: ListImplem.H:56
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
List< T > & operator()(const IntVect &a_p, int a_N)
Definition: BaseFabImplem.H:291
int nComp() const
{ accessors}
Definition: BaseFabImplem.H:264
RealVect m_mesh_spacing
cell size in physical space
Definition: BinFab.H:170
void undefine()
Definition: BaseFabImplem.H:728
bool isEmpty() const
{ Comparison Functions}
Definition: Box.H:1862
Base class for particle data on a Box.
Definition: BinFab.H:30
long m_numpts
Definition: BaseFab.H:634
virtual void addItemsDestructive(List< T > &a_list)
Copy items into the appropriate bins and remove them from the List.
Definition: BinFabImplem.H:157
virtual void transfer(BinFab< T > &a_src, const Box &a_srcBox, const Box &a_destBox)
Move particles from a BinFab to the overlapping cells in this one.
Definition: BinFabImplem.H:369
static void Abort(const char *const a_msg=m_nullString)
Print out message to cerr and exit via abort() (if serial) or MPI_Abort() (if parallel).
virtual void addItems(const List< T > &a_list)
Copy items into the appropriate bins.
Definition: BinFabImplem.H:130