Commit b0ac8693 authored by [deprecated account] Sebastian Friedemann's avatar [deprecated account] Sebastian Friedemann 💬
Browse files

Print outputs in Simulation

parent 8b236fb7
......@@ -7,13 +7,30 @@
#include "../api/melissa_api.h"
#include <iostream>
const int GLOBAL_VECT_SIZE = 40;
using namespace std;
void print_state(vector<double> &state, int timestep, int rank)
{
cout << "$ {" << endl <<
"$ timestep\" : " << timestep << "," << endl <<
"$ \"simulation_rank\":" << rank << endl <<
"$ \"state1\": [";
for (auto it = state.begin(); it != state.end(); it++)
{
cout << " " << *it << ',';
}
cout << "$]" << endl << "$ }," << endl;
}
int main(int argc, char * args[])
{
cout << "$[" << endl;
int comm_size;
int comm_rank;
......@@ -31,6 +48,10 @@ int main(int argc, char * args[])
vector<double> state1(local_vect_size);
fill(state1.begin(), state1.end(), comm_rank);
int timestep = 0;
print_state(state1, timestep, comm_rank);
while (timestepping)
{
for (auto it = state1.begin(); it != state1.end(); it++)
......@@ -43,8 +64,14 @@ int main(int argc, char * args[])
timestepping = melissa_expose("variableX", state1.data());
print_state(state1, timestep, comm_rank);
timestep++;
// TODO: print output to see what happens!
}
cout << "$]" << endl;
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();
}
......
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