Skip to content

Commit

Permalink
Merge pull request #305 from CFD-GO/master
Browse files Browse the repository at this point in the history
propagation of #303
  • Loading branch information
llaniewski authored Aug 5, 2020
2 parents ae27b1f + 99242e5 commit 0d8d7ca
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "TCLB_tests"]
path = tests
url = https://github.com/CFD-GO/TCLB_tests.git
url = ../../CFD-GO/TCLB_tests.git
50 changes: 28 additions & 22 deletions src/compare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,34 +234,40 @@ int main(int argc, char *argv[]) {
std::set< std::string > names;
for (Tabs::TabMap::iterator it = tabs1.tab.begin(); it != tabs1.tab.end(); it++) names.insert(it->first);
for (Tabs::TabMap::iterator it = tabs2.tab.begin(); it != tabs2.tab.end(); it++) names.insert(it->first);
bool result = true;
for (std::set< std::string >::iterator it = names.begin(); it != names.end(); it++) {
std::string name = *it;
if (tabs1.tab.find(name) == tabs1.tab.end()) {
printf("%s not in first file\n", name.c_str());
exit(-1);
}
if (tabs2.tab.find(name) == tabs2.tab.end()) {
result = false;
} else if (tabs2.tab.find(name) == tabs2.tab.end()) {
printf("%s not in second file\n", name.c_str());
exit(-1);
}
double diff = tabs1.tab[name]->compare(tabs2.tab[name]);
printf("%s: Max difference: %lg", name.c_str(), diff);
double auto_eps;
if (tabs1.tab[name]->ftype == "Float64") {
auto_eps = 2.22e-16;
} else if (tabs1.tab[name]->ftype == "Float32") {
auto_eps = 1.19e-07;
result = false;
} else {
auto_eps = 0;
}
if (auto_eps != 0) {
printf(" = %.1lf * %lg", diff / auto_eps, auto_eps);
double diff = tabs1.tab[name]->compare(tabs2.tab[name]);
printf("%s: Max difference: %lg", name.c_str(), diff);
double auto_eps;
if (tabs1.tab[name]->ftype == "Float64") {
auto_eps = 2.22e-16;
} else if (tabs1.tab[name]->ftype == "Float32") {
auto_eps = 1.19e-07;
} else {
auto_eps = 0;
}
if (auto_eps != 0) {
printf(" = %.1lf * %lg", diff / auto_eps, auto_eps);
}
if (diff > auto_eps * eps) {
printf(" --- WRONG\n");
result = false;
} else {
printf(" --- OK\n");
}
}
if (diff > auto_eps * eps) {
printf(" --- WRONG\n");
exit(-1);
} else {
printf(" --- OK\n");
}
}
if (result) {
return 0;
} else {
return -1;
}
}
2 changes: 1 addition & 1 deletion tests
Submodule tests updated 68 files
+4 −2 d2q9/karman.test
+0 −7 d2q9/karman_by_val.test
+36 −0 d2q9/output/pythonGeom_VTK_P00_00000000.vti
+0 −1 d2q9/output/pythonGeom_VTK_P00_00000000.vti.sha1
+1 −2 d2q9/pythonGeom.test
+0 −17 d2q9_bc/output/runexternal_VTK_P00_00000010.pvti
+0 −1 d2q9_bc/output/runexternal_VTK_P00_00000010.vti.sha1
+0 −17 d2q9_bc/output/runexternal_VTK_P00_00000020.pvti
+0 −1 d2q9_bc/output/runexternal_VTK_P00_00000020.vti.sha1
+0 −17 d2q9_bc/output/runexternal_VTK_P00_00000030.pvti
+0 −1 d2q9_bc/output/runexternal_VTK_P00_00000030.vti.sha1
+0 −17 d2q9_bc/output/runexternal_VTK_P00_00000040.pvti
+0 −1 d2q9_bc/output/runexternal_VTK_P00_00000040.vti.sha1
+0 −17 d2q9_bc/output/runexternal_VTK_P00_00000050.pvti
+0 −1 d2q9_bc/output/runexternal_VTK_P00_00000050.vti.sha1
+0 −17 d2q9_bc/output/runexternal_VTK_P00_00000060.pvti
+0 −1 d2q9_bc/output/runexternal_VTK_P00_00000060.vti.sha1
+0 −17 d2q9_bc/output/runexternal_VTK_P00_00000070.pvti
+0 −1 d2q9_bc/output/runexternal_VTK_P00_00000070.vti.sha1
+0 −17 d2q9_bc/output/runexternal_VTK_P00_00000080.pvti
+0 −1 d2q9_bc/output/runexternal_VTK_P00_00000080.vti.sha1
+0 −17 d2q9_bc/output/runexternal_VTK_P00_00000090.pvti
+0 −1 d2q9_bc/output/runexternal_VTK_P00_00000090.vti.sha1
+36 −0 d2q9_bc/output/runexternal_VTK_P00_00000100.vti
+0 −1 d2q9_bc/output/runexternal_VTK_P00_00000100.vti.sha1
+1 −20 d2q9_bc/runexternal.test
+1 −1 d2q9_bc/runexternal.xml
+1 −10 d2q9_kuper/drop.test
+0 −18 d2q9_kuper/output/drop_VTK_P00_00000010.pvti
+0 −1 d2q9_kuper/output/drop_VTK_P00_00000010.vti.sha1
+0 −18 d2q9_kuper/output/drop_VTK_P00_00000020.pvti
+0 −1 d2q9_kuper/output/drop_VTK_P00_00000020.vti.sha1
+0 −18 d2q9_kuper/output/drop_VTK_P00_00000030.pvti
+0 −1 d2q9_kuper/output/drop_VTK_P00_00000030.vti.sha1
+0 −18 d2q9_kuper/output/drop_VTK_P00_00000040.pvti
+0 −1 d2q9_kuper/output/drop_VTK_P00_00000040.vti.sha1
+39 −0 d2q9_kuper/output/drop_VTK_P00_00000050.vti
+0 −1 d2q9_kuper/output/drop_VTK_P00_00000050.vti.sha1
+0 −20 d2q9_pf/output/zalesak_VTK_P00_00000100.pvti
+0 −1 d2q9_pf/output/zalesak_VTK_P00_00000100.vti.sha1
+0 −20 d2q9_pf/output/zalesak_VTK_P00_00000200.pvti
+0 −1 d2q9_pf/output/zalesak_VTK_P00_00000200.vti.sha1
+0 −20 d2q9_pf/output/zalesak_VTK_P00_00000300.pvti
+0 −1 d2q9_pf/output/zalesak_VTK_P00_00000300.vti.sha1
+0 −20 d2q9_pf/output/zalesak_VTK_P00_00000400.pvti
+0 −1 d2q9_pf/output/zalesak_VTK_P00_00000400.vti.sha1
+0 −20 d2q9_pf/output/zalesak_VTK_P00_00000500.pvti
+0 −1 d2q9_pf/output/zalesak_VTK_P00_00000500.vti.sha1
+45 −0 d2q9_pf/output/zalesak_VTK_P00_00000600.vti
+0 −1 d2q9_pf/output/zalesak_VTK_P00_00000600.vti.sha1
+0 −12 d2q9_pf/zalesak.test
+3 −0 d2q9_pf/zalesak.test_
+1 −1 d2q9_pf/zalesak.xml
+0 −20 d2q9_pf_fd/output/zalesak_VTK_P00_00000100.pvti
+0 −1 d2q9_pf_fd/output/zalesak_VTK_P00_00000100.vti.sha1
+0 −20 d2q9_pf_fd/output/zalesak_VTK_P00_00000200.pvti
+0 −1 d2q9_pf_fd/output/zalesak_VTK_P00_00000200.vti.sha1
+0 −20 d2q9_pf_fd/output/zalesak_VTK_P00_00000300.pvti
+0 −1 d2q9_pf_fd/output/zalesak_VTK_P00_00000300.vti.sha1
+0 −20 d2q9_pf_fd/output/zalesak_VTK_P00_00000400.pvti
+0 −1 d2q9_pf_fd/output/zalesak_VTK_P00_00000400.vti.sha1
+0 −20 d2q9_pf_fd/output/zalesak_VTK_P00_00000500.pvti
+0 −1 d2q9_pf_fd/output/zalesak_VTK_P00_00000500.vti.sha1
+45 −0 d2q9_pf_fd/output/zalesak_VTK_P00_00000600.vti
+0 −1 d2q9_pf_fd/output/zalesak_VTK_P00_00000600.vti.sha1
+0 −12 d2q9_pf_fd/zalesak.test
+3 −0 d2q9_pf_fd/zalesak.test_
+1 −1 d2q9_pf_fd/zalesak.xml
12 changes: 6 additions & 6 deletions tools/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ fi

if test -z "$TESTS"
then
echo "No tests for model $MODEL \(WARNING: there is a directory tests/$MODEL !\)"
echo "Exiting with error. Because I Can."
exit -1
echo "No tests for model $MODEL (WARNING: there is a directory tests/$MODEL)"
echo "Exiting with no error."
exit 0
fi


Expand All @@ -150,9 +150,9 @@ export PYTHONPATH="$PYTHONPATH:$PWD/tools/python"

function runline {
CMD=$1
R=$2
G=$TEST_DIR/$R
shift
R=$1
G=$TEST_DIR/$R
case $CMD in
need)
comment_wait "copy $@"
Expand All @@ -175,7 +175,7 @@ function runline {
csvdiff) try "checking $R (csvdiff)" $TCLB/tools/csvdiff -a "$R" -b "$G" -x 1e-10 -d Walltime ;;
diff) try "checking $R" diff "$R" "$G" ;;
sha1) try "checking $R (sha1)" sha1sum -c "$G.sha1" ;;
pvtidiff) try "checking $R (pvtidiff)" $TCLB/CLB/$MODEL/compare "$R" "$G" 8;;
pvtidiff) try "checking $R (pvtidiff)" $TCLB/CLB/$MODEL/compare "$R" "$G" "${2:-8}" ;; # ${2:-8} is { if $2 == "" then "8" else $2 }
*) echo "unknown: $CMD"; return -1;;
esac
return 0;
Expand Down

0 comments on commit 0d8d7ca

Please sign in to comment.