當前位置: 首頁>>代碼示例>>C++>>正文


C++ GMX_RELEASE_ASSERT函數代碼示例

本文整理匯總了C++中GMX_RELEASE_ASSERT函數的典型用法代碼示例。如果您正苦於以下問題:C++ GMX_RELEASE_ASSERT函數的具體用法?C++ GMX_RELEASE_ASSERT怎麽用?C++ GMX_RELEASE_ASSERT使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GMX_RELEASE_ASSERT函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: GMX_RELEASE_ASSERT

void
AnalysisDataDisplacementModule::setMSDHistogram(AnalysisDataBinAverageModule *histm)
{
    GMX_RELEASE_ASSERT(!_impl->histm, "Can only set MSD histogram once");
    _impl->histm = histm;
    histm->setIgnoreMissing(true);
    addModule(histm);
}
開發者ID:alexholehouse,項目名稱:gromacs,代碼行數:8,代碼來源:displacement.cpp

示例2: GMX_RELEASE_ASSERT

AnalysisDataHandle
TrajectoryAnalysisModuleData::dataHandle(const AnalysisData &data)
{
    Impl::HandleContainer::const_iterator i = impl_->handles_.find(&data);
    GMX_RELEASE_ASSERT(i != impl_->handles_.end(),
                       "Data handle requested on unknown dataset");
    return i->second;
}
開發者ID:MelroLeandro,項目名稱:gromacs,代碼行數:8,代碼來源:analysismodule.cpp

示例3: GMX_RELEASE_ASSERT

void TopologyManager::initUniformMolecules(int moleculeSize)
{
    GMX_RELEASE_ASSERT(mtop_ != nullptr, "Topology not initialized");
    GMX_RELEASE_ASSERT(mtop_->molblock.size() == 1, "initUniformMolecules only implemented for a single molblock");
    gmx_molblock_t &molblock = mtop_->molblock[0];
    t_atoms        &atoms    = mtop_->moltype[molblock.type].atoms;
    GMX_RELEASE_ASSERT(atoms.nr % moleculeSize == 0,
                       "The number of atoms should be a multiple of moleculeSize");
    molblock.nmol  = atoms.nr/moleculeSize;
    atoms.nr       = moleculeSize;
    const int nres = atoms.atom[atoms.nr].resind;
    GMX_RELEASE_ASSERT(atoms.atom[atoms.nr-1].resind != nres,
                       "The residues should break at molecule boundaries");
    atoms.nres                 = nres;
    mtop_->haveMoleculeIndices = true;
    gmx_mtop_finalize(mtop_.get());
}
開發者ID:friforever,項目名稱:gromacs,代碼行數:17,代碼來源:toputils.cpp

示例4: GMX_RELEASE_ASSERT

void
AnalysisDataDisplacementModule::setMSDHistogram(
        AnalysisDataBinAverageModulePointer histm)
{
    GMX_RELEASE_ASSERT(_impl->histm == NULL, "Can only set MSD histogram once");
    _impl->histm = histm.get();
    addModule(histm);
}
開發者ID:pslacerda,項目名稱:gromacs,代碼行數:8,代碼來源:displacement.cpp

示例5: GMX_RELEASE_ASSERT

void OptionsAssigner::finishSection()
{
    // Should only be called if we are in a subsection.
    GMX_RELEASE_ASSERT(impl_->inSection(), "startSection() not called");
    Impl::Section *section = impl_->sectionStack_.back();
    section->finish();
    impl_->sectionStack_.pop_back();
}
開發者ID:friforever,項目名稱:gromacs,代碼行數:8,代碼來源:optionsassigner.cpp

示例6: GMX_RELEASE_ASSERT

void
AbstractAnalysisArrayData::setColumnCount(int ncols)
{
    GMX_RELEASE_ASSERT(!isAllocated(),
                       "Cannot change column count after data has been allocated");
    AbstractAnalysisData::setColumnCount(0, ncols);
    pointSetInfo_ = AnalysisDataPointSetInfo(0, ncols, 0, 0);
}
開發者ID:MelroLeandro,項目名稱:gromacs,代碼行數:8,代碼來源:arraydata.cpp

示例7: removeExtraSpaces

/*! \brief Replace duplicated spaces with a single one in string
 *
 * Only the first character will be kept for multiple adjacent characters that
 * are both identical and where the first one returns true for isspace().
 *
 * \param str String that will be modified.
 */
static void
removeExtraSpaces(std::string *str)
{
    GMX_RELEASE_ASSERT(str != nullptr, "A pointer to an actual string must be provided");
    std::string::iterator newEnd =
        std::unique( str->begin(), str->end(), [ = ](char a, char b){ return isspace(a) != 0 && (a == b); } );
    str->erase(newEnd, str->end());
}
開發者ID:friforever,項目名稱:gromacs,代碼行數:15,代碼來源:ocl_compiler.cpp

示例8: GMX_RELEASE_ASSERT

void
AnalysisDataModuleManager::applyModule(AbstractAnalysisData        *data,
                                       AnalysisDataModuleInterface *module)
{
    impl_->checkModuleProperties(*module);
    GMX_RELEASE_ASSERT(impl_->state_ == Impl::eFinished,
                       "Data module can only be applied to ready data");
    impl_->presentData(data, module);
}
開發者ID:ElsevierSoftwareX,項目名稱:SOFTX-D-15-00003,代碼行數:9,代碼來源:datamodulemanager.cpp

示例9: gmx_omp_nthreads_set

void
gmx_omp_nthreads_set(int mod, int nthreads)
{
    /* Catch an attempt to set the number of threads on an invalid
     * OpenMP module. */
    GMX_RELEASE_ASSERT(mod >= 0 && mod < emntNR, "Trying to set nthreads on invalid OpenMP module");

    modth.nth[mod] = nthreads;
}
開發者ID:friforever,項目名稱:gromacs,代碼行數:9,代碼來源:gmx_omp_nthreads.cpp

示例10: GMX_RELEASE_ASSERT

void AbstractOptionStorage::finish()
{
    GMX_RELEASE_ASSERT(!bInSet_, "finishSet() not called");
    processAll();
    if (isRequired() && !(isSet() || hasFlag(efOption_ExplicitDefaultValue)))
    {
        GMX_THROW(InvalidInputError("Option is required, but not set"));
    }
}
開發者ID:alwanderer,項目名稱:gromacs,代碼行數:9,代碼來源:abstractoption.cpp

示例11: _gmx_sel_mempool_reserve

void
_gmx_sel_mempool_reserve(gmx_sel_mempool_t *mp, size_t size)
{
    GMX_RELEASE_ASSERT(mp->nblocks == 0,
                       "Cannot reserve memory pool when there is something allocated");
    GMX_RELEASE_ASSERT(!mp->buffer, "Cannot reserve memory pool twice");
    if (size == 0)
    {
        size = mp->maxsize;
    }
    mp->buffer = (char *)malloc(size);
    if (!mp->buffer)
    {
        throw std::bad_alloc();
    }
    mp->freesize = size;
    mp->freeptr  = mp->buffer;
}
開發者ID:alexholehouse,項目名稱:gromacs,代碼行數:18,代碼來源:mempool.cpp

示例12: dd_collect_state

void dd_collect_state(gmx_domdec_t *dd,
                      const t_state *state_local, t_state *state)
{
    int nh = state_local->nhchainlength;

    if (DDMASTER(dd))
    {
        GMX_RELEASE_ASSERT(state->nhchainlength == nh, "The global and local Nose-Hoover chain lengths should match");

        for (int i = 0; i < efptNR; i++)
        {
            state->lambda[i] = state_local->lambda[i];
        }
        state->fep_state = state_local->fep_state;
        state->veta      = state_local->veta;
        state->vol0      = state_local->vol0;
        copy_mat(state_local->box, state->box);
        copy_mat(state_local->boxv, state->boxv);
        copy_mat(state_local->svir_prev, state->svir_prev);
        copy_mat(state_local->fvir_prev, state->fvir_prev);
        copy_mat(state_local->pres_prev, state->pres_prev);

        for (int i = 0; i < state_local->ngtc; i++)
        {
            for (int j = 0; j < nh; j++)
            {
                state->nosehoover_xi[i*nh+j]        = state_local->nosehoover_xi[i*nh+j];
                state->nosehoover_vxi[i*nh+j]       = state_local->nosehoover_vxi[i*nh+j];
            }
            state->therm_integral[i] = state_local->therm_integral[i];
        }
        for (int i = 0; i < state_local->nnhpres; i++)
        {
            for (int j = 0; j < nh; j++)
            {
                state->nhpres_xi[i*nh+j]        = state_local->nhpres_xi[i*nh+j];
                state->nhpres_vxi[i*nh+j]       = state_local->nhpres_vxi[i*nh+j];
            }
        }
        state->baros_integral = state_local->baros_integral;
    }
    if (state_local->flags & (1 << estX))
    {
        gmx::ArrayRef<gmx::RVec> globalXRef = state ? makeArrayRef(state->x) : gmx::EmptyArrayRef();
        dd_collect_vec(dd, state_local, makeConstArrayRef(state_local->x), globalXRef);
    }
    if (state_local->flags & (1 << estV))
    {
        gmx::ArrayRef<gmx::RVec> globalVRef = state ? makeArrayRef(state->v) : gmx::EmptyArrayRef();
        dd_collect_vec(dd, state_local, makeConstArrayRef(state_local->v), globalVRef);
    }
    if (state_local->flags & (1 << estCGP))
    {
        gmx::ArrayRef<gmx::RVec> globalCgpRef = state ? makeArrayRef(state->cg_p) : gmx::EmptyArrayRef();
        dd_collect_vec(dd, state_local, makeConstArrayRef(state_local->cg_p), globalCgpRef);
    }
}
開發者ID:friforever,項目名稱:gromacs,代碼行數:57,代碼來源:collect.cpp

示例13: GMX_RELEASE_ASSERT

void OptionsAssigner::appendValue(const std::string &value)
{
    AbstractOptionStorage *option = _impl->_currentOption;
    GMX_RELEASE_ASSERT(option != NULL, "startOption() not called");
    // Does not count correctly, but the actual count is not really used.
    // TODO: Rename the variable to better reflect the usage.
    ++_impl->_currentValueCount;
    option->appendValue(value);
}
開發者ID:alexholehouse,項目名稱:gromacs,代碼行數:9,代碼來源:optionsassigner.cpp

示例14: GMX_RELEASE_ASSERT

/*! \internal
 * This method is not const because the dataStarted() methods of the attached
 * modules can request storage of the data.
 */
void
AbstractAnalysisData::notifyDataStart()
{
    GMX_RELEASE_ASSERT(!impl_->bDataStart_,
                       "notifyDataStart() called more than once");
    GMX_RELEASE_ASSERT(columnCount_ > 0, "Data column count is not set");
    impl_->bDataStart_ = impl_->bInData_ = true;

    Impl::ModuleList::const_iterator i;
    for (i = impl_->modules_.begin(); i != impl_->modules_.end(); ++i)
    {
        if (columnCount_ > 1 && !((*i)->flags() & AnalysisDataModuleInterface::efAllowMulticolumn))
        {
            GMX_THROW(APIError("Data module not compatible with data object properties"));
        }
        (*i)->dataStarted(this);
    }
}
開發者ID:enasyunis,項目名稱:gromacs,代碼行數:22,代碼來源:abstractdata.cpp

示例15: GMX_RELEASE_ASSERT

void UpdateGroupsCog::addCogs(gmx::ArrayRef<const int>        globalAtomIndices,
                              gmx::ArrayRef<const gmx::RVec>  coordinates)
{
    const int    localAtomBegin = cogIndices_.size();
    const size_t cogBegin       = cogs_.size();

    GMX_RELEASE_ASSERT(globalAtomIndices.size() >= localAtomBegin,
                       "addCogs should only be called to add COGs to the list that is already present (which could be empty)");

    cogIndices_.reserve(globalAtomIndices.size());

    int moleculeBlock = 0;
    for (int localAtom = localAtomBegin; localAtom < globalAtomIndices.size(); localAtom++)
    {
        const int   globalAtom = globalAtomIndices[localAtom];
        int         moleculeIndex;
        int         atomIndexInMolecule;
        mtopGetMolblockIndex(&mtop_, globalAtom,
                             &moleculeBlock, &moleculeIndex, &atomIndexInMolecule);
        const auto &indicesForBlock        = indicesPerMoleculeblock_[moleculeBlock];
        int         globalUpdateGroupIndex =
            indicesForBlock.groupStart_ +
            moleculeIndex*indicesForBlock.numGroupsPerMolecule_ +
            indicesForBlock.groupIndex_[atomIndexInMolecule];

        if (const int *cogIndexPtr = globalToLocalMap_.find(globalUpdateGroupIndex))
        {
            GMX_ASSERT(static_cast<size_t>(*cogIndexPtr) >= cogBegin,
                       "Added atoms should not be part of previously present groups");

            cogIndices_.push_back(*cogIndexPtr);

            cogs_[*cogIndexPtr] += coordinates[localAtom];
            numAtomsPerCog_[*cogIndexPtr]++;
        }
        else
        {
            const int cogIndex = cogs_.size();

            globalToLocalMap_.insert(globalUpdateGroupIndex, cogIndex);
            cogIndices_.push_back(cogIndex);
            cogs_.push_back(coordinates[localAtom]);
            numAtomsPerCog_.push_back(1);
        }
    }

    /* Divide sum of coordinates for each COG by the number of atoms */
    for (size_t i = cogBegin; i < cogs_.size(); i++)
    {
        const int numAtoms = numAtomsPerCog_[i];
        if (numAtoms > 1)
        {
            cogs_[i] /= numAtoms;
        }
    }
}
開發者ID:friforever,項目名稱:gromacs,代碼行數:56,代碼來源:updategroupscog.cpp


注:本文中的GMX_RELEASE_ASSERT函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。