当前位置: 首页>>代码示例>>C++>>正文


C++ MultiValue::clearAll方法代码示例

本文整理汇总了C++中MultiValue::clearAll方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiValue::clearAll方法的具体用法?C++ MultiValue::clearAll怎么用?C++ MultiValue::clearAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MultiValue的用法示例。


在下文中一共展示了MultiValue::clearAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: retrieveDerivatives

void StoreDataVessel::retrieveDerivatives( const unsigned& myelem, const bool& normed, MultiValue& myvals ){
  plumed_dbg_assert( myvals.getNumberOfValues()==vecsize && myvals.getNumberOfDerivatives()==getAction()->getNumberOfDerivatives() );

  myvals.clearAll();
  if( getAction()->lowmem ){
      recalculateStoredQuantity( myelem, myvals );
      if( normed ) getAction()->normalizeVectorDerivatives( myvals );
  } else {
      unsigned jelem = getAction()->getPositionInCurrentTaskList( myelem );
      // Retrieve the derivatives for elements 0 and 1 - weight and norm
      for(unsigned icomp=0;icomp<vecsize;++icomp){
          unsigned ibuf = jelem * ( vecsize*nspace ) + icomp*nspace + 1;
          unsigned kder = getNumberOfStoredValues() + jelem * ( nspace - 1 );
          for(unsigned j=0;j<active_der[jelem];++j){
              myvals.addDerivative( icomp, active_der[kder], local_buffer[ibuf] );
              kder++; ibuf++;
          }
      }
      if( normed ) getAction()->normalizeVectorDerivatives( myvals );
      // Now ensure appropriate parts of list are activated
      myvals.emptyActiveMembers();
      unsigned kder = getNumberOfStoredValues() + jelem * ( nspace - 1 );
      for(unsigned j=0;j<active_der[jelem];++j){ myvals.putIndexInActiveArray( active_der[kder] ); kder++; }
      myvals.sortActiveList();
  } 
}
开发者ID:edoardob90,项目名称:plumed2,代码行数:26,代码来源:StoreDataVessel.cpp

示例2: calculateAllVessels

bool ActionWithVessel::calculateAllVessels( const unsigned& taskCode, MultiValue& myvals, MultiValue& bvals, std::vector<double>& buffer, std::vector<unsigned>& der_list ){
  bool keep=false; 
  for(unsigned j=0;j<functions.size();++j){
      // Calculate returns a bool that tells us if this particular
      // quantity is contributing more than the tolerance
      if( functions[j]->calculate( taskCode, functions[j]->transformDerivatives(taskCode, myvals, bvals), buffer, der_list ) ) keep=true;
      if( !actionIsBridged && bvals.getNumberActive()>0 ) bvals.clearAll(); 
  }
  return keep;
}
开发者ID:yongwangCPH,项目名称:plumed2,代码行数:10,代码来源:ActionWithVessel.cpp


注:本文中的MultiValue::clearAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。