OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
ie_ghost.hpp
1 /*
2  * ie_ghost.hpp
3  *
4  * Created on: Aug 8, 2015
5  * Author: i-bird
6  */
7 
8 #ifndef SRC_DECOMPOSITION_IE_GHOST_HPP_
9 #define SRC_DECOMPOSITION_IE_GHOST_HPP_
10 
11 #include "common.hpp"
12 #include "nn_processor.hpp"
13 #include "Decomposition/shift_vect_converter.hpp"
14 
15 
24 template<unsigned int dim, typename T>
25 class ie_ghost
26 {
32 
35 
38 
41 
44 
47 
50 
53 
56 
73  inline size_t link_ebx_ibx(const nn_prcs<dim,T> & nn_p, size_t p_id, size_t i)
74  {
75  // Search for the correct id
76  size_t k = 0;
77  size_t p_idp = nn_p.ProctoID(p_id);
78  for (k = 0 ; k < nn_p.getSentSubdomains(p_idp).size() ; k++)
79  {
80  if (nn_p.getSentSubdomains(p_idp).get(k) == i)
81  break;
82  }
83  if (k == nn_p.getSentSubdomains(p_idp).size())
84  std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " sub-domain not found\n";
85 
86  return k;
87  }
88 
143  inline 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)
144  {
145  comb<dim> cext = c;
146 
147  if (ei == true)
148  cext.sign_flip();
149 
150  return ((k * N_b + b) * v_cl.getProcessingUnits() + p_id) * openfpm::math::pow(3,dim) + cext.lin();
151  }
152 
153 protected:
154 
160  void generateShiftVectors(const Box<dim,T> & domain, size_t (& bc)[dim])
161  {
162  sc_convert.generateShiftVectors(domain,bc,shifts);
163  }
164 
174  void Initialize_geo_cell(const Box<dim,T> & domain, const size_t (&div)[dim])
175  {
176  // Initialize the geo_cell structure
177  geo_cell.Initialize(domain,div,0);
178  }
179 
196  Ghost<dim,T> & ghost,
197  openfpm::vector<SpaceBox<dim,T>> & sub_domains,
198  const openfpm::vector<openfpm::vector<long unsigned int> > & box_nn_processor,
199  const nn_prcs<dim,T> & nn_p)
200  {
201  box_nn_processor_int.resize(sub_domains.size());
202  proc_int_box.resize(nn_p.getNNProcessors());
203 
204  // For each sub-domain
205  for (size_t i = 0 ; i < sub_domains.size() ; i++)
206  {
207  SpaceBox<dim,T> sub_with_ghost = sub_domains.get(i);
208 
209  // enlarge the sub-domain with the ghost
210  sub_with_ghost.enlarge(ghost);
211 
212  // resize based on the number of near processors
213  box_nn_processor_int.get(i).resize(box_nn_processor.get(i).size());
214 
215  // For each processor near to this sub-domain
216  for (size_t j = 0 ; j < box_nn_processor.get(i).size() ; j++)
217  {
218  // near processor
219  size_t p_id = box_nn_processor.get(i).get(j);
220 
221  // used later
222  Box_dom<dim,T> & proc_int_box_g = proc_int_box.get(nn_p.ProctoID(p_id));
223 
224  // Number of received sub-domains
225  size_t n_r_sub = nn_p.getNRealSubdomains(p_id);
226 
227  // get the set of sub-domains, sector position, and real sub-domain id of the near processor p_id
228  const openfpm::vector< ::Box<dim,T> > & nn_processor_subdomains_g = nn_p.getNearSubdomains(p_id);
229  const openfpm::vector< comb<dim> > & nnpsg_pos = nn_p.getNearSubdomainsPos(p_id);
230  const openfpm::vector< size_t > & r_sub = nn_p.getNearSubdomainsRealId(p_id);
231 
232  // used later
233  openfpm::vector< ::Box<dim,T> > & box_nn_processor_int_gg = box_nn_processor_int.get(i).get(j).bx;
234 
235  // for each near processor sub-domain intersect with the enlarged local sub-domain and store it
236  for (size_t b = 0 ; b < nn_processor_subdomains_g.size() ; b++)
237  {
238  ::Box<dim,T> bi;
239  ::Box<dim,T> sub_bb(nn_processor_subdomains_g.get(b));
240 
241  bool intersect = sub_with_ghost.Intersect(sub_bb,bi);
242 
243  if (intersect == true)
244  {
245  struct p_box<dim,T> pb;
246 
247  pb.box = bi;
248  pb.proc = p_id;
249  pb.lc_proc = nn_p.ProctoID(p_id);
250  pb.shift_id = (size_t)-1;
251 
252  //
253  // Updating
254  //
255  // vb_ext
256  // box_nn_processor_int
257  // proc_int_box
258  //
259  // They all store the same information but organized in different ways
260  // read the description of each for more information
261  //
262 
263  vb_ext.add(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);
269 
270  // Search where the sub-domain i is in the sent list for processor p_id
271  size_t k = link_ebx_ibx(nn_p,p_id,i);
272 
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);
274  }
275  }
276  }
277  }
278  }
279 
297  Ghost<dim,T> & ghost,
298  openfpm::vector<SpaceBox<dim,T>> & sub_domains,
299  const openfpm::vector<openfpm::vector<long unsigned int> > & box_nn_processor,
300  const nn_prcs<dim,T> & nn_p)
301  {
302  box_nn_processor_int.resize(sub_domains.size());
303  proc_int_box.resize(nn_p.getNNProcessors());
304 
305  // For each sub-domain
306  for (size_t i = 0 ; i < sub_domains.size() ; i++)
307  {
308  // For each processor contiguous to this sub-domain
309  for (size_t j = 0 ; j < box_nn_processor.get(i).size() ; j++)
310  {
311  // Near processor
312  size_t p_id = box_nn_processor.get(i).get(j);
313 
314  // get the set of sub-domains of the near processor p_id
315  const openfpm::vector< ::Box<dim,T> > & nn_p_box = nn_p.getNearSubdomains(p_id);
316 
317  // get the sector position for each sub-domain in the list
318  const openfpm::vector< comb<dim> > nn_p_box_pos = nn_p.getNearSubdomainsPos(p_id);
319 
320  // get the real sub-domain id for each sub-domain
321  const openfpm::vector<size_t> r_sub = nn_p.getNearSubdomainsRealId(p_id);
322 
323  // get the local processor id
324  size_t lc_proc = nn_p.getNearProcessor(p_id);
325 
326  // For each near processor sub-domains enlarge and intersect with the local sub-domain and store the result
327  for (size_t k = 0 ; k < nn_p_box.size() ; k++)
328  {
329  // enlarge the near-processor sub-domain
330  ::Box<dim,T> n_sub = nn_p_box.get(k);
331 
332  // local sub-domain
333  ::SpaceBox<dim,T> l_sub = sub_domains.get(i);
334 
335  // Create a margin of ghost size around the near processor sub-domain
336  n_sub.enlarge(ghost);
337 
338  // Intersect with the local sub-domain
339  p_box<dim,T> b_int;
340  bool intersect = n_sub.Intersect(l_sub,b_int.box);
341 
342  // store if it intersect
343  if (intersect == true)
344  {
345  // the box fill with the processor id
346  b_int.proc = p_id;
347 
348  // fill the local processor id
349  b_int.lc_proc = lc_proc;
350 
351  // fill the shift id
352  b_int.shift_id = convertShift(nn_p_box_pos.get(k));
353 
354  //
355  // Updating
356  //
357  // vb_int
358  // box_nn_processor_int
359  // proc_int_box
360  //
361  // They all store the same information but organized in different ways
362  // read the description of each for more information
363  //
364 
365  // add the box to the near processor sub-domain intersections
366  openfpm::vector< ::Box<dim,T> > & p_box_int = box_nn_processor_int.get(i).get(j).nbx;
367  p_box_int.add(b_int.box);
368  vb_int.add(b_int);
369 
370  // store the box in proc_int_box storing from which sub-domain they come from
371  Box_sub<dim,T> sb;
372  sb.bx = b_int.box;
373  sb.sub = i;
374  sb.r_sub = r_sub.get(k);
375  sb.cmb = nn_p_box_pos.get(k);
376 
377  size_t p_idp = nn_p.ProctoID(p_id);
378 
379  // Search where the sub-domain i is in the sent list for processor p_id
380  size_t s = link_ebx_ibx(nn_p,p_id,i);
381 
382  // calculate the id of the internal box
383  sb.id = ebx_ibx_form(r_sub.get(k),s,v_cl.getProcessUnitID(),nn_p_box_pos.get(k),nn_p.getSentSubdomains(p_idp).size(),v_cl,false);
384 
385  Box_dom<dim,T> & pr_box_int = proc_int_box.get(nn_p.ProctoID(p_id));
386  pr_box_int.ibx.add(sb);
387 
388  // update the geo_cell list
389 
390  // get the cells this box span
391  const grid_key_dx<dim> p1 = geo_cell.getCellGrid(b_int.box.getP1());
392  const grid_key_dx<dim> p2 = geo_cell.getCellGrid(b_int.box.getP2());
393 
394  // Get the grid and the sub-iterator
395  auto & gi = geo_cell.getGrid();
396  grid_key_dx_iterator_sub<dim> g_sub(gi,p1,p2);
397 
398  // add the box-id to the cell list
399  while (g_sub.isNext())
400  {
401  auto key = g_sub.get();
402  geo_cell.addCell(gi.LinId(key),vb_int.size()-1);
403  ++g_sub;
404  }
405  }
406  }
407  }
408  }
409  }
410 
411 
412 public:
413 
415  ie_ghost() {};
416 
419  {
420  this->operator =(ie);
421  }
422 
425  {
426  this->operator=(ie);
427  }
428 
431  {
432  box_nn_processor_int.swap(ie.box_nn_processor_int);
433  proc_int_box.swap(ie.proc_int_box);
434  vb_ext.swap(ie.vb_ext);
435  vb_int.swap(ie.vb_int);
436  geo_cell.swap(ie.geo_cell);
437  shifts.swap(ie.shifts);
438  ids_p.swap(ie.ids_p);
439  ids.swap(ie.ids);
440 
441  return *this;
442  }
443 
446  {
449  vb_ext = ie.vb_ext;
450  vb_int = ie.vb_int;
451  geo_cell = ie.geo_cell;
452  shifts = ie.shifts;
453  ids_p = ie.ids_p;
454  ids = ie.ids;
455 
456  return *this;
457  }
458 
508  {
509  return shifts;
510  }
511 
521  size_t convertShift(const comb<dim> & cmb)
522  {
523  return sc_convert.linId(cmb);
524  }
525 
532  inline size_t getProcessorNIGhost(size_t id) const
533  {
534  return proc_int_box.get(id).ibx.size();
535  }
536 
543  inline size_t getProcessorNEGhost(size_t id) const
544  {
545  return proc_int_box.get(id).ebx.size();
546  }
547 
555  inline const ::Box<dim,T> & getProcessorIGhostBox(size_t id, size_t j) const
556  {
557  return proc_int_box.get(id).ibx.get(j).bx;
558  }
559 
567  inline const ::Box<dim,T> & getProcessorEGhostBox(size_t id, size_t j) const
568  {
569  return proc_int_box.get(id).ebx.get(j).bx;
570  }
571 
579  inline const comb<dim> & getProcessorEGhostPos(size_t id, size_t j) const
580  {
581  return proc_int_box.get(id).ebx.get(j).cmb;
582  }
583 
591  inline const comb<dim> & getProcessorIGhostPos(size_t id, size_t j) const
592  {
593  return proc_int_box.get(id).ibx.get(j).cmb;
594  }
595 
607  inline size_t getProcessorIGhostId(size_t id, size_t j) const
608  {
609  return proc_int_box.get(id).ibx.get(j).id;
610  }
611 
623  inline size_t getProcessorEGhostId(size_t id, size_t j) const
624  {
625  return proc_int_box.get(id).ebx.get(j).id;
626  }
627 
639  inline size_t getProcessorIGhostSSub(size_t id, size_t j) const
640  {
641  return proc_int_box.get(id).ibx.get(j).r_sub;
642  }
643 
651  inline size_t getProcessorIGhostSub(size_t id, size_t j) const
652  {
653  return proc_int_box.get(id).ibx.get(j).sub;
654  }
655 
663  inline size_t getProcessorEGhostSub(size_t id, size_t j) const
664  {
665  return proc_int_box.get(id).ebx.get(j).sub;
666  }
667 
673  inline size_t getNIGhostBox() const
674  {
675  return vb_int.size();
676  }
677 
685  inline const ::Box<dim,T> & getIGhostBox(size_t b_id) const
686  {
687  return vb_int.get(b_id).box;
688  }
689 
698  inline size_t getIGhostBoxProcessor(size_t b_id) const
699  {
700  return vb_int.get(b_id).proc;
701  }
702 
708  inline size_t getNEGhostBox() const
709  {
710  return vb_ext.size();
711  }
712 
720  inline ::Box<dim,T> getEGhostBox(size_t b_id) const
721  {
722  return vb_ext.get(b_id).box;
723  }
724 
733  inline size_t getEGhostBoxProcessor(size_t b_id) const
734  {
735  return vb_ext.get(b_id).proc;
736  }
737 
746  {
747  return geo_cell.getCellIterator(geo_cell.getCell(p));
748  }
749 
757  inline auto labelPoint(Point<dim,T> & p) -> decltype(geo_cell.getCellIterator(geo_cell.getCell(p)))
758  {
759  return geo_cell.getCellIterator(geo_cell.getCell(p));
760  }
761 
779  template <typename id1, typename id2> inline const openfpm::vector<std::pair<size_t,size_t>> ghost_processorID_pair(Point<dim,T> & p, const int opt = MULTIPLE)
780  {
781  ids_p.clear();
782 
783  // Check with geo-cell if a particle is inside one Cell containing boxes
784 
785  auto cell_it = geo_cell.getCellIterator(geo_cell.getCell(p));
786 
787  // For each element in the cell, check if the point is inside the box
788  // if it is, store the processor id
789  while (cell_it.isNext())
790  {
791  size_t bid = cell_it.get();
792 
793  if (vb_int.get(bid).box.isInside(p) == true)
794  {
795  ids_p.add(std::pair<size_t,size_t>(id1::id(vb_int.get(bid),bid),id2::id(vb_int.get(bid),bid)));
796  }
797 
798  ++cell_it;
799  }
800 
801  // Make the id unique
802  if (opt == UNIQUE)
803  {
804  ids_p.sort();
805  ids_p.unique();
806  }
807 
808  return ids_p;
809  }
810 
828  template <typename id> inline const openfpm::vector<size_t> ghost_processorID(const Point<dim,T> & p, const int opt = MULTIPLE)
829  {
830  ids.clear();
831 
832  // Check with geo-cell if a particle is inside one Cell containing boxes
833 
834  auto cell_it = geo_cell.getCellIterator(geo_cell.getCell(p));
835 
836  // For each element in the cell, check if the point is inside the box
837  // if it is, store the processor id
838  while (cell_it.isNext())
839  {
840  size_t bid = cell_it.get();
841 
842  if (vb_int.get(bid).box.isInside(p) == true)
843  {
844  ids.add(id::id(vb_int.get(bid),bid));
845  }
846 
847  ++cell_it;
848  }
849 
850  // Make the id unique
851  if (opt == UNIQUE)
852  {
853  ids_p.sort();
854  ids_p.unique();
855  }
856 
857  return ids;
858  }
859 
872  template<typename id1, typename id2, typename Mem> inline const openfpm::vector<std::pair<size_t,size_t>> & ghost_processorID_pair(const encapc<1,Point<dim,T>,Mem> & p, const int opt = MULTIPLE)
873  {
874  ids_p.clear();
875 
876  // Check with geo-cell if a particle is inside one Cell containing boxes
877 
878  auto cell_it = geo_cell.getCellIterator(geo_cell.getCell(p));
879 
880  // For each element in the cell, check if the point is inside the box
881  // if it is, store the processor id
882  while (cell_it.isNext())
883  {
884  size_t bid = cell_it.get();
885 
886  if (vb_int.get(bid).box.isInside(p) == true)
887  {
888  ids_p.add(std::pair<size_t,size_t>(id1::id(vb_int.get(bid),bid),id2::id(vb_int.get(bid),bid)));
889  }
890 
891  ++cell_it;
892  }
893 
894  // Make the id unique
895  if (opt == UNIQUE)
896  {
897  ids_p.sort();
898  ids_p.unique();
899  }
900 
901  return ids_p;
902  }
903 
915  template<typename id, typename Mem> inline const openfpm::vector<size_t> & ghost_processorID(const encapc<1,Point<dim,T>,Mem> & p, const int opt = MULTIPLE)
916  {
917  ids.clear();
918 
919  // Check with geo-cell if a particle is inside one Cell containing boxes
920 
921  auto cell_it = geo_cell.getCellIterator(geo_cell.getCell(p));
922 
923  // For each element in the cell, check if the point is inside the box
924  // if it is, store the processor id
925  while (cell_it.isNext())
926  {
927  size_t bid = cell_it.get();
928 
929  if (vb_int.get(bid).box.isInside(p) == true)
930  {
931  ids.add(id::id(vb_int.get(bid),bid));
932  }
933 
934  ++cell_it;
935  }
936 
937  // Make the id unique
938  if (opt == UNIQUE)
939  {
940  ids_p.sort();
941  ids_p.unique();
942  }
943 
944  return ids;
945  }
946 
959  bool write(std::string output, size_t p_id) const
960  {
962  VTKWriter<openfpm::vector<::Box<dim,T>>,VECTOR_BOX> vtk_box3;
963  for (size_t p = 0 ; p < box_nn_processor_int.size() ; p++)
964  {
965  for (size_t s = 0 ; s < box_nn_processor_int.get(p).size() ; s++)
966  {
967  vtk_box3.add(box_nn_processor_int.get(p).get(s).nbx);
968  }
969  }
970  vtk_box3.write(output + std::string("internal_ghost_") + std::to_string(p_id) + std::string(".vtk"));
971 
973  VTKWriter<openfpm::vector<::Box<dim,T>>,VECTOR_BOX> vtk_box4;
974  for (size_t p = 0 ; p < box_nn_processor_int.size() ; p++)
975  {
976  for (size_t s = 0 ; s < box_nn_processor_int.get(p).size() ; s++)
977  {
978  vtk_box4.add(box_nn_processor_int.get(p).get(s).bx);
979  }
980  }
981  vtk_box4.write(output + std::string("external_ghost_") + std::to_string(p_id) + std::string(".vtk"));
982 
983  return true;
984  }
985 
994  {
995  if (getNEGhostBox() != ig.getNEGhostBox())
996  return false;
997 
998  if (getNIGhostBox() != ig.getNIGhostBox())
999  return false;
1000 
1001  for (size_t i = 0 ; i < getNIGhostBox() ; i++)
1002  {
1003  if (getIGhostBox(i) != ig.getIGhostBox(i))
1004  return false;
1006  return false;
1007  }
1008 
1009  for (size_t i = 0 ; i < proc_int_box.size() ; i++)
1010  {
1011  if (getProcessorNIGhost(i) != ig.getProcessorNIGhost(i))
1012  return false;
1013  for (size_t j = 0 ; j < getProcessorNIGhost(i) ; j++)
1014  {
1015  if (getProcessorIGhostBox(i,j) != ig.getProcessorIGhostBox(i,j))
1016  return false;
1017  if (getProcessorIGhostId(i,j) != ig.getProcessorIGhostId(i,j))
1018  return false;
1019  if (getProcessorIGhostSub(i,j) != ig.getProcessorIGhostSub(i,j))
1020  return false;
1021  }
1022  }
1023 
1024  for (size_t i = 0 ; i < getNEGhostBox() ; i++)
1025  {
1026  if (getEGhostBox(i) != ig.getEGhostBox(i))
1027  return false;
1029  return false;
1030  }
1031 
1032  for (size_t i = 0 ; i < proc_int_box.size() ; i++)
1033  {
1034  if (getProcessorNEGhost(i) != ig.getProcessorNEGhost(i))
1035  return false;
1036  for (size_t j = 0 ; j < getProcessorNEGhost(i) ; j++)
1037  {
1038  if (getProcessorEGhostBox(i,j) != ig.getProcessorEGhostBox(i,j))
1039  return false;
1040  if (getProcessorEGhostId(i,j) != ig.getProcessorEGhostId(i,j))
1041  return false;
1042  if (getProcessorEGhostSub(i,j) != ig.getProcessorEGhostSub(i,j))
1043  return false;
1044  }
1045  }
1046 
1047  return true;
1048  }
1049 
1059  {
1060  return true;
1061  }
1062 
1066  void reset()
1067  {
1068  box_nn_processor_int.clear();
1069  proc_int_box.clear();
1070  vb_ext.clear();
1071  vb_int.clear();
1072  geo_cell.clear();
1073  shifts.clear();
1074  ids_p.clear();
1075  ids.clear();
1076  }
1077 };
1078 
1079 
1080 #endif /* SRC_DECOMPOSITION_IE_GHOST_HPP_ */
size_t getNIGhostBox() const
Return the total number of the calculated internal ghost boxes.
Definition: ie_ghost.hpp:673
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.
Definition: ie_ghost.hpp:52
This class represent an N-dimensional box.
Definition: SpaceBox.hpp:26
openfpm::vector< std::pair< size_t, size_t > > ids_p
Temporal buffers to return temporal information for ghost_processorID.
Definition: ie_ghost.hpp:49
openfpm::vector< Box_dom< dim, T > > proc_int_box
It store the same information of box_nn_processor_int organized by processor id.
Definition: ie_ghost.hpp:34
size_t getNEGhostBox() const
Get the number of the calculated external ghost boxes.
Definition: ie_ghost.hpp:708
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...
Definition: ie_ghost.hpp:73
openfpm::vector< p_box< dim, T > > vb_int
Internal ghost boxes for this processor domain.
Definition: ie_ghost.hpp:40
bool write(std::string output, size_t p_id) const
write the information about the ghost in vtk format
Definition: ie_ghost.hpp:959
openfpm::vector< p_box< dim, T > > vb_ext
External ghost boxes for this processor.
Definition: ie_ghost.hpp:37
grid_key_dx is the key to access any element in the grid
Definition: grid_key.hpp:18
ie_ghost(const ie_ghost< dim, T > &ie)
Copy constructor.
Definition: ie_ghost.hpp:418
Position of the element of dimension d in the hyper-cube of dimension dim.
Definition: comb.hpp:34
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...
Definition: ie_ghost.hpp:779
const ::Box< dim, T > & getProcessorIGhostBox(size_t id, size_t j) const
Get the j Internal ghost box for one processor.
Definition: ie_ghost.hpp:555
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.
Definition: ie_ghost.hpp:160
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...
Definition: ie_ghost.hpp:698
size_t getNNProcessors() const
Get the number of Near processors.
auto getInternalIDBoxes(Point< dim, T > &p) -> decltype(geo_cell.getCellIterator(geo_cell.getCell(p)))
Definition: ie_ghost.hpp:745
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.
Definition: ie_ghost.hpp:195
size_t sub
Domain id.
Definition: common.hpp:76
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)
Definition: CellList.hpp:434
size_t getProcessorNEGhost(size_t id) const
Get the number of External ghost boxes for one processor id.
Definition: ie_ghost.hpp:543
void sign_flip()
Flip the sign of the combination.
Definition: comb.hpp:124
size_t size()
Stub size.
Definition: map_vector.hpp:70
inline::Box< dim, T > getEGhostBox(size_t b_id) const
Given the external ghost box id, it return the external ghost box.
Definition: ie_ghost.hpp:720
This class implement the point shape in an N-dimensional space.
Definition: Point.hpp:22
const ::Box< dim, T > & getProcessorEGhostBox(size_t id, size_t j) const
Get the j External ghost box.
Definition: ie_ghost.hpp:567
Case for external ghost box.
Definition: common.hpp:149
ie_ghost< dim, T > & operator=(ie_ghost< dim, T > &&ie)
Copy operator.
Definition: ie_ghost.hpp:430
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...
Definition: ie_ghost.hpp:828
shift_vect_converter< dim, T > sc_convert
shift converter
Definition: ie_ghost.hpp:55
void reset()
Reset the nn_prcs structure.
Definition: ie_ghost.hpp:1066
size_t lin() const
Linearization.
Definition: comb.hpp:376
Definition: Ghost.hpp:39
void swap(CellList< dim, T, Mem_type, transform, base > &cl)
Swap the memory.
Definition: CellList.hpp:819
Implementation of VCluster class.
Definition: VCluster.hpp:36
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...
Definition: ie_ghost.hpp:915
size_t lc_proc
local processor id
Definition: common.hpp:281
const comb< dim > & getProcessorEGhostPos(size_t id, size_t j) const
Get the j External ghost box sector.
Definition: ie_ghost.hpp:579
bool Intersect(const Box< dim, T > &b, Box< dim, T > &b_out) const
Intersect.
Definition: Box.hpp:88
CellIterator< CellList< dim, T, Mem_type, transform, base > > getCellIterator(size_t cell)
Get the Cell iterator.
Definition: CellList.hpp:836
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...
Definition: ie_ghost.hpp:757
Box< dim, T > bx
Internal ghost box definition.
Definition: common.hpp:73
size_t getProcessorNIGhost(size_t id) const
Get the number of Internal ghost boxes for one processor.
Definition: ie_ghost.hpp:532
comb< dim > cmb
see ie_ghost follow sector explanation
Definition: common.hpp:85
CellList< dim, T, Mem_fast<>, shift< dim, T > > geo_cell
Cell-list that store the geometrical information of the internal ghost boxes.
Definition: ie_ghost.hpp:43
::Box< dim, T > box
Definition: common.hpp:279
structure that store and compute the internal and external local ghost box
Definition: ie_ghost.hpp:25
openfpm::vector< Point< dim, T > > shifts
shift vectors
Definition: ie_ghost.hpp:46
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...
Definition: ie_ghost.hpp:1058
void enlarge(const Box< dim, T > &gh)
Enlarge the box with ghost margin.
Definition: Box.hpp:700
size_t shift_id
shift vector id
Definition: common.hpp:286
size_t id
see ebx_ibx_form in ie_ghost for the meaning
Definition: common.hpp:79
size_t convertShift(const comb< dim > &cmb)
Definition: ie_ghost.hpp:521
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...
Definition: ie_ghost.hpp:591
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.
Definition: ie_ghost.hpp:296
size_t proc
processor rank
Definition: common.hpp:283
This class represent an N-dimensional box.
Definition: Box.hpp:56
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. ...
Definition: memory_c.hpp:201
size_t r_sub
see getNearSubdomainsRealId in nn_prcs
Definition: common.hpp:82
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.
Definition: ie_ghost.hpp:174
void clear()
Clear the cell list.
Definition: CellList.hpp:996
ie_ghost(ie_ghost< dim, T > &&ie)
Copy constructor.
Definition: ie_ghost.hpp:424
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...
Definition: ie_ghost.hpp:872
openfpm::vector< openfpm::vector< Box_proc< dim, T > > > box_nn_processor_int
Definition: ie_ghost.hpp:31
const grid_sm< dim, void > & getGrid()
Return the underlying grid information of the cell list.
Definition: CellList.hpp:416
ie_ghost()
Default constructor.
Definition: ie_ghost.hpp:415
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.
Definition: ie_ghost.hpp:623
void addCell(size_t cell_id, typename base::value_type ele)
Add to the cell.
Definition: CellList.hpp:651
size_t getProcessorEGhostSub(size_t id, size_t j) const
Get the local sub-domain at witch belong the external ghost box.
Definition: ie_ghost.hpp:663
size_t getProcessorIGhostId(size_t id, size_t j) const
Get the j Internal ghost box id.
Definition: ie_ghost.hpp:607
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.
Definition: common.hpp:275
openfpm::vector_std< Box_sub< dim, T > > ebx
Definition: common.hpp:153
const ::Box< dim, T > & getIGhostBox(size_t b_id) const
Given the internal ghost box id, it return the internal ghost box.
Definition: ie_ghost.hpp:685
ie_ghost< dim, T > & operator=(const ie_ghost< dim, T > &ie)
Copy operator.
Definition: ie_ghost.hpp:445
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.
Definition: ie_ghost.hpp:639
Implementation of 1-D std::vector like structure.
Definition: map_vector.hpp:61
Class for FAST cell list implementation.
Definition: CellList.hpp:269
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.
Definition: ie_ghost.hpp:993
const openfpm::vector< Point< dim, T > > & getShiftVectors()
Definition: ie_ghost.hpp:507
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...
Definition: ie_ghost.hpp:733
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.
Definition: ie_ghost.hpp:143
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.
Definition: ie_ghost.hpp:651
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.