-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #6449 Streamlined MDNode interfaces
- Loading branch information
Showing
5 changed files
with
187 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
#ifndef IMD_NODE_H_ | ||
#define IMD_NODE_H_ | ||
|
||
#include <vector> | ||
#include "MantidKernel/ThreadScheduler.h" | ||
#include "MantidKernel/INode.h" | ||
#include "MantidGeometry/MDGeometry/MDImplicitFunction.h" | ||
#include "MantidAPI/BoxController.h" | ||
|
||
namespace Mantid | ||
{ | ||
namespace API | ||
{ | ||
|
||
class IMDNode : public Kernel::INode | ||
{ | ||
public: | ||
virtual Kernel::ISaveable *const getISaveable(){return NULL;} | ||
virtual Kernel::ISaveable *const getISaveable()const{return NULL;} | ||
//---------------- ISAVABLE | ||
/// @return the amount of memory that the object takes up in the MRU. | ||
virtual uint64_t getTotalDataSize() const=0; | ||
|
||
virtual size_t getDataMemorySize()const=0; | ||
|
||
virtual void clearDataFromMemory()=0; | ||
//------------------------------------------------------------- | ||
/// Get number of dimensions | ||
virtual size_t getNumDims() const = 0; | ||
|
||
/// Getter for the masking | ||
virtual bool getIsMasked() const = 0; | ||
|
||
///Setter for masking the box | ||
virtual void mask() = 0; | ||
|
||
///Setter for unmasking the box | ||
virtual void unmask() = 0; | ||
|
||
/// get box controller | ||
virtual Mantid::API::BoxController *getBoxController() const=0; | ||
|
||
/** Set the box controller used. | ||
* @param controller :: Mantid::API::BoxController * | ||
*/ | ||
virtual void setBoxController(Mantid::API::BoxController *controller)=0; | ||
|
||
// -------------------------------- Parents/Children-Related ------------------------------------------- | ||
/// Avoid rtti | ||
virtual bool isBox()const=0; | ||
/// Get the total # of unsplit MDBoxes contained. | ||
virtual size_t getNumMDBoxes() const = 0; | ||
/// Get the # of children MDBoxBase'es (non-recursive) | ||
virtual size_t getNumChildren() const = 0; | ||
/// Return the indexth child MDBoxBase. | ||
virtual IMDNode * getChild(size_t index) = 0; | ||
|
||
/// Sets the children from a vector of children | ||
virtual void setChildren(const std::vector<IMDNode *> & boxes, const size_t indexStart, const size_t indexEnd) = 0; | ||
|
||
/// Return a pointer to the parent box | ||
virtual void setParent(IMDNode * parent)=0; | ||
|
||
/// Return a pointer to the parent box | ||
virtual IMDNode * getParent()=0; | ||
|
||
|
||
/// Return a pointer to the parent box (const) | ||
virtual const IMDNode * getParent() const = 0; | ||
|
||
// -------------------------------- Events-Related ------------------------------------------- | ||
/// Clear all contained data | ||
virtual void clear() = 0; | ||
/// Get total number of points | ||
virtual uint64_t getNPoints() const = 0; | ||
|
||
|
||
/// Return a copy of contained events | ||
//virtual std::vector<coor> & getEventsCopy() = 0; | ||
/// Add a single event | ||
virtual void addEvent(const std::vector<coord_t> &point, signal_t Signal, signal_t errorSq,uint16_t runIndex,uint32_t detectorId) = 0; | ||
// add a single event and set pointer to the box which needs splitting (if one actually need) | ||
virtual void addAndTraceEvent(const std::vector<coord_t> &point, signal_t Signal, signal_t errorSq,uint16_t runIndex,uint32_t detectorId,size_t index) = 0; | ||
|
||
/// Add a single event, with no mutex locking | ||
virtual void addEventUnsafe(const std::vector<coord_t> &point, signal_t Signal, signal_t errorSq,uint16_t runIndex,uint32_t detectorId) = 0; | ||
|
||
/// Add several events, within a given range | ||
//virtual size_t addEventsPart(const std::vector<coord_t> &coords,const signal_t *Signal,const signal_t *errorSq,const uint16_t *runIndex,const uint32_t *detectorId, const size_t start_at, const size_t stop_at)=0; | ||
virtual size_t addEvents(const std::vector<signal_t> &sigErrSq,const std::vector<coord_t> &Coord,const std::vector<uint16_t> &runIndex,const std::vector<uint32_t> &detectorId)=0; | ||
|
||
/// Add several events, within a given range, with no bounds checking | ||
//virtual size_t addEventsPartUnsafe(const std::vector<MDE> & events, const size_t start_at, const size_t stop_at); | ||
//size_t addEventsUnsafe(const std::vector<MDE> & events); | ||
|
||
/** Perform centerpoint binning of events | ||
* @param bin :: MDBin object giving the limits of events to accept. | ||
* @param fullyContained :: optional bool array sized [nd] of which dimensions are known to be fully contained (for MDSplitBox) | ||
*/ | ||
//virtual void centerpointBin(MDBin<MDE,nd> & bin, bool * fullyContained) const = 0; | ||
|
||
/// General binning method for any shape. | ||
//virtual void generalBin(MDBin<MDE,nd> & bin, Mantid::Geometry::MDImplicitFunction & function) const = 0; | ||
|
||
/** Sphere (peak) integration */ | ||
virtual void integrateSphere(Mantid::API::CoordTransform & radiusTransform, const coord_t radiusSquared, signal_t & signal, signal_t & errorSquared) const = 0; | ||
|
||
/** Find the centroid around a sphere */ | ||
virtual void centroidSphere(Mantid::API::CoordTransform & radiusTransform, const coord_t radiusSquared, coord_t * centroid, signal_t & signal) const = 0; | ||
|
||
// box-related | ||
/** Split sub-boxes, if this is possible and neede for this box */ | ||
virtual void splitAllIfNeeded(Mantid::Kernel::ThreadScheduler * /*ts*/ = NULL)=0; | ||
|
||
|
||
/** Recalculate signal etc. */ | ||
virtual void refreshCache(Kernel::ThreadScheduler * /*ts*/ = NULL)=0; | ||
|
||
// ------------------------------------------------------------------------------------------- | ||
/** Cache the centroid of this box and all sub-boxes. */ | ||
virtual void refreshCentroid(Kernel::ThreadScheduler * /*ts*/ = NULL)= 0; | ||
|
||
virtual void calculateCentroid(coord_t * /*centroid*/) const=0; | ||
|
||
|
||
/// Fill a vector with all the boxes up to a certain depth | ||
virtual void getBoxes(std::vector<IMDNode *> & boxes, size_t maxDepth, bool leafOnly) = 0; | ||
/// Fill a vector with all the boxes up to a certain depth | ||
virtual void getBoxes(std::vector<IMDNode *> & boxes, size_t maxDepth, bool leafOnly, Mantid::Geometry::MDImplicitFunction * function) = 0; | ||
|
||
|
||
|
||
|
||
}; | ||
|
||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#ifndef INODE_H_ | ||
#define INODE_H_ | ||
|
||
//---------------------------------------------------------------------- | ||
// Includes | ||
//---------------------------------------------------------------------- | ||
#include "MantidKernel/ISaveable.h" | ||
|
||
namespace Mantid | ||
{ | ||
namespace Kernel | ||
{ | ||
/** Helper class providing interface to ISAveable | ||
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 INode | ||
{ | ||
public: | ||
virtual ISaveable *const getISaveable()=0; | ||
virtual ISaveable *const getISaveable()const=0; | ||
virtual ~INode(){}; | ||
}; | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters