本文整理汇总了C++中TableWorkspace_sptr::getRow方法的典型用法代码示例。如果您正苦于以下问题:C++ TableWorkspace_sptr::getRow方法的具体用法?C++ TableWorkspace_sptr::getRow怎么用?C++ TableWorkspace_sptr::getRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableWorkspace_sptr
的用法示例。
在下文中一共展示了TableWorkspace_sptr::getRow方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selectFromGivenFunction
/** Select background points via a given background function
*/
void ProcessBackground::selectFromGivenFunction() {
// Process properties
BackgroundFunction_sptr bkgdfunc = createBackgroundFunction(m_bkgdType);
TableWorkspace_sptr bkgdtablews = getProperty("BackgroundTableWorkspace");
// Set up background function from table
size_t numrows = bkgdtablews->rowCount();
map<string, double> parmap;
for (size_t i = 0; i < numrows; ++i) {
TableRow row = bkgdtablews->getRow(i);
string parname;
double parvalue;
row >> parname >> parvalue;
if (parname[0] == 'A')
parmap.emplace(parname, parvalue);
}
int bkgdorder =
static_cast<int>(parmap.size() - 1); // A0 - A(n) total n+1 parameters
bkgdfunc->setAttributeValue("n", bkgdorder);
for (auto &mit : parmap) {
string parname = mit.first;
double parvalue = mit.second;
bkgdfunc->setParameter(parname, parvalue);
}
// Filter out
m_outputWS = filterForBackground(bkgdfunc);
return;
}
示例2: createBackgroundFunction
/** Select background points via a given background function
*/
void ProcessBackground::execSelectBkgdPoints2()
{
// Process properties
BackgroundFunction_sptr bkgdfunc = createBackgroundFunction(m_bkgdType);
TableWorkspace_sptr bkgdtablews = getProperty("BackgroundTableWorkspace");
// Set up background function from table
size_t numrows = bkgdtablews->rowCount();
map<string, double> parmap;
for (size_t i = 0; i < numrows; ++i)
{
TableRow row = bkgdtablews->getRow(i);
string parname;
double parvalue;
row >> parname >> parvalue;
if (parname[0] == 'A')
parmap.insert(make_pair(parname, parvalue));
}
int bkgdorder = static_cast<int>(parmap.size()-1); // A0 - A(n) total n+1 parameters
bkgdfunc->setAttributeValue("n", bkgdorder);
for (map<string, double>::iterator mit = parmap.begin(); mit != parmap.end(); ++mit)
{
string parname = mit->first;
double parvalue = mit->second;
bkgdfunc->setParameter(parname, parvalue);
}
// Filter out
m_outputWS = filterForBackground(bkgdfunc);
return;
}
示例3: copyTableWorkspaceContent
/** Copy table workspace content from one workspace to another
* @param sourceWS :: table workspace from which the content is copied;
* @param targetWS :: table workspace to which the content is copied;
*/
void ExtractMaskToTable::copyTableWorkspaceContent(
TableWorkspace_sptr sourceWS, TableWorkspace_sptr targetWS) {
// Compare the column names. They must be exactly the same
vector<string> sourcecolnames = sourceWS->getColumnNames();
vector<string> targetcolnames = targetWS->getColumnNames();
if (sourcecolnames.size() != targetcolnames.size()) {
stringstream errmsg;
errmsg << "Soruce table workspace " << sourceWS->name()
<< " has different number of columns (" << sourcecolnames.size()
<< ") than target table workspace's (" << targetcolnames.size()
<< ")";
throw runtime_error(errmsg.str());
}
for (size_t i = 0; i < sourcecolnames.size(); ++i) {
if (sourcecolnames[i].compare(targetcolnames[i])) {
stringstream errss;
errss << "Source and target have incompatible column name at column " << i
<< ". "
<< "Column name of source is " << sourcecolnames[i] << "; "
<< "Column name of target is " << targetcolnames[i];
throw runtime_error(errss.str());
}
}
// Copy over the content
size_t numrows = sourceWS->rowCount();
for (size_t i = 0; i < numrows; ++i) {
double xmin, xmax;
string speclist;
TableRow tmprow = sourceWS->getRow(i);
tmprow >> xmin >> xmax >> speclist;
TableRow newrow = targetWS->appendRow();
newrow << xmin << xmax << speclist;
}
return;
}
示例4: constructFromTableWorkspace
void PoldiPeakCollection::constructFromTableWorkspace(
const TableWorkspace_sptr &tableWorkspace) {
if (checkColumns(tableWorkspace)) {
size_t newPeakCount = tableWorkspace->rowCount();
m_peaks.resize(newPeakCount);
recoverDataFromLog(tableWorkspace);
for (size_t i = 0; i < newPeakCount; ++i) {
TableRow nextRow = tableWorkspace->getRow(i);
std::string hklString;
double d, deltaD, q, deltaQ, intensity, deltaIntensity, fwhm, deltaFwhm;
nextRow >> hklString >> d >> deltaD >> q >> deltaQ >> intensity >>
deltaIntensity >> fwhm >> deltaFwhm;
PoldiPeak_sptr peak = PoldiPeak::create(
MillerIndicesIO::fromString(hklString), UncertainValue(d, deltaD),
UncertainValue(intensity, deltaIntensity),
UncertainValue(fwhm, deltaFwhm));
m_peaks[i] = peak;
}
}
}