This class take a graph representing the space decomposition and produce a simplified version.
More...
template<unsigned int dim, typename Graph>
class dec_optimizer< dim, Graph >
This class take a graph representing the space decomposition and produce a simplified version.
Given a Graph_CSR and a seed point produce an alternative decomposition in boxes with less sub-domain. In the following we referee with sub-domain the boxes produced by this algorithm and sub-sub-domain the sub-domain before reduction
Definition at line 50 of file dec_optimizer.hpp.
|
| dec_optimizer (Graph &g, const size_t(&sz)[dim]) |
| Constructor.
|
|
template<unsigned int p_sub, unsigned int p_id> |
void | optimize (grid_key_dx< dim > &start_p, Graph &graph, const Ghost< dim, long int > &ghe, const size_t(&bc)[dim]) |
| optimize the graph
|
|
template<unsigned int p_sub, unsigned int p_id> |
void | optimize (Graph &graph, long int pr_id, openfpm::vector< Box< dim, size_t > > &lb, openfpm::vector< openfpm::vector< size_t > > &box_nn_processor, const Ghost< dim, long int > &ghe, const size_t(&bc)[dim]) |
| optimize the graph
|
|
|
void | expand_one_wf (openfpm::vector< wavefront< dim > > &v_w, std::vector< comb< dim > > &w_comb, size_t d) |
| Expand one wavefront.
|
|
void | adjust_others_wf (openfpm::vector< wavefront< dim > > &v_w, HyperCube< dim > &hyp, std::vector< comb< dim > > &w_comb, size_t d) |
| Adjust the other wavefronts.
|
|
template<unsigned int prp> |
void | write_wavefront (Graph &graph, openfpm::vector< wavefront< dim > > &v_w) |
| Fill the wavefront position.
|
|
template<unsigned int p_sub> |
void | fill_domain (Graph &graph, const Box< dim, size_t > &box, long int ids) |
| Fill the domain.
|
|
template<unsigned int p_sub, unsigned int p_id> |
void | add_to_queue (openfpm::vector< size_t > &domains, openfpm::vector< wavefront< dim > > &v_w, Graph &graph, std::vector< comb< dim > > &w_comb, long int pr_id, const size_t(&bc)[dim]) |
| Add the boundary domain of id p_id to the queue.
|
|
template<unsigned int p_sub, unsigned int p_id> |
void | expand_from_point (size_t start_p, Graph &graph, Box< dim, size_t > &box, openfpm::vector< wavefront< dim > > &v_w, std::vector< comb< dim > > &w_comb) |
| Find the biggest hyper-cube.
|
|
void | InitializeWavefront (grid_key_dx< dim > &start_p, openfpm::vector< wavefront< dim > > &v_w) |
| Initialize the wavefronts.
|
|
template<unsigned int p_id, unsigned int p_sub> |
grid_key_dx< dim > | search_seed (Graph &graph, long int id) |
| Get the first seed.
|
|
template<unsigned int p_sub, unsigned int p_id> |
size_t | optimize (grid_key_dx< dim > &start_p, Graph &graph, long int pr_id, openfpm::vector< Box< dim, size_t > > &lb, openfpm::vector< openfpm::vector< size_t > > &box_nn_processor, const Ghost< dim, long int > &ghe, const size_t(&bc)[dim], bool init_sub_id=true, size_t sub_id=0) |
| optimize the graph
|
|
template<unsigned int p_id> |
void | construct_box_nn_processor (Graph &graph, openfpm::vector< openfpm::vector< size_t > > &box_nn_processor, const openfpm::vector< Box< dim, size_t > > &subs, const Ghost< dim, long int > &ghe, const size_t(&bc)[dim], long int pr_id) |
| Construct the sub-domain processor list.
|
|
template<unsigned int dim, typename Graph >
template<unsigned int p_id>
Construct the sub-domain processor list.
- Template Parameters
-
p_id | property that contain the decomposition |
Each entry is a sub-domain, the list of numbers indicate the neighborhood processors
- Parameters
-
graph | graph to process |
box_nn_processor | for each sub-domain it list all the neighborhood processors |
subs | vector of sub-domains |
ghe | ghost extensions |
bc | boundary conditions |
pr_id | processor that we are processing |
Definition at line 572 of file dec_optimizer.hpp.
template<unsigned int dim, typename Graph >
template<unsigned int p_sub, unsigned int p_id>
Find the biggest hyper-cube.
starting from one initial sub-domain find the biggest hyper-cube output the box, and fill a list of neighborhood processor
- Template Parameters
-
p_sub | id of the property storing the sub-decomposition |
p_id | id of the property containing the decomposition |
- Parameters
-
start_p | initial domain |
graph | representing the grid of sub-sub-domain |
box | produced box |
v_w | Wavefronts |
w_comb | wavefronts directions (0,0,1) (0,0,-1) (0,1,0) (0,-1,0) ... |
Definition at line 274 of file dec_optimizer.hpp.
template<unsigned int dim, typename Graph >
template<unsigned int p_sub, unsigned int p_id>
optimize the graph
Starting from a sub-sub-domain, it create wavefronts at the boundary and expand the boundary until the wavefronts cannot expand any more, creating a sub-domain covering more sub-sub-domain. This procedure continue until all the sub-domain of the processor p_id are covered by a sub-domains
- Template Parameters
-
p_id | property containing the decomposition |
p_sub | property to fill with the sub-domain decomposition |
- Parameters
-
graph | we are processing |
pr_id | Processor id (if p_id == -1 the optimization is done for all the processors) |
lb | list of sub-domain boxes |
box_nn_processor | for each sub-domain it list all the neighborhood processors |
ghe | ghost size |
Definition at line 664 of file dec_optimizer.hpp.
template<unsigned int dim, typename Graph >
template<unsigned int p_sub, unsigned int p_id>
void dec_optimizer< dim, Graph >::optimize |
( |
grid_key_dx< dim > & |
start_p, |
|
|
Graph & |
graph, |
|
|
const Ghost< dim, long int > & |
ghe, |
|
|
const size_t(&) |
bc[dim] |
|
) |
| |
|
inline |
optimize the graph
Starting from a sub-sub-domain, it create wavefronts at the boundary and expand the boundary until the wavefronts cannot expand any more, creating a sub-domain covering more sub-sub-domain. This procedure continue until all the domain is covered by a sub-domains
- Template Parameters
-
p_id | property containing the processor decomposition |
p_sub | property to fill with the sub-domain decomposition |
- Parameters
-
start_p | seed point |
graph | we are processing |
ghe | ghost size |
bc | boundary conditions |
Definition at line 636 of file dec_optimizer.hpp.
template<unsigned int dim, typename Graph >
template<unsigned int p_sub, unsigned int p_id>
size_t dec_optimizer< dim, Graph >::optimize |
( |
grid_key_dx< dim > & |
start_p, |
|
|
Graph & |
graph, |
|
|
long int |
pr_id, |
|
|
openfpm::vector< Box< dim, size_t > > & |
lb, |
|
|
openfpm::vector< openfpm::vector< size_t > > & |
box_nn_processor, |
|
|
const Ghost< dim, long int > & |
ghe, |
|
|
const size_t(&) |
bc[dim], |
|
|
bool |
init_sub_id = true , |
|
|
size_t |
sub_id = 0 |
|
) |
| |
|
inlineprivate |
optimize the graph
Starting from a domain (hyper-cubic), it create wavefront at the boundary and expand the boundary until the wavefronts cannot expand any more. To the domains inside the hyper-cube one sub-id is assigned. This procedure continue until all the domain of one p_id has a sub-id
- Template Parameters
-
p_id | property containing the decomposition |
p_sub | property to fill with the sub-domain decomposition |
- Parameters
-
start_p | seed point |
graph | we are processing |
pr_id | Processor id (if p_id == -1 the optimization is done for all the processors) |
lb | list of sub-domain boxes produced by the algorithm |
box_nn_processor | for each sub-domain it list all the neighborhood processors |
ghe | Ghost extension in sub-sub-domain units in each direction |
init_sub_id | when true p_sub property is initially set to -1 [default true] |
sub_id | starting sub_id to enumerate them [default 0] |
bc | boundary conditions |
- Returns
- last assigned sub-id
Definition at line 503 of file dec_optimizer.hpp.
template<unsigned int dim, typename Graph >
template<unsigned int p_id, unsigned int p_sub>
Get the first seed.
search in the graph for one sub-domain labelled with processor id to use as seed
- Template Parameters
-
p_id | property id containing the decomposition |
p_sub | property id that will contain the sub-domain decomposition |
- Parameters
-
graph | Graph |
id | processor id |
- Returns
- a valid seed key
Definition at line 442 of file dec_optimizer.hpp.