Resolve "Strategy pattern for DataSink"
Closes #303 (closed)
Merge request reports
Activity
- src/Structure/SDDSWriter.cpp 0 → 100644
81 } 82 83 84 void SDDSWriter::addDescription(const std::string& text, 85 const std::string& content) 86 { 87 os_m << "&description\n" 88 << indent_m << "text=\"" << text << "\",\n" 89 << indent_m << "contents=\"" << content << "\"\n" 90 << "&end\n"; 91 } 92 93 94 void SDDSWriter::addParameter(const std::string& name, 95 const std::string& type, 96 const std::string& desc) Sure, I can change. It's anyway a bit more efficient. I would also like to change the way we do the dumping. We could add a new command
ẀRITE
that hasTYPE
andFREQ
as attribute. This way what we dump is more flexible (e.g. as user might not be interested in the load balancing) and the number ofOPTIONS
would be reduced. But this would be another issue, I think.
- src/Structure/StatWriter.cpp 0 → 100644
232 this->writeValue(beam->get_DDy()); // 33 233 234 // Write head/reference particle/tail field information. 235 this->writeValue(FDext[0](0)); // 34 B-ref x 236 this->writeValue(FDext[0](1)); // 35 B-ref y 237 this->writeValue(FDext[0](2)); // 36 B-ref z 238 239 this->writeValue(FDext[1](0)); // 37 E-ref x 240 this->writeValue(FDext[1](1)); // 38 E-ref y 241 this->writeValue(FDext[1](2)); // 39 E-ref z 242 243 this->writeValue(beam->getdE()); // 40 dE energy spread 244 this->writeValue(beam->getdT() * 1e9); // 41 dt time step size 245 this->writeValue(npOutside); // 42 number of particles outside n*sigma 246 247 if (Ippl::getNodes() == 1 && beam->getLocalNum() > 0) { Good point. Actually, I took the existing implementation. I think the idea behind these lines were that
getLocalNum() == getTotalNum()
in single core execution and that OPAL stops when there are no particles left. But sure, it's safer we write zeros instead since we don't know when OPAL checks that and really stops. I agree.In
ParallelTTracker
beam->R[0]
is a regular particle. In branch 303-strategy-pattern-for-datasink_proposal I don't write these columns ifParallelTTracker
is used. To my knowledge this will also be the case for the cyclotron tracker once we have implemented #287 .Ok, so we don't write redundant info in this case.
Yes, I also had #287 in my mind.
@frey_m have a look at this commit for my ideas about SDDSWriter. Sofar I have only adapted the StatWriter. The other writers would have to be adapted likewise.
The idea behind the SDDSDataRow class is that the order of the columns is only defined in one place.
@kraus Why not adding the type and description to
SDDSDataRow
? We might get rid of filling the header separately. We'd just need to add another function in order to write the header first.
181 << OPAL_PROJECT_VERSION << " git rev. #" << Util::getGitRevision() << "\n" 182 << (OpalData::getInstance()->isInOPALTMode()? "opal-t": 183 (OpalData::getInstance()->isInOPALCyclMode()? "opal-cycl": "opal-env")) 184 << std::endl; 180 << "&end"; 181 182 while (!paramValues_m.empty()) { 183 os_m << "\n" << paramValues_m.front(); 184 185 paramValues_m.pop(); 186 } 187 188 os_m << std::endl; 185 189 } 190 191 void SDDSWriter::addDefaultParameters() { @kraus Thanks that's definitely better!
@kraus I merged your branch with the proposal on issue #303 (closed) into the 'main issue branch' and will delete your branch.
16 16 #include "Ippl.h" 17 17 18 18 #include <iomanip> 19 19 #include <sstream> 20 21 namespace { 22 std::string to_string(long double d) { @kraus Why don't you use
std::to_string(long double)
and implemented your own version?
added Enhancement label
In the attached patch I've removed unused code and cleaned a bit up.
added 1 commit
- 92f332aa - applied Christof's patch 0001-cleaning-up.patch
- Resolved by kraus
- Resolved by frey_m
- Resolved by frey_m
- Resolved by frey_m
- Resolved by frey_m
- Resolved by frey_m