This class store the adjacent processors and the adjacent sub_domains. More...
This class store the adjacent processors and the adjacent sub_domains.
dim | is the dimensionality of the physical domain we are going to decompose. |
T | type of the space we decompose, Real, Integer, Complex ... |
Definition at line 23 of file nn_processor.hpp.
#include <nn_processor.hpp>
Public Member Functions | |
nn_prcs (Vcluster<> &v_cl) | |
Constructor require Vcluster. | |
nn_prcs (const nn_prcs< dim, T, layout_base, Memory > &ilg) | |
Constructor from another nn_prcs. | |
nn_prcs (nn_prcs< dim, T, layout_base, Memory > &&ilg) | |
Constructor from temporal ie_loc_ghost. | |
nn_prcs< dim, T, layout_base, Memory > & | operator= (const nn_prcs< dim, T, layout_base, Memory > &nnp) |
Copy the object. | |
nn_prcs< dim, T, layout_base, Memory > & | operator= (nn_prcs< dim, T, layout_base, Memory > &&nnp) |
Copy the object. | |
template<typename Memory2 , template< typename > class layout_base2> | |
nn_prcs< dim, T, layout_base, Memory > & | operator= (const nn_prcs< dim, T, layout_base2, Memory2 > &nnp) |
Copy the object. | |
openfpm::vector< size_t > & | private_get_nn_processors () |
Return the internal nn_processor struct. | |
std::unordered_map< size_t, N_box< dim, T > > & | private_get_nn_processor_subdomains () |
Return the internal nn_processor_subdomains. | |
openfpm::vector< openfpm::vector< size_t > > & | private_get_proc_adj_box () |
Return the internal proc_adj_box. | |
openfpm::vector< openfpm::vector< ::SpaceBox< dim, T > > > & | private_get_boxes () |
Return the internal boxes structure. | |
template<typename Memory2 , template< typename > class layout_base2> | |
nn_prcs< dim, T, layout_base, Memory > & | operator= (nn_prcs< dim, T, layout_base2, Memory2 > &&nnp) |
Copy the object. | |
void | create (const openfpm::vector< openfpm::vector< long unsigned int > > &box_nn_processor, const openfpm::vector< SpaceBox< dim, T >, Memory, layout_base > &sub_domains) |
Create the list of adjacent processors and the list of adjacent sub-domains. | |
size_t | getNNProcessors () const |
Get the number of Near processors. | |
size_t | IDtoProc (size_t id) const |
Return the processor id of the near processor list at place id. | |
const openfpm::vector< size_t > & | getNearSubdomainsRealId (size_t p_id) const |
Get the real-id of the sub-domains of a near processor. | |
const openfpm::vector< ::Box< dim, T > > & | getNearSubdomains (size_t p_id) const |
Get the sub-domains of a near processor. | |
size_t | getNRealSubdomains (size_t p_id) const |
Get the number of real sub-domains of a near processor. | |
const openfpm::vector< comb< dim > > & | getNearSubdomainsPos (size_t p_id) const |
Get the sub-domains sector position of a near processor. | |
size_t | getNearProcessor (size_t p_id) const |
Get the near processor id. | |
const openfpm::vector< size_t > & | getSentSubdomains (size_t p_id) const |
For each near processor it give a vector with the id of the local sub-domain sent to that processor. | |
size_t | ProctoID (size_t p) const |
Convert the processor rank to the id in the list. | |
bool | write (std::string output) const |
Write the decomposition as VTK file. | |
void | applyBC (const Box< dim, T > &domain, const Ghost< dim, T > &ghost, const size_t(&bc)[dim]) |
Apply boundary conditions. | |
bool | is_equal (nn_prcs< dim, T, layout_base, Memory > &np) |
Check if the nn_prcs contain the same information. | |
void | reset () |
Reset the nn_prcs structure. | |
std::unordered_map< size_t, N_box< dim, T > > & | get_nn_processor_subdomains () |
Used for testing porpose do not use. | |
openfpm::vector< size_t > & | get_nn_processors () |
Used for testing porpose do not use. | |
Static Public Member Functions | |
static bool | check_valid (comb< dim > cmb, const size_t(&bc)[dim]) |
Private Member Functions | |
void | consistent_shift (Box< dim, T > &box, const Box< dim, T > &domain, const Point< dim, T > &shift) |
It shift a box but it does consistently. | |
void | add_nn_subdomain (size_t i, size_t r_sub, const Box< dim, T > &bx, const comb< dim > &c) |
add sub-domains to processor for a near processor i | |
void | add_box_periodic (const Box< dim, T > &domain, const Ghost< dim, T > &ghost, const size_t(&bc)[dim]) |
In case of periodic boundary conditions we replicate the sub-domains at the border. | |
void | flush () |
Flush the temporal added sub-domain to the processor sub-domain. | |
Static Private Member Functions | |
static void * | message_alloc (size_t msg_i, size_t total_msg, size_t total_p, size_t i, size_t ri, size_t tag, void *ptr) |
Message allocation. | |
Private Attributes | |
Vcluster & | v_cl |
Virtual cluster. | |
openfpm::vector< size_t > | nn_processors |
List of adjacent processors. | |
std::unordered_map< size_t, N_box< dim, T > > | nn_processor_subdomains |
for each near processor store the sub-domains of the near processors | |
std::unordered_map< size_t, N_box< dim, T > > | nn_processor_subdomains_tmp |
when we add new boxes, are added here | |
openfpm::vector< openfpm::vector< size_t > > | proc_adj_box |
openfpm::vector< openfpm::vector< ::SpaceBox< dim, T > > > | boxes |
contain the set of sub-domains sent to the other processors | |
size_t | recv_cnt |
Receive counter. | |
bool | aBC |
applyBC function is suppose to be called only one time | |
|
inline |
Constructor require Vcluster.
Definition at line 274 of file nn_processor.hpp.
|
inline |
Constructor from another nn_prcs.
Definition at line 279 of file nn_processor.hpp.
|
inline |
Constructor from temporal ie_loc_ghost.
Definition at line 286 of file nn_processor.hpp.
|
inlineprivate |
In case of periodic boundary conditions we replicate the sub-domains at the border.
domain | Domain |
ghost | ghost part |
bc | boundary boundary conditions |
Definition at line 173 of file nn_processor.hpp.
|
inlineprivate |
add sub-domains to processor for a near processor i
i | near processor |
r_sub | real sub-domain id |
bx | Box to add |
c | from which sector the sub-domain come from |
Definition at line 158 of file nn_processor.hpp.
|
inline |
Apply boundary conditions.
domain | The simulation domain |
ghost | ghost part |
bc | Boundary conditions |
Definition at line 705 of file nn_processor.hpp.
|
inlinestatic |
Check that the combination is valid
Is a function that is used in otder to understand if a sub-domain must be mirrored because of boundary conditions
cmb | combination |
bc | boundary conditions |
Definition at line 303 of file nn_processor.hpp.
|
inlineprivate |
It shift a box but it does consistently.
In calculating internal and external ghost boxes, domains are shifted by periodicity. In particular, consider a box touching with the left bolder the left border of the domain
before shift after shift
+--------------------------—+ +---------------------------—+ | | | |
domain | domain | |
---|---|---|
+------—+ | +------—+ |
box | box | |||
+------—+ | +------—+ | |
---|---|---|
+--------------------------—+ +---------------------------—+
shifting the box on the right by the size of the domain, we expect to have a box touching with the left side the right side of the domain. Because of rounding off problem this is not possible with a simple shift. This function ensure consistency like ensuring the previous condition, with the assumption that the shift is +/- the domain size
box | to shift |
domain | |
shift |
Definition at line 93 of file nn_processor.hpp.
|
inline |
Create the list of adjacent processors and the list of adjacent sub-domains.
box_nn_processor | list of adjacent processors for each sub-domain |
sub_domains | list of local sub-domains |
Definition at line 433 of file nn_processor.hpp.
|
inlineprivate |
Flush the temporal added sub-domain to the processor sub-domain.
Definition at line 251 of file nn_processor.hpp.
|
inline |
Used for testing porpose do not use.
Definition at line 758 of file nn_processor.hpp.
|
inline |
Used for testing porpose do not use.
Definition at line 764 of file nn_processor.hpp.
|
inline |
Get the near processor id.
p_id | adjacent processor rank |
Definition at line 623 of file nn_processor.hpp.
|
inline |
Get the sub-domains of a near processor.
p_id | near processor rank |
Definition at line 562 of file nn_processor.hpp.
|
inline |
Get the sub-domains sector position of a near processor.
p_id | near processor rank |
Definition at line 604 of file nn_processor.hpp.
|
inline |
Get the real-id of the sub-domains of a near processor.
p_id | near processor rank |
Definition at line 542 of file nn_processor.hpp.
|
inline |
Get the number of Near processors.
Definition at line 518 of file nn_processor.hpp.
|
inline |
Get the number of real sub-domains of a near processor.
p_id | near processor rank |
Definition at line 584 of file nn_processor.hpp.
|
inline |
For each near processor it give a vector with the id of the local sub-domain sent to that processor.
p_id | adjacent processor (id from 0 to getNNProcessors()) |
Definition at line 644 of file nn_processor.hpp.
|
inline |
Return the processor id of the near processor list at place id.
id |
Definition at line 530 of file nn_processor.hpp.
|
inline |
Check if the nn_prcs contain the same information.
np | Element to check |
Definition at line 725 of file nn_processor.hpp.
|
inlinestaticprivate |
Message allocation.
msg_i | message size required to receive from i |
total_msg | total message size to receive from all the processors |
total_p | the total number of processor want to communicate with you |
i | processor id from which we receive |
ri | request id (it is an id that goes from 0 to total_p, and is unique every time message_alloc is called) |
ptr | a pointer to the vector_dist structure |
Definition at line 139 of file nn_processor.hpp.
|
inline |
Copy the object.
nnp | object to copy |
Definition at line 324 of file nn_processor.hpp.
|
inline |
Copy the object.
nnp | object to copy |
Definition at line 359 of file nn_processor.hpp.
|
inline |
Copy the object.
nnp | object to copy |
Definition at line 341 of file nn_processor.hpp.
|
inline |
Copy the object.
nnp | object to copy |
Definition at line 417 of file nn_processor.hpp.
|
inline |
Return the internal boxes structure.
Definition at line 404 of file nn_processor.hpp.
|
inline |
Return the internal nn_processor_subdomains.
Definition at line 384 of file nn_processor.hpp.
|
inline |
Return the internal nn_processor struct.
Definition at line 374 of file nn_processor.hpp.
|
inline |
Return the internal proc_adj_box.
Definition at line 394 of file nn_processor.hpp.
|
inline |
Convert the processor rank to the id in the list.
p | processor rank |
Definition at line 656 of file nn_processor.hpp.
|
inline |
Reset the nn_prcs structure.
Definition at line 746 of file nn_processor.hpp.
|
inline |
Write the decomposition as VTK file.
The function generate several files
1) subdomains_adjacent_X.vtk sub-domains adjacent to the local processor (X)
where X is the local processor rank
output | directory where to write the files |
subdomains_adjacent_X.vtk sub-domains adjacent to the local processor (X)
Definition at line 682 of file nn_processor.hpp.
|
private |
applyBC function is suppose to be called only one time
Definition at line 49 of file nn_processor.hpp.
|
private |
contain the set of sub-domains sent to the other processors
Definition at line 43 of file nn_processor.hpp.
|
private |
for each near processor store the sub-domains of the near processors
Definition at line 32 of file nn_processor.hpp.
|
private |
when we add new boxes, are added here
Definition at line 35 of file nn_processor.hpp.
|
private |
List of adjacent processors.
Definition at line 29 of file nn_processor.hpp.
|
private |
contain the same information as the member boxes with the difference that instead of the Box itself, it contain the sub-domain id in the list of the local sub-domains
Definition at line 40 of file nn_processor.hpp.
|
private |
Receive counter.
Definition at line 46 of file nn_processor.hpp.
|
private |
Virtual cluster.
Definition at line 26 of file nn_processor.hpp.