Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openfpm_pdata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
argupta
openfpm_pdata
Commits
694c676e
Commit
694c676e
authored
9 years ago
by
Pietro Incardona
Browse files
Options
Downloads
Patches
Plain Diff
Cleaning prey predators example
parent
4ad1a79c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
example/Numerics/Agent_sim/main.cpp
+4
-68
4 additions, 68 deletions
example/Numerics/Agent_sim/main.cpp
with
4 additions
and
68 deletions
example/Numerics/Agent_sim/main.cpp
+
4
−
68
View file @
694c676e
...
...
@@ -9,9 +9,6 @@
*
*/
#define SE_CLASS1
#define THROW_ON_ERROR
#include
"Vector/vector_dist.hpp"
#include
"Decomposition/CartDecomposition.hpp"
#include
"PSE/Kernels.hpp"
...
...
@@ -197,8 +194,6 @@ int main(int argc, char* argv[])
// 100 step random walk
for
(
size_t
j
=
0
;
j
<
100
;
j
++
)
{
std
::
cout
<<
"iteration: "
<<
j
<<
std
::
endl
;
size_t
prey
=
0
,
predators
=
0
;
auto
it
=
vd
.
getDomainIterator
();
...
...
@@ -220,33 +215,11 @@ int main(int argc, char* argv[])
vd
.
map
();
float
tot_p
=
vd
.
size_local
();
v_cl
.
sum
(
tot_p
);
v_cl
.
sum
(
prey
);
v_cl
.
sum
(
predators
);
v_cl
.
execute
();
// if(v_cl.getProcessUnitID()==0)
// {
// std::cout << j << " -> tot: " << tot_p << " prey: " << prey << " predators: " << predators << "\n";
// }
/////// Interactions ///
// get ghosts
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
;
}
vd
.
ghost_get
<
0
>
();
// vector of dead animals
openfpm
::
vector
<
size_t
>
deads
;
...
...
@@ -257,11 +230,7 @@ int main(int argc, char* argv[])
bool
error
=
false
;
CellList
<
2
,
float
,
FAST
,
shift
<
2
,
float
>
>
NN
;
NN
=
vd
.
getCellList
(
0.01
/
factor
);
auto
NN
=
vd
.
getCellList
(
0.01
/
factor
);
// iterate across the domain particle
...
...
@@ -374,50 +343,17 @@ int main(int argc, char* argv[])
deads
.
sort
();
vd
.
remove
(
deads
,
0
);
/* for (size_t i = 0 ; i < deads.size() ; i++)
{
size_t d = deads.get(i);
vd.remove(d);
}*/
deads
.
resize
(
0
);
vd
.
deleteGhost
();
////////////////////////
vd
.
map
();
vd
.
addComputationCosts
();
// vd.write("before_ref_particles" + std::to_string(j),j);
// vd.getDecomposition().write("before_ref_decomposition" + std::to_string(j));
vd
.
getDecomposition
().
rebalance
(
1
);
vd
.
getDecomposition
().
rebalance
(
dlb
);
vd
.
map
();
// vd.write("after_ref_particles" + std::to_string(j),j);
// vd.getDecomposition().write("after_ref_decomposition" + std::to_string(j));
//vd.getDecomposition().getDistribution().write("parmetis_prey_predators_" + std::to_string(j+1) + ".vtk");
//vd.write("particles_", j+1, NO_GHOST);
//vd.getDecomposition().write("dec_");
size_t
l
=
vd
.
size_local
();
v_cl
.
sum
(
l
);
v_cl
.
execute
();
if
(
v_cl
.
getProcessUnitID
()
==
0
)
{
std
::
cout
<<
"Particles: "
<<
l
<<
"
\n
"
;
}
// Count the local particles and check that the total number is consistent
//size_t cnt = total_n_part_lc(vd,bc);
//BOOST_REQUIRE_EQUAL((size_t)k,cnt);
}
//
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment