Skip to content
Snippets Groups Projects
Commit 0c5abcf8 authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #4820: Removed superfluous TRIGGER_DATA, and got rid of FIRST_OUTPUT_TYPE...

Task #4820: Removed superfluous TRIGGER_DATA, and got rid of FIRST_OUTPUT_TYPE and LAST_OUTPUT_TYPE since we don't need to loop over those anymore
parent a94bc32b
No related branches found
No related tags found
No related merge requests found
......@@ -53,8 +53,6 @@ namespace LOFAR
return new FinalBeamFormedData(nrSamples, nrSubbands, nrChannels, allocator);
}
case TRIGGER_DATA: return new TriggerData;
default: THROW(CoInterfaceException, "unsupported output type");
}
......
......@@ -29,26 +29,9 @@ namespace LOFAR
enum OutputType
{
CORRELATED_DATA = 1,
BEAM_FORMED_DATA,
TRIGGER_DATA,
// define LAST and FIRST in the enum to make them valid values within the
// allocated range for the enum (=minimal number of bits to store all values)
LAST_OUTPUT_TYPE,
FIRST_OUTPUT_TYPE = 1
BEAM_FORMED_DATA
};
inline OutputType operator ++ (OutputType &outputType) // prefix ++
{
return (outputType = static_cast<OutputType>(outputType + 1));
}
inline OutputType operator ++ (OutputType &outputType, int) // postfix ++
{
return static_cast<OutputType>((outputType = static_cast<OutputType>(outputType + 1)) - 1);
}
} // namespace Cobalt
} // namespace LOFAR
......
......@@ -679,24 +679,6 @@ namespace LOFAR
void Parset::check() const
{
checkInputConsistency();
checkVectorLength("Observation.beamList", nrSubbands());
for (OutputType outputType = FIRST_OUTPUT_TYPE; outputType < LAST_OUTPUT_TYPE; outputType++)
if (outputThisType(outputType)) {
std::string prefix = keyPrefix(outputType);
unsigned expected = nrStreams(outputType);
checkVectorLength(prefix + ".locations", expected);
checkVectorLength(prefix + ".filenames", expected);
}
if (CNintegrationSteps() % dedispersionFFTsize() != 0)
THROW(CoInterfaceException, "OLAP.CNProc.integrationSteps (" << CNintegrationSteps() << ") must be divisible by OLAP.CNProc.dedispersionFFTsize (" << dedispersionFFTsize() << ')');
if (outputThisType(BEAM_FORMED_DATA) || outputThisType(TRIGGER_DATA)) {
// second transpose is performed
}
}
......@@ -725,7 +707,6 @@ namespace LOFAR
switch (outputType) {
case CORRELATED_DATA: return "Observation.DataProducts.Output_Correlated";
case BEAM_FORMED_DATA: return "Observation.DataProducts.Output_Beamformed";
case TRIGGER_DATA: return "Observation.DataProducts.Output_Trigger";
default: THROW(CoInterfaceException, "Unknown output type");
}
}
......@@ -734,9 +715,12 @@ namespace LOFAR
std::string Parset::getHostName(OutputType outputType, unsigned streamNr) const
{
if (outputType == CORRELATED_DATA)
return settings.correlator.files[streamNr].location.host; // TODO: add to check() to reject parset or obsconfig early to avoid segfault here if streamNr >= settings.correlator.files.size()
return settings.correlator.files[streamNr].location.host;
if (outputType == BEAM_FORMED_DATA)
return settings.beamFormer.files[streamNr].location.host;
return StringUtil::split(getStringVector(keyPrefix(outputType) + ".locations", true)[streamNr], ':')[0];
return "unknown";
}
......@@ -745,16 +729,10 @@ namespace LOFAR
if (outputType == CORRELATED_DATA)
return settings.correlator.files[streamNr].location.filename;
const std::string keyname = keyPrefix(outputType) + ".filenames";
if (!isDefined(keyname))
THROW(CoInterfaceException, "Could not find filename key: " << keyname);
const std::vector<std::string> filenames = getStringVector(keyname, true);
if (outputType == BEAM_FORMED_DATA)
return settings.beamFormer.files[streamNr].location.filename;
if (streamNr >= filenames.size())
THROW(CoInterfaceException, "Filename index out of bounds for key " << keyname << ": " << streamNr << " >= " << filenames.size());
return filenames[streamNr];
return "unknown";
}
......@@ -763,7 +741,10 @@ namespace LOFAR
if (outputType == CORRELATED_DATA)
return settings.correlator.files[streamNr].location.directory;
return StringUtil::split(getStringVector(keyPrefix(outputType) + ".locations", true)[streamNr], ':')[1];
if (outputType == BEAM_FORMED_DATA)
return settings.beamFormer.files[streamNr].location.directory;
return "unknown";
}
......@@ -774,8 +755,7 @@ namespace LOFAR
switch (outputType) {
case CORRELATED_DATA: return settings.correlator.files.size();
case BEAM_FORMED_DATA: // FALL THROUGH
case TRIGGER_DATA: return settings.beamFormer.files.size();
case BEAM_FORMED_DATA: return settings.beamFormer.files.size();
default: THROW(CoInterfaceException, "Unknown output type");
}
}
......
......@@ -139,14 +139,29 @@ void process(Stream &controlStream, size_t myRank)
vector<SmartPtr<SubbandWriter> > subbandWriters;
for (OutputType outputType = FIRST_OUTPUT_TYPE; outputType < LAST_OUTPUT_TYPE; outputType++)
// Process correlated data
if (parset.settings.correlator.enabled) {
for (size_t fileIdx = 0; fileIdx < parset.settings.correlator.files.size(); ++fileIdx)
{
for (unsigned streamNr = 0; streamNr < parset.nrStreams(outputType); streamNr++)
if (parset.settings.correlator.files[fileIdx].location.host != myHostName)
continue;
SubbandWriter *writer = startWriter(parset, CORRELATED_DATA, fileIdx);
if (writer == NULL)
continue;
subbandWriters.push_back(writer);
}
}
// Process beam-formed data
if (parset.settings.beamFormer.enabled) {
for (size_t fileIdx = 0; fileIdx < parset.settings.beamFormer.files.size(); ++fileIdx)
{
if (parset.getHostName(outputType, streamNr) != myHostName)
if (parset.settings.beamFormer.files[fileIdx].location.host != myHostName)
continue;
SubbandWriter *writer = startWriter(parset, outputType, streamNr);
SubbandWriter *writer = startWriter(parset, BEAM_FORMED_DATA, fileIdx);
if (writer == NULL)
continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment