本文整理汇总了C++中mantid::api::MatrixWorkspace_sptr::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixWorkspace_sptr::getName方法的具体用法?C++ MatrixWorkspace_sptr::getName怎么用?C++ MatrixWorkspace_sptr::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mantid::api::MatrixWorkspace_sptr
的用法示例。
在下文中一共展示了MatrixWorkspace_sptr::getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertFromDistribution
void EnggDiffFittingModel::convertFromDistribution(
Mantid::API::MatrixWorkspace_sptr inputWS) {
const auto name = inputWS->getName();
auto convertFromDistAlg = Mantid::API::AlgorithmManager::Instance().create(
"ConvertFromDistribution");
convertFromDistAlg->initialize();
convertFromDistAlg->setProperty("Workspace", inputWS);
convertFromDistAlg->execute();
}
示例2: plotSpectrum
void IndirectFitAnalysisTab::plotSpectrum(
Mantid::API::MatrixWorkspace_sptr workspace,
const std::string ¶meterToPlot) {
const auto name = QString::fromStdString(workspace->getName());
const auto labels = IndirectTab::extractAxisLabels(workspace, 1);
for (const auto ¶meter : m_fittingModel->getFitParameterNames()) {
if (boost::contains(parameter, parameterToPlot)) {
auto it = labels.find(parameter);
if (it != labels.end())
IndirectTab::plotSpectrum(name, static_cast<int>(it->second));
}
}
}
示例3: findMinMax
/** Method takes min-max values from algorithm parameters if they are present or calculates default min-max values if these values
* were not supplied to the method or the supplied value is incorrect.
*
*@param inWS -- the shared pointer to the source workspace
*@param QMode -- the string which defines algorithms Q-conversion mode
*@param dEMode -- the string describes the algorithms energy conversion mode
*@param QFrame -- in Q3D case this describes target coordinate system and is ignored in any other caste
*@param ConvertTo -- The parameter describing Q-scaling transformations
*@param otherDim -- the vector of other dimension names (if any)
* Input-output values:
*@param minVal -- the vector with min values for the algorithm
*@param maxVal -- the vector with max values for the algorithm
*
*
*/
void ConvertToMD::findMinMax(const Mantid::API::MatrixWorkspace_sptr &inWS,const std::string &QMode, const std::string &dEMode,
const std::string &QFrame,const std::string &ConvertTo,const std::vector<std::string> &otherDim,
std::vector<double> &minVal,std::vector<double> &maxVal)
{
// get raw pointer to Q-transformation (do not delete this pointer, it hold by MDTransfFatctory!)
MDTransfInterface* pQtransf = MDTransfFactory::Instance().create(QMode).get();
// get number of dimensions this Q transformation generates from the workspace.
auto iEmode = Kernel::DeltaEMode().fromString(dEMode);
// get total number of dimensions the workspace would have.
unsigned int nMatrixDim = pQtransf->getNMatrixDimensions(iEmode,inWS);
// total number of dimensions
size_t nDim =nMatrixDim+otherDim.size();
// probably already have well defined min-max values, so no point of pre-calculating them
bool wellDefined(true);
if((nDim == minVal.size()) && (minVal.size()==maxVal.size()))
{
// are they indeed well defined?
for(size_t i=0;i<minVal.size();i++)
{
if(minVal[i]>=maxVal[i]) // no it is ill defined
{
g_log.information()<<" Min Value: "<<minVal[i]<<" for dimension N: "<<i<<" equal or exceeds max value:"<<maxVal[i]<<std::endl;
wellDefined = false;
break;
}
}
if (wellDefined)return;
}
// we need to identify min-max values by themselves
Mantid::API::Algorithm_sptr childAlg = createChildAlgorithm("ConvertToMDMinMaxLocal");
if(!childAlg)throw(std::runtime_error("Can not create child ChildAlgorithm to found min/max values"));
childAlg->setPropertyValue("InputWorkspace", inWS->getName());
childAlg->setPropertyValue("QDimensions",QMode);
childAlg->setPropertyValue("dEAnalysisMode",dEMode);
childAlg->setPropertyValue("Q3DFrames",QFrame);
childAlg->setProperty("OtherDimensions",otherDim);
childAlg->setProperty("QConversionScales",ConvertTo);
childAlg->setProperty("PreprocDetectorsWS",std::string(getProperty("PreprocDetectorsWS")));
childAlg->execute();
if(!childAlg->isExecuted())throw(std::runtime_error("Can not properly execute child algorithm to find min/max workspace values"));
minVal = childAlg->getProperty("MinValues");
maxVal = childAlg->getProperty("MaxValues");
// if some min-max values for dimensions produce ws with 0 width in this direction, change it to have some width;
for(unsigned int i=0;i<nDim;i++)
{
if(minVal[i]>=maxVal[i])
{
g_log.debug()<<"identified min-max values for dimension N: "<<i<<" are equal. Modifying min-max value to produce dimension with 0.2*dimValue width\n";
if(minVal[i]>0)
{
minVal[i]*=0.9;
maxVal[i]*=1.1;
}
else if(minVal[i]==0)
{
minVal[i]=-0.1;
maxVal[i]=0.1;
}
else
{
minVal[i]*=1.1;
maxVal[i]*=0.9;
}
}
else // expand min-max values a bit to avoid cutting data on the edges
{
if (std::fabs(minVal[i])>FLT_EPSILON)
minVal[i]*=(1+2*FLT_EPSILON);
else
minVal[i]-=2*FLT_EPSILON;
if (std::fabs(minVal[i])>FLT_EPSILON)
maxVal[i]*=(1+2*FLT_EPSILON);
else
minVal[i]+=2*FLT_EPSILON;
}
}
//.........这里部分代码省略.........