Skip to content

Commit

Permalink
Created files for FixGSASInstrumentFile in C++. Refs #7948.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Sep 26, 2013
1 parent d7573e9 commit ba0d813
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#ifndef MANTID_ALGORITHMS_FIXGSASINSTRUMENTFILE_H_
#define MANTID_ALGORITHMS_FIXGSASINSTRUMENTFILE_H_

#include "MantidKernel/System.h"
#include "MantidAPI/Algorithm.h"


namespace Mantid
{
namespace Algorithms
{

/** FixGSASInstrumentFile : TODO: DESCRIPTION
Copyright © 2013 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport FixGSASInstrumentFile : public API::Algorithm
{
public:
FixGSASInstrumentFile();
virtual ~FixGSASInstrumentFile();


/// Algorithm's name for identification overriding a virtual method
virtual const std::string name() const { return "LoadFullprofResolution";}

/// Algorithm's version for identification overriding a virtual method
virtual int version() const { return 1;}

/// Algorithm's category for identification overriding a virtual method
virtual const std::string category() const { return "Diffraction";}

private:
/// Sets documentation strings for this algorithm
virtual void initDocs();
/// Implement abstract Algorithm methods
void init();
/// Implement abstract Algorithm methods
void exec();

};


} // namespace Algorithms
} // namespace Mantid

#endif /* MANTID_ALGORITHMS_FIXGSASINSTRUMENTFILE_H_ */
73 changes: 73 additions & 0 deletions Code/Mantid/Framework/Algorithms/src/FixGSASInstrumentFile.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#include "MantidAlgorithms/FixGSASInstrumentFile.h"

#include "MantidDataHandling/LoadFullprofResolution.h"
#include "MantidAPI/FileProperty.h"
#include "MantidKernel/ArrayProperty.h"
#include "MantidAPI/WorkspaceProperty.h"
#include "MantidAPI/TableRow.h"

#include <boost/algorithm/string/trim.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/iter_find.hpp>
#include <boost/algorithm/string/finder.hpp>
#include <boost/algorithm/string/predicate.hpp>

namespace Mantid
{
namespace Algorithms
{


//----------------------------------------------------------------------------------------------
/** Constructor
*/
FixGSASInstrumentFile::FixGSASInstrumentFile()
{
}

//----------------------------------------------------------------------------------------------
/** Destructor
*/
FixGSASInstrumentFile::~FixGSASInstrumentFile()
{
}

//----------------------------------------------------------------------------------------------
/** Sets documentation strings for this algorithm
*/
void LoadFullprofResolution::initDocs()
{
setWikiSummary("Load Fullprof's resolution (.irf) file to one or multiple TableWorkspace(s).");
setOptionalMessage("Load Fullprof's resolution (.irf) file to one or multiple TableWorkspace(s).");

return;
}

//----------------------------------------------------------------------------------------------
/** Implement abstract Algorithm methods
*/
void LoadFullprofResolution::init()
{
// Input file name
vector<std::string> exts;
exts.push_back(".irf");
declareProperty(new FileProperty("Filename", "", FileProperty::Load, exts),
"Path to an Fullprof .irf file to load.");

// Output workspace
auto wsprop = new WorkspaceProperty<TableWorkspace>("OutputWorkspace", "", Direction::Output);
declareProperty(wsprop, "Name of the output TableWorkspace containing profile parameters or bank information. ");

// Bank to import
declareProperty(new ArrayProperty<int>("Banks"), "ID(s) of specified bank(s) to load. "
"Default is all banks contained in input .irf file.");

// declareProperty("Bank", EMPTY_INT(), "ID of a specific bank to load. Default is all banks in .irf file.");

return;
}



} // namespace Algorithms
} // namespace Mantid
28 changes: 28 additions & 0 deletions Code/Mantid/Framework/Algorithms/test/FixGSASInstrumentFileTest.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef MANTID_ALGORITHMS_FIXGSASINSTRUMENTFILETEST_H_
#define MANTID_ALGORITHMS_FIXGSASINSTRUMENTFILETEST_H_

#include <cxxtest/TestSuite.h>

#include "MantidAlgorithms/FixGSASInstrumentFile.h"

using Mantid::Algorithms::FixGSASInstrumentFile;

class FixGSASInstrumentFileTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static FixGSASInstrumentFileTest *createSuite() { return new FixGSASInstrumentFileTest(); }
static void destroySuite( FixGSASInstrumentFileTest *suite ) { delete suite; }


void test_Something()
{
TSM_ASSERT( "You forgot to write a test!", 0);
}


};


#endif /* MANTID_ALGORITHMS_FIXGSASINSTRUMENTFILETEST_H_ */

0 comments on commit ba0d813

Please sign in to comment.