Skip to content
Snippets Groups Projects
IMDWorkspace.h 3.31 KiB
Newer Older
#ifndef MANTID_API_IMDWORKSPACE_H_
#define MANTID_API_IMDWORKSPACE_H_

//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/Workspace.h"
#include "MantidGeometry/MDGeometry/IMDDimension.h"
#include "MantidAPI/MDGeometry.h"
    /** Basic MD Workspace Abstract Class.
     *
     *  This defines the interface that allows one to iterate through several types of workspaces:
     *
     *   - The regularly gridded MDHistoWorkspace
     *   - The recursively binned MDEventWorkspace
     *   - The regular (2D) MatrixWorkspace.
     @date 04/10/2010

     Copyright © 2007-2010 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://svn.mantidproject.org/mantid/trunk/Code/Mantid>.
     Code Documentation is available at: <http://doxygen.mantidproject.org>
    */
    class MANTID_API_DLL IMDWorkspace : public Workspace, public Mantid::API::MDGeometry
      /// Get the number of points associated with the workspace.
      /// For MDEvenWorkspace it is the number of events contributing into the workspace
      /// For regularly gridded workspace (MDHistoWorkspace and MatrixWorkspace), it is
      /// the number of bins.
      /// Creates a new iterator pointing to the first cell in the workspace
      virtual IMDIterator* createIterator() const;

      /// Returns the (normalized) signal at a given coordinates
      virtual signal_t getSignalAtCoord(const coord_t * coords) const
      {
        UNUSED_ARG(coords);
        throw std::runtime_error("getSignalAtCoord() not implemented.");
      }

      //-------------------------------------------------------------------------------------------
      /// Returns the (normalized) signal at a given coordinates
      /// @param coords :: coordinate as a VMD vector
      signal_t getSignalAtCoord(const Mantid::Kernel::VMD & coords) const
      {
        return this->getSignalAtCoord(coords.getBareArray());
      }

    };
    
    /// Shared pointer to the matrix workspace base class
    typedef boost::shared_ptr<IMDWorkspace> IMDWorkspace_sptr;
    /// Shared pointer to the matrix workspace base class (const version)
    typedef boost::shared_ptr<const IMDWorkspace> IMDWorkspace_const_sptr;
  }
}
#endif //MANTID_API_IMDWORKSPACE_H_