Commit 4ad1a79c authored by Pietro Incardona's avatar Pietro Incardona

Fixing boundary conditions applications

parent 09c2f039
......@@ -7,7 +7,7 @@ LDIR =
OBJ = main.o
%.o: %.cpp
$(CC) -O0 -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH) -I/home/i-bird/HDF5/include
$(CC) -O3 -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH) -I/home/i-bird/HDF5/include
agsim: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
......
......@@ -123,8 +123,8 @@ int main(int argc, char* argv[])
// set the seed
// create the random generator engine
std::srand(v_cl.getProcessUnitID());
// unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::default_random_engine eg(20);
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::default_random_engine eg(seed);
std::uniform_real_distribution<float> ud(0.0f, 1.0f);
std::uniform_real_distribution<float> md(-1.0f, 1.0f);
std::uniform_real_distribution<float> uc(0.0f, 0.7f);
......@@ -236,7 +236,17 @@ int main(int argc, char* argv[])
/////// Interactions ///
// get ghosts
vd.ghost_get<0>();
try
{
vd.ghost_get<0>();
}
catch (size_t e)
{
vd.write("err_particles",j);
vd.getDecomposition().write("err_decomposition");
MPI_Abort(MPI_COMM_WORLD,-1);
return -1;
}
// vector of dead animals
openfpm::vector<size_t> deads;
......@@ -249,17 +259,9 @@ int main(int argc, char* argv[])
CellList<2, float, FAST, shift<2, float> > NN;
try
{
NN = vd.getCellList(0.01/factor);
}
catch (size_t e)
{
vd.write("err_particles",j);
vd.getDecomposition().write("err_decomposition");
MPI_Abort(MPI_COMM_WORLD,-1);
return -1;
}
// iterate across the domain particle
......@@ -279,9 +281,8 @@ int main(int argc, char* argv[])
if(gp == PREY)
{
if( prey < k/1.5 && ud(eg) < PREY_REPR )
{
reps_prey.add(p);
}
vd.getProp<animal::time_a>(p)--;
if(vd.getProp<animal::time_a>(p) <= 0)
......@@ -300,7 +301,7 @@ int main(int argc, char* argv[])
}
else
{
auto Np = NN.getIterator(NN.getCell(vd.getPos<0>(p)));
auto Np = NN.getIterator(NN.getCell(xp));
while (Np.isNext())
{
......@@ -322,9 +323,7 @@ int main(int argc, char* argv[])
vd.getProp<animal::time_a>(p) = PRED_TIME_A;
if( ud(eg) < PRED_REPR )
{
reps_pred.add(p);
}
}
}
++Np;
......
openfpm_data @ 123b7afa
Subproject commit 67d2dcc48107a5160d1f4ba4946d80d4a9eb84d3
Subproject commit 123b7afa82d9186d7f880110a83da875573ee55b
......@@ -351,7 +351,7 @@ public:
{
// Refine
ParMETIS_V3_AdaptiveRepart((idx_t *) vtxdist.getPointer(), Mg.xadj, Mg.adjncy, Mg.vwgt, Mg.vsize, Mg.adjwgt, Mg.wgtflag, Mg.numflag, Mg.ncon, Mg.nparts, Mg.tpwgts, Mg.ubvec, Mg.itr, Mg.options, Mg.edgecut, Mg.part, &comm);
ParMETIS_V3_RefineKway((idx_t *) vtxdist.getPointer(), Mg.xadj, Mg.adjncy, Mg.vwgt, Mg.adjwgt, Mg.wgtflag, Mg.numflag, Mg.ncon, Mg.nparts, Mg.tpwgts, Mg.ubvec, Mg.options, Mg.edgecut, Mg.part, &comm);
}
/*! \brief Get graph partition vector
......
......@@ -109,19 +109,19 @@ private:
openfpm::vector<size_t> ghost_prc_sz;
//! Sending buffer for the ghost particles properties
HeapMemory g_prp_mem;
BHeapMemory g_prp_mem;
//! Sending buffer for the ghost particles position
HeapMemory g_pos_mem;
BHeapMemory g_pos_mem;
//! For each adjacent processor it store the size of the receiving message in byte
openfpm::vector<size_t> recv_sz;
//! For each adjacent processor it store the received message for ghost get
openfpm::vector<HeapMemory> recv_mem_gg;
openfpm::vector<BHeapMemory> recv_mem_gg;
//! For each processor it store the received message for global map
openfpm::vector<HeapMemory> recv_mem_gm;
openfpm::vector<BHeapMemory> recv_mem_gm;
/*! \brief It store for each processor the position and properties vector of the particles
*
......@@ -217,7 +217,7 @@ private:
oshift.resize(dec.getNNProcessors());
// Iterate over all particles
auto it = v_pos.getIterator();
auto it = v_pos.getIteratorTo(g_m);
while (it.isNext())
{
auto key = it.get();
......@@ -235,17 +235,6 @@ private:
ghost_prc_sz.get(p_id)++;
opart.get(p_id).add(key);
oshift.get(p_id).add(vp_id.get(i).second);
/////// DEBUG /////////////
if (v_pos.template get<0>(key)[0] >= 0.653903 && v_pos.template get<0>(key)[0] <= 0.653905 &&
v_pos.template get<0>(key)[1] >= 0.989091 && v_pos.template get<0>(key)[1] <= 0.989093)
{
std::cerr << "DETECTED BASTARD" << "\n";
}
////////////////////////////
}
++it;
......@@ -566,26 +555,6 @@ private:
// resize with the number of elements
v2.resize(n_ele);
///////// DEBUG /////////////////////
// Check that all the particles are inside the processor boud enlarged by ghost
Ghost<dim,St> g = dec.getGhost();
g.magnify(1.01);
auto pbox = dec.getProcessorBounds();
pbox.enlarge(g);
for (size_t j = 0 ; j < v2.size() ; j++)
{
if (pbox.isInside(v2.get(j)) == false)
{
std::cerr << "AAAAAAAAAAAAAAAAAAA" << "/n";
}
}
//////////////////////////////////////
// Add the ghost particle
v_pos.template add<PtrMemory, openfpm::grow_policy_identity>(v2);
}
......@@ -871,10 +840,7 @@ public:
{
// Unload receive buffer
for (size_t i = 0 ; i < recv_mem_gg.size() ; i++)
{
recv_mem_gg.get(i).destroy();
recv_sz.get(i) = 0;
}
// Sending property object
typedef object<typename object_creator<typename prop::type, prp...>::type> prp_object;
......
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