Skip to content

Commit f2c0921

Browse files
author
Charles PIGNEROL
committed
Version 7.12.2. Option -precision of the -cmp function of the xlmlima utility
1 parent c0e15f3 commit f2c0921

4 files changed

Lines changed: 32 additions & 9 deletions

File tree

cmake/version.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
set (LIMA_MAJOR_VERSION "7")
66
set (LIMA_MINOR_VERSION "12")
7-
set (LIMA_RELEASE_VERSION "1")
7+
set (LIMA_RELEASE_VERSION "2")
88
set (LIMA_VERSION ${LIMA_MAJOR_VERSION}.${LIMA_MINOR_VERSION}.${LIMA_RELEASE_VERSION})
99

1010

installation.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ cmake -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_
2222
-DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_XLMLIMA=ON -DBUILD_TESTS:BOOL=ON -DBUILD_SCRIPTING:BOOL=ON -DMACHINE_TYPES:BOOL=OFF -DSUMESH:BOOL=OFF -DFORMAT_MLI:BOOL=OFF -DFORMAT_MLI2:BOOL=ON -DFORMAT_MLI2:BOOL=ON \
2323
-DBUILD_SHARED_LIBS:BOOL=ON -DINT_8:BOOL=ON -DREAL_8:BOOL=ON \
2424
-DSWIG_EXECUTABLE=/opt/swig/4.1.1/bin/swig -DPython3_ROOT_DIR=/usr/lib/python3 -DHDF5_ROOT=/opt/HDF5/1.12.0 \
25-
-B /tmp/lima_build_dir -DCMAKE_INSTALL_PREFIX=/opt/Lima/7.12.1
25+
-B /tmp/lima_build_dir -DCMAKE_INSTALL_PREFIX=/opt/Lima/7.12.2
2626
cmake --build /tmp/lima_build_dir
2727
cmake --install /tmp/lima_build_dir
2828

@@ -32,7 +32,7 @@ cmake -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_
3232
-DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_XLMLIMA=ON -DBUILD_TESTS:BOOL=ON -DBUILD_SCRIPTING:BOOL=ON -DMACHINE_TYPES:BOOL=ON -DSUMESH:BOOL=ON -DFORMAT_MLI:BOOL=ON -DFORMAT_MLI2:BOOL=ON \
3333
-DBUILD_SHARED_LIBS:BOOL=ON -DINT_8:BOOL=ON -DREAL_8:BOOL=ON \
3434
-DSWIG_EXECUTABLE=/opt/swig/4.1.1/bin/swig -DPython3_ROOT_DIR=/usr/lib/python3 -DHDF5_ROOT=/opt/HDF5/1.12.0 -DHDF145_INCLUDE_DIR=/opt/hdf145/1.3.0/include -DHDF145CPP_LIBRARY=/opt/hdf145/1.3.0/lib/libhdf145_cpp.so -DHDF145_LIBRARY=/opt/hdf145/1.3.0/lib/libhdf145.so \
35-
-B /tmp/lima_build_dir -DCMAKE_INSTALL_PREFIX=/opt/Lima/7.12.1
35+
-B /tmp/lima_build_dir -DCMAKE_INSTALL_PREFIX=/opt/Lima/7.12.2
3636
cmake --build /tmp/lima_build_dir
3737
cmake --install /tmp/lima_build_dir
3838

src/Xlmlima_exe/XlmLimaComparer.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ inline bool operator == (const Noeud& n1, const Noeud& n2)
4141
double dy = n1.y ( ) - n2.y ( );
4242
double dz = n1.z ( ) - n2.z ( );
4343
double distance2 = dx * dx + dy * dy + dz * dz;
44+
if (!le (distance2, epsilon2))
45+
cout << setprecision (20) << "D2=" << distance2 << " D=" << sqrt (distance2) << " EPS2=" << epsilon2 << " (" << n1.x ( ) << ", " << n1.y ( ) << ", " << n1.z ( ) << ") != (" << n2.x ( ) << ", " << n2.y ( ) << ", " << n2.z ( ) << ")" << endl;
4446

4547
return le (distance2, epsilon2);
4648
} // operator == (const Noeud& n1, const Noeud& n2)
@@ -298,6 +300,7 @@ void XlmLimaComparer::run ( )
298300
compareAttributes (mesh1.att_polyedres ( ), mesh2.att_polyedres ( ));
299301

300302
// Comparaison des noeuds :
303+
// CP v 7.12.2 : être capable de spécifier l'epsilon pour la comparaison des noeuds
301304
epsilon2 = getPrecision ( ) * getPrecision ( );
302305
size_t i = 0, j = 0;
303306
for (i = 0; i < mesh1.nb_noeuds ( ); i++)
@@ -310,8 +313,8 @@ void XlmLimaComparer::run ( )
310313
} // if (n1.id ( ) != n2.id ( ))
311314
if (n1 != n2)
312315
{
313-
str << "Les noeuds " << n1.id ( ) << " n'ont pas les mêmes coordonnées (" << n1.x ( ) << ", " << n1.y ( ) << ", "
314-
<< n1.z ( ) << ") / (" << n2.x ( ) << ", " << n2.y ( ) << ", " << n2.z ( ) << ").";
316+
str << "Les noeuds " << n1.id ( ) << " n'ont pas les mêmes coordonnées (" << setprecision (20)
317+
<< n1.x ( ) << ", " << n1.y ( ) << ", " << n1.z ( ) << ") / (" << n2.x ( ) << ", " << n2.y ( ) << ", " << n2.z ( ) << ").";
315318
throw XlmLimaException (str.str ( ));
316319
} // if (n1 != n2)
317320
} // for (i = 0; i < mesh1.nb_noeuds ( ); i++)

src/Xlmlima_exe/XlmLimaFactory.cpp

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,27 +167,47 @@ XlmLimaAction* XlmLimaFactory::createAction (int argc, char* argv [])
167167

168168
if (action == "-cmp")
169169
{
170+
double precision = DBL_EPSILON;
170171
string inputFile2 ("");
171172
format_t inputFormat2 = SUFFIXE;
172173

173174
switch (argc)
174175
{
175-
case 3 :
176+
case 3 : // => -cmp infile outfile
176177
inputFile = argv [1];
177178
inputFile2 = argv [2];
178179
break;
179180
case 5 :
181+
if (0 == strcmp (argv [3], "-precision"))
182+
{ // => -cmp infile outfile -precision precision
183+
inputFile = argv [1];
184+
inputFile2 = argv [2];
185+
precision = stringToDouble (argv [4]);
186+
} // if (0 == strcmp (argv [3], "-precision"))
187+
else
188+
{ // -cmp format infile format outfile
189+
inputFormat = stringToFormat (argv [1]);
190+
inputFile = argv [2];
191+
inputFormat2= stringToFormat (argv [3]);
192+
inputFile2 = argv [4];
193+
} // else if (0 == strcmp (argv [3], "-precision"))
194+
break;
195+
case 7 : // -cmp format infile format outfile -precision precision
196+
if (0 != strcmp (argv [6], "-precision"))
197+
break;
180198
inputFormat = stringToFormat (argv [1]);
181199
inputFile = argv [2];
182200
inputFormat2= stringToFormat (argv [3]);
183201
inputFile2 = argv [4];
202+
precision = stringToDouble (argv [6]);
184203
break;
185204
default :
186205
syntax ( );
187206
} // switch (argc)
188207

189-
return new XlmLimaComparer (
190-
inputFile, inputFormat, inputFile2, inputFormat2);
208+
XlmLimaComparer* comparer = new XlmLimaComparer (inputFile, inputFormat, inputFile2, inputFormat2);
209+
comparer->setPrecision (precision); // v 7.12.2
210+
return comparer;
191211
} // if (action == "-cmp")
192212

193213

@@ -281,7 +301,7 @@ void XlmLimaFactory::syntax ( )
281301
message += string ("\n \tpour préparer\n");
282302
message += string (" -cp [format] fichier_entrée [format] fichier_sortie");
283303
message += string ("\n \tpour copier\n");
284-
message += string (" -cmp [format] fichier1 [format] fichier2");
304+
message += string (" -cmp [format] fichier1 [format] fichier2 [-precision precision]");
285305
message += string ("\n \tpour comparer deux maillages\n");
286306
message += string (" -m [format] fichier_entrée [format] fichier_sortie");
287307
message += string ("\n \tpour exprimer les coordonnées en mètres\n");

0 commit comments

Comments
 (0)