BoxLayout Class Reference
A not-necessarily-disjoint collective of boxes.
More...
#include <BoxLayout.H>
Inheritance diagram for BoxLayout:
[legend]Collaboration diagram for BoxLayout:
[legend]List of all members.
Detailed Description
A not-necessarily-disjoint collective of boxes.
A BoxLayout is a collection of Box objects that are assigned to process numbers. Each box is associated with only one process. Processes are numbered from 0 to n-1 (for a job with n processes).
A BoxLayout can be either open or closed.
Open BoxLayout:
- Created by null construction or deepCopy.
- Boxes may be added to it.
- Non-const operations may be performed on the boxes in it.
Closed BoxLayout:
- Created by constructor with vectors of Boxes and processors given explicitly.
- Cannot be modified.
- Represented as sorted boxes.
- Many uses of BoxLayouts require a closed BoxLayout.
Ref-counting
BoxLayout is an explicitly ref-counted object.
Assignment and copy are compiler-generated. They increment the refcount on the contained data members. They perform shallow, ref-counted operations.
Refcounting is a process whereby multiple instantiations make use of a single implementation of that object and keep a tally of how many instantiations are sharing. Thus:
BoxLayout b1(boxes, procIDs);
b1 ----> refcount = 1
----> m_boxes
----> m_processors
BoxLayout b2(b1)
b1 ----> refcount = 2 <---- b2
----> m_boxes <----
----> m_processors <----
BoxLayout b3;
b3 = b2;
b1 ----> refcount = 3 <---- b2
----> m_boxes <----
----> m_processors <----
^^^
|||
b3
Constructor & Destructor Documentation
|
Construct BoxLayout with no boxes. |
BoxLayout::BoxLayout |
( |
const Vector< Box > & |
a_boxes, |
|
|
const Vector< int > & |
a_procIDs |
|
) |
|
|
|
Construct from a Vector of Boxes and a Vector of processor assignments. On exit, the BoxLayout will be closed. |
|
Ref-counted destruction. Once the last reference to the implementation of this class is destroyed, the data members are cleaned up |
Member Function Documentation
|
Add a box to this BoxLayout. Takes the processor assignment. The input box is copied. BoxLayout must be "open" for this operation, or else a runtime error will occur. |
void BoxLayout::aliasAddBox |
( |
const Box & |
box |
) |
|
|
|
Not a user function, used in Chombo interface to AMRData.H interoperability tools. |
void BoxLayout::aliasClose |
( |
|
) |
|
|
|
Not a user function, used in Chombo interface to AMRData.H interoperability tools. |
bool BoxLayout::check |
( |
const LayoutIndex & |
index |
) |
const [inline] |
|
virtual void BoxLayout::close |
( |
|
) |
[virtual] |
|
|
Mark this BoxLayout as complete and unchangeable.
Reimplemented in DisjointBoxLayout. |
bool BoxLayout::coarsenable |
( |
int |
refRatio |
) |
const |
|
|
returns true iff:
- every Box in the BoxLayout can be coarsened by refRatio and return back to the original Box when refined by refRatio.
- refRatio must be a positive non-zero integer.
|
|
Parallel iterator.
Parallel iterator.
Returns DataIndex object that corresponds to boxes on the local processor only. |
virtual void BoxLayout::deepCopy |
( |
const BoxLayout & |
a_source |
) |
[virtual] |
|
|
Actual deep copy operation. New object created with copied data. This object disassociates itself with original implementation safely. This object now is considered 'open' and can be non-const modified. There is no assurance that the order in which this BoxLayout is indexed corresponds to the indexing of a_source.
BoxLayout b1(boxes, procIDs);
b1 ----> refcount = 1
----> m_boxes
----> m_processors
BoxLayout b2(b1)
b1 ----> refcount = 2 <---- b2
----> m_boxes <----
----> m_processors <----
BoxLayout b3;
b3.deepCopy(b2);
b1 ----> refcount = 2 <---- b2 b3 ----> refcount = 1
----> m_boxes <---- ----> m_boxes
----> m_processors <---- ----> m_processors
Reimplemented in DisjointBoxLayout. |
virtual void BoxLayout::define |
( |
const Vector< Box > & |
a_boxes, |
|
|
const Vector< int > & |
a_procIDs |
|
) |
[virtual] |
|
|
Define this BoxLayout from a Vector of Boxes and a Vector of processor assignments. Any pre-existing layout will be lost (ref-count dropped by one). The processor assignment Vector must be the same length as the Box Vector. On exit, the BoxLayout will be closed.
Reimplemented in DisjointBoxLayout. |
bool BoxLayout::eq |
( |
const BoxLayout & |
rhs |
) |
const [inline] |
|
|
Refcounted pointer check. Return true if these two objects share the same implementation. |
|
Get box indexed by it.
As a consequence of the C++ compiler being free to choose which version of operator[] when the object is technically non-const, we very often get 'BoxLayout closed' errors. This is a non-overloaded get method. |
unsigned int BoxLayout::index |
( |
const LayoutIndex & |
index |
) |
const [inline] |
|
|
Not a user function. Used in I/O routine. |
bool BoxLayout::isClosed |
( |
|
) |
const [inline] |
|
|
Return true if close() has been called. Closed BoxLayout is always sorted. |
bool BoxLayout::isSorted |
( |
|
) |
const [inline] |
|
|
Return true if sort() has been called. |
|
Iterator that processes through ALL the boxes in a BoxLayout.
Iterator that processes through ALL the boxes in a BoxLayout.
If BoxLayout is closed, then LayoutIterator will return the Boxes in sorted order. |
int BoxLayout::numBoxes |
( |
const int |
procID |
) |
const |
|
|
Returns the number of boxes assigned to a given procID. |
bool BoxLayout::operator== |
( |
const BoxLayout & |
rhs |
) |
const [inline] |
|
|
Refcounted pointer check. Return true if these two objects share the same implementation. |
|
accessor operator. See also get(const DataIndex&). |
const Box & BoxLayout::operator[] |
( |
const LayoutIndex & |
it |
) |
const [inline] |
|
|
const accessor operator. See also get(const DataIndex&). |
void BoxLayout::p |
( |
|
) |
const [inline] |
|
|
Invokes cout<<*this; pretty-print dump of BoxLayout. |
void BoxLayout::print |
( |
|
) |
const |
|
|
Invokes cout<<*this; pretty-print dump of BoxLayout. |
unsigned int BoxLayout::procID |
( |
const LayoutIndex & |
a_index |
) |
const [inline] |
|
|
Returns the processor to which this box has been assigned. Not a user function, at least, not a new user function. It can be used safely at anytime, closed or open. A person needing this level of knowledge of the processor assignment should have non-trivial needs, like writing your own load balancer or such. Most user-level parallel coding needs can be addressed using the DataIterator class. |
void BoxLayout::setIndexVector |
( |
|
) |
[protected] |
|
void BoxLayout::setProcID |
( |
const LayoutIndex & |
a_index, |
|
|
unsigned int |
a_procID |
|
) |
[inline] |
|
|
Assign a Box in the BoxLayout to a processor. Requires the BoxLayout to be open. |
unsigned int BoxLayout::size |
( |
|
) |
const [inline] |
|
|
Returns the total number of boxes in the BoxLayout. |
|
Sort the boxes of an open BoxLayout. No change if the BoxLayout is closed. |
Friends And Related Function Documentation
|
Coarsen a BoxLayout:
- output must be open
- input must be closed
- refinement must be a positive non-zero integer
- output and input do not share an implementation.
output is first deepCopy'ed from input, then coarsen(refinement) is called on each box of output.
output returns from this function closed.
LayoutIterators from input and output can perform interchangeably. |
|
Refine a BoxLayout:
- output must be open
- input must be closed
- refinement must be a positive non-zero integer
- output and input do not share an implementation.
output is first deepCopy'ed from input, then refine(refinement) is called on each box of output.
output returns from this function closed.
LayoutIterators from input and output can perform interchangeably. |
Member Data Documentation
The documentation for this class was generated from the following file:
Generated on Wed Oct 5 14:00:06 2005 for Chombo&AMRSelfGravity by
1.4.1