From cb130fcfba530fe670395ab641a7d432d171c7c8 Mon Sep 17 00:00:00 2001 From: Pietro Incardona Date: Thu, 6 Apr 2017 22:20:18 +0200 Subject: [PATCH] Small fix for emty processors --- src/Decomposition/CartDecomposition.hpp | 38 +++++++++++++------ .../Distribution/ParMetisDistribution.hpp | 6 +-- src/Vector/vector_dist.hpp | 8 ++++ 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/Decomposition/CartDecomposition.hpp b/src/Decomposition/CartDecomposition.hpp index f283550..e27f9aa 100755 --- a/src/Decomposition/CartDecomposition.hpp +++ b/src/Decomposition/CartDecomposition.hpp @@ -268,12 +268,24 @@ public: d_o.template optimize(dist.getGraph(), p_id, loc_box, box_nn_processor,ghe,bc); // Initialize - if (loc_box.size() >= 0) + if (loc_box.size() > 0) { bbox = convertDecBoxIntoSubDomain(loc_box.get(0)); proc_box = loc_box.get(0); sub_domains.add(bbox); } + else + { + // invalidate all the boxes + for (size_t i = 0 ; i < dim ; i++) + { + proc_box.setLow(i,0.0); + proc_box.setHigh(i,(size_t)-1); + + bbox.setLow(i,0.0); + bbox.setHigh(i,(size_t)-1); + } + } // convert into sub-domain for (size_t s = 1; s < loc_box.size(); s++) @@ -327,19 +339,23 @@ public: { // Get the processor bounding Box ::Box bound = getProcessorBounds(); - // Not necessary, but I prefer - bound.enlarge(ghost); - // calculate the sub-divisions - size_t div[dim]; - for (size_t i = 0; i < dim; i++) - div[i] = (size_t) ((bound.getHigh(i) - bound.getLow(i)) / cd.getCellBox().getP2()[i]); + if (bound.isValid() == true) + { + // Not necessary, but I prefer + bound.enlarge(ghost); - // Initialize the geo_cell structure - ie_ghost::Initialize_geo_cell(bound,div); + // calculate the sub-divisions + size_t div[dim]; + for (size_t i = 0; i < dim; i++) + div[i] = (size_t) ((bound.getHigh(i) - bound.getLow(i)) / cd.getCellBox().getP2()[i]); - // Initialize shift vectors - ie_ghost::generateShiftVectors(domain); + // Initialize the geo_cell structure + ie_ghost::Initialize_geo_cell(bound,div); + + // Initialize shift vectors + ie_ghost::generateShiftVectors(domain); + } } /*! \brief Calculate communication and migration costs diff --git a/src/Decomposition/Distribution/ParMetisDistribution.hpp b/src/Decomposition/Distribution/ParMetisDistribution.hpp index ed14061..961da28 100644 --- a/src/Decomposition/Distribution/ParMetisDistribution.hpp +++ b/src/Decomposition/Distribution/ParMetisDistribution.hpp @@ -471,7 +471,7 @@ public: #ifdef SE_CLASS1 if (id >= gp.getNVertex()) - std::cerr << << __FILE__ << ":" << __LINE__ << "Such vertex doesn't exist (id = " << id << ", " << "total size = " << gp.getNVertex() << ")\n"; + std::cerr << __FILE__ << ":" << __LINE__ << "Such vertex doesn't exist (id = " << id << ", " << "total size = " << gp.getNVertex() << ")\n"; #endif // Update vertex in main graph @@ -545,10 +545,10 @@ public: */ void setCommunicationCost(size_t v_id, size_t e, size_t communication) { - size_t e_id = v_id + e; - +#ifdef SE_CLASS1 if (e_id >= gp.getNEdge()) std::cerr << "Such edge doesn't exist (id = " << e_id << ", " << "total size = " << gp.getNEdge() << ")\n"; +#endif gp.getChildEdge(v_id, e).template get() = communication; } diff --git a/src/Vector/vector_dist.hpp b/src/Vector/vector_dist.hpp index 821bdc9..07b4b8d 100644 --- a/src/Vector/vector_dist.hpp +++ b/src/Vector/vector_dist.hpp @@ -1488,6 +1488,14 @@ public: */ template inline void ghost_get(size_t opt = WITH_POSITION) { +#ifdef SE_CLASS1 + if (getDecomposition().getProcessorBounds().isValid() == false && vd.size_local() != 0) + { + std::cerr << __FILE__ << ":" << __LINE__ << " Error the processor " << v_cl.getProcessorUnitID() << " has particles, but is supposed to be unloaded" << std::endl; + ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT); + } +#endif + #ifdef SE_CLASS3 se3.template ghost_get_pre(opt); #endif -- GitLab