Skip to content

Commit

Permalink
Refs #8570. Add method which saves fake column data.
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbekasov committed Jan 28, 2014
1 parent c6836f5 commit f82bf8f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
13 changes: 13 additions & 0 deletions Code/Mantid/Framework/Nexus/inc/MantidNexus/NexusFileIO.h
Expand Up @@ -5,6 +5,7 @@
#include "MantidAPI/Progress.h"
#include "MantidKernel/TimeSeriesProperty.h"
#include "MantidDataObjects/EventWorkspace.h"
#include "MantidDataObjects/VectorColumn.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/date_time/local_time_adjustor.hpp>
#include <boost/date_time/c_local_time_adjustor.hpp>
Expand Down Expand Up @@ -180,6 +181,9 @@ namespace Mantid
template<class T>
std::string logValueType()const{return "unknown";}

template<typename T>
void writeNexusVectorColumn(const std::string& columnName,
const boost::shared_ptr< const DataObjects::VectorColumn<T> >& column) const;
};

/**
Expand Down Expand Up @@ -355,6 +359,15 @@ namespace Mantid
status=NXclosegroup(fileID);
}

template<typename T>
void NexusFileIO::writeNexusVectorColumn(const std::string& columnName,
const boost::shared_ptr<const DataObjects::VectorColumn<T> >& column) const
{
UNUSED_ARG(column);
int dims[1]; dims[0] = 3;
int fake_data[3]; fake_data[0] = 1; fake_data[1] = 2; fake_data[2] = 3;
NXwritedata(columnName.c_str(), NX_INT32, 1, dims, (void *)(&fake_data), false);
}

} // namespace NeXus
} // namespace Mantid
Expand Down
11 changes: 7 additions & 4 deletions Code/Mantid/Framework/Nexus/src/NexusFileIO.cpp
Expand Up @@ -24,6 +24,7 @@
#include "MantidDataObjects/TableWorkspace.h"
#include "MantidDataObjects/PeaksWorkspace.h"
#include "MantidDataObjects/TableColumn.h"
#include "MantidDataObjects/VectorColumn.h"
#include "MantidDataObjects/RebinnedOutput.h"
#include "MantidAPI/ITableWorkspace.h"
#include "MantidAPI/AlgorithmHistory.h"
Expand Down Expand Up @@ -480,7 +481,7 @@ using namespace DataObjects;

for (size_t i = 0; i < itableworkspace->columnCount(); i++)
{
boost::shared_ptr<const API::Column> col = itableworkspace->getColumn(i);
Column_const_sptr col = itableworkspace->getColumn(i);

std::string str = "column_" + boost::lexical_cast<std::string>(i+1);

Expand Down Expand Up @@ -554,6 +555,11 @@ using namespace DataObjects;

NXclosedata(fileID);
}
else if ( col->isType< std::vector<int> >() )
{
auto vecCol = boost::dynamic_pointer_cast< const VectorColumn<int> >(col);
writeNexusVectorColumn(str, vecCol);
}

// write out title
NXopendata(fileID, str.c_str());
Expand All @@ -565,9 +571,6 @@ using namespace DataObjects;
return((status==NX_ERROR)?3:0);
}




//-------------------------------------------------------------------------------------
/** Write out a combined chunk of event data
*
Expand Down

0 comments on commit f82bf8f

Please sign in to comment.