8#ifndef SRC_DECOMPOSITION_GHOST_DEC_IE_GHOST_HPP_
9#define SRC_DECOMPOSITION_GHOST_DEC_IE_GHOST_HPP_
11#include "Space/Shape/Box.hpp"
12#include "Space/Ghost.hpp"
13#include "Space/SpaceBox.hpp"
15#include "VTKWriter/VTKWriter.hpp"
16#include "nn_processor.hpp"
26template<
unsigned int dim,
typename T,
template <
typename>
class layout_base,
typename Memory>
52 for (
size_t i = 0 ; i < sub_domains.size() ; i++)
60 for (
size_t j = 0 ; j < sub_domains_prc.size() ; j++)
62 size_t rj = sub_domains_prc.get(j).sub;
64 if (rj == i && sub_domains_prc.get(j).cmb == zero)
69 bool intersect = sub_with_ghost.
Intersect(sub_domains_prc.get(j).bx,bi);
71 if (intersect ==
true)
76 b.cmb = sub_domains_prc.get(j).cmb;
84 if (
loc_ghost_box.get(rj).ibx.get(k).sub == i &&
loc_ghost_box.get(rj).ibx.get(k).cmb == sub_domains_prc.get(j).cmb.operator-())
113 for (
size_t i = 0 ; i < sub_domains.size() ; i++)
116 for (
size_t j = 0 ; j < sub_domains_prc.size() ; j++)
119 size_t rj = sub_domains_prc.get(j).sub;
122 if (rj == i && sub_domains_prc.get(j).cmb == zero)
132 if (intersect ==
true)
138 b.cmb = sub_domains_prc.get(j).cmb;
160 for (
long int i = dim-1 ; i >= 0 ; i--)
164 for (
size_t j = 0 ; j < cmbs.size() ; j++)
172 for (
size_t k = 0 ; k < dim ; k++)
178 bp.
setHigh(k,domain.getHigh(k));
179 shift.get(k) = -domain.getHigh(k)+domain.getLow(k);
182 bp.
setLow(k,domain.getLow(k));
183 bp.
setHigh(k,domain.getHigh(k));
187 bp.
setLow(k,domain.getLow(k));
189 shift.get(k) = domain.getHigh(k)-domain.getLow(k);
197 for (
size_t k = 0 ; k < sub_domains.size() ; k++)
261 for (
size_t i = 0 ; i < sub_domains.size() ; i++)
264 sub_domains_prc.add(bls);
265 sub_domains_prc.last().sub = i;
268 applyBC(sub_domains_prc,domain,ghost,bc);
322 template<
template <
typename>
class layout_base2,
typename Memory2>
336 template<
template <
typename>
class layout_base2,
typename Memory2>
549 bool write(std::string output,
size_t p_id)
const
563 for (
size_t p = 0 ; p < vv5.
size() ; p++)
565 vtk_box5.add(vv5.get(p));
567 vtk_box5.write(output + std::string(
"local_internal_ghost_") + std::to_string(p_id) + std::string(
".vtk"));
581 for (
size_t p = 0 ; p < vv6.
size() ; p++)
583 vtk_box6.add(vv6.get(p));
585 vtk_box6.write(output + std::string(
"local_external_ghost_") + std::to_string(p_id) + std::string(
".vtk"));
606 std::cout << __FILE__ <<
":" << __LINE__ <<
" Error: inconsistent decomposition no ibx link" <<
"\n";
615 std::cout << __FILE__ <<
":" << __LINE__ <<
" Error: inconsistent link between an external ghost box and an internal ghost box" <<
"\n";
This class represent an N-dimensional box.
__device__ __host__ T getLow(int i) const
get the i-coordinate of the low bound interval of the box
__device__ __host__ bool Intersect(const Box< dim, T > &b, Box< dim, T > &b_out) const
Intersect.
__device__ __host__ T getHigh(int i) const
get the high interval of the box
void enlarge(const Box< dim, T > &gh)
Enlarge the box with ghost margin.
__device__ __host__ void setHigh(int i, T val)
set the high interval of the box
__device__ __host__ void setLow(int i, T val)
set the low interval of the box
This class calculate elements of the hyper-cube.
static std::vector< comb< dim > > getCombinations_R_bc(size_t d, const size_t(&bc)[dim])
This class implement the point shape in an N-dimensional space.
This class represent an N-dimensional box.
structure that store and compute the internal and external local ghost box
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 ...
ie_loc_ghost< dim, T, layout_base, Memory > & operator=(ie_loc_ghost< dim, T, layout_base2, Memory2 > &&ilg)
copy the ie_loc_ghost
size_t getLocalNIGhost(size_t id)
Get the number of internal local ghost box for each sub-domain.
openfpm::vector< lBox_dom< dim, T > > loc_ghost_box
It contain the calculated local ghost boxes.
ie_loc_ghost(const ie_loc_ghost< dim, T, layout_base, Memory > &ilg)
Constructor from another ie_loc_ghost.
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.
openfpm::vector< Box_loc_sub< dim, T > > sub_domains_tmp
temporal added sub-domains
bool write(std::string output, size_t p_id) const
Write the decomposition as VTK file.
bool is_equal(ie_loc_ghost< dim, T, layout_base, Memory > &ilg)
Check if the ie_loc_ghosts contain the same information.
size_t getNLocalSub()
Get the number of local ghost boxes.
ie_loc_ghost()
Default constructor.
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.
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.
ie_loc_ghost< dim, T, layout_base, Memory > & operator=(const ie_loc_ghost< dim, T, layout_base2, Memory2 > &ilg)
copy the ie_loc_ghost
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.
const comb< dim > & getLocalEGhostPos(size_t i, size_t j) const
Get the j external local ghost box for the local processor.
void reset()
Reset the ie_loc_ghost.
size_t getLocalNEGhost(size_t id)
Get the number of external 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 b...
ie_loc_ghost(ie_loc_ghost< dim, T, layout_base, Memory > &&ilg)
Constructor from temporal ie_loc_ghost.
bool check_consistency(size_t n_sub)
function to check the consistency of the information of the decomposition
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.
void flush(openfpm::vector< Box_loc_sub< dim, T > > &sub_domains)
Flush the temporal added sub-domain to the sub-domain list.
const ::Box< dim, T > & getLocalEGhostBox(size_t i, size_t j) const
Get the j external local ghost box for the local processor.
ie_loc_ghost< dim, T, layout_base, Memory > & operator=(ie_loc_ghost< dim, T, layout_base, Memory > &&ilg)
copy the ie_loc_ghost
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 ...
ie_loc_ghost< dim, T, layout_base, Memory > & operator=(const ie_loc_ghost< dim, T, layout_base, Memory > &ilg)
copy the ie_loc_ghost
void add_subdomain(const Box_loc_sub< dim, T > &bx)
add sub-domains to a temporal list
const ::Box< dim, T > & getLocalIGhostBox(size_t i, size_t j) const
Get the j internal local ghost box for the i sub-domain.
openfpm::vector< lBox_dom< dim, T > > & private_get_loc_ghost_box()
Get the internal loc_ghost_box.
This class store the adjacent processors and the adjacent sub_domains.
Implementation of 1-D std::vector like structure.
for each sub-domain box sub contain the real the sub-domain id
Particular case for local internal ghost boxes.
Position of the element of dimension d in the hyper-cube of dimension dim.
void zero()
Set all the elements to zero.