Skip to content

Commit 2689acd

Browse files
[arcane,utils] Ajoute support pour la lecture de 'Real3' comme les 'Real'.
1 parent 31bd938 commit 2689acd

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

arcane/src/arcane/utils/ValueConvert.cc

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ _getDoubleValue(double& v, StringView s)
153153
}
154154
#endif
155155
char* ptr2 = nullptr;
156-
v = ::strtod(ptr, &ptr2);
156+
if (ptr)
157+
v = ::strtod(ptr, &ptr2);
157158
return (ptr2 - ptr);
158159
}
159160

@@ -390,6 +391,28 @@ builtInGetValue(Real2& v, StringView s)
390391
template <> ARCANE_UTILS_EXPORT bool
391392
builtInGetValue(Real3& v, StringView s)
392393
{
394+
if (global_use_same_value_convert_for_all_real) {
395+
// ATTENTION: Pour l'instant ce nouveau mécanisme ne tolère pas
396+
// les espaces en début de \a s.
397+
v = {};
398+
const bool is_verbose = global_value_convert_verbosity > 0;
399+
if (is_verbose)
400+
std::cout << "Try Read Real3: '" << s << "'\n";
401+
Int64 p = StringViewToDoubleConverter::_getDoubleValue(v.x, s);
402+
if (p == (-1) || (p == s.size()))
403+
return true;
404+
s = _removeLeadingSpaces(s, p);
405+
if (is_verbose)
406+
std::cout << "VX=" << v.x << " remaining_s='" << s << "'\n";
407+
p = StringViewToDoubleConverter::_getDoubleValue(v.y, s);
408+
if (p == (-1) || (p == s.size()))
409+
return true;
410+
s = _removeLeadingSpaces(s, p);
411+
if (is_verbose)
412+
std::cout << "VY=" << v.x << " remaining_s='" << s << "'\n";
413+
p = StringViewToDoubleConverter::_getDoubleValue(v.z, s);
414+
return (p == (-1) || (p != s.size()));
415+
}
393416
return impl::builtInGetValueGeneric(v, s);
394417
}
395418

0 commit comments

Comments
 (0)