Skip to content

Commit

Permalink
refs #9048 still lefower from merge conflict with develop.
Browse files Browse the repository at this point in the history
Conflicts:

	Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/UnitsConversionHelper.h
	Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp
  • Loading branch information
martyngigg committed Feb 21, 2014
1 parent 3de64c6 commit 0eeeb85
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 36 deletions.
Expand Up @@ -73,8 +73,10 @@ class DLLExport UnitsConversionHelper

public:
UnitsConversionHelper();

void initialize(const MDWSDescription &targetWSDescr,const std::string &units_to,bool forceViaTOF=false);
void initialize(const std::string &unitsFrom,const std::string &unitsTo,const DataObjects::TableWorkspace_const_sptr &DetWS,int Emode,bool forceViaTOF=false);

void updateConversion(size_t i);
double convertUnits(double val)const;

Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp
Expand Up @@ -361,7 +361,7 @@ namespace Mantid

/// constructor;
MDTransfModQ::MDTransfModQ():
m_Det(NULL),
m_DetDirecton(NULL),
m_ex(0),m_ey(0),m_ez(1),
m_NMatrixDim(0), //uninitialized
m_Emode(Kernel::DeltaEMode::Undefined), // uninitialized
Expand Down
70 changes: 35 additions & 35 deletions Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp
Expand Up @@ -13,13 +13,13 @@ namespace Mantid

/** establish and initialize proper units conversion from input to output units
@param UnitsFrom -- the ID of the units, which have to be converted from
@param UnitsTo -- the ID of the units to converted to
@param forceViaTOF -- force to perform unit conversion via TOF even if quick conversion exist (by default, false)
@param UnitsTo -- the ID of the units to converted to
@param forceViaTOF -- force to perform unit conversion via TOF even if quick conversion exist (by default, false)
@return kind of the initiated conversion, e.g. no conversion (unitsFrom == UnitsTo, fastConversion, convFromTOF or convViaTOF.
@return kind of the initiated conversion, e.g. no conversion (unitsFrom == UnitsTo, fastConversion, convFromTOF or convViaTOF.
See ConvertUnits for the details of this transformations
if necessary, also sets up the proper units convertor pointers which do the actual conversion.
if necessary, also sets up the proper units convertor pointers which do the actual conversion.
*/
CnvrtToMD::ConvertUnits UnitsConversionHelper::analyzeUnitsConversion(const std::string &UnitsFrom,const std::string &UnitsTo,bool forceViaTOF)
{
Expand Down Expand Up @@ -60,14 +60,14 @@ namespace Mantid

}
/** Initialize unit conversion helper
* This method is interface to internal initialize method, which actually takes all parameters UnitConversion helper needs from
* targetWSDescr class
* @param targetWSDescr -- the class which contains all information about target workspace
including energy transfer mode, number of dimensions, input workspace etc.
* @param unitsTo -- the ID of the units conversion helper would help to convert to
* @param forceViaTOF -- force to perform unit conversion via TOF even if quick conversion exist (by default, false)
*
* This method is interface to internal initialize method, which actually takes all parameters UnitConversion helper needs from
* targetWSDescr class
* @param targetWSDescr -- the class which contains all information about target workspace
including energy transfer mode, number of dimensions, input workspace etc.
* @param unitsTo -- the ID of the units conversion helper would help to convert to
* @param forceViaTOF -- force to perform unit conversion via TOF even if quick conversion exist (by default, false)
*
*/
void UnitsConversionHelper::initialize(const MDWSDescription &targetWSDescr, const std::string &unitsTo,bool forceViaTOF)
{
Expand Down Expand Up @@ -108,10 +108,10 @@ namespace Mantid
return false;
}



/** Method verify if the Units transformation is well defined in the range provided and if not
returns the range where the transformation is well defined.
returns the range where the transformation is well defined.
It is assumed that the points beyond of this range will be filtered in some other way
@param x1 -- the initial point of the units conversion range to verify
Expand Down Expand Up @@ -176,9 +176,9 @@ namespace Mantid
if (!inRange(source_range,range.first) || !inRange(source_range,range.second))
{
if (inRange(range,source_range.first))
range.first = source_range.first;
range.first = source_range.first;
if (inRange(range,source_range.second))
range.second = source_range.second;
range.second = source_range.second;
}
double tof1=m_SourceWSUnit->singleToTOF(range.first);
double tof2=m_SourceWSUnit->singleToTOF(range.second);
Expand Down Expand Up @@ -219,15 +219,15 @@ namespace Mantid

/** Initialize unit conversion helper
* @param unitsFrom -- the ID of the unit, which should be converted from
* @param unitsTo -- the ID of the units conversion helper helps to convert to
* @param DetWS -- table workspace with preprocessed detectors information.
See MDAlgorithms::PreprocessDetectorsToMD for the info what this workspace contains
* @param Emode -- energy transfer mode (integer value used by Kernel::ConvertUnits to indetify energy transfer mode
* @param forceViaTOF -- force to perform unit conversion via TOF even if quick conversion exist (by default, false)
*
* @param unitsFrom -- the ID of the unit, which should be converted from
* @param unitsTo -- the ID of the units conversion helper helps to convert to
* @param DetWS -- table workspace with preprocessed detectors information.
See MDAlgorithms::PreprocessDetectorsToMD for the info what this workspace contains
* @param Emode -- energy transfer mode (integer value used by Kernel::ConvertUnits to indetify energy transfer mode
* @param forceViaTOF -- force to perform unit conversion via TOF even if quick conversion exist (by default, false)
*
*/

void UnitsConversionHelper::initialize(const std::string &unitsFrom,const std::string &unitsTo,const DataObjects::TableWorkspace_const_sptr &DetWS,int Emode,bool forceViaTOF)
{
m_Emode = Emode;
Expand Down Expand Up @@ -262,7 +262,7 @@ namespace Mantid
m_TargetUnit->initialize(m_L1,m_L2,m_TwoTheta,m_Emode,Efix,0.);
if (m_SourceWSUnit)
{
m_SourceWSUnit->initialize(m_L1,m_L2,m_TwoTheta,m_Emode,Efix,0.);
m_SourceWSUnit->initialize(m_L1,m_L2,m_TwoTheta,m_Emode,Efix,0.);
}
}
/** Method updates unit conversion given the index of detector parameters in the array of detectors */
Expand Down Expand Up @@ -301,8 +301,8 @@ namespace Mantid
}
}
/** do actual unit conversion from input to oputput data
@param val -- the input value which has to be converted
@return the input value converted into the units requested.
@param val -- the input value which has to be converted
@return the input value converted into the units requested.
*/
double UnitsConversionHelper::convertUnits(double val)const
{
Expand Down Expand Up @@ -350,13 +350,13 @@ namespace Mantid
if(another.m_TargetUnit) m_TargetUnit = Kernel::Unit_sptr(another.m_TargetUnit->clone());
}

UnitsConversionHelper::UnitsConversionHelper():
m_UnitCnvrsn(CnvrtToMD::ConvertNo),
m_Factor(1),m_Power(1),
m_Emode(-1), // undefined
m_L1(1),m_Efix(1),m_TwoTheta(0),m_L2(1),
m_pTwoThetas(NULL),m_pL2s(NULL),m_pEfixedArray(NULL)
{};
UnitsConversionHelper::UnitsConversionHelper():
m_UnitCnvrsn(CnvrtToMD::ConvertNo),
m_Factor(1),m_Power(1),
m_Emode(-1), // undefined
m_L1(1),m_Efix(1),m_TwoTheta(0),m_L2(1),
m_pTwoThetas(NULL),m_pL2s(NULL),m_pEfixedArray(NULL)
{};

} // endNamespace MDEvents
} // endNamespace Mantid
Expand Down

0 comments on commit 0eeeb85

Please sign in to comment.