本文整理汇总了C++中api::ITableWorkspace_sptr::getRow方法的典型用法代码示例。如果您正苦于以下问题:C++ ITableWorkspace_sptr::getRow方法的具体用法?C++ ITableWorkspace_sptr::getRow怎么用?C++ ITableWorkspace_sptr::getRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api::ITableWorkspace_sptr
的用法示例。
在下文中一共展示了ITableWorkspace_sptr::getRow方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mergeTables
void EnggDiffFittingModel::mergeTables(
const API::ITableWorkspace_sptr tableToCopy,
API::ITableWorkspace_sptr targetTable) const {
for (size_t i = 0; i < tableToCopy->rowCount(); ++i) {
API::TableRow rowToCopy = tableToCopy->getRow(i);
API::TableRow newRow = targetTable->appendRow();
for (size_t j = 0; j < tableToCopy->columnCount(); ++j) {
double valueToCopy;
rowToCopy >> valueToCopy;
newRow << valueToCopy;
}
}
}
示例2: getTableRowNumbers
/* This function fills in a list of the row numbers starting 0 of the parameters
in the table workspace, so one can find the position in a column of
the value of the given parameter.
*/
void LoadFullprofResolution::getTableRowNumbers(
const API::ITableWorkspace_sptr &tablews,
std::map<std::string, size_t> ¶mmap) {
parammap.clear();
size_t numrows = tablews->rowCount();
for (size_t i = 0; i < numrows; ++i) {
TableRow row = tablews->getRow(i);
std::string name;
row >> name;
parammap.emplace(name, i);
}
return;
}
示例3: writeData
void SaveDiffFittingAscii::writeData(const API::ITableWorkspace_sptr workspace,
std::ofstream &file,
const size_t columnSize) {
for (size_t rowIndex = 0; rowIndex < workspace->rowCount(); ++rowIndex) {
TableRow row = workspace->getRow(rowIndex);
for (size_t columnIndex = 0; columnIndex < columnSize; columnIndex++) {
const auto row_str =
boost::lexical_cast<std::string>(row.Double(columnIndex));
g_log.debug() << row_str << std::endl;
if (columnIndex == columnSize - 1)
writeVal(row_str, file, true);
else
writeVal(row_str, file, false);
}
}
}
示例4: loadPhaseTable
/** Load PhaseTable file to a vector of HistData.
* @param phaseTable :: [input] phase table containing detector info
* @param deadTimeTable :: [output] phase table containing dead times
*/
void PhaseQuadMuon::loadPhaseTable(API::ITableWorkspace_sptr phaseTable, API::ITableWorkspace_sptr deadTimeTable)
{
if ( phaseTable->rowCount() )
{
if ( phaseTable->columnCount()<4 )
{
throw std::invalid_argument("PhaseQuad: PhaseTable must contain at least four columns");
}
// Check number of histograms in inputWs match number of detectors in phase table
if (m_nHist != static_cast<int>(phaseTable->rowCount()))
{
throw std::runtime_error("PhaseQuad: Number of histograms in phase table does not match number of spectra in workspace");
}
for (size_t i=0; i<phaseTable->rowCount(); ++i)
{
API::TableRow phaseRow = phaseTable->getRow(i);
// The first three columns go to m_histData
HistData tempHist;
tempHist.detOK = phaseRow.Bool(0);
tempHist.alpha = phaseRow.Double(1);
tempHist.phi = phaseRow.Double(2);
m_histData.push_back(tempHist);
// The last column goes to deadTimeTable
API::TableRow deadRow = deadTimeTable->appendRow();
deadRow << static_cast<int>(i)+1 << phaseRow.Double(3);
}
}
else
{
throw std::invalid_argument("PhaseQuad: PhaseTable is empty");
}
}