NodeFArrayBox Class Reference
A wrapper for an FArrayBox to contain NODE-centered data.
More...
#include <NodeFArrayBox.H>
Collaboration diagram for NodeFArrayBox:
[legend]List of all members.
|
Linearization functions |
int | size (const Box &a_R, const Interval &a_comps) const |
void | linearOut (void *a_buf, const Box &a_R, const Interval &a_comps) const |
void | linearIn (void *a_buf, const Box &a_R, const Interval &a_comps) |
void | linearOut (void *a_buf) const |
| These functions are required for broadcast & gather.
|
void | linearIn (const void *const a_buf) |
int | linearSize (void) const |
static int | preAllocatable () |
Public Member Functions |
|
| NodeFArrayBox () |
| NodeFArrayBox (const Box &a_bx, int a_nComp, Real *a_alias=NULL) |
| NodeFArrayBox (const Interval &a_comps, NodeFArrayBox &a_original) |
| ~NodeFArrayBox () |
void | define (const Box &a_bx, int a_nComp=1) |
|
const Box & | box () const |
FArrayBox & | getFab () |
const FArrayBox & | getFab () const |
|
void | copy (const NodeFArrayBox &a_src) |
void | copy (const Box &a_regionFrom, const Interval &a_Cdest, const Box &a_regionTo, const NodeFArrayBox &a_src, const Interval &a_Csrc) |
Protected Attributes |
Box | m_box |
FArrayBox | m_fab |
Detailed Description
A wrapper for an FArrayBox to contain NODE-centered data.
This is a class to contain NODE-centered data on a box.
Question: Why not just use NODE-centered FArrayBox?
Answer: We want to use LevelData<NodeFArrayBox>, which requires that the underlying BoxLayout be a DisjointBoxLayout. Adjacent NODE-centered boxes intersect, but adjacent CELL-centered boxes do not.
The underlying DisjointBoxLayout will be CELL-centered.
In a LevelData<NodeFArrayBox>, some of the grids may share nodes. The data on shared nodes must be the same.
Example: A four-grid layout is shown on the left. As shown on the right, the nodes marked "2" are shared by two grids, and those marked "3" are shared by three grids.
+-----+ YYYY--+
| | | |
| | | |
| | | |
+---+--+--+---+ +---2223222---+
| | | | 2 |
| | | | 2 |
| | | | 2 |
+---+------+------+ X---22222223------X
| | | |
| | | |
| | | |
+----------+ +-------YYYY
Additional nodes may be shared if the boxes extend to the faces of a domain that is periodic in one or more directions. In the example above, these nodes are marked "X" and "Y".
Horizontally periodic domain: node "X" shared by two grids.
Vertically periodic domain: nodes "Y" shared by two grids.
One of the most useful features of LevelData<NodeFArrayBox> is the copyTo() function. THE copyTo() FUNCTION MUST BE USED WITH CAUTION if the source and destination have different layouts.
Consider an example where A and B are on layouts of one box each, and these two boxes abut:
+-------+
| |
| A |
| |
=========
| |
| B |
| |
+-------+
If we do A.copyTo(B), then the data on the nodes of the interface (marked "=") are NOT copied, because the underlying CELL-centered DisjointBoxLayouts of the LevelDatas do not intersect.
So whenever we want to use src.copyTo(dest), unless we are sure that src and dest have the same layout, we do the following:
- define BoxLayoutData<NodeFArrayBox> destExpanded on the BoxLayout of dest with each box expanded by one in each dimension;
- do src.copyTo(destExpanded);
- box by box, copy destExpanded to dest.
Constructor & Destructor Documentation
NodeFArrayBox::NodeFArrayBox |
( |
|
) |
|
|
|
Default constructor. User must subsequently call define(). |
NodeFArrayBox::NodeFArrayBox |
( |
const Box & |
a_bx, |
|
|
int |
a_nComp, |
|
|
Real * |
a_alias = NULL |
|
) |
|
|
|
Constructs NodeFArrayBox on CELL-centered box a_bx with a_nComp components using the aliased data space. |
|
Constructs an aliased NodeFArrayBox. |
Member Function Documentation
const Box& NodeFArrayBox::box |
( |
|
) |
const |
|
|
Returns the CELL-centered domain where the array is defined. |
|
Modifies the data in this NodeFArrayBox by copying the data from a_src into it, over the intersection of:
- the nodes surrounding the CELL-centered box a_regionFrom;
- the nodes surrounding the CELL-centered box a_regionTo;
- the nodes containing data in this NodeFArrayBox;
- the nodes containing data in a_src.
The components in the interval a_Csrc in a_src are copied to the components in the interval a_Cdest in this NodeFArrayBox.
This function is required in order to have BoxLayoutData<NodeFArrayBox>. |
|
Modifies the data in this NodeFArrayBox by copying data from a_src into it, over the nodes that they have in common.
If this NodeFArrayBox and a_src have abutting grids, as shown:
+--------+
| |
| this |
| |
========== <- data copied here from a_src to this
| |
| a_src |
| |
+--------+
then the data in this NodeFArrayBox WILL be modified along the edge nodes where they abut -- even though this.box() and a_src.box(), being CELL-centered, do NOT intersect.
All components are copied. |
void NodeFArrayBox::define |
( |
const Box & |
a_bx, |
|
|
int |
a_nComp = 1 |
|
) |
|
|
|
Defines NodeFArrayBox on CELL-centered box a_bx with a_nComp components. |
const FArrayBox& NodeFArrayBox::getFab |
( |
|
) |
const |
|
|
Returns a constant reference to the NODE-centered FArrayBox containing the data. |
|
Returns a modifiable reference to the NODE-centered FArrayBox containing the data. |
void NodeFArrayBox::linearIn |
( |
const void *const |
a_buf |
) |
|
|
void NodeFArrayBox::linearIn |
( |
void * |
a_buf, |
|
|
const Box & |
a_R, |
|
|
const Interval & |
a_comps |
|
) |
|
|
void NodeFArrayBox::linearOut |
( |
void * |
a_buf |
) |
const |
|
|
These functions are required for broadcast & gather.
|
void NodeFArrayBox::linearOut |
( |
void * |
a_buf, |
|
|
const Box & |
a_R, |
|
|
const Interval & |
a_comps |
|
) |
const |
|
|
Writes into a_buf a linear representation of the internal data for the nodes surrounding CELL-centered box a_R, over the component Interval a_comps.
Assumes that sufficient memory for the buffer has already been allocated by the caller.
This function is required in order to have BoxLayoutData<NodeFArrayBox>. |
int NodeFArrayBox::linearSize |
( |
void |
|
) |
const |
|
static int NodeFArrayBox::preAllocatable |
( |
|
) |
[inline, static] |
|
int NodeFArrayBox::size |
( |
const Box & |
a_R, |
|
|
const Interval & |
a_comps |
|
) |
const |
|
|
Returns size, in number of bytes, of a flat linear representation of the data in this object in the area defined by the nodes in CELL-centered box a_R and the component Interval a_comps.
This function is required in order to have BoxLayoutData<NodeFArrayBox>. |
Member Data Documentation
The documentation for this class was generated from the following file:
Generated on Wed Oct 5 14:01:35 2005 for Chombo&AMRSelfGravity by
1.4.1