14#include "arcane/core/VariableDiff.h"
16#include "arcane/utils/OStringStream.h"
17#include "arcane/utils/ITraceMng.h"
19#include "arcane/core/IVariable.h"
20#include "arcane/core/IParallelMng.h"
30template <
typename DataType>
void VariableDiff<DataType>::DiffPrinter::
31sort(ArrayView<DiffInfo> diffs_info)
33 if constexpr (std::is_same<TrueType, typename VarDataTypeTraits::IsNumeric>::value) {
34 std::sort(std::begin(diffs_info), std::end(diffs_info));
37 ARCANE_UNUSED(diffs_info);
43template <
typename DataType>
void VariableDiff<DataType>::DiffPrinter::
44dump(ConstArrayView<DiffInfo> diffs_info, IVariable* var, IParallelMng* pm,
int max_print)
46 ITraceMng* msg = pm->traceMng();
47 Int32 sid = pm->commRank();
48 const String& var_name = var->name();
49 Integer nb_diff = diffs_info.size();
51 if (max_print >= 0 && nb_diff >
static_cast<Integer>(max_print))
54 ostr().precision(FloatInfo<Real>::maxDigit());
55 ostr() << nb_diff <<
" entities having different values for the variable "
57 for (Integer i = 0; i < nb_print; ++i) {
58 const DiffInfo& di = diffs_info[i];
59 if (di.m_unique_id != NULL_ITEM_UNIQUE_ID) {
61 char type = di.m_is_own ?
'O' :
'G';
62 ostr() <<
"VDIFF: Variable '" << var_name <<
"'"
63 <<
" (" << type <<
")"
64 <<
" uid=" << di.m_unique_id
65 <<
" lid=" << di.m_local_id;
66 if (di.m_sub_index != NULL_ITEM_ID)
67 ostr() <<
" [" << di.m_sub_index <<
"]";
68 ostr() <<
" val: " << di.m_current
69 <<
" ref: " << di.m_ref <<
" rdiff: " << di.m_diff <<
'\n';
73 ostr() <<
"VDIFF: Variable '" << var_name <<
"'"
74 <<
" index=" << di.m_local_id;
75 if (di.m_sub_index != NULL_ITEM_ID)
76 ostr() <<
" [" << di.m_sub_index <<
"]";
77 ostr() <<
" val: " << di.m_current
78 <<
" ref: " << di.m_ref <<
" rdiff: " << di.m_diff <<
'\n';
81 msg->pinfo() <<
"Processor " << sid <<
" : " << nb_diff
82 <<
" values are different on the variable "
90template class VariableDiff<Byte>::DiffPrinter;
91template class VariableDiff<Real>::DiffPrinter;
92template class VariableDiff<Int16>::DiffPrinter;
93template class VariableDiff<Int32>::DiffPrinter;
94template class VariableDiff<Int64>::DiffPrinter;
95template class VariableDiff<Real2>::DiffPrinter;
96template class VariableDiff<Real2x2>::DiffPrinter;
97template class VariableDiff<Real3>::DiffPrinter;
98template class VariableDiff<Real3x3>::DiffPrinter;
99template class VariableDiff<String>::DiffPrinter;
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Int32 Integer
Type représentant un entier.