本文整理汇总了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);
}
示例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);
}
示例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;
}