本文整理汇总了C++中Epetra_Vector::Label方法的典型用法代码示例。如果您正苦于以下问题:C++ Epetra_Vector::Label方法的具体用法?C++ Epetra_Vector::Label怎么用?C++ Epetra_Vector::Label使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Epetra_Vector
的用法示例。
在下文中一共展示了Epetra_Vector::Label方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Ifpack_AnalyzeVectorElements
int Ifpack_AnalyzeVectorElements(const Epetra_Vector& Diagonal,
const bool abs, const int steps)
{
bool verbose = (Diagonal.Comm().MyPID() == 0);
double min_val = DBL_MAX;
double max_val = -DBL_MAX;
for (int i = 0 ; i < Diagonal.MyLength() ; ++i) {
double v = Diagonal[i];
if (abs)
if (v < 0) v = -v;
if (v > max_val)
max_val = v;
if (v < min_val)
min_val = v;
}
if (verbose) {
cout << endl;
Ifpack_PrintLine();
cout << "Vector label = " << Diagonal.Label() << endl;
cout << endl;
}
double delta = (max_val - min_val) / steps;
for (int k = 0 ; k < steps ; ++k) {
double below = delta * k + min_val;
double above = below + delta;
int MyBelow = 0, GlobalBelow;
for (int i = 0 ; i < Diagonal.MyLength() ; ++i) {
double v = Diagonal[i];
if (v < 0) v = -v;
if (v >= below && v < above) MyBelow++;
}
Diagonal.Comm().SumAll(&MyBelow, &GlobalBelow, 1);
if (verbose) {
printf("Elements in [%+7e, %+7e) = %10d ( = %5.2f %%)\n",
below, above, GlobalBelow,
100.0 * GlobalBelow / Diagonal.GlobalLength64());
}
}
if (verbose) {
Ifpack_PrintLine();
cout << endl;
}
return(0);
}