コード例 #1
0
void
AnalysisDataModuleManager::Impl::presentData(AbstractAnalysisData        *data,
        AnalysisDataModuleInterface *module)
{
    if (state_ == eNotStarted)
    {
        return;
    }
    GMX_RELEASE_ASSERT(state_ != eInFrame,
                       "Cannot apply a modules in mid-frame");
    module->dataStarted(data);
    const bool bCheckMissing = bAllowMissing_
                               && !(module->flags() & AnalysisDataModuleInterface::efAllowMissing);
    for (int i = 0; i < data->frameCount(); ++i)
    {
        AnalysisDataFrameRef frame = data->getDataFrame(i);
        GMX_RELEASE_ASSERT(frame.isValid(), "Invalid data frame returned");
        // TODO: Check all frames before doing anything for slightly better
        // exception behavior.
        if (bCheckMissing && !frame.allPresent())
        {
            GMX_THROW(APIError("Missing data not supported by a module"));
        }
        module->frameStarted(frame.header());
        for (int j = 0; j < frame.pointSetCount(); ++j)
        {
            module->pointsAdded(frame.pointSet(j));
        }
        module->frameFinished(frame.header());
    }
    if (state_ == eFinished)
    {
        module->dataFinished();
    }
}
コード例 #2
0
ファイル: abstractdata.cpp プロジェクト: enasyunis/gromacs
void
AbstractAnalysisData::Impl::presentData(AbstractAnalysisData *data,
                                        AnalysisDataModuleInterface *module)
{
    module->dataStarted(data);
    bool bCheckMissing = bAllowMissing_
        && !(module->flags() & AnalysisDataModuleInterface::efAllowMissing);
    for (int i = 0; i < data->frameCount(); ++i)
    {
        AnalysisDataFrameRef frame = data->getDataFrame(i);
        GMX_RELEASE_ASSERT(frame.isValid(), "Invalid data frame returned");
        // TODO: Check all frames before doing anything for slightly better
        // exception behavior.
        if (bCheckMissing && !frame.allPresent())
        {
            GMX_THROW(APIError("Missing data not supported by a module"));
        }
        module->frameStarted(frame.header());
        module->pointsAdded(frame.points());
        module->frameFinished(frame.header());
    }
    if (!bInData_)
    {
        module->dataFinished();
    }
}
コード例 #3
0
ファイル: dataframe.cpp プロジェクト: alwanderer/gromacs
AnalysisDataFrameRef::AnalysisDataFrameRef(
        const AnalysisDataFrameRef &frame, int firstColumn, int columnCount)
    : header_(frame.header()), values_(&frame.values_[firstColumn], columnCount)
{
    GMX_ASSERT(firstColumn >= 0, "Invalid first column");
    GMX_ASSERT(columnCount >= 0, "Invalid column count");
    GMX_ASSERT(firstColumn + columnCount <= frame.columnCount(),
               "Invalid last column");
}
コード例 #4
0
ファイル: dataframe.cpp プロジェクト: gromacs/gromacs
AnalysisDataFrameRef::AnalysisDataFrameRef(
        const AnalysisDataFrameRef &frame, int firstColumn, int columnCount)
    : header_(frame.header()),
      values_(constArrayRefFromArray(&frame.values_[firstColumn], columnCount)),
      pointSets_(frame.pointSets_)
{
    // FIXME: This doesn't produce a valid internal state, although it does
    // work in some cases. The point sets cannot be correctly managed here, but
    // need to be handles by the data proxy class.
    GMX_ASSERT(firstColumn >= 0, "Invalid first column");
    GMX_ASSERT(columnCount >= 0, "Invalid column count");
    GMX_ASSERT(pointSets_.size() == 1U,
               "Subsets of frames only supported with simple data");
    GMX_ASSERT(firstColumn + columnCount <= ssize(values_),
               "Invalid last column");
}