Salome HOME
projects
/
tools
/
medcoupling.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add test for .mesh file format
[tools/medcoupling.git]
/
src
/
MEDLoader
/
SauvReader.cxx
diff --git
a/src/MEDLoader/SauvReader.cxx
b/src/MEDLoader/SauvReader.cxx
index 30a62fecbe913530f3a61ad35fe08233e0120b63..f2a64fffff631bf83bfb8ba4f378119f079f97da 100644
(file)
--- a/
src/MEDLoader/SauvReader.cxx
+++ b/
src/MEDLoader/SauvReader.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-20
19 CEA/DEN, EDF R&D
+// Copyright (C) 2007-20
24 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@
-38,6
+38,24
@@
using namespace std;
#define GIBI_EQUAL(var_str, stat_str) (strncmp (var_str, stat_str, strlen(stat_str)) == 0)
#define GIBI_EQUAL(var_str, stat_str) (strncmp (var_str, stat_str, strlen(stat_str)) == 0)
+namespace
+{
+ class Localizer
+ {
+ std::string _locale;
+ public:
+ Localizer()
+ {
+ _locale = setlocale(LC_NUMERIC, NULL);
+ setlocale(LC_NUMERIC, "C");
+ }
+ ~Localizer()
+ {
+ setlocale(LC_NUMERIC, _locale.c_str());
+ }
+ };
+}
+
//================================================================================
/*!
* \brief Creates a reader of a given sauve file
//================================================================================
/*!
* \brief Creates a reader of a given sauve file
@@
-114,6
+132,8
@@
std::string SauvReader::lineNb() const
MEDCoupling::MEDFileData * SauvReader::loadInMEDFileDS()
{
MEDCoupling::MEDFileData * SauvReader::loadInMEDFileDS()
{
+ Localizer loc; // localization, to read numbers in "C" locale
+
SauvUtilities::IntermediateMED iMed; // intermadiate DS
_iMed = &iMed;
SauvUtilities::IntermediateMED iMed; // intermadiate DS
_iMed = &iMed;
@@
-735,10
+755,10
@@
void SauvReader::setFieldSupport(const vector<SauvUtilities::Group*>& supports,
while ( isSwapped )
{
isSwapped = false;
while ( isSwapped )
{
isSwapped = false;
- for ( size_t i = 1; i < groups.size(); ++i )
+ for ( s
td::s
ize_t i = 1; i < groups.size(); ++i )
{
{
-
in
t nbN1 = groups[i-1]->empty() ? 0 : groups[i-1]->_cells[0]->_nodes.size();
-
in
t nbN2 = groups[i ]->empty() ? 0 : groups[i ]->_cells[0]->_nodes.size();
+
std::size_
t nbN1 = groups[i-1]->empty() ? 0 : groups[i-1]->_cells[0]->_nodes.size();
+
std::size_
t nbN2 = groups[i ]->empty() ? 0 : groups[i ]->_cells[0]->_nodes.size();
if ( nbN1 > nbN2 )
{
isSwapped = isModified = true;
if ( nbN1 > nbN2 )
{
isSwapped = isModified = true;
@@
-1204,7
+1224,7
@@
void SauvReader::read_PILE_STRINGS (const int nbObjects,
const int fixedLength = 71;
while ((int)aWholeString.length() < stringLen)
{
const int fixedLength = 71;
while ((int)aWholeString.length() < stringLen)
{
- int remainLen =
stringLen - aWholeString.length(
);
+ int remainLen =
(int)(stringLen - aWholeString.length()
);
int len;
if ( remainLen > fixedLength )
{
int len;
if ( remainLen > fixedLength )
{
@@
-1226,7
+1246,7
@@
void SauvReader::read_PILE_STRINGS (const int nbObjects,
while ((int)aWholeString.length() < stringLen)
{
getNextLine( line );
while ((int)aWholeString.length() < stringLen)
{
getNextLine( line );
- int remainLen =
stringLen - aWholeString.length(
);
+ int remainLen =
(int)(stringLen - aWholeString.length()
);
if ( remainLen > fixedLength )
{
aWholeString += line + 1;
if ( remainLen > fixedLength )
{
aWholeString += line + 1;