DIY 3.0 data-parallel out-of-core C++ library

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Examples

All Classes Namespaces Functions Typedefs Groups Pages
Classes | Functions
Decomposition

## Detailed Description

Provides regular decomposition of the domain.

// block create function or AddBlock functor with
// overloaded function call of the same signature
void create(int gid,
const Bounds& core,
const Bounds& bounds,
const Bounds& domain,
const diy::Link& link);
// --- or ---
// functor to add blocks to master
struct AddBlock
{
void operator()(int gid,
const Bounds& core,
const Bounds& bounds,
const Bounds& domain,
const diy::Link& link)
const
{
...
}
} create;
diy::Master(...) master;
// share_face is a vector of bools indicating whether faces are shared in each dimension
// uninitialized values default to false
diy::RegularDecomposer<Bounds>::BoolVector share_face;
// wrap is a vector of bools indicating whether boundary conditions are periodic in each dimension
// uninitialized values default to false
diy::RegularDecomposer<Bounds>::BoolVector wrap;
// ghosts is a vector of ints indicating number of ghost cells per side in each dimension
// uninitialized values default to 0
diy::RegularDecomposer<Bounds>::CoordinateVector ghosts;
// --- various ways to decompose a 3D domain follow (choose one) ---
// use a helper function given the AddBlock functor or a
// create function of the signature above
diy::decompose(dim,
rank,
domain,
assigner,
create,
share_face,
wrap,
ghosts);
// --- or ---
// use a helper function given the master
// for the "short form" of creating blocks, w/o the functor or signature above
diy::decompose(dim,
rank,
domain,
assigner,
master,
share_face,
wrap,
ghosts);
// --- or ---
// create a RegularDecomposer
// allows access to all the methods in RegularDecomposer
diy::RegularDecomposer<Bounds> decomposer(dim,
domain,
nblocks,
share_face,
wrap,
ghosts);
// --- and ---
// call the decomposer's decompose function given AddBlock or
// a create function of the signature above
decomposer.decompose(world.rank(),
assigner,
create);
// --- or ---
// call the decomposer's decompose function given master only
// (uses the master's AddBlock functor instead)
decomposer.decompose(world.rank(),
assigner,
master);

## Classes
struct | diy::RegularDecomposer< Bounds_ >
| Decomposes a regular (discrete or continuous) domain into even blocks; creates Links with Bounds along the way. More...

## Functions
template<class Bounds >
void | diy::decompose (int dim, int rank, const Bounds &domain, const Assigner &assigner, const typename RegularDecomposer< Bounds >::Creator &create, typename RegularDecomposer< Bounds >::BoolVector share_face=typename RegularDecomposer< Bounds >::BoolVector(), typename RegularDecomposer< Bounds >::BoolVector wrap=typename RegularDecomposer< Bounds >::BoolVector(), typename RegularDecomposer< Bounds >::CoordinateVector ghosts=typename RegularDecomposer< Bounds >::CoordinateVector(), typename RegularDecomposer< Bounds >::DivisionsVector divs=typename RegularDecomposer< Bounds >::DivisionsVector())
| Decomposes the domain into a prescribed pattern of blocks. More...
template<class Bounds >
void | diy::decompose (int dim, int rank, const Bounds &domain, const Assigner &assigner, Master &master, typename RegularDecomposer< Bounds >::BoolVector share_face=typename RegularDecomposer< Bounds >::BoolVector(), typename RegularDecomposer< Bounds >::BoolVector wrap=typename RegularDecomposer< Bounds >::BoolVector(), typename RegularDecomposer< Bounds >::CoordinateVector ghosts=typename RegularDecomposer< Bounds >::CoordinateVector(), typename RegularDecomposer< Bounds >::DivisionsVector divs=typename RegularDecomposer< Bounds >::DivisionsVector())
| Decomposes the domain into a prescribed pattern of blocks. More...
void | diy::decompose (int rank, const Assigner &assigner, Master &master)
| A "null" decompositon that simply creates the blocks and adds them to the master. More...
template<class Bounds >
void | diy::decompose (int dim, int rank, const Bounds &domain, const Assigner &assigner, Master &master, const typename RegularDecomposer< Bounds >::Updater &update, typename RegularDecomposer< Bounds >::BoolVector share_face=typename RegularDecomposer< Bounds >::BoolVector(), typename RegularDecomposer< Bounds >::BoolVector wrap=typename RegularDecomposer< Bounds >::BoolVector(), typename RegularDecomposer< Bounds >::CoordinateVector ghosts=typename RegularDecomposer< Bounds >::CoordinateVector(), typename RegularDecomposer< Bounds >::DivisionsVector divs=typename RegularDecomposer< Bounds >::DivisionsVector())
| Add a decomposition (modify links) of an existing set of blocks that were added to the master previously. More...
void | diy::RegularDecomposer< Bounds_ >::fill_bounds (Bounds &bounds, const DivisionsVector &coords, bool add_ghosts=false) const
| Gets the bounds, with or without ghosts, for a block specified by its block coordinates. More...
void | diy::RegularDecomposer< Bounds_ >::fill_bounds (Bounds &bounds, int gid, bool add_ghosts=false) const
| Gets the bounds, with or without ghosts, for a block specified by its gid. More...

## Function Documentation

template<class Bounds >

void diy::decompose | ( | int | dim,
|  | int | rank,
|  | const Bounds & | domain,
|  | const Assigner & | assigner,
|  | const typename RegularDecomposer< Bounds >::Creator & | create,
|  | typename RegularDecomposer< Bounds >::BoolVector | share_face = `typename RegularDecomposer<Bounds>::BoolVector()`,
|  | typename RegularDecomposer< Bounds >::BoolVector | wrap = `typename RegularDecomposer<Bounds>::BoolVector()`,
|  | typename RegularDecomposer< Bounds >::CoordinateVector | ghosts = `typename RegularDecomposer<Bounds>::CoordinateVector()`,
|  | typename RegularDecomposer< Bounds >::DivisionsVector | divs = `typename RegularDecomposer<Bounds>::DivisionsVector()`
| ) |  |

Decomposes the domain into a prescribed pattern of blocks.

Parameters

  dim | dimension of the domain
  rank | local rank
  assigner | decides how processors are assigned to blocks (maps a gid to a rank) also communicates the total number of blocks
  create | the callback functor
  wrap | indicates dimensions on which to wrap the boundary
  ghosts | indicates how many ghosts to use in each dimension
  divs | indicates how many cuts to make along each dimension (0 means "no constraint," i.e., leave it up to the algorithm)

`create(...)` is called with each block assigned to the local domain. See decomposition example.

Examples:
  decomposition/test-decomposition.cpp, decomposition/test-direct-master.cpp, and reduce/all-done.cpp.

template<class Bounds >

void diy::decompose | ( | int | dim,
|  | int | rank,
|  | const Bounds & | domain,
|  | const Assigner & | assigner,
|  | Master & | master,
|  | typename RegularDecomposer< Bounds >::BoolVector | share_face = `typename RegularDecomposer<Bounds>::BoolVector()`,
|  | typename RegularDecomposer< Bounds >::BoolVector | wrap = `typename RegularDecomposer<Bounds>::BoolVector()`,
|  | typename RegularDecomposer< Bounds >::CoordinateVector | ghosts = `typename RegularDecomposer<Bounds>::CoordinateVector()`,
|  | typename RegularDecomposer< Bounds >::DivisionsVector | divs = `typename RegularDecomposer<Bounds>::DivisionsVector()`
| ) |  |

Decomposes the domain into a prescribed pattern of blocks.

Parameters

  dim | dimension of the domain
  rank | local rank
  assigner | decides how processors are assigned to blocks (maps a gid to a rank) also communicates the total number of blocks
  master | gets the blocks once this function returns
  wrap | indicates dimensions on which to wrap the boundary
  ghosts | indicates how many ghosts to use in each dimension
  divs | indicates how many cuts to make along each dimension (0 means "no constraint," i.e., leave it up to the algorithm)

`master` must have been supplied a create function in order for this function to work.

void diy::decompose | ( | int | rank,
|  | const Assigner & | assigner,
|  | Master & | master
| ) |  |
| inline

A "null" decompositon that simply creates the blocks and adds them to the master.

Parameters

  rank | local rank
  assigner | decides how processors are assigned to blocks (maps a gid to a rank) also communicates the total number of blocks
  master | gets the blocks once this function returns

template<class Bounds >

void diy::decompose | ( | int | dim,
|  | int | rank,
|  | const Bounds & | domain,
|  | const Assigner & | assigner,
|  | Master & | master,
|  | const typename RegularDecomposer< Bounds >::Updater & | update,
|  | typename RegularDecomposer< Bounds >::BoolVector | share_face = `typename RegularDecomposer<Bounds>::BoolVector()`,
|  | typename RegularDecomposer< Bounds >::BoolVector | wrap = `typename RegularDecomposer<Bounds>::BoolVector()`,
|  | typename RegularDecomposer< Bounds >::CoordinateVector | ghosts = `typename RegularDecomposer<Bounds>::CoordinateVector()`,
|  | typename RegularDecomposer< Bounds >::DivisionsVector | divs = `typename RegularDecomposer<Bounds>::DivisionsVector()`
| ) |  |

Add a decomposition (modify links) of an existing set of blocks that were added to the master previously.

Parameters

  rank | local rank
  assigner | decides how processors are assigned to blocks (maps a gid to a rank) also communicates the total number of blocks

template<class Bounds >

void diy::RegularDecomposer< Bounds >::fill_bounds | ( | Bounds & | bounds,
|  | const DivisionsVector & | coords,
|  | bool | add_ghosts = `false`
| ) |  | const

Gets the bounds, with or without ghosts, for a block specified by its block coordinates.

Parameters

  bounds | (output) bounds
  coords | coordinates of the block in the decomposition
  add_ghosts | whether to include ghosts in the output bounds

template<class Bounds >

void diy::RegularDecomposer< Bounds >::fill_bounds | ( | Bounds & | bounds,
|  | int | gid,
|  | bool | add_ghosts = `false`
| ) |  | const

Gets the bounds, with or without ghosts, for a block specified by its gid.

Parameters

  bounds | (output) bounds
  gid | global id of the block
  add_ghosts | whether to include ghosts in the output bounds