45 vlsv::Writer vlsvWriter;
46 vlsvWriter.open(filename,MPI_COMM_WORLD,0);
48 std::vector<double> writebuf(p.size() * 3);
51 uint writable_particles=0;
52 for(
unsigned int i=0;
i < p.size();
i++) {
57 for(
int j=0;
j<3;
j++) {
58 writebuf[3*writable_particles+
j] = p[
i].x[
j];
63 std::map<std::string,std::string> attribs;
64 attribs[
"name"] =
"proton_position";
65 attribs[
"type"] = vlsv::mesh::STRING_POINT;
66 if (vlsvWriter.writeArray(
"MESH",attribs,writable_particles,3,writebuf.data()) ==
false) {
67 std::cerr <<
"\t ERROR failed to write particle positions!" << std::endl;
72 for(
unsigned int i=0;
i < p.size();
i++) {
76 for(
int j=0;
j<3;
j++) {
77 writebuf[3*writable_particles+
j] = p[
i].v[
j];
82 attribs[
"name"] =
"proton_velocity";
83 if (vlsvWriter.writeArray(
"MESH",attribs,writable_particles,3,writebuf.data()) ==
false) {
84 std::cerr <<
"\t ERROR failed to write particle velocities!" << std::endl;
void writeParticles(const ParticleContainer &p, const char *filename)
std::vector< Particle, aligned_allocator< Particle, 32 > > ParticleContainer
void push(Vec3d &B, Vec3d &E, double dt)