Commit d9a32287 authored by Karl Palmen's avatar Karl Palmen
Browse files

Elimination of compiler warnings re #4137


Signed-off-by: default avatarKarl Palmen <karl.palmen@stfc.ac.uk>
parent b5bd1bf4
......@@ -237,185 +237,183 @@ namespace DataObjects
void PeaksWorkspace::saveNexus(::NeXus::File * file ) const
{
int pNum = getNumberPeaks();
// Column vectors for peaks table
// Column vectors for peaks table
std::vector<int> detectorID;
std::vector<double> H;
std::vector<double> K;
std::vector<double> L;
std::vector<double> intensity;
std::vector<double> sigmaIntensity;
std::vector<double> binCount;
std::vector<double> initialEnergy;
std::vector<double> finalEnergy;
std::vector<double> waveLength;
std::vector<double> scattering;
std::vector<double> dSpacing;
std::vector<double> TOF;
std::vector<double> K;
std::vector<double> L;
std::vector<double> intensity;
std::vector<double> sigmaIntensity;
std::vector<double> binCount;
std::vector<double> initialEnergy;
std::vector<double> finalEnergy;
std::vector<double> waveLength;
std::vector<double> scattering;
std::vector<double> dSpacing;
std::vector<double> TOF;
std::vector<int> runNumber;
std::vector<double> goniometerMatrix;
// Populate column vectors from Peak Workspace
for (size_t i=0; i < peaks.size(); i++)
{
Peak p = peaks[i];
detectorID.push_back( p.getDetectorID() );
H.push_back( p.getH() );
K.push_back( p.getK() );
L.push_back( p.getL() );
intensity.push_back( p.getIntensity() );
sigmaIntensity.push_back( p.getSigmaIntensity() );
binCount.push_back( p.getBinCount() );
initialEnergy.push_back( p.getInitialEnergy() );
finalEnergy.push_back( p.getFinalEnergy() );
waveLength.push_back( p.getWavelength() );
scattering.push_back( p.getScattering() );
dSpacing.push_back( p.getDSpacing() );
TOF.push_back( p.getTOF() );
runNumber.push_back( p.getRunNumber() );
{
Matrix<double> gm = p.getGoniometerMatrix();
goniometerMatrix.push_back( gm[0][0]);
goniometerMatrix.push_back( gm[1][0]);
goniometerMatrix.push_back( gm[2][0]);
goniometerMatrix.push_back( gm[0][1]);
goniometerMatrix.push_back( gm[1][1]);
goniometerMatrix.push_back( gm[2][1]);
goniometerMatrix.push_back( gm[0][2]);
goniometerMatrix.push_back( gm[1][2]);
goniometerMatrix.push_back( gm[1][2]);
}
std::vector<double> goniometerMatrix;
// Populate column vectors from Peak Workspace
for (size_t i=0; i < peaks.size(); i++)
{
Peak p = peaks[i];
detectorID.push_back( p.getDetectorID() );
H.push_back( p.getH() );
K.push_back( p.getK() );
L.push_back( p.getL() );
intensity.push_back( p.getIntensity() );
sigmaIntensity.push_back( p.getSigmaIntensity() );
binCount.push_back( p.getBinCount() );
initialEnergy.push_back( p.getInitialEnergy() );
finalEnergy.push_back( p.getFinalEnergy() );
waveLength.push_back( p.getWavelength() );
scattering.push_back( p.getScattering() );
dSpacing.push_back( p.getDSpacing() );
TOF.push_back( p.getTOF() );
runNumber.push_back( p.getRunNumber() );
{
Matrix<double> gm = p.getGoniometerMatrix();
goniometerMatrix.push_back( gm[0][0]);
goniometerMatrix.push_back( gm[1][0]);
goniometerMatrix.push_back( gm[2][0]);
goniometerMatrix.push_back( gm[0][1]);
goniometerMatrix.push_back( gm[1][1]);
goniometerMatrix.push_back( gm[2][1]);
goniometerMatrix.push_back( gm[0][2]);
goniometerMatrix.push_back( gm[1][2]);
goniometerMatrix.push_back( gm[1][2]);
}
// etc.
}
}
// Start Peaks Workspace in Nexus File
// Start Peaks Workspace in Nexus File
file->makeGroup("peaks_workspace", "NXentry", true); // For when peaksWorkspace can be loaded
// Detectors column
file->writeData("column_1", detectorID);
file->openData("column_1");
file->putAttr("name", "Dectector ID");
file->putAttr("interpret_as","An integer");
file->putAttr("units","Not known");
file->closeData();
// H column
file->writeData("column_1", detectorID);
file->openData("column_1");
file->putAttr("name", "Dectector ID");
file->putAttr("interpret_as","An integer");
file->putAttr("units","Not known");
file->closeData();
// H column
file->writeData("column_2", H);
file->openData("column_2");
file->putAttr("name", "H");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
file->openData("column_2");
file->putAttr("name", "H");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// K column
// K column
file->writeData("column_3", K);
file->openData("column_3");
file->putAttr("name", "K");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
file->openData("column_3");
file->putAttr("name", "K");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// L column
// L column
file->writeData("column_4", L);
file->openData("column_4");
file->putAttr("name", "L");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Intensity column
file->writeData("column_5", intensity);
file->openData("column_5");
file->putAttr("name", "Intensity");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Sigma Intensity column
file->writeData("column_6", sigmaIntensity);
file->openData("column_6");
file->putAttr("name", "Sigma Intensity");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Bin Count column
file->writeData("column_7", binCount);
file->openData("column_7");
file->putAttr("name", "Bin Count");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
file->openData("column_4");
file->putAttr("name", "L");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Intensity column
file->writeData("column_5", intensity);
file->openData("column_5");
file->putAttr("name", "Intensity");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Sigma Intensity column
file->writeData("column_6", sigmaIntensity);
file->openData("column_6");
file->putAttr("name", "Sigma Intensity");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Bin Count column
file->writeData("column_7", binCount);
file->openData("column_7");
file->putAttr("name", "Bin Count");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Initial Energy column
file->writeData("column_8", initialEnergy );
file->openData("column_8");
file->putAttr("name", "Initial Energy");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
file->writeData("column_8", initialEnergy );
file->openData("column_8");
file->putAttr("name", "Initial Energy");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Final Energy column
file->writeData("column_9", finalEnergy );
file->openData("column_9");
file->putAttr("name", "Final Energy");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Wave Length Column
file->writeData("column_10", waveLength );
file->openData("column_10");
file->putAttr("name", "Wave Length");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Scattering Column
file->writeData("column_11", scattering );
file->openData("column_11");
file->putAttr("name", "Scattering");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// D Spacing Column
file->writeData("column_12", dSpacing );
file->openData("column_12");
file->putAttr("name", "D Spacing");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// TOF Column
file->writeData("column_13", TOF );
file->openData("column_13");
file->putAttr("name", "TOF");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
//Run Number column
file->writeData("column_14", runNumber );
file->openData("column_14");
file->putAttr("name", "Run Number");
file->putAttr("interpret_as","A integer");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Goniometer Matrix Column
std::vector<int> array_dims;
array_dims.push_back(peaks.size());
file->writeData("column_9", finalEnergy );
file->openData("column_9");
file->putAttr("name", "Final Energy");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Wave Length Column
file->writeData("column_10", waveLength );
file->openData("column_10");
file->putAttr("name", "Wave Length");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Scattering Column
file->writeData("column_11", scattering );
file->openData("column_11");
file->putAttr("name", "Scattering");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// D Spacing Column
file->writeData("column_12", dSpacing );
file->openData("column_12");
file->putAttr("name", "D Spacing");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// TOF Column
file->writeData("column_13", TOF );
file->openData("column_13");
file->putAttr("name", "TOF");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
//Run Number column
file->writeData("column_14", runNumber );
file->openData("column_14");
file->putAttr("name", "Run Number");
file->putAttr("interpret_as","A integer");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Goniometer Matrix Column
std::vector<int> array_dims;
array_dims.push_back(static_cast<int>(peaks.size()));
array_dims.push_back(9);
file->writeData("column_15", goniometerMatrix, array_dims);
file->openData("column_15");
file->putAttr("name", "Goniometer Matrix");
file->putAttr("interpret_as","A matrix of 3x3 doubles");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
file->closeGroup(); // end of peaks workpace
file->writeData("column_15", goniometerMatrix, array_dims);
file->openData("column_15");
file->putAttr("name", "Goniometer Matrix");
file->putAttr("interpret_as","A matrix of 3x3 doubles");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
file->closeGroup(); // end of peaks workpace
}
}
......
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