Commit bc68ad93 authored by incardon's avatar incardon

SPH final version with DLB

parent 25e49534
This diff is collapsed.
...@@ -104,6 +104,9 @@ public: ...@@ -104,6 +104,9 @@ public:
protected: protected:
//! Indicate the communication weight has been set
bool commCostSet = false;
//! This is the key type to access data_s, for example in the case of vector //! This is the key type to access data_s, for example in the case of vector
//! acc_key is size_t //! acc_key is size_t
typedef typename openfpm::vector<SpaceBox<dim, T>, typedef typename openfpm::vector<SpaceBox<dim, T>,
...@@ -202,9 +205,6 @@ protected: ...@@ -202,9 +205,6 @@ protected:
return sub_d; return sub_d;
} }
protected:
public: public:
...@@ -351,14 +351,16 @@ public: ...@@ -351,14 +351,16 @@ public:
for (size_t i = 0; i < dist.getNSubSubDomains(); i++) for (size_t i = 0; i < dist.getNSubSubDomains(); i++)
{ {
dist.setMigrationCost(i, norm * migration /* * dist.getSubSubDomainComputationCost(i) */); dist.setMigrationCost(i, norm * migration * dist.getSubSubDomainComputationCost(i) );
for (size_t s = 0; s < dist.getNSubSubDomainNeighbors(i); s++) for (size_t s = 0; s < dist.getNSubSubDomainNeighbors(i); s++)
{ {
dist.setCommunicationCost(i, s, 1 * /* dist.getSubSubDomainComputationCost(i) * */ ts); dist.setCommunicationCost(i, s, 1 * dist.getSubSubDomainComputationCost(i) * ts);
} }
prev += dist.getNSubSubDomainNeighbors(i); prev += dist.getNSubSubDomainNeighbors(i);
} }
commCostSet = true;
} }
/*! \brief Create the sub-domain that decompose your domain /*! \brief Create the sub-domain that decompose your domain
...@@ -1007,7 +1009,8 @@ public: ...@@ -1007,7 +1009,8 @@ public:
{ {
reset(); reset();
computeCommunicationAndMigrationCosts(1); if (commCostSet == false)
computeCommunicationAndMigrationCosts(1);
dist.decompose(); dist.decompose();
...@@ -1025,7 +1028,8 @@ public: ...@@ -1025,7 +1028,8 @@ public:
{ {
reset(); reset();
computeCommunicationAndMigrationCosts(ts); if (commCostSet == false)
computeCommunicationAndMigrationCosts(ts);
dist.refine(); dist.refine();
......
...@@ -121,18 +121,6 @@ class ParMetisDistribution ...@@ -121,18 +121,6 @@ class ParMetisDistribution
openfpm::vector<size_t> cnt; openfpm::vector<size_t> cnt;
cnt.resize(Np); cnt.resize(Np);
// Renumber the main graph and re-create the map
/* for (size_t p = 0; p < (size_t)Np; p++)
{
size_t i = 0;
for (rid j = vtxdist.get(p); j < vtxdist.get(p + 1); ++j, i++)
{
setMapId(j, v_per_proc.get(p).get(i));
gp.vertex(v_per_proc.get(p).get(i).id).template get<nm_v::id>() = cnt.get(p) + vtxdist.get(p).id;
cnt.get(p)++;
}
}*/
for (size_t i = 0 ; i < gp.getNVertex(); ++i) for (size_t i = 0 ; i < gp.getNVertex(); ++i)
{ {
size_t pid = gp.template vertex_p<nm_v::proc_id>(i); size_t pid = gp.template vertex_p<nm_v::proc_id>(i);
......
...@@ -1028,10 +1028,15 @@ public: ...@@ -1028,10 +1028,15 @@ public:
g_m--; g_m--;
} }
/*! \brief Add the computation cost on the decomposition coming from the particles /*! \brief Add the computation cost on the decomposition coming
* from the particles
*
* \param md Model to use
* \param ts It is an optional parameter approximately should be the number of ghost get between two
* rebalancing at first decomposition this number can be ignored (default = 1) because not used
* *
*/ */
template <typename Model=ModelLin>inline void addComputationCosts(Model md=Model()) template <typename Model=ModelLin>inline void addComputationCosts(Model md=Model(), size_t ts = 1)
{ {
CellDecomposer_sm<dim, St, shift<dim,St>> cdsm; CellDecomposer_sm<dim, St, shift<dim,St>> cdsm;
...@@ -1053,6 +1058,8 @@ public: ...@@ -1053,6 +1058,8 @@ public:
++it; ++it;
} }
dec.computeCommunicationAndMigrationCosts(ts);
// Go throught all the sub-sub-domains and apply the model // Go throught all the sub-sub-domains and apply the model
for (size_t i = 0 ; i < dec.getDistribution().getNSubSubDomains(); i++) for (size_t i = 0 ; i < dec.getDistribution().getNSubSubDomains(); i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment