Commit 29f9b866 authored by ext-rogers_c's avatar ext-rogers_c
Browse files

Revert various hacks

parent af52c9e3
......@@ -184,11 +184,10 @@ OpalDataImpl::~OpalDataImpl() {
delete bunch_m;
delete slbunch_m;
if (bg_m != NULL) {
delete bg_m;
}
delete bg_m;
delete dataSink_m;
mainDirectory.erase();
tableDirectory.clear();
exprDirectory.clear();
......@@ -478,9 +477,6 @@ double OpalData::getGlobalPhaseShift() {
}
void OpalData::setGlobalGeometry(BoundaryGeometry *bg) {
if (p->bg_m != NULL) {
delete p->bg_m;
}
p->bg_m = bg;
}
......@@ -794,4 +790,4 @@ std::vector<std::string> OpalData::getAllNames() {
//// /DTA
return result;
}
}
\ No newline at end of file
......@@ -396,7 +396,7 @@ void StatisticalErrors::shutReplicasDown(int tag,
std::vector<char> sendBuffer(sizeof(int) + LENGTH_DIRECTORY_NAME);
int runStatus = DONE;
std::memcpy(&sendBuffer[0], reinterpret_cast<const char*>(&runStatus), sizeof(int));
memcpy(&sendBuffer[0], reinterpret_cast<const char*>(&runStatus), sizeof(int));
for (unsigned int i = 0; i < localMasters_m.size(); ++ i) {
MPI_Recv(&runStatus, 1, MPI_INT, MPI_ANY_SOURCE, tag, Ippl::getComm(), &mpiStatus);
MPI_Isend(&sendBuffer[0],
......@@ -460,7 +460,7 @@ std::string StatisticalErrors::assignReplicaNewJob(const OpalInputInterpreter &i
ofh.close();
std::memcpy(&sendBuffer[0], reinterpret_cast<const char*>(&runStatus), sizeof(int));
memcpy(&sendBuffer[0], reinterpret_cast<const char*>(&runStatus), sizeof(int));
strcpy(&sendBuffer[sizeof(int)], nextDir.c_str());
MPI_Isend(&sendBuffer[0],
......@@ -1045,7 +1045,7 @@ StatisticalErrors::DataSource StatisticalErrors::getProcessedDataFromReplica(int
Ippl::getComm(),
&mpiStatus);
objectiveData.source = mpiStatus.MPI_SOURCE;
std::memcpy(reinterpret_cast<char*>(&objectiveData.ID), messageBuffer + sizeof(int), sizeof(int));
memcpy(reinterpret_cast<char*>(&objectiveData.ID), messageBuffer + sizeof(int), sizeof(int));
if (objectiveData.ID >= 0) {
unsigned int k = 2 * sizeof(int);
......@@ -1059,7 +1059,7 @@ StatisticalErrors::DataSource StatisticalErrors::getProcessedDataFromReplica(int
objectiveData.data.resize(2 * length);
for (unsigned int j = 0; j < 2 * length; ++ j, k += sizeof(double)) {
std::memcpy(reinterpret_cast<char*>(&objectiveData.data[j]), messageBuffer + k, sizeof(double));
memcpy(reinterpret_cast<char*>(&objectiveData.data[j]), messageBuffer + k, sizeof(double));
}
}
return objectiveData;
......@@ -1071,8 +1071,8 @@ void StatisticalErrors::sendProcessedDataToPrimary(int tag,
char *messageBuffer) {
MPI_Request mpiRequest;
int runStatus = DONE;
std::memcpy(messageBuffer, reinterpret_cast<char*>(&runStatus), sizeof(int));
std::memcpy(messageBuffer + sizeof(int), reinterpret_cast<char*>(&objectiveID), sizeof(int));
memcpy(messageBuffer, reinterpret_cast<char*>(&runStatus), sizeof(int));
memcpy(messageBuffer + sizeof(int), reinterpret_cast<char*>(&objectiveID), sizeof(int));
MPI_Isend(messageBuffer,
2 * sizeof(int),
......@@ -1099,10 +1099,10 @@ void StatisticalErrors::copyDataToBuffer(char *messageBuffer,
unsigned int length = statistics.size();
for (unsigned int i = 0; i < length; ++ i, mptr += sizeof(double)) {
std::memcpy(mptr, reinterpret_cast<const char*>(&statistics[i].first), sizeof(double));
memcpy(mptr, reinterpret_cast<const char*>(&statistics[i].first), sizeof(double));
}
for (unsigned int i = 0; i < length; ++ i, mptr += sizeof(double)) {
std::memcpy(mptr, reinterpret_cast<const char*>(&statistics[i].second), sizeof(double));
memcpy(mptr, reinterpret_cast<const char*>(&statistics[i].second), sizeof(double));
}
}
......@@ -1114,8 +1114,8 @@ void StatisticalErrors::sendObjectiveForProcessing(int tag,
MPI_Request mpiRequest;
int runStatus = (i < objectives_m.size()) ? NORMAL: DONE;
std::memcpy(messageBuffer, reinterpret_cast<char*>(&runStatus), sizeof(int));
std::memcpy(messageBuffer + sizeof(int), reinterpret_cast<char*>(&i), sizeof(int));
memcpy(messageBuffer, reinterpret_cast<char*>(&runStatus), sizeof(int));
memcpy(messageBuffer + sizeof(int), reinterpret_cast<char*>(&i), sizeof(int));
MPI_Isend(messageBuffer,
2 * sizeof(int),
......@@ -1140,8 +1140,8 @@ std::pair<int, int> StatisticalErrors::getNextObjectiveToProcess(int tag, char *
&mpiStatus);
std::memcpy(reinterpret_cast<char*>(&nextJob.first), messageBuffer, sizeof(int));
std::memcpy(reinterpret_cast<char*>(&nextJob.second), messageBuffer + sizeof(int), sizeof(int));
memcpy(reinterpret_cast<char*>(&nextJob.first), messageBuffer, sizeof(int));
memcpy(reinterpret_cast<char*>(&nextJob.second), messageBuffer + sizeof(int), sizeof(int));
return nextJob;
}
......@@ -51,10 +51,6 @@ DataSink::DataSink(H5PartWrapper *h5wrapper, int restartStep):
h5wrapper_m(h5wrapper)
{
namespace fs = boost::filesystem;
if (!h5wrapper_m) {
doHDF5_m = false;
return;
}
doHDF5_m = Options::enableHDF5;
if (!doHDF5_m) {
......@@ -108,12 +104,6 @@ DataSink::DataSink(H5PartWrapper *h5wrapper):
{
/// Constructor steps:
/// Get timers from IPPL.
if (!h5wrapper_m) {
doHDF5_m = false;
return;
}
H5PartTimer_m = IpplTimings::getTimer("Write H5-File");
StatMarkerTimer_m = IpplTimings::getTimer("Write Stat");
......
......@@ -561,21 +561,20 @@ void TrackRun::setupCyclotronTracker(){
double macrocharge = 0.0;
const int specifiedNumBunch = int(std::abs(Round(Attributes::getReal(itsAttr[TURNS]))));
if (Options::enableHDF5) {
if(opal->inRestartRun()) {
phaseSpaceSink_m = new H5PartWrapperForPC(opal->getInputBasename() + std::string(".h5"),
opal->getRestartStep(),
OpalData::getInstance()->getRestartFileName(),
H5_O_WRONLY);
} else if (opal->hasBunchAllocated() && !Options::scan) {
phaseSpaceSink_m = new H5PartWrapperForPC(opal->getInputBasename() + std::string(".h5"),
-1,
opal->getInputBasename() + std::string(".h5"),
H5_O_WRONLY);
} else {
phaseSpaceSink_m = new H5PartWrapperForPC(opal->getInputBasename() + std::string(".h5"),
H5_O_WRONLY);
}
if(opal->inRestartRun()) {
phaseSpaceSink_m = new H5PartWrapperForPC(opal->getInputBasename() + std::string(".h5"),
opal->getRestartStep(),
OpalData::getInstance()->getRestartFileName(),
H5_O_WRONLY);
} else if (opal->hasBunchAllocated() && !Options::scan) {
phaseSpaceSink_m = new H5PartWrapperForPC(opal->getInputBasename() + std::string(".h5"),
-1,
opal->getInputBasename() + std::string(".h5"),
H5_O_WRONLY);
} else {
phaseSpaceSink_m = new H5PartWrapperForPC(opal->getInputBasename() + std::string(".h5"),
H5_O_WRONLY);
}
if(beam->getNumberOfParticles() < 3 || beam->getCurrent() == 0.0) {
......
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