本文整理汇总了C++中MultiValue::copyValues方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiValue::copyValues方法的具体用法?C++ MultiValue::copyValues怎么用?C++ MultiValue::copyValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultiValue
的用法示例。
在下文中一共展示了MultiValue::copyValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: completeTask
void MultiColvarFilter::completeTask( const unsigned& curr, MultiValue& invals, MultiValue& outvals ) const {
invals.copyValues( outvals );
if( derivativesAreRequired() ) invals.copyDerivatives( outvals );
// Retrive the value of the multicolvar and apply filter
double val=invals.get(1), df, weight=applyFilter( val, df );
// Now propegate derivatives
if( !getPntrToMultiColvar()->weightHasDerivatives ){
outvals.setValue( 0, weight );
if( derivativesAreRequired() ){
for(unsigned i=0;i<invals.getNumberActive();++i){
unsigned jder=invals.getActiveIndex(i);
outvals.addDerivative( 0, jder, df*invals.getDerivative(1, jder ) );
}
}
} else {
double ww=outvals.get(0); outvals.setValue( 0, ww*weight );
if( derivativesAreRequired() ){
for(unsigned i=0;i<outvals.getNumberActive();++i){
unsigned ider=outvals.getActiveIndex(i);
outvals.setDerivative( 0, ider, weight*outvals.getDerivative(1,ider) + ww*df*outvals.getDerivative(0,ider) );
}
}
}
}
示例2: completeTask
void VolumeGradientBase::completeTask( const unsigned& curr, MultiValue& invals, MultiValue& outvals ) const {
if( getPntrToMultiColvar()->isDensity() ) {
outvals.setValue(0, 1.0); outvals.setValue(1, 1.0);
} else {
// Copy derivatives of the colvar and the value of the colvar
invals.copyValues( outvals );
if( derivativesAreRequired() ) invals.copyDerivatives( outvals );
}
calculateAllVolumes( curr, outvals );
}