diff --git a/src/Decomposition/CartDecomposition.hpp b/src/Decomposition/CartDecomposition.hpp index 7d13b3312cb3cb3a488a93f1c6df628d5c61294d..1a0e90d88ae9031fb669d4dc6b3d72e741e4e2be 100644 --- a/src/Decomposition/CartDecomposition.hpp +++ b/src/Decomposition/CartDecomposition.hpp @@ -316,31 +316,6 @@ private: // Receive counter size_t recv_cnt; - /*! \brief Message allocation - * - * \param message size required to receive from i - * \param total message size to receive from all the processors - * \param the total number of processor want to communicate with you - * \param i processor id - * \param ri request id (it is an id that goes from 0 to total_p, and is unique - * every time message_alloc is called) - * \param ptr a pointer to the vector_dist structure - * - * \return the pointer where to store the message - * - */ - static void * message_alloc(size_t msg_i ,size_t total_msg, size_t total_p, size_t i, size_t ri, void * ptr) - { - // cast the pointer - CartDecomposition<dim,T,device_l,Memory,Domain> * cd = static_cast< CartDecomposition<dim,T,device_l,Memory,Domain> *>(ptr); - - // Resize the memory - cd->nn_processor_subdomains[i].bx.resize(msg_i / sizeof(::Box<dim,T>) ); - - // Return the receive pointer - return cd->nn_processor_subdomains[i].bx.getPointer(); - } - public: /*! \brief Cartesian decomposition constructor @@ -809,6 +784,12 @@ p1[0]<-----+ +----> p2[0] void debugPrint() { + std::cout << "Subdomains\n"; + for (size_t p = 0 ; p < sub_domains.size() ; p++) + { + std::cout << ::SpaceBox<dim,T>(sub_domains.get(p)).toString() << "\n"; + } + std::cout << "External ghost box\n"; for (size_t p = 0 ; p < nn_prcs<dim,T>::getNNProcessors() ; p++) diff --git a/src/Decomposition/nn_processor.hpp b/src/Decomposition/nn_processor.hpp index b11a758196ffe9f51d03c1d03f8fc427e6b0a5b3..73ccf5f73c4e80014214f12fcd69aba5a0740275 100644 --- a/src/Decomposition/nn_processor.hpp +++ b/src/Decomposition/nn_processor.hpp @@ -91,6 +91,25 @@ public: auto last = std::unique(nn_processors.begin(), nn_processors.end()); nn_processors.erase(last, nn_processors.end()); + // produce the list of the contiguous processor (nn_processors) and link nn_processor_subdomains to the + // processor list (nn_processors) + for (size_t i = 0 ; i < box_nn_processor.size() ; i++) + { + for (size_t j = 0 ; j < box_nn_processor.get(i).size() ; j++) + { + // processor id near to this sub-domain + size_t proc_id = box_nn_processor.get(i).get(j); + + size_t k = 0; + // search inside near processor list + for (k = 0 ; k < nn_processors.size() ; k++) + if (nn_processors.get(k) == proc_id) break; + + nn_processor_subdomains[proc_id].id = k; + } + } + + // create a buffer with the sub-domains of this processor, the informations ( the boxes ) // of the sub-domains contiguous to the processor A are sent to the processor A and // the information of the contiguous sub-domains in the near processors are received