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