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


C++ CollOfScalar::size方法代码示例

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


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

示例1: operatorOn

CollOfScalar EquelleRuntimeCUDA::operatorOn(const CollOfScalar& data_in,
					    const CollOfIndices<codim>& from_set,
					    const CollOfIndices<codim>& to_set) {

    if ( data_in.size() != from_set.size()) {
	OPM_THROW(std::logic_error, "data_in (size " << data_in.size() << ") and from_set (size " << from_set.size() << ") have to be of the same size in On function for CollOfScalar.");
    }
    //if ( to_set.size() > from_set.size() ) {
    //	OPM_THROW(std::runtime_error, "To_set (size " << to_set.size() << ") has to be a subset of from_set (size " << from_set.size() << ")");
    //}

    return dev_grid_.operatorOn(data_in, from_set, to_set);
}
开发者ID:havahol,项目名称:equelle,代码行数:13,代码来源:EquelleRuntimeCUDA_impl.hpp

示例2: operatorExtend

CollOfScalar EquelleRuntimeCUDA::operatorExtend(const CollOfScalar& data_in,
						const CollOfIndices<codim>& from_set,
						const CollOfIndices<codim>& to_set) const {
    
    if (data_in.size() != from_set.size() ) {
	OPM_THROW(std::runtime_error, "data_in (size " << data_in.size() << ") and from_set (size " << from_set.size() << ") have to be of the same size in Extend function."); 
    }
    if (from_set.size() > to_set.size() ) {
	OPM_THROW(std::runtime_error, "From_set (size " << from_set.size() << ") has to be a subset of to_set (size " << to_set.size() << ")");
    }
    
    return dev_grid_.operatorExtend(data_in, from_set, to_set);
}
开发者ID:havahol,项目名称:equelle,代码行数:13,代码来源:EquelleRuntimeCUDA_impl.hpp

示例3: compare

int compare(CollOfScalar scal, double sol[], 
	    int sol_size,
	    std::string test) 
{ 
    // Test size:
    if ( scal.size() != sol_size ) {
	std::cout << "Error in valsOnGrid.cpp - testing " << test << "\n";
	std::cout << "\tThe collection is of wrong size!\n";
	std::cout << "\tSize is " << scal.size() << " but should be " << sol_size << "\n";
	return 1;
    }
    
    // Testing indices
    std::vector<double> host = scal.copyToHost();
    std::cout << "CollOfScalar " << test << " is the following:\n";
    bool correct = true;
    for (int i = 0; i < host.size(); ++i) {
	std::cout << host[i] << " ";
	if (i < sol_size) {
	    //if (host[i] != sol[i]) {
	    if ( fabs(host[i] - sol[i]) > 1000*std::numeric_limits<double>::epsilon() ) {
		std::cout << "(<- " << sol[i] << ") ";
		correct = false;
	    }
	}
    }
    if (correct) {
	std::cout << "\n\tThis is correct\n";
    } else {
	std::cout << "\n\tThis is wrong\n";
	std::cout << "Error in valsOnGrid.cpp - testing " << test << "\n";
	std::cout << "\tThe indices in the collection is wrong\n";
	return 1;
    }

    return 0;

}
开发者ID:atgeirr,项目名称:equelle,代码行数:38,代码来源:vectors.cpp


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