Skip to content
Snippets Groups Projects
Commit 67ba60b6 authored by Andrea Dell'Acqua's avatar Andrea Dell'Acqua
Browse files

Major revision of GeoModel/GeoModelTools/ExpressionEvaluator.

Main target is to replace the CLHEP Evaluator (totally outdated) with Partow's
Mathematical Expression Library (http://www.partow.net/programming/exprtk/index.html).
The move affects AGDD/MuonDD, GeoModelXML and GDMLtoGM at different levels: GeoModelXML
uses the CLHEP Evaluator directly while AGDD/GDMLtoGM get to the Evaluator by means of
the utility class ExpressionEvaluator. The original CLHEP Evaluator was left basically
untouched (hence GeoModelXML is as a matter of principle NOT touched by this move),
the Evaluator's signature was abstracted into IEvaluator.h and a new evaluator class
(ExprtkEvaluator, based on Partow's) was developed. The ExpressionEvaluator class was
totally rewritten to use the new ExprtkEvaluator by keeping the original UI: this means
that, with little changes, AGDD/MuonDD and GDMLtoGM DO NOW USE the new evaluator.

Tests were run on the AMDC XML files and no difference was observed but there are two
important caveats to be borne in mind:
1) the original exponentiation operator ("**" as in FORTRAN) is replaced by the Caret
symbol ("^") in Partow's. To avoid modifying the AMDC files a hack was introduced, which
seems to work well but which is hopefully not to stay forever.
2) array elements, which used to be dereferenced by means of underscores ( array_i_ ) are
back to to their usual form ( array[i] ) in Partow's. This has no impact on AGDD (the old
ExpressionEvaluator was already taking care of that) but IT WILL AFFECT the way arrays
are used in GDMLtoGM and GeoModelXML (if and when it will be moved to the new evaluator).

More developments and a general tidy-up are to be foreseen in future but this is the bulk
of it, please report any problem/misfunctioning...

<dellacqu@mail.cern.ch>

Changes to be committed:
deleted:    GeoModelTools/ExpressionEvaluator/ExpressionEvaluator/AGDDTokenizer.h
modified:   GeoModelTools/ExpressionEvaluator/ExpressionEvaluator/Evaluator.h
modified:   GeoModelTools/ExpressionEvaluator/ExpressionEvaluator/ExpressionEvaluator.h
new file:   GeoModelTools/ExpressionEvaluator/ExpressionEvaluator/ExprtkEvaluator.h
new file:   GeoModelTools/ExpressionEvaluator/ExpressionEvaluator/IEvaluator.h
new file:   GeoModelTools/ExpressionEvaluator/ExpressionEvaluator/exprtk.hpp
deleted:    GeoModelTools/ExpressionEvaluator/ExpressionEvaluator/test.hpp
deleted:    GeoModelTools/ExpressionEvaluator/src/AGDDTokenizer.cxx
modified:   GeoModelTools/ExpressionEvaluator/src/ExpressionEvaluator.cxx
new file:   GeoModelTools/ExpressionEvaluator/src/ExprtkEvaluator.cxx
modified:   GeoModelTools/ExpressionEvaluator/src/setSystemOfUnits.cxx
modified:   GeoModelTools/GeoModelXMLParser/GeoModelXMLParser/XMLHandler.h
modified:   GeoModelTools/GeoModelXMLParser/src/XMLHandler.cxx
parent 6ccf3413
No related branches found
No related tags found
No related merge requests found
Showing
with 40510 additions and 333 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment