OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
dec_optimizer< dim, Graph > Class Template Reference

This class take a graph representing the space decomposition and produce a simplified version. More...

Detailed Description

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.

#include <dec_optimizer.hpp>

Public Member Functions

 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
 

Private Member Functions

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.
 

Private Attributes

grid_sm< dim, void > gh
 Contain information about the grid size.
 

Constructor & Destructor Documentation

◆ dec_optimizer()

template<unsigned int dim, typename Graph >
dec_optimizer< dim, Graph >::dec_optimizer ( Graph &  g,
const size_t(&)  sz[dim] 
)
inline

Constructor.

Parameters
gGraph to simplify
szsize of the grid on each dimension

Definition at line 614 of file dec_optimizer.hpp.

Member Function Documentation

◆ add_to_queue()

template<unsigned int dim, typename Graph >
template<unsigned int p_sub, unsigned int p_id>
void dec_optimizer< dim, Graph >::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] 
)
inlineprivate

Add the boundary domain of id p_id to the queue.

Template Parameters
p_subproperty id where to store the sub-domain decomposition
p_idproperty id where is stored the decomposition
Parameters
domainsvector with sub-sub-domains still to process
v_warray of wave-fronts
graphwe are processing
w_combwavefront combination, it is the normal vector to the wavefront
pr_idprocessor id for which we are optimizing the decomposition
bcboundary conditions

Definition at line 189 of file dec_optimizer.hpp.

◆ adjust_others_wf()

template<unsigned int dim, typename Graph >
void dec_optimizer< dim, Graph >::adjust_others_wf ( openfpm::vector< wavefront< dim > > &  v_w,
HyperCube< dim > &  hyp,
std::vector< comb< dim > > &  w_comb,
size_t  d 
)
inlineprivate

Adjust the other wavefronts.

Parameters
v_warray of wavefronts
hypHyper cube used to adjust the wavefront
w_combfor each wavefront indicate their position (normal to the face of the wavefront)
ddirection

Definition at line 82 of file dec_optimizer.hpp.

◆ construct_box_nn_processor()

template<unsigned int dim, typename Graph >
template<unsigned int p_id>
void dec_optimizer< dim, Graph >::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 
)
inlineprivate

Construct the sub-domain processor list.

Template Parameters
p_idproperty that contain the decomposition

Each entry is a sub-domain, the list of numbers indicate the neighborhood processors

Parameters
graphgraph to process
box_nn_processorfor each sub-domain it list all the neighborhood processors
subsvector of sub-domains
gheghost extensions
bcboundary conditions
pr_idprocessor that we are processing

Definition at line 572 of file dec_optimizer.hpp.

◆ expand_from_point()

template<unsigned int dim, typename Graph >
template<unsigned int p_sub, unsigned int p_id>
void dec_optimizer< dim, Graph >::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 
)
inlineprivate

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_subid of the property storing the sub-decomposition
p_idid of the property containing the decomposition
Parameters
start_pinitial domain
graphrepresenting the grid of sub-sub-domain
boxproduced box
v_wWavefronts
w_combwavefronts directions (0,0,1) (0,0,-1) (0,1,0) (0,-1,0) ...

Definition at line 274 of file dec_optimizer.hpp.

◆ expand_one_wf()

template<unsigned int dim, typename Graph >
void dec_optimizer< dim, Graph >::expand_one_wf ( openfpm::vector< wavefront< dim > > &  v_w,
std::vector< comb< dim > > &  w_comb,
size_t  d 
)
inlineprivate

Expand one wavefront.

Parameters
v_wwavefronts
w_combwavefront expansion combinations
ddirection of expansion

Definition at line 64 of file dec_optimizer.hpp.

◆ fill_domain()

template<unsigned int dim, typename Graph >
template<unsigned int p_sub>
void dec_optimizer< dim, Graph >::fill_domain ( Graph &  graph,
const Box< dim, size_t > &  box,
long int  ids 
)
inlineprivate

Fill the domain.

Template Parameters
p_subproperty to set with the sub-domain id
Parameters
graphwe are processing
boxBox to fill
idsvalue to fill with

Definition at line 155 of file dec_optimizer.hpp.

◆ InitializeWavefront()

template<unsigned int dim, typename Graph >
void dec_optimizer< dim, Graph >::InitializeWavefront ( grid_key_dx< dim > &  start_p,
openfpm::vector< wavefront< dim > > &  v_w 
)
inlineprivate

Initialize the wavefronts.

Parameters
start_pstarting point for the wavefront set
v_wWavefront array

Definition at line 414 of file dec_optimizer.hpp.

◆ optimize() [1/3]

template<unsigned int dim, typename Graph >
template<unsigned int p_sub, unsigned int p_id>
void dec_optimizer< dim, Graph >::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] 
)
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 sub-domain of the processor p_id are covered by a sub-domains

Template Parameters
p_idproperty containing the decomposition
p_subproperty to fill with the sub-domain decomposition
Parameters
graphwe are processing
pr_idProcessor id (if p_id == -1 the optimization is done for all the processors)
lblist of sub-domain boxes
box_nn_processorfor each sub-domain it list all the neighborhood processors
gheghost size

Definition at line 664 of file dec_optimizer.hpp.

◆ optimize() [2/3]

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_idproperty containing the processor decomposition
p_subproperty to fill with the sub-domain decomposition
Parameters
start_pseed point
graphwe are processing
gheghost size
bcboundary conditions

Definition at line 636 of file dec_optimizer.hpp.

◆ optimize() [3/3]

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_idproperty containing the decomposition
p_subproperty to fill with the sub-domain decomposition
Parameters
start_pseed point
graphwe are processing
pr_idProcessor id (if p_id == -1 the optimization is done for all the processors)
lblist of sub-domain boxes produced by the algorithm
box_nn_processorfor each sub-domain it list all the neighborhood processors
gheGhost extension in sub-sub-domain units in each direction
init_sub_idwhen true p_sub property is initially set to -1 [default true]
sub_idstarting sub_id to enumerate them [default 0]
bcboundary conditions
Returns
last assigned sub-id

Definition at line 503 of file dec_optimizer.hpp.

◆ search_seed()

template<unsigned int dim, typename Graph >
template<unsigned int p_id, unsigned int p_sub>
grid_key_dx< dim > dec_optimizer< dim, Graph >::search_seed ( Graph &  graph,
long int  id 
)
inlineprivate

Get the first seed.

search in the graph for one sub-domain labelled with processor id to use as seed

Template Parameters
p_idproperty id containing the decomposition
p_subproperty id that will contain the sub-domain decomposition
Parameters
graphGraph
idprocessor id
Returns
a valid seed key

Definition at line 442 of file dec_optimizer.hpp.

◆ write_wavefront()

template<unsigned int dim, typename Graph >
template<unsigned int prp>
void dec_optimizer< dim, Graph >::write_wavefront ( Graph &  graph,
openfpm::vector< wavefront< dim > > &  v_w 
)
inlineprivate

Fill the wavefront position.

Template Parameters
prpproperty to set
Parameters
graphwe are processing
v_warray of wavefronts

Definition at line 129 of file dec_optimizer.hpp.

Field Documentation

◆ gh

template<unsigned int dim, typename Graph >
grid_sm<dim,void> dec_optimizer< dim, Graph >::gh
private

Contain information about the grid size.

Definition at line 53 of file dec_optimizer.hpp.


The documentation for this class was generated from the following file: