diff --git a/Core/Algorithms/inc/ILayerRTCoefficients.h b/Core/Algorithms/inc/ILayerRTCoefficients.h index 6e0738e23bcfc5bdd1a2a5549ee1515e867a880d..90da0dc6acd980281429fa00787da31449c391e4 100644 --- a/Core/Algorithms/inc/ILayerRTCoefficients.h +++ b/Core/Algorithms/inc/ILayerRTCoefficients.h @@ -18,7 +18,7 @@ #include "Types.h" #include "EigenCore.h" - +#include "Exceptions.h" //! @class ILayerRTCoefficients //! @ingroup algorithms_internal diff --git a/Core/Geometry/inc/BasicVector3D.h b/Core/Geometry/inc/BasicVector3D.h index b7ecb970e2f694ab10fc780c1798e8e8ce8ad004..47fc7d015556a8290f440a9dcc87c12cdbc25f33 100644 --- a/Core/Geometry/inc/BasicVector3D.h +++ b/Core/Geometry/inc/BasicVector3D.h @@ -23,7 +23,6 @@ #include "Numeric.h" #include "Units.h" -#include "Exceptions.h" #include "WinDllMacros.h" #include <complex> @@ -337,5 +336,3 @@ BA_CORE_API_ BasicVector3D<std::complex<double> > toComplexVector( } // namespace Geometry #endif /* GEOMETRY_BASICVECTOR3D_H */ - - diff --git a/Core/Tools/inc/IAxis.h b/Core/Tools/inc/IAxis.h index f3fa56d68c415e23f4868c273b6a40c2deece7a8..e82fe40f7a0a1e625aebcccc0a606f7750f55cf0 100644 --- a/Core/Tools/inc/IAxis.h +++ b/Core/Tools/inc/IAxis.h @@ -17,6 +17,7 @@ #define IAXIS_H_ #include "Bin.h" +#include "Exceptions.h" //! @class IAxis //! @ingroup tools_internal @@ -135,5 +136,3 @@ inline bool HaveSameNameAndShape(const IAxis& left, const IAxis& right) } #endif /* IAXIS_H_ */ - - diff --git a/dev-tools/math/test_polyhedron.cpp b/dev-tools/math/test_polyhedron.cpp new file mode 100644 index 0000000000000000000000000000000000000000..89e2f48ec9d84222849105e53bdfb996adece806 --- /dev/null +++ b/dev-tools/math/test_polyhedron.cpp @@ -0,0 +1,48 @@ +// internal test program +// JWu 2016 + +#include <complex> +using std::complex; +#include <iostream> +#include <cstdio> +#include <vector> +using std::vector; + +typedef complex<double> cmplx; +class q_type { +public: + q_type( double _abs, cmplx _ux, cmplx _uy, cmplx _uz ) : abs(_abs), uvec({_ux,_uy,_uz}) {}; + double abs; + cmplx uvec[3]; +}; + +cmplx face( const vector<double*>& VV ) +{ +// for( auto V: VV ) +// for( int i=0; i<3; ++i ) +// std::cout << "corner" << i << ": " << V[i] << "\n"; + // compute n_k + + return cmplx(1.,0); +} + +cmplx ff( const q_type q ) +{ + double V[4][3] = { + { 0., 0., 0. }, + { 1., 0., 0. }, + { 0., 1., 0. }, + { 0., 0., 1. } }; + cmplx res = 0; + res += face( { V[0], V[1], V[2] } ); + res += face( { V[0], V[3], V[1] } ); + res += face( { V[0], V[2], V[3] } ); + res += face( { V[1], V[3], V[2] } ); + return res; +} + +int main (int argc, char *argv[]) +{ + q_type q( 0., 1., 0., 0. ); + std::cout << "volume: " << ff(q) << "\n"; +} diff --git a/dev-tools/math/triangle.cpp b/dev-tools/math/triangle.cpp deleted file mode 100644 index 9b4c7687565dbab4db3376d7ef09bf3b608e18bc..0000000000000000000000000000000000000000 --- a/dev-tools/math/triangle.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include <complex> -using std::complex; -#include <iostream> -#include <cstdio> - -typedef long double quad; - -complex<double> eval( double a, double b, int mode, int& info ) -{ - static double eps = 1e-8; - quad aa = a; - quad bb = b; - complex<quad> ci( 0.L, 1.L ); - complex<quad> res; - if( std::abs(b)<eps ) { - if( std::abs(a)<eps ) { - info = 5; - res = 1; - } else { - info = 6; - res = 2.L*(-1.L + (1.L-ci*aa)*std::exp(ci*aa))/aa/aa; - } - } else { - if( std::abs(a-b)<eps ) { - info = 3; - res = ((1.L-std::exp(ci*(aa+bb)))/(aa+bb) + ci ) / bb; - } else if( std::abs(a+b)<eps ) { - info = 4; - res = ( -ci - (1.L-std::exp(ci*(aa-bb)))/(aa-bb) ) / bb; - } else { - if ( mode==1 ) { - info = 1; - res = ( (1.L-std::exp(ci*(aa+bb)))/(aa+bb) - - (1.L-std::exp(ci*(aa-bb)))/(aa-bb) ) / bb; - } else if ( mode==2 ) { - info = 2; - res = (-1.L + ( std::cos(bb) - ci*aa*std::sin(bb)/bb)* - std::exp(ci*aa)) * 2.L / (aa*aa-bb*bb); - } else - throw "unexpected mode"; - } - } - return (complex<double>)(res); -} - - -int line_test( double a_step, double b_step, double a_perp, double b_perp ) -{ - static int Nj = 35; - static int Ni = 15; - int count = 0; - for( int j=0; j<Nj; ++j ) { - double pos = 1e-20*pow(10.,j*21./Nj); - double a = a_step * pos; - double b = b_step * pos; - for( int i=0; i<Ni; ++i ){ - double del = 1e-20*pow(10.,i*21./Ni); - double aa = a + a_perp * del; - double bb = b + b_perp * del; - int i1, i2; - complex<double> e1 = eval(aa,bb,1,i1); - complex<double> e2 = eval(aa,bb,2,i2); - double dd = std::abs(e1 - e2) / ( std::abs(e1) + std::abs(e2) ) * 2; - if( std::abs(dd)>1e-8 ) { - ++count; - printf( "%9.2g %9.2g %1i %11.4g %11.4g %1i %11.4g %11.4g %11.4g\n", - aa, bb, - i1, 1-e1.real(), e1.imag(), - i2, 1-e2.real(), e2.imag(), dd ); - } - } - } - printf( "#--> #problems = %i\n", count ); - return count; -} - -int main (int argc, char *argv[]) -{ - int totcount = 0; - constexpr double r2 = sqrt(0.5); - std::cout << "## line b=0 ##\n"; - totcount += line_test( 1., 0., 0., 1. ); - std::cout << "## line a=b ##\n"; - totcount += line_test( r2, r2, r2, -r2 ); - std::cout << "## line a=-b ##\n"; - totcount += line_test( r2, -r2, r2, r2 ); - std::cout << "## line a=0 ##\n"; - totcount += line_test( 0., 1., 1., 0. ); - std::cout << "## oblique line ##\n"; - constexpr double r3 = sqrt(1/3.); - constexpr double c3 = sqrt(1-r3*r3); - totcount += line_test( r3, c3, c3, -r3); - printf( "#==> #Problems = %i\n", totcount ); -}