Resolve "VariableRF, FFA, Offset and MultipoleT: unify units internally"
- Closes #787 (closed)
- Update license headers and fix coding style
Merge request reports
Activity
changed milestone to %2024.1
added Cleanup Enhancement labels
assigned to @ext-calvo_p
added 2 commits
requested review from @adelmann, @snuverink_j, @ext-rogers_c, and @carl_j
@ext-rogers_c: could you have a look to this MR? Specially to the first two commits.
I have ensured that all unit tests are successful and VFFA-1 regression test passes, but I may have made a mistake in the internal unit change.
- Resolved by ext-calvo_p
Browsing the code I notice that there are no changes in PyOpal, did you run the PyOpal tests at
tests/opal_src/PyOpal/
==
Unfortunately I get a fail at compile time, probably unrelated to the issue. It looks like a problem from Vektor, defined in ippl/src/AppTypes/Vektor.h, although diff tells me there are no differences between my IPPL AppTypes and the version in this source tree.
[ 20%] Building CXX object src/CMakeFiles/libOPALObj.dir/AbstractObjects/BeamSequence.cpp.o In file included from /usr/include/c++/11/cassert:44, from /home/cr67/Software/install/include/boost/numeric/ublas/detail/config.hpp:16, from /home/cr67/Software/install/include/boost/numeric/ublas/exception.hpp:19, from /home/cr67/Software/install/include/boost/numeric/ublas/storage.hpp:26, from /home/cr67/Software/install/include/boost/numeric/ublas/vector.hpp:21, from /home/cr67/Software/install/include/boost/numeric/ublas/matrix.hpp:18, from /home/cr67/Software/OPAL/opal_src_3/src/Algorithms/BoostMatrix.h:21, from /home/cr67/Software/OPAL/opal_src_3/src/Classic/Algorithms/CoordinateSystemTrafo.h:4, from /home/cr67/Software/OPAL/opal_src_3/src/Classic/AbsBeamline/ElementBase.h:67, from /home/cr67/Software/OPAL/opal_src_3/src/AbstractObjects/Element.h:34, from /home/cr67/Software/OPAL/opal_src_3/src/AbstractObjects/BeamSequence.h:21, from /home/cr67/Software/OPAL/opal_src_3/src/AbstractObjects/BeamSequence.cpp:19: /home/cr67/Software/OPAL/opal_src_3/src/Algorithms/BoostMatrix.h: In instantiation of ‘T prod_boost_vector(const boost::numeric::ublas::matrix<double>&, const T&) [with T = Vektor<double, 3>]’: /home/cr67/Software/OPAL/opal_src_3/src/Classic/Algorithms/CoordinateSystemTrafo.h:78:29: required from here /home/cr67/Software/OPAL/opal_src_3/src/Algorithms/BoostMatrix.h:28:19: error: ‘const class Vektor<double, 3>’ has no member named ‘size’; did you mean ‘Size’? 28 | assert(vector.size() == 3); | ~~~~~~~^~~~ make[2]: *** [src/CMakeFiles/libOPALObj.dir/build.make:160: src/CMakeFiles/libOPALObj.dir/AbstractObjects/BeamSequence.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:2182: src/CMakeFiles/libOPALObj.dir/all] Error 2 make: *** [Makefile:136: all] Error 2
- Resolved by ext-calvo_p
I don't see how anything can build at all, the compile error is correctly flagging a non-existent function that is called by BoostMatrix, namely Vektor::size. Anyway, I agree it is not related to this issue and it can be worked around by commenting the relevant assert statement.
PyOpal tests are not run by default because it is still an experimental feature. I don't know how to make it all work because it depends on testing infrastructure that I do not have any sight of (like the nightly tests and things). It should be possible make some sort of C++ unit test that auto-runs the PyOpal tests, and even sees the relevant CMake compile flag, but I have not implemented that.
Upon spending a morning digging, it looks like a terrible evil has befallen the PyOpal tests. Some horrible confusion of Ippl and MPI that I do not find straight forwards to untangle. Sigh.
Anyway, in general the elements in src/PyOpal/PyElements wrap the OpalElement, so this should be correctly implemented by the changes here, I hope. However, there are direct calls to element::apply in order to directly access the field values (for user validation), and implemented as get_field_value on the python side, where unit conversions are necessary to maintain the correct user-side units.
I raised the build error as #789 (closed)
added 2 commits