8 #ifndef SRC_DECOMPOSITION_IE_GHOST_HPP_
9 #define SRC_DECOMPOSITION_IE_GHOST_HPP_
12 #include "nn_processor.hpp"
13 #include "Decomposition/shift_vect_converter.hpp"
24 template<
unsigned int dim,
typename T>
84 std::cerr <<
"Error: " << __FILE__ <<
":" << __LINE__ <<
" sub-domain not found\n";
205 for (
size_t i = 0 ; i < sub_domains.size() ; i++)
216 for (
size_t j = 0 ; j < box_nn_processor.get(i).size() ; j++)
219 size_t p_id = box_nn_processor.get(i).get(j);
236 for (
size_t b = 0 ; b < nn_processor_subdomains_g.
size() ; b++)
241 bool intersect = sub_with_ghost.
Intersect(sub_bb,bi);
243 if (intersect ==
true)
245 struct p_box<dim,T> pb;
264 box_nn_processor_int_gg.add(bi);
265 proc_int_box_g.
ebx.add();
266 proc_int_box_g.
ebx.last().bx = bi;
267 proc_int_box_g.
ebx.last().sub = i;
268 proc_int_box_g.
ebx.last().cmb = nnpsg_pos.get(b);
273 proc_int_box_g.
ebx.last().id =
ebx_ibx_form(k,r_sub.get(b),p_id,nnpsg_pos.get(b),n_r_sub,v_cl,
true);
306 for (
size_t i = 0 ; i < sub_domains.size() ; i++)
309 for (
size_t j = 0 ; j < box_nn_processor.get(i).size() ; j++)
312 size_t p_id = box_nn_processor.get(i).get(j);
327 for (
size_t k = 0 ; k < nn_p_box.
size() ; k++)
343 if (intersect ==
true)
367 p_box_int.add(b_int.
box);
374 sb.
r_sub = r_sub.get(k);
375 sb.
cmb = nn_p_box_pos.get(k);
386 pr_box_int.ibx.add(sb);
438 ids_p.swap(ie.ids_p);
687 return vb_int.get(b_id).box;
700 return vb_int.get(b_id).proc;
722 return vb_ext.get(b_id).box;
735 return vb_ext.get(b_id).proc;
789 while (cell_it.isNext())
791 size_t bid = cell_it.get();
793 if (
vb_int.get(bid).box.isInside(p) ==
true)
795 ids_p.add(std::pair<size_t,size_t>(id1::id(
vb_int.get(bid),bid),id2::id(
vb_int.get(bid),bid)));
838 while (cell_it.isNext())
840 size_t bid = cell_it.get();
842 if (
vb_int.get(bid).box.isInside(p) ==
true)
882 while (cell_it.isNext())
884 size_t bid = cell_it.get();
886 if (
vb_int.get(bid).box.isInside(p) ==
true)
888 ids_p.add(std::pair<size_t,size_t>(id1::id(
vb_int.get(bid),bid),id2::id(
vb_int.get(bid),bid)));
925 while (cell_it.isNext())
927 size_t bid = cell_it.get();
929 if (
vb_int.get(bid).box.isInside(p) ==
true)
959 bool write(std::string output,
size_t p_id)
const
970 vtk_box3.write(output + std::string(
"internal_ghost_") + std::to_string(p_id) + std::string(
".vtk"));
981 vtk_box4.write(output + std::string(
"external_ghost_") + std::to_string(p_id) + std::string(
".vtk"));
size_t getNIGhostBox() const
Return the total number of the calculated internal ghost boxes.
size_t ProctoID(size_t p) const
Convert the processor rank to the id in the list.
openfpm::vector< size_t > ids
Temporal buffers to return temporal information.
This class represent an N-dimensional box.
openfpm::vector< std::pair< size_t, size_t > > ids_p
Temporal buffers to return temporal information for ghost_processorID.
openfpm::vector< Box_dom< dim, T > > proc_int_box
It store the same information of box_nn_processor_int organized by processor id.
size_t getNEGhostBox() const
Get the number of the calculated external ghost boxes.
size_t link_ebx_ibx(const nn_prcs< dim, T > &nn_p, size_t p_id, size_t i)
Given a local sub-domain i, it give the id of such sub-domain in the sent list for the processor p_id...
openfpm::vector< p_box< dim, T > > vb_int
Internal ghost boxes for this processor domain.
bool write(std::string output, size_t p_id) const
write the information about the ghost in vtk format
openfpm::vector< p_box< dim, T > > vb_ext
External ghost boxes for this processor.
grid_key_dx is the key to access any element in the grid
ie_ghost(const ie_ghost< dim, T > &ie)
Copy constructor.
Position of the element of dimension d in the hyper-cube of dimension dim.
const openfpm::vector< std::pair< size_t, size_t > > ghost_processorID_pair(Point< dim, T > &p, const int opt=MULTIPLE)
Given a position it return if the position belong to any neighborhood processor ghost (Internal ghost...
const ::Box< dim, T > & getProcessorIGhostBox(size_t id, size_t j) const
Get the j Internal ghost box for one processor.
size_t getProcessUnitID()
Get the process unit id.
void generateShiftVectors(const Box< dim, T > &domain, size_t(&bc)[dim])
Here we generare the shift vectors.
size_t getIGhostBoxProcessor(size_t b_id) const
Given the internal ghost box id, it return the near processor at witch belong or the near processor t...
size_t getNNProcessors() const
Get the number of Near processors.
auto getInternalIDBoxes(Point< dim, T > &p) -> decltype(geo_cell.getCellIterator(geo_cell.getCell(p)))
void create_box_nn_processor_ext(Vcluster &v_cl, Ghost< dim, T > &ghost, openfpm::vector< SpaceBox< dim, T >> &sub_domains, const openfpm::vector< openfpm::vector< long unsigned int > > &box_nn_processor, const nn_prcs< dim, T > &nn_p)
Create the box_nn_processor_int (bx part) structure.
void Initialize(CellDecomposer_sm< dim, T, transform > &cd_sm, const Box< dim, T > &dom_box, const size_t pad=1, size_t slot=STARTING_NSLOT)
size_t getProcessorNEGhost(size_t id) const
Get the number of External ghost boxes for one processor id.
void sign_flip()
Flip the sign of the combination.
inline::Box< dim, T > getEGhostBox(size_t b_id) const
Given the external ghost box id, it return the external ghost box.
This class implement the point shape in an N-dimensional space.
const ::Box< dim, T > & getProcessorEGhostBox(size_t id, size_t j) const
Get the j External ghost box.
Case for external ghost box.
ie_ghost< dim, T > & operator=(ie_ghost< dim, T > &&ie)
Copy operator.
const openfpm::vector< size_t > ghost_processorID(const Point< dim, T > &p, const int opt=MULTIPLE)
Given a position it return if the position belong to any neighborhood processor ghost (Internal ghost...
shift_vect_converter< dim, T > sc_convert
shift converter
void reset()
Reset the nn_prcs structure.
size_t lin() const
Linearization.
void swap(CellList< dim, T, Mem_type, transform, base > &cl)
Swap the memory.
Implementation of VCluster class.
const openfpm::vector< size_t > & ghost_processorID(const encapc< 1, Point< dim, T >, Mem > &p, const int opt=MULTIPLE)
Given a position it return if the position belong to any neighborhood processor ghost (Internal ghost...
size_t lc_proc
local processor id
const comb< dim > & getProcessorEGhostPos(size_t id, size_t j) const
Get the j External ghost box sector.
bool Intersect(const Box< dim, T > &b, Box< dim, T > &b_out) const
Intersect.
CellIterator< CellList< dim, T, Mem_type, transform, base > > getCellIterator(size_t cell)
Get the Cell iterator.
const openfpm::vector< size_t > & getNearSubdomainsRealId(size_t p_id) const
Get the real-id of the sub-domains of a near processor.
auto labelPoint(Point< dim, T > &p) -> decltype(geo_cell.getCellIterator(geo_cell.getCell(p)))
if the point fall into the ghost of some near processor it return the processors id's in which it fal...
Box< dim, T > bx
Internal ghost box definition.
size_t getProcessorNIGhost(size_t id) const
Get the number of Internal ghost boxes for one processor.
comb< dim > cmb
see ie_ghost follow sector explanation
CellList< dim, T, Mem_fast<>, shift< dim, T > > geo_cell
Cell-list that store the geometrical information of the internal ghost boxes.
structure that store and compute the internal and external local ghost box
openfpm::vector< Point< dim, T > > shifts
shift vectors
bool is_equal_ng(ie_ghost< dim, T > &ig)
Check if the ie_loc_ghosts contain the same information with the exception of the ghost part It is an...
void enlarge(const Box< dim, T > &gh)
Enlarge the box with ghost margin.
size_t shift_id
shift vector id
size_t id
see ebx_ibx_form in ie_ghost for the meaning
size_t convertShift(const comb< dim > &cmb)
const comb< dim > & getProcessorIGhostPos(size_t id, size_t j) const
Get the ghost box sector of the external ghost box linked with the j internal ghost box...
void create_box_nn_processor_int(Vcluster &v_cl, Ghost< dim, T > &ghost, openfpm::vector< SpaceBox< dim, T >> &sub_domains, const openfpm::vector< openfpm::vector< long unsigned int > > &box_nn_processor, const nn_prcs< dim, T > &nn_p)
Create the box_nn_processor_int (nbx part) structure, the geo_cell list and proc_int_box.
size_t proc
processor rank
This class represent an N-dimensional box.
grid_key_dx< dim > get() const
Return the actual grid key iterator.
This class is a trick to indicate the compiler a specific specialization pattern. ...
size_t r_sub
see getNearSubdomainsRealId in nn_prcs
size_t getNearProcessor(size_t p_id) const
Get the near processor id.
void Initialize_geo_cell(const Box< dim, T > &domain, const size_t(&div)[dim])
Initialize the geo cell list structure.
void clear()
Clear the cell list.
ie_ghost(ie_ghost< dim, T > &&ie)
Copy constructor.
const openfpm::vector< std::pair< size_t, size_t > > & ghost_processorID_pair(const encapc< 1, Point< dim, T >, Mem > &p, const int opt=MULTIPLE)
Given a position it return if the position belong to any neighborhood processor ghost (Internal ghost...
openfpm::vector< openfpm::vector< Box_proc< dim, T > > > box_nn_processor_int
const grid_sm< dim, void > & getGrid()
Return the underlying grid information of the cell list.
ie_ghost()
Default constructor.
in case of high dimensions shift vector converter
size_t getProcessorEGhostId(size_t id, size_t j) const
Get the j External ghost box id.
void addCell(size_t cell_id, typename base::value_type ele)
Add to the cell.
size_t getProcessorEGhostSub(size_t id, size_t j) const
Get the local sub-domain at witch belong the external ghost box.
size_t getProcessorIGhostId(size_t id, size_t j) const
Get the j Internal ghost box id.
const openfpm::vector< comb< dim > > & getNearSubdomainsPos(size_t p_id) const
Get the sub-domains sector position of a near processor.
It store all the boxes of the near processors in a linear array.
openfpm::vector_std< Box_sub< dim, T > > ebx
const ::Box< dim, T > & getIGhostBox(size_t b_id) const
Given the internal ghost box id, it return the internal ghost box.
ie_ghost< dim, T > & operator=(const ie_ghost< dim, T > &ie)
Copy operator.
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 getProcessorIGhostSSub(size_t id, size_t j) const
Get the sub-domain send-id at witch belong the internal ghost box.
Implementation of 1-D std::vector like structure.
Class for FAST cell list implementation.
bool isNext()
Check if there is the next element.
size_t getProcessingUnits()
Get the total number of processors.
bool is_equal(ie_ghost< dim, T > &ig)
Check if the ie_ghosts contain the same information.
const openfpm::vector< Point< dim, T > > & getShiftVectors()
size_t getEGhostBoxProcessor(size_t b_id) const
Given the external ghost box id, it return the near processor at witch belong or the near processor t...
size_t ebx_ibx_form(size_t k, size_t b, size_t p_id, const comb< dim > &c, size_t N_b, Vcluster &v_cl, const bool ei)
This is the external and internal ghost box link formula.
const openfpm::vector< ::Box< dim, T > > & getNearSubdomains(size_t p_id) const
Get the sub-domains of a near processor.
size_t getProcessorIGhostSub(size_t id, size_t j) const
Get the local sub-domain at witch belong the internal ghost box.
size_t getNRealSubdomains(size_t p_id) const
Get the number of real sub-domains of a near processor.
This class store the adjacent processors and the adjacent sub_domains.