OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
ie_loc_ghost< dim, T, layout_base, Memory > Class Template Reference

structure that store and compute the internal and external local ghost box More...

Detailed Description

template<unsigned int dim, typename T, template< typename > class layout_base, typename Memory>
class ie_loc_ghost< dim, T, layout_base, Memory >

structure that store and compute the internal and external local ghost box

Template Parameters
dimis the dimensionality of the physical domain we are going to decompose.
Ttype of the space we decompose, Real, Integer, Complex ...
See also
CartDecomposition

Definition at line 27 of file ie_loc_ghost.hpp.

#include <ie_loc_ghost.hpp>

+ Inheritance diagram for ie_loc_ghost< dim, T, layout_base, Memory >:

Public Member Functions

void create (openfpm::vector< SpaceBox< dim, T >, Memory, layout_base > &sub_domains, Box< dim, T > &domain, Ghost< dim, T > &ghost, const size_t(&bc)[dim])
 Create external and internal local ghosts.
 
 ie_loc_ghost ()
 Default constructor.
 
 ie_loc_ghost (const ie_loc_ghost< dim, T, layout_base, Memory > &ilg)
 Constructor from another ie_loc_ghost.
 
 ie_loc_ghost (ie_loc_ghost< dim, T, layout_base, Memory > &&ilg)
 Constructor from temporal ie_loc_ghost.
 
ie_loc_ghost< dim, T, layout_base, Memory > & operator= (const ie_loc_ghost< dim, T, layout_base, Memory > &ilg)
 copy the ie_loc_ghost
 
ie_loc_ghost< dim, T, layout_base, Memory > & operator= (ie_loc_ghost< dim, T, layout_base, Memory > &&ilg)
 copy the ie_loc_ghost
 
template<template< typename > class layout_base2, typename Memory2 >
ie_loc_ghost< dim, T, layout_base, Memory > & operator= (const ie_loc_ghost< dim, T, layout_base2, Memory2 > &ilg)
 copy the ie_loc_ghost
 
template<template< typename > class layout_base2, typename Memory2 >
ie_loc_ghost< dim, T, layout_base, Memory > & operator= (ie_loc_ghost< dim, T, layout_base2, Memory2 > &&ilg)
 copy the ie_loc_ghost
 
openfpm::vector< lBox_dom< dim, T > > & private_get_loc_ghost_box ()
 Get the internal loc_ghost_box.
 
size_t getNLocalSub ()
 Get the number of local ghost boxes.
 
size_t getLocalNEGhost (size_t id)
 Get the number of external local ghost box for each sub-domain.
 
size_t getLocalNIGhost (size_t id)
 Get the number of internal local ghost box for each sub-domain.
 
size_t getLocalIGhostE (size_t i, size_t j)
 For the sub-domain i intersected with a surrounding sub-domain enlarged j. Produce a internal ghost box from the prospecive of i and an associated external ghost box from the prospective of j. In order to retrieve the information about the external ghost box we have to use getLocalEGhostBox(x,k). where k is the value returned by getLocalIGhostE(i,j) and x is the value returned by getLocalIGhostSub(i,j)
 
const ::Box< dim, T > & getLocalIGhostBox (size_t i, size_t j) const
 Get the j internal local ghost box for the i sub-domain.
 
const comb< dim > & getLocalIGhostPos (size_t i, size_t j) const
 Get the j internal local ghost box boundary position for the i sub-domain of the local processor.
 
const ::Box< dim, T > & getLocalEGhostBox (size_t i, size_t j) const
 Get the j external local ghost box for the local processor.
 
const comb< dim > & getLocalEGhostPos (size_t i, size_t j) const
 Get the j external local ghost box for the local processor.
 
size_t getLocalIGhostSub (size_t i, size_t k) const
 Considering that sub-domains has N internal local ghost box identified with the 0 <= k < N that come from the intersection of 2 sub-domains i and j where j is enlarged, given the sub-domain i and the id k of the internal box, it return the id j of the other sub-domain that produced the intersection.
 
size_t getLocalEGhostSub (size_t i, size_t k) const
 Considering that sub-domains has N external local ghost box identified with the 0 <= k < N that come from the intersection of 2 sub-domains i and j where i is enlarged, given the sub-domain i and the id k of the external box, it return the id of the other sub-domain j that produced the intersection.
 
bool write (std::string output, size_t p_id) const
 Write the decomposition as VTK file.
 
bool check_consistency (size_t n_sub)
 function to check the consistency of the information of the decomposition
 
bool is_equal (ie_loc_ghost< dim, T, layout_base, Memory > &ilg)
 Check if the ie_loc_ghosts contain the same information.
 
bool is_equal_ng (ie_loc_ghost< dim, T, layout_base, Memory > &ilg)
 Check if the ie_loc_ghosts contain the same information with the exception of the ghost part.
 
void reset ()
 Reset the ie_loc_ghost.
 

Private Member Functions

void create_loc_ghost_ebox (Ghost< dim, T > &ghost, openfpm::vector< SpaceBox< dim, T >, Memory, layout_base > &sub_domains, openfpm::vector< Box_loc_sub< dim, T > > &sub_domains_prc)
 Create the external local ghost boxes.
 
void create_loc_ghost_ibox (Ghost< dim, T > &ghost, openfpm::vector< SpaceBox< dim, T >, Memory, layout_base > &sub_domains, openfpm::vector< Box_loc_sub< dim, T > > &sub_domains_prc)
 Create the internal local ghost boxes.
 
void applyBC (openfpm::vector< Box_loc_sub< dim, T > > &sub_domains, 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 add_subdomain (const Box_loc_sub< dim, T > &bx)
 add sub-domains to a temporal list
 
void flush (openfpm::vector< Box_loc_sub< dim, T > > &sub_domains)
 Flush the temporal added sub-domain to the sub-domain list.
 

Private Attributes

openfpm::vector< lBox_dom< dim, T > > loc_ghost_box
 It contain the calculated local ghost boxes.
 
openfpm::vector< Box_loc_sub< dim, T > > sub_domains_tmp
 temporal added sub-domains
 

Constructor & Destructor Documentation

◆ ie_loc_ghost() [1/3]

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
ie_loc_ghost< dim, T, layout_base, Memory >::ie_loc_ghost ( )
inline

Default constructor.

Definition at line 275 of file ie_loc_ghost.hpp.

◆ ie_loc_ghost() [2/3]

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
ie_loc_ghost< dim, T, layout_base, Memory >::ie_loc_ghost ( const ie_loc_ghost< dim, T, layout_base, Memory > &  ilg)
inline

Constructor from another ie_loc_ghost.

Definition at line 278 of file ie_loc_ghost.hpp.

◆ ie_loc_ghost() [3/3]

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
ie_loc_ghost< dim, T, layout_base, Memory >::ie_loc_ghost ( ie_loc_ghost< dim, T, layout_base, Memory > &&  ilg)
inline

Constructor from temporal ie_loc_ghost.

Definition at line 284 of file ie_loc_ghost.hpp.

Member Function Documentation

◆ add_subdomain()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
void ie_loc_ghost< dim, T, layout_base, Memory >::add_subdomain ( const Box_loc_sub< dim, T > &  bx)
inlineprivate

add sub-domains to a temporal list

Parameters
bxBox to add

Definition at line 221 of file ie_loc_ghost.hpp.

◆ applyBC()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
void ie_loc_ghost< dim, T, layout_base, Memory >::applyBC ( openfpm::vector< Box_loc_sub< dim, T > > &  sub_domains,
const Box< dim, T > &  domain,
const Ghost< dim, T > &  ghost,
const size_t(&)  bc[dim] 
)
inlineprivate

In case of periodic boundary conditions we replicate the sub-domains at the border.

Parameters
sub_domainslist of sub-domains
domainDomain box
ghostpart
bcboundary conditions

Definition at line 154 of file ie_loc_ghost.hpp.

◆ check_consistency()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
bool ie_loc_ghost< dim, T, layout_base, Memory >::check_consistency ( size_t  n_sub)
inline

function to check the consistency of the information of the decomposition

Parameters
n_subNumber of sub_domain
Returns
false if is inconsistent

for each sub-domain

Definition at line 597 of file ie_loc_ghost.hpp.

◆ create()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
void ie_loc_ghost< dim, T, layout_base, Memory >::create ( openfpm::vector< SpaceBox< dim, T >, Memory, layout_base > &  sub_domains,
Box< dim, T > &  domain,
Ghost< dim, T > &  ghost,
const size_t(&)  bc[dim] 
)
inline

Create external and internal local ghosts.

Parameters
sub_domainslist of local sub-domains
domainsimulation domain
ghostboundary
bcBoundary conditions

Definition at line 252 of file ie_loc_ghost.hpp.

◆ create_loc_ghost_ebox()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
void ie_loc_ghost< dim, T, layout_base, Memory >::create_loc_ghost_ebox ( Ghost< dim, T > &  ghost,
openfpm::vector< SpaceBox< dim, T >, Memory, layout_base > &  sub_domains,
openfpm::vector< Box_loc_sub< dim, T > > &  sub_domains_prc 
)
inlineprivate

Create the external local ghost boxes.

Parameters
ghostpart
sub_domainslist of local sub-domains
sub_domains_prclist of sub-domains from the neighborhood processors

Definition at line 42 of file ie_loc_ghost.hpp.

◆ create_loc_ghost_ibox()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
void ie_loc_ghost< dim, T, layout_base, Memory >::create_loc_ghost_ibox ( Ghost< dim, T > &  ghost,
openfpm::vector< SpaceBox< dim, T >, Memory, layout_base > &  sub_domains,
openfpm::vector< Box_loc_sub< dim, T > > &  sub_domains_prc 
)
inlineprivate

Create the internal local ghost boxes.

Parameters
ghostpart
sub_domainslocal sub-domains
sub_domains_prclist of sub-domains from the neighborhood processors

Definition at line 103 of file ie_loc_ghost.hpp.

◆ flush()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
void ie_loc_ghost< dim, T, layout_base, Memory >::flush ( openfpm::vector< Box_loc_sub< dim, T > > &  sub_domains)
inlineprivate

Flush the temporal added sub-domain to the sub-domain list.

Parameters
sub_domainsto add (In general they come from mirroring periodic boundary conditions)

Definition at line 232 of file ie_loc_ghost.hpp.

◆ getLocalEGhostBox()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
const ::Box< dim, T > & ie_loc_ghost< dim, T, layout_base, Memory >::getLocalEGhostBox ( size_t  i,
size_t  j 
) const
inline

Get the j external local ghost box for the local processor.

Parameters
isub-domain
jbox
Returns
the box

Definition at line 487 of file ie_loc_ghost.hpp.

◆ getLocalEGhostPos()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
const comb< dim > & ie_loc_ghost< dim, T, layout_base, Memory >::getLocalEGhostPos ( size_t  i,
size_t  j 
) const
inline

Get the j external local ghost box for the local processor.

Parameters
isub-domain
jbox
Returns
the box

Definition at line 499 of file ie_loc_ghost.hpp.

◆ getLocalEGhostSub()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
size_t ie_loc_ghost< dim, T, layout_base, Memory >::getLocalEGhostSub ( size_t  i,
size_t  k 
) const
inline

Considering that sub-domains has N external local ghost box identified with the 0 <= k < N that come from the intersection of 2 sub-domains i and j where i is enlarged, given the sub-domain i and the id k of the external box, it return the id of the other sub-domain j that produced the intersection.

Parameters
isub-domain
kid
Returns
j

Definition at line 529 of file ie_loc_ghost.hpp.

◆ getLocalIGhostBox()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
const ::Box< dim, T > & ie_loc_ghost< dim, T, layout_base, Memory >::getLocalIGhostBox ( size_t  i,
size_t  j 
) const
inline

Get the j internal local ghost box for the i sub-domain.

Note
For the sub-domain i intersected with the sub-domain j enlarged, the associated external ghost box is located in getLocalIGhostBox(j,k) with getLocalIGhostSub(j,k) == i

To get k use getLocalIGhostE

See also
getLocalIGhostE
Parameters
isub-domain
jbox
Returns
the box

Definition at line 420 of file ie_loc_ghost.hpp.

◆ getLocalIGhostE()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
size_t ie_loc_ghost< dim, T, layout_base, Memory >::getLocalIGhostE ( size_t  i,
size_t  j 
)
inline

For the sub-domain i intersected with a surrounding sub-domain enlarged j. Produce a internal ghost box from the prospecive of i and an associated external ghost box from the prospective of j. In order to retrieve the information about the external ghost box we have to use getLocalEGhostBox(x,k). where k is the value returned by getLocalIGhostE(i,j) and x is the value returned by getLocalIGhostSub(i,j)

Parameters
i
j
Returns
k

Definition at line 400 of file ie_loc_ghost.hpp.

◆ getLocalIGhostPos()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
const comb< dim > & ie_loc_ghost< dim, T, layout_base, Memory >::getLocalIGhostPos ( size_t  i,
size_t  j 
) const
inline

Get the j internal local ghost box boundary position for the i sub-domain of the local processor.

Note
For the sub-domain i intersected with the sub-domain j enlarged, the associated external ghost box is located in getLocalIGhostBox(j,k) with getLocalIGhostSub(j,k) == i

To get k use getLocalIGhostE

See also
getLocalIGhostE

Some of the intersection boxes has special position, because they are at the boundary, this function return their position at the border

                                                    [1,1]
    +---------+------------------------+---------+
    | (1,-1)  |                        | (1,1)   |
    |   |     |    (1,0) --> 7         |   |     |
    |   v     |                        |   v     |
    |   6     |                        |   8     |
    +--------------------------------------------+
    |         |                        |         |
    |         |                        |         |
    |         |                        |         |
    | (-1,0)  |                        | (1,0)   |
    |    |    |                        |   |     |
    |    v    |      (0,0) --> 4       |   v     |
    |    3    |                        |   5     |
    |         |                        |         |
    |         |                        |         |
    |         |                        |         |
    |         |                        |         |
    |         |                        |         |
    |         |                        |         |
    +--------------------------------------------+
    | (-1,-1) |                        | (-1,1)  |
    |    |    |   (-1,0) --> 1         |    |    |
    |    v    |                        |    v    |
    |    0    |                        |    2    |
    +---------+------------------------+---------+
Parameters
isub-domain
jbox
Returns
the box

Definition at line 475 of file ie_loc_ghost.hpp.

◆ getLocalIGhostSub()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
size_t ie_loc_ghost< dim, T, layout_base, Memory >::getLocalIGhostSub ( size_t  i,
size_t  k 
) const
inline

Considering that sub-domains has N internal local ghost box identified with the 0 <= k < N that come from the intersection of 2 sub-domains i and j where j is enlarged, given the sub-domain i and the id k of the internal box, it return the id j of the other sub-domain that produced the intersection.

Parameters
isub-domain
kid
Returns
j

Definition at line 514 of file ie_loc_ghost.hpp.

◆ getLocalNEGhost()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
size_t ie_loc_ghost< dim, T, layout_base, Memory >::getLocalNEGhost ( size_t  id)
inline

Get the number of external local ghost box for each sub-domain.

Parameters
idsub-domain id
Returns
the number of external ghost box

Definition at line 371 of file ie_loc_ghost.hpp.

◆ getLocalNIGhost()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
size_t ie_loc_ghost< dim, T, layout_base, Memory >::getLocalNIGhost ( size_t  id)
inline

Get the number of internal local ghost box for each sub-domain.

Parameters
idsub-domain id
Returns
the number of internal ghost box

Definition at line 383 of file ie_loc_ghost.hpp.

◆ getNLocalSub()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
size_t ie_loc_ghost< dim, T, layout_base, Memory >::getNLocalSub ( )
inline

Get the number of local ghost boxes.

Returns
the number of local ghost boxes

Definition at line 359 of file ie_loc_ghost.hpp.

◆ is_equal()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
bool ie_loc_ghost< dim, T, layout_base, Memory >::is_equal ( ie_loc_ghost< dim, T, layout_base, Memory > &  ilg)
inline

Check if the ie_loc_ghosts contain the same information.

Parameters
ilgElement to check
Returns
true if they match

Definition at line 631 of file ie_loc_ghost.hpp.

◆ is_equal_ng()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
bool ie_loc_ghost< dim, T, layout_base, Memory >::is_equal_ng ( ie_loc_ghost< dim, T, layout_base, Memory > &  ilg)
inline

Check if the ie_loc_ghosts contain the same information with the exception of the ghost part.

Parameters
ilgElement to check
Returns
true if the two objects are equal with the exception of the ghost part

Definition at line 678 of file ie_loc_ghost.hpp.

◆ operator=() [1/4]

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
ie_loc_ghost< dim, T, layout_base, Memory > & ie_loc_ghost< dim, T, layout_base, Memory >::operator= ( const ie_loc_ghost< dim, T, layout_base, Memory > &  ilg)
inline

copy the ie_loc_ghost

Parameters
ilgobject to copy
Returns
itself

Definition at line 296 of file ie_loc_ghost.hpp.

◆ operator=() [2/4]

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
template<template< typename > class layout_base2, typename Memory2 >
ie_loc_ghost< dim, T, layout_base, Memory > & ie_loc_ghost< dim, T, layout_base, Memory >::operator= ( const ie_loc_ghost< dim, T, layout_base2, Memory2 > &  ilg)
inline

copy the ie_loc_ghost

Parameters
ilgobject to copy
Returns
itself

Definition at line 323 of file ie_loc_ghost.hpp.

◆ operator=() [3/4]

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
ie_loc_ghost< dim, T, layout_base, Memory > & ie_loc_ghost< dim, T, layout_base, Memory >::operator= ( ie_loc_ghost< dim, T, layout_base, Memory > &&  ilg)
inline

copy the ie_loc_ghost

Parameters
ilgobject to copy
Returns
itself

Definition at line 309 of file ie_loc_ghost.hpp.

◆ operator=() [4/4]

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
template<template< typename > class layout_base2, typename Memory2 >
ie_loc_ghost< dim, T, layout_base, Memory > & ie_loc_ghost< dim, T, layout_base, Memory >::operator= ( ie_loc_ghost< dim, T, layout_base2, Memory2 > &&  ilg)
inline

copy the ie_loc_ghost

Parameters
ilgobject to copy
Returns
itself

Definition at line 337 of file ie_loc_ghost.hpp.

◆ private_get_loc_ghost_box()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
openfpm::vector< lBox_dom< dim, T > > & ie_loc_ghost< dim, T, layout_base, Memory >::private_get_loc_ghost_box ( )
inline

Get the internal loc_ghost_box.

Returns
the internal loc_ghost_box

Definition at line 348 of file ie_loc_ghost.hpp.

◆ reset()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
void ie_loc_ghost< dim, T, layout_base, Memory >::reset ( )
inline

Reset the ie_loc_ghost.

Definition at line 686 of file ie_loc_ghost.hpp.

◆ write()

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
bool ie_loc_ghost< dim, T, layout_base, Memory >::write ( std::string  output,
size_t  p_id 
) const
inline

Write the decomposition as VTK file.

The function generate several files

5) local_internal_ghost_X.vtk internal local ghost boxes for the local processor (X) 6) local_external_ghost_X.vtk external local ghost boxes for the local processor (X)

where X is the local processor rank

Parameters
outputdirectory where to write the files
p_idid of the local processor
Returns
true if the file is written correctly

local_internal_ghost_X.vtk internal local ghost boxes for the local processor (X)

local_external_ghost_X.vtk external local ghost boxes for the local processor (X)

Definition at line 549 of file ie_loc_ghost.hpp.

Field Documentation

◆ loc_ghost_box

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
openfpm::vector<lBox_dom<dim,T> > ie_loc_ghost< dim, T, layout_base, Memory >::loc_ghost_box
private

It contain the calculated local ghost boxes.

Definition at line 30 of file ie_loc_ghost.hpp.

◆ sub_domains_tmp

template<unsigned int dim, typename T , template< typename > class layout_base, typename Memory >
openfpm::vector<Box_loc_sub<dim,T> > ie_loc_ghost< dim, T, layout_base, Memory >::sub_domains_tmp
private

temporal added sub-domains

Definition at line 33 of file ie_loc_ghost.hpp.


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