Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions src/orbit/Bunch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -893,8 +893,6 @@ int Bunch::getCapacity(){

void Bunch::print(std::ostream& Out)
{
int N_flush = 10000;

//single CPU case
if(rank_MPI == 0){

Expand All @@ -905,7 +903,7 @@ void Bunch::print(std::ostream& Out)
ParticleAttributes* attrCntr = *pos;
Out << attrCntr->name()<<" ";
}
Out << std::endl;
Out << '\n';

for (pos = attrCntrVect.begin(); pos != attrCntrVect.end(); ++pos) {
ParticleAttributes* attrCntr = *pos;
Expand All @@ -918,7 +916,7 @@ void Bunch::print(std::ostream& Out)
double val = params_pos->second;
Out << name <<" " << val << " ";
}
Out << std::endl;
Out << '\n';
}
}

Expand All @@ -927,13 +925,13 @@ void Bunch::print(std::ostream& Out)
bunchAttr->getIntAttributeNames(bunch_attr_names);
for(int i = 0, n = bunch_attr_names.size(); i < n; i++){
Out << "% BUNCH_ATTRIBUTE_INT "<<bunch_attr_names[i]<<" ";
Out << bunchAttr->intVal(bunch_attr_names[i]) <<" "<< std::endl;
Out << bunchAttr->intVal(bunch_attr_names[i]) <<" "<< '\n';
}
bunch_attr_names.clear();
bunchAttr->getDoubleAttributeNames(bunch_attr_names);
for(int i = 0, n = bunch_attr_names.size(); i < n; i++){
Out << "% BUNCH_ATTRIBUTE_DOUBLE "<<bunch_attr_names[i]<<" ";
Out << bunchAttr->doubleVal(bunch_attr_names[i]) <<" "<< std::endl;
Out << bunchAttr->doubleVal(bunch_attr_names[i]) <<" "<< '\n';
}

//print synchronous particle parameters to the stream
Expand All @@ -946,7 +944,7 @@ void Bunch::print(std::ostream& Out)
Out << attrCntr->attrDescription()<<" ";
}

Out << std::endl;
Out << '\n';

Out <<std::setprecision(8); //<< std::setiosflags(ios::scientific);

Expand All @@ -967,12 +965,9 @@ void Bunch::print(std::ostream& Out)
Out << getParticleAttributeVal(i,j) <<" ";
}

Out <<std::endl;
Out <<'\n';
}

if (i % N_flush == 0){Out.flush();}
}
Out.flush();
if(size_MPI == 1) return;
}

Expand Down Expand Up @@ -1046,16 +1041,13 @@ void Bunch::print(std::ostream& Out)
Out<< dump_arr[(nDimAndAttr)*j + 7 + k] << " ";
}

Out << std::endl;
Out << '\n';
}

if (j % N_flush == 0){ Out.flush();}
}
}
}
}

if(rank_MPI == 0){Out.flush();}
BufferStore::getBufferStore()->setUnusedIntArr(buff_index0);
BufferStore::getBufferStore()->setUnusedIntArr(buff_index1);
BufferStore::getBufferStore()->setUnusedDoubleArr(buff_index2);
Expand Down
18 changes: 8 additions & 10 deletions src/orbit/SyncPart.cc
Original file line number Diff line number Diff line change
Expand Up @@ -488,51 +488,49 @@ void SyncPart::print(std::ostream& Out)
Out << getY() <<" ";
Out << getZ() <<" ";
Out <<" x, y, z positions in [m]";
Out << std::endl;
Out << '\n';

//print momentum
Out << "% SYNC_PART_MOMENTUM ";
Out << getPX() <<" ";
Out << getPY() <<" ";
Out << getPZ() <<" ";
Out <<" px, py, pz momentum component in GeV/c";
Out << std::endl;
Out << '\n';

//print x-axis ort
Out << "% SYNC_PART_X_AXIS ";
Out << getNormalXX() <<" ";
Out << getNormalXY() <<" ";
Out << getNormalXZ() <<" ";
Out <<" nxx, nxy, pxz - x-axis ort coordinates";
Out << std::endl;
Out << '\n';

//print energy
Out << "% info only: energy of the synchronous particle [GeV] = ";
Out << getEnergy() <<" ";
Out << std::endl;
Out << '\n';

//print momentum
Out << "% info only: momentum of the synchronous particle [GeV/c] = ";
Out << getMomentum() <<" ";
Out << std::endl;
Out << '\n';

//print beta
Out << "% info only: beta=v/c of the synchronous particle = ";
Out << getBeta() <<" ";
Out << std::endl;
Out << '\n';

//print gamma
Out << "% info only: gamma=1/sqrt(1-(v/c)**2) of the synchronous particle = ";
Out << getGamma() <<" ";
Out << std::endl;
Out << '\n';

//print time
Out << "% SYNC_PART_TIME ";
Out << getTime() <<" ";
Out <<" time in [sec]";
Out << std::endl;
Out << '\n';
}

if(rank_MPI == 0){Out.flush();}
// ===== MPI end =====
}