diff --git a/App/App.pro b/App/App.pro index f31b9994ad4195b4c4fbcf8a3673fa6d4689fb92..917f84b3718523d504eff240565b485efc0546f1 100644 --- a/App/App.pro +++ b/App/App.pro @@ -2,7 +2,7 @@ TEMPLATE = app CONFIG += console CONFIG -= qt CONFIG -= app_bundle -CONFIG += debug +#CONFIG += debug QT -= core gui #CONFIG += GPERFTOOLS # to compile with GPERFTOOLS support for code profiling diff --git a/App/inc/TestPerformance.h b/App/inc/TestPerformance.h index a09a454e0bb1f8e8e55712179c467f6017a4ba91..2451962d394bffd8c4566eaa86e56e7641571329 100644 --- a/App/inc/TestPerformance.h +++ b/App/inc/TestPerformance.h @@ -58,6 +58,9 @@ private: //! return delimeter between columns std::string get_delimeter() { return std::string(" | "); } + //! adjust string length to requested + std::string adjust_string_length(std::string name, int length); + std::map<std::string, std::string > m_performance_info; //!< holds system information performance_tests_t m_tests; //!< list of tests for performance measurements diff --git a/App/src/TestDetectorResolution.cpp b/App/src/TestDetectorResolution.cpp index 5078764c19e17e5daa012b56bf34ddf3560b4f63..f42a9fad6bfcdfb73d1be64d95a4bca48d38726a 100644 --- a/App/src/TestDetectorResolution.cpp +++ b/App/src/TestDetectorResolution.cpp @@ -39,12 +39,12 @@ void TestDetectorResolution::execute() initializeSample(); GISASExperiment experiment; experiment.setSample(mp_sample); - experiment.setDetectorParameters(0.0*Units::degree, 2.0*Units::degree, 100 - , 0.0*Units::degree, 2.0*Units::degree, 100); + experiment.setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree + ,100, 0.0*Units::degree, 2.0*Units::degree); experiment.setDetectorResolutionFunction(&testResolutionFunction); experiment.setBeamParameters(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); experiment.runSimulation(); - mp_intensity_output = experiment.getOutputData(); + mp_intensity_output = experiment.getOutputDataClone(); IsGISAXSTools::drawLogOutputData(*mp_intensity_output, "c1_test_detector_resolution", "Detector resolution", "CONT4 Z"); } diff --git a/App/src/TestFactory.cpp b/App/src/TestFactory.cpp index e9328d32cddc2903bcb6f1a4306804665e9c6ac0..240689f136be91df0b884a8fa682c99ef9f7fbcb 100644 --- a/App/src/TestFactory.cpp +++ b/App/src/TestFactory.cpp @@ -97,7 +97,7 @@ void TestFactory::profile(std::string name) } test->initialise(); - for(int i=0; i<10; i++) test->execute(); + for(int i=0; i<1; i++) test->execute(); } diff --git a/App/src/TestFittingModule.cpp b/App/src/TestFittingModule.cpp index 7f36047e15b88299607de6e8e8aaee697eb35a58..1816490d4f80cce7c9e8c0a3c7d6265a56615298 100644 --- a/App/src/TestFittingModule.cpp +++ b/App/src/TestFittingModule.cpp @@ -34,11 +34,11 @@ void TestFittingModule::execute() initializeSample(); GISASExperiment experiment; experiment.setSample(mp_sample); - experiment.setDetectorParameters(0.0*Units::degree, 2.0*Units::degree, 100 - , 0.0*Units::degree, 2.0*Units::degree, 100); + experiment.setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree + ,100 , 0.0*Units::degree, 2.0*Units::degree); experiment.setBeamParameters(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); experiment.runSimulation(); - mp_exact_data = experiment.getOutputData(); + mp_exact_data = experiment.getOutputDataClone(); // Generate noisy version generateRealData(0.2); IsGISAXSTools::drawLogOutputData(*mp_real_data, "c1_test_fitting", "fitting", "CONT4 Z"); diff --git a/App/src/TestFresnelCoeff.cpp b/App/src/TestFresnelCoeff.cpp index 4cc68bcceee76753b25c148fa10e142d3f280e08..c1f4591b888078f69dc5e4275974224b4147b47c 100644 --- a/App/src/TestFresnelCoeff.cpp +++ b/App/src/TestFresnelCoeff.cpp @@ -69,7 +69,8 @@ void TestFresnelCoeff::test_standard_samples() m_coeffs->resetIndex(); while (m_coeffs->hasNext()) { double alpha_i = m_coeffs->getCurrentValueOfAxis<double>("alpha_i"); - kvector_t kvec = kvector_t::LambdaAlphaPhi(1.54*Units::angstrom, -alpha_i, 0.0); + kvector_t kvec; + kvec.setLambdaAlphaPhi(1.54*Units::angstrom, -alpha_i, 0.0); OpticalFresnel::MultiLayerCoeff_t coeffs; OpticalFresnel fresnelCalculator; @@ -270,7 +271,8 @@ void TestFresnelCoeff::test_roughness_set() double roughness = m_coeffs->getCurrentValueOfAxis<double>("roughness"); multipar.setValue(roughness); - kvector_t kvec = kvector_t::LambdaAlphaPhi(1.54*Units::angstrom, -alpha_i, 0.0); + kvector_t kvec; + kvec.setLambdaAlphaPhi(1.54*Units::angstrom, -alpha_i, 0.0); OpticalFresnel::MultiLayerCoeff_t coeffs; OpticalFresnel fresnelCalculator; fresnelCalculator.execute(*m_sample, kvec, coeffs, true); diff --git a/App/src/TestIsGISAXS1.cpp b/App/src/TestIsGISAXS1.cpp index 107dd7d2061af40df3c587f926d467d2a61044e0..8db600fc870867dfd9e72d5893a181c4678975ba 100644 --- a/App/src/TestIsGISAXS1.cpp +++ b/App/src/TestIsGISAXS1.cpp @@ -35,12 +35,12 @@ void TestIsGISAXS1::execute() initializeSample(); GISASExperiment experiment; experiment.setSample(mp_sample); - experiment.setDetectorParameters(-1.0*Units::degree, 1.0*Units::degree, 100 - , 0.0*Units::degree, 2.0*Units::degree, 100, true); + experiment.setDetectorParameters(100,-1.0*Units::degree, 1.0*Units::degree + , 100, 0.0*Units::degree, 2.0*Units::degree, true); experiment.setBeamParameters(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); experiment.runSimulation(); if (mp_intensity_output) delete mp_intensity_output; - mp_intensity_output = experiment.getOutputData(); + mp_intensity_output = experiment.getOutputDataClone(); IsGISAXSTools::drawLogOutputData(*mp_intensity_output, "c1_test_2_particles_formfactor", "Two particles mean DWBA Formfactor", "CONT4 Z"); IsGISAXSTools::writeOutputDataToFile(*mp_intensity_output, Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-1/2-particles.ima"); diff --git a/App/src/TestIsGISAXS10.cpp b/App/src/TestIsGISAXS10.cpp index 3534f8cef731bd2a6f1d26e50f010e4356293cb4..d72f7579930193728513e8f9c65050b0ad29d8eb 100644 --- a/App/src/TestIsGISAXS10.cpp +++ b/App/src/TestIsGISAXS10.cpp @@ -29,11 +29,11 @@ void TestIsGISAXS10::execute() initializeSample(); GISASExperiment experiment; experiment.setSample(mp_sample); - experiment.setDetectorParameters(0.0*Units::degree, 2.0*Units::degree, 100 - , 0.0*Units::degree, 2.0*Units::degree, 100, true); + experiment.setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree + , 100, 0.0*Units::degree, 2.0*Units::degree, true); experiment.setBeamParameters(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); experiment.runSimulation(); - mp_intensity_output = experiment.getOutputData(); + mp_intensity_output = experiment.getOutputDataClone(); IsGISAXSTools::drawLogOutputData(*mp_intensity_output, "c1_test_isgisaxs_10", "1D paracrystal islands", "CONT4 Z"); IsGISAXSTools::writeOutputDataToFile(*mp_intensity_output, Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-10/para1dcyl.ima"); diff --git a/App/src/TestIsGISAXS3.cpp b/App/src/TestIsGISAXS3.cpp index 3d3a626a419705bbc7531ab1932204d9d7debd94..3d7169f69d0faa009b7ba5106b5bd4a5e12e6c79 100644 --- a/App/src/TestIsGISAXS3.cpp +++ b/App/src/TestIsGISAXS3.cpp @@ -28,12 +28,12 @@ void TestIsGISAXS3::execute() initializeSample(); GISASExperiment experiment; experiment.setSample(mp_sample); - experiment.setDetectorParameters(0.0*Units::degree, 2.0*Units::degree, 100 - , 0.0*Units::degree, 2.0*Units::degree, 100, true); + experiment.setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree + , 100, 0.0*Units::degree, 2.0*Units::degree, true); experiment.setBeamParameters(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); experiment.runSimulation(); if (mp_intensity_output) delete mp_intensity_output; - mp_intensity_output = experiment.getOutputData(); + mp_intensity_output = experiment.getOutputDataClone(); IsGISAXSTools::drawLogOutputData(*mp_intensity_output, "c1_test_dwba_formfactor", "Cylinder DWBA Formfactor", "CONT4 Z"); IsGISAXSTools::writeOutputDataToFile(*mp_intensity_output, Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-3/dwbacyl.ima"); diff --git a/App/src/TestIsGISAXS9.cpp b/App/src/TestIsGISAXS9.cpp index e98fb8fd5713dec79e887b29738ba1d3651e0e5a..33f7876c95fa535595d755cdf0fbae31133ed6c9 100644 --- a/App/src/TestIsGISAXS9.cpp +++ b/App/src/TestIsGISAXS9.cpp @@ -48,22 +48,21 @@ void TestIsGISAXS9::execute() // setting experiment GISASExperiment experiment; - experiment.setDetectorParameters(0.0*Units::degree, 2.0*Units::degree, 100 - , 0.0*Units::degree, 2.0*Units::degree, 100, true); + experiment.setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree, 100, 0.0*Units::degree, 2.0*Units::degree, true); experiment.setBeamParameters(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); // pyramid initializeSample_Pyramid(); experiment.setSample(m_sample); experiment.runSimulation(); - m_results.push_back( experiment.getOutputData() ); + m_results.push_back( experiment.getOutputDataClone() ); IsGISAXSTools::writeOutputDataToFile(*m_results.back(), Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-9/this_pyramid_Z0.ima"); // rotated pyramid initializeSample_RotatedPyramid(); experiment.setSample(m_sample); experiment.runSimulation(); - m_results.push_back( experiment.getOutputData() ); + m_results.push_back( experiment.getOutputDataClone() ); IsGISAXSTools::writeOutputDataToFile(*m_results.back(), Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-9/this_pyramid_Z45.ima"); } diff --git a/App/src/TestMesoCrystal.cpp b/App/src/TestMesoCrystal.cpp index 7adad2c434844588c60a816bdbc9e51fb4bc1b7e..d729d78fa9f81d35d79178c98f50c9a1fab974c3 100644 --- a/App/src/TestMesoCrystal.cpp +++ b/App/src/TestMesoCrystal.cpp @@ -44,12 +44,12 @@ void TestMesoCrystal::execute() initializeSample(); GISASExperiment experiment; experiment.setSample(mp_sample); - experiment.setDetectorParameters(0.1*Units::degree, 2.0*Units::degree, 100 - , 0.0*Units::degree, 2.0*Units::degree, 100); + experiment.setDetectorParameters(100, 0.1*Units::degree, 2.0*Units::degree + , 100 , 0.0*Units::degree, 2.0*Units::degree); // experiment.setDetectorResolutionFunction(&testResolutionFunction); experiment.setBeamParameters(0.77*Units::angstrom, -0.4*Units::degree, 0.0*Units::degree); experiment.runSimulation(); - mp_intensity_output = experiment.getOutputData(); + mp_intensity_output = experiment.getOutputDataClone(); IsGISAXSTools::drawLogOutputData(*mp_intensity_output, "c1_test_meso_crystal", "mesocrystal", "CONT4 Z"); IsGISAXSTools::writeOutputDataToFile(*mp_intensity_output, Utils::FileSystem::GetHomePath()+"./Examples/MesoCrystals/mesocrystal.ima"); diff --git a/App/src/TestPerformance.cpp b/App/src/TestPerformance.cpp index 188ad1edbca945838760f2dec0488f918be217c6..e5405c2e7748f44de1448c50abaac7197dabbe80 100644 --- a/App/src/TestPerformance.cpp +++ b/App/src/TestPerformance.cpp @@ -87,7 +87,7 @@ void TestPerformance::execute() << std::setw(4) << std::left << test_info->m_nrepetitions << " repetitions )"<< std::endl; // saving results std::ostringstream os; - os << std::setw(8) << std::setprecision(6) << fhz; + os << std::setprecision(6) << fhz; m_performance_info[test_name] = os.str(); } @@ -112,11 +112,11 @@ void TestPerformance::write_performance() } file << m_performance_info["datime"] << get_delimeter(); - file << m_performance_info["hostname"] << get_delimeter(); - file << std::setw(8) << m_performance_info["sysinfo"] << get_delimeter(); + file << std::left << adjust_string_length(m_performance_info["hostname"],10) << get_delimeter(); + file << std::left << adjust_string_length(m_performance_info["sysinfo"],23) << get_delimeter(); for(performance_tests_t::iterator it=m_tests.begin(); it!= m_tests.end(); it++) { std::string test_name = (*it)->m_test->getName(); - file << m_performance_info[test_name] << get_delimeter(); + file << std::left << adjust_string_length(m_performance_info[test_name],7) << get_delimeter(); } file<<std::endl; @@ -126,6 +126,16 @@ void TestPerformance::write_performance() } +/* ************************************************************************* */ +// adjust length of string +/* ************************************************************************* */ +std::string TestPerformance::adjust_string_length(std::string name, int length) +{ + std::string newstring = name; + newstring.resize(length,' '); + return newstring; +} + /* ************************************************************************* */ @@ -156,7 +166,7 @@ void TestPerformance::get_sysinfo() }else{ std::ostringstream os; os << std::string(gSystem->GetBuildArch()) << ", "<< sys_info.fCpuSpeed << " MHz"; - os << ", " << sys_info.fL2Cache << " Kb"; + //os << ", " << sys_info.fL2Cache << " Kb"; m_performance_info["sysinfo"] = os.str(); } } @@ -201,7 +211,8 @@ void PerfTest_FresnelCoeff::initialise() void PerfTest_FresnelCoeff::execute() { static double alpha_i = -0.3; - kvector_t kvec = kvector_t::LambdaAlphaPhi(1.54*Units::angstrom, -alpha_i, 0.0); + kvector_t kvec; + kvec.setLambdaAlphaPhi(1.54*Units::angstrom, -alpha_i, 0.0); OpticalFresnel::MultiLayerCoeff_t coeffs; OpticalFresnel fresnelCalculator; MultiLayer *ml = (MultiLayer *) m_sample; @@ -237,8 +248,7 @@ void PerfTest_Pyramid::initialise() // experiment if(m_experiment) delete m_experiment; m_experiment = new GISASExperiment; - m_experiment->setDetectorParameters(0.0*Units::degree, 2.0*Units::degree, 100 - , 0.0*Units::degree, 2.0*Units::degree, 100, true); + m_experiment->setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree, 100, 0.0*Units::degree, 2.0*Units::degree, true); m_experiment->setBeamParameters(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); m_experiment->setSample(m_sample); } @@ -287,8 +297,7 @@ void PerfTest_RotatedPyramid::initialise() // experiment if(m_experiment) delete m_experiment; m_experiment = new GISASExperiment; - m_experiment->setDetectorParameters(0.0*Units::degree, 2.0*Units::degree, 100 - , 0.0*Units::degree, 2.0*Units::degree, 100, true); + m_experiment->setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree, 100, 0.0*Units::degree, 2.0*Units::degree, true); m_experiment->setBeamParameters(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); m_experiment->setSample(m_sample); } @@ -353,8 +362,7 @@ void PerfTest_MesoCrystal::initialise() // experiment m_experiment = new GISASExperiment; m_experiment->setSample(m_sample); - m_experiment->setDetectorParameters(0.1*Units::degree, 2.0*Units::degree, 100 - , 0.0*Units::degree, 2.0*Units::degree, 100); + m_experiment->setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree, 100, 0.0*Units::degree, 2.0*Units::degree, true); m_experiment->setBeamParameters(0.77*Units::angstrom, -0.4*Units::degree, 0.0*Units::degree); } diff --git a/App/src/TestRootTree.cpp b/App/src/TestRootTree.cpp index 9a1f816047cb4e576f9ab0e21eaad072c2267734..c0d6ff8dc645e62c10039cbc41f2caa8f5f3f9d3 100644 --- a/App/src/TestRootTree.cpp +++ b/App/src/TestRootTree.cpp @@ -30,20 +30,10 @@ TestRootTree::~TestRootTree() delete m_data; } -void test( const OutputData<double > &oo); - void TestRootTree::execute() { - m_data = new OutputData<double >; - m_data->addAxis(std::string("alpha_i"), 0.0*Units::degree, 2.0*Units::degree, 2000); - m_data->setAllTo(0.0); - - test(*m_data); - - return; - // preparing some real data for tree playing prepare_experiment(); @@ -57,14 +47,6 @@ void TestRootTree::execute() } -void test( const OutputData<double > &oo) -{ - - oo.resetIndex(); - -} - - /* ************************************************************************* */ // example showing writing in the tree simple data structures /* ************************************************************************* */ @@ -113,7 +95,7 @@ void TestRootTree::simple_write() m_experiment->setBeamParameters(1.0*Units::angstrom, alpha_i*Units::degree, phi_i); m_experiment->runSimulation(); - m_data = m_experiment->getOutputData(); + m_data = m_experiment->getOutputDataClone(); // accessing to scattering data NamedVector<double> *axis0 = dynamic_cast<NamedVector<double>*>(m_data->getAxes()[0]); NamedVector<double> *axis1 = dynamic_cast<NamedVector<double>*>(m_data->getAxes()[1]); @@ -328,7 +310,7 @@ void TestRootTree::prepare_experiment() // setting experiment m_experiment = new GISASExperiment(); - m_experiment->setDetectorParameters(0.0*Units::degree, 2.0*Units::degree, 100, 0.0*Units::degree, 2.0*Units::degree, 100, true); + m_experiment->setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree, 100, 0.0*Units::degree, 2.0*Units::degree, true); m_experiment->setBeamParameters(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); m_experiment->setSample(m_sample); diff --git a/Core/Algorithms/inc/DecouplingApproximationStrategy.h b/Core/Algorithms/inc/DecouplingApproximationStrategy.h index fc4a1dcba73d8a120eb6c5cdfe7f67ffe1212fc9..73525db9851779b47b873aa4d35659b0a8a42a89 100644 --- a/Core/Algorithms/inc/DecouplingApproximationStrategy.h +++ b/Core/Algorithms/inc/DecouplingApproximationStrategy.h @@ -14,6 +14,7 @@ //! @author Scientific Computing Group at FRM II //! @date Jun 29, 2012 +#include "Types.h" #include "IInterferenceFunctionStrategy.h" class DecouplingApproximationStrategy : public IInterferenceFunctionStrategy diff --git a/Core/Algorithms/inc/Experiment.h b/Core/Algorithms/inc/Experiment.h index 86c4c4bd4ad332077318d9e1ae4816271b1a61ad..b1777ecdf279ba043018bc28cf9d8dbe8553d6d9 100644 --- a/Core/Algorithms/inc/Experiment.h +++ b/Core/Algorithms/inc/Experiment.h @@ -33,7 +33,9 @@ public: void setSample(ISample *p_sample); /// Get data structure that contains the intensity map on the detector for all scan parameters - OutputData<double>* getOutputData() const; + OutputData<double>* getOutputDataClone() const; + + const OutputData<double>* getOutputData() const; Beam getBeam() const { diff --git a/Core/Algorithms/inc/FormFactorDecoratorTransformation.h b/Core/Algorithms/inc/FormFactorDecoratorTransformation.h index c3a58dc39565a424c21decca3b2392f7076f443a..d254d7c25f1a852eb416ae2e5a96261b9a7f3b76 100644 --- a/Core/Algorithms/inc/FormFactorDecoratorTransformation.h +++ b/Core/Algorithms/inc/FormFactorDecoratorTransformation.h @@ -62,12 +62,16 @@ inline complex_t FormFactorDecoratorTransformation::evaluate(kvector_t k_i, inline complex_t FormFactorDecoratorTransformation::evaluateForComplexkz(kvector_t k_i, kvector_t k_f, complex_t k_iz, complex_t k_fz) const { - Geometry::Vector3D<double> vki( k_i.x(), k_i.y(), k_i.z() ); - Geometry::Vector3D<double> vkf( k_f.x(), k_f.y(), k_f.z() ); - vki = *m_transform*vki; - vkf = *m_transform*vkf; - k_i.setXYZ(vki.x(), vki.y(), vki.z() ); - k_f.setXYZ(vkf.x(), vkf.y(), vkf.z() ); +// Geometry::Vector3D<double> vki( k_i.x(), k_i.y(), k_i.z() ); +// Geometry::Vector3D<double> vkf( k_f.x(), k_f.y(), k_f.z() ); +// vki = *m_transform*vki; +// vkf = *m_transform*vkf; +// k_i.setXYZ(vki.x(), vki.y(), vki.z() ); +// k_f.setXYZ(vkf.x(), vkf.y(), vkf.z() ); +// k_i = *m_transform*k_i; +// k_f = *m_transform*k_f; + k_i.transform(*m_transform); + k_f.transform(*m_transform); return mp_form_factor->evaluateForComplexkz(k_i, k_f, k_iz, k_fz); } diff --git a/Core/Algorithms/inc/GISASExperiment.h b/Core/Algorithms/inc/GISASExperiment.h index 92c92a4961a07a6ad98daf7cf55247275340fc38..0a6ff9b600b26cc738c0a01a078f295f7161dca8 100644 --- a/Core/Algorithms/inc/GISASExperiment.h +++ b/Core/Algorithms/inc/GISASExperiment.h @@ -25,8 +25,8 @@ public: virtual void runSimulation(); - void setDetectorParameters(double phi_f_min, double phi_f_max, size_t n_phi, - double alpha_f_min, double alpha_f_max, size_t n_alpha, bool isgisaxs_style=false); + void setDetectorParameters(size_t n_phi, double phi_f_min, double phi_f_max, + size_t n_alpha, double alpha_f_min, double alpha_f_max, bool isgisaxs_style=false); void setDetectorResolutionFunction(ConvolutionDetectorResolution::cumulative_DF_2d resolution_function); private: diff --git a/Core/Algorithms/inc/IInterferenceFunctionStrategy.h b/Core/Algorithms/inc/IInterferenceFunctionStrategy.h index 3d7963c53242be8fcb58f378e6aebb0b97a129f0..078f23f78bdd6ac541f5c8df7fbb3212f38da0d1 100644 --- a/Core/Algorithms/inc/IInterferenceFunctionStrategy.h +++ b/Core/Algorithms/inc/IInterferenceFunctionStrategy.h @@ -14,6 +14,7 @@ //! @author Scientific Computing Group at FRM II //! @date Jun 29, 2012 +#include "Types.h" #include "IFormFactor.h" #include "IInterferenceFunction.h" diff --git a/Core/Algorithms/src/Experiment.cpp b/Core/Algorithms/src/Experiment.cpp index c29b4cc243e007d420d1d4d75597a6f48e9e4a01..d84ae0c5715798e481e4893e0834143762043789 100644 --- a/Core/Algorithms/src/Experiment.cpp +++ b/Core/Algorithms/src/Experiment.cpp @@ -19,11 +19,17 @@ void Experiment::setSample(ISample* p_sample) mp_sample = p_sample; ///< Not owned by Experiment } -OutputData<double>* Experiment::getOutputData() const +OutputData<double>* Experiment::getOutputDataClone() const { return m_intensity_map.clone(); } +const OutputData<double>* Experiment::getOutputData() const +{ + return &m_intensity_map; +} + + void Experiment::setBeamParameters(double lambda, double alpha_i, double phi_i) { m_beam.setCentralK(lambda, alpha_i, phi_i); diff --git a/Core/Algorithms/src/GISASExperiment.cpp b/Core/Algorithms/src/GISASExperiment.cpp index 1f27b93ed2ce68b51f8d0e34e88cf5655c1a17cf..6ee4439d7c720693cccd402345bfdef152e03834 100644 --- a/Core/Algorithms/src/GISASExperiment.cpp +++ b/Core/Algorithms/src/GISASExperiment.cpp @@ -7,8 +7,8 @@ GISASExperiment::GISASExperiment() { m_beam.setCentralK(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); ///< Set default beam parameters - setDetectorParameters(0.0*Units::degree, 2.0*Units::degree, 100, - 0.0*Units::degree, 2.0*Units::degree, 100); + setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree, + 100, 0.0*Units::degree, 2.0*Units::degree); } void GISASExperiment::runSimulation() @@ -25,9 +25,9 @@ void GISASExperiment::runSimulation() delete p_dwba_simulation; } -void GISASExperiment::setDetectorParameters(double phi_f_min, double phi_f_max, - size_t n_phi, double alpha_f_min, double alpha_f_max, size_t n_alpha, - bool isgisaxs_style) + +void GISASExperiment::setDetectorParameters(size_t n_phi, double phi_f_min, double phi_f_max, + size_t n_alpha, double alpha_f_min, double alpha_f_max, bool isgisaxs_style) { m_detector.clear(); NamedVector<double> phi_axis("phi_f"); diff --git a/Core/Algorithms/src/MultiLayerDWBASimulation.cpp b/Core/Algorithms/src/MultiLayerDWBASimulation.cpp index 2225834e7ed3683fd0b2cf22cb03b24658249847..bbb18f889c5f81216ccbe17edf01fba4cbcecd08 100644 --- a/Core/Algorithms/src/MultiLayerDWBASimulation.cpp +++ b/Core/Algorithms/src/MultiLayerDWBASimulation.cpp @@ -39,7 +39,9 @@ void MultiLayerDWBASimulation::run() std::map<double, OpticalFresnel::MultiLayerCoeff_t> fresnel_coeff_map; for (size_t i=0; i<p_alpha_axis->getSize(); ++i) { double angle = (*p_alpha_axis)[i]; - kvector_t kvec = kvector_t::LambdaAlphaPhi(lambda, -angle, 0.0); + //kvector_t kvec = kvector_t::LambdaAlphaPhi(lambda, -angle, 0.0); + kvector_t kvec; + kvec.setLambdaAlphaPhi(lambda, -angle, 0.0); OpticalFresnel::MultiLayerCoeff_t coeffs; fresnelCalculator.execute(*mp_multi_layer, kvec, coeffs); fresnel_coeff_map[angle] = coeffs; diff --git a/Core/Algorithms/src/OpticalFresnel.cpp b/Core/Algorithms/src/OpticalFresnel.cpp index 281d62f867286546028d2061971be2aa1b1c4f5d..aa677f905ce5910cd46d08718039262494874a62 100644 --- a/Core/Algorithms/src/OpticalFresnel.cpp +++ b/Core/Algorithms/src/OpticalFresnel.cpp @@ -36,7 +36,8 @@ void OpticalFresnel::calculateKZ(const MultiLayer &sample, const kvector_t &kvec // Q_{z,j} &= 2k_{z,j} = 2\cdot \sqrt{ k^2 n_j^2 - k_x^2 } for(size_t i=0; i<coeff.size(); ++i) { complex_t rindex = sample.getLayer(i)->getRefractiveIndex(); - coeff[i].kz = std::sqrt( kvec.mag2()*rindex*rindex - kvec.magxy()*kvec.magxy() ); + //coeff[i].kz = std::sqrt( kvec.mag2()*rindex*rindex - kvec.magxy()*kvec.magxy() ); + coeff[i].kz = std::sqrt( kvec.mag2()*rindex*rindex - kvec.perp2() ); //std::cout << "k_z: " << coeff[i].kz << std::endl; } } diff --git a/Core/Core.pro b/Core/Core.pro index 3ccfbd83f95dc69401cde4c267d3230c00f4a688..f424047074c8dfc745b894b47328410f30d9010c 100644 --- a/Core/Core.pro +++ b/Core/Core.pro @@ -4,7 +4,7 @@ TARGET = ScattCore TEMPLATE = lib CONFIG += plugin # to remove versions from file name -CONFIG += debug +#CONFIG += debug QT -= core gui CONFIG += BUILD_PYTHON_BOOST_MODULE # to generate python interface @@ -193,8 +193,8 @@ HEADERS += \ PythonAPI/inc/PythonInterface_free_functions.h \ PythonAPI/inc/PythonInterface_global_variables.h \ PythonAPI/inc/PythonModule.h \ - PythonAPI/inc/PythonPlusplusHelper.h \ - PythonAPI/inc/PythonOutputData.h + PythonAPI/inc/PythonOutputData.h \ + PythonAPI/inc/PythonPlusplusHelper.h INCLUDEPATH += ./Algorithms/inc ./Geometry/inc ./Samples/inc ./Tools/inc ./PythonAPI/inc DEPENDPATH += ./Algorithms/inc ./Geometry/inc ./Samples/inc ./Tools/inc ./PythonAPI/inc @@ -208,6 +208,7 @@ DEPENDPATH += ./Algorithms/inc ./Geometry/inc ./Samples/inc ./Tools/inc ./Pytho PythonAPI/inc/PythonInterface_free_functions.h \ PythonAPI/inc/PythonInterface_global_variables.h \ PythonAPI/inc/PythonModule.h \ + PythonAPI/inc/PythonOutputData.h \ PythonAPI/inc/PythonPlusplusHelper.h SOURCES -= \ @@ -217,6 +218,7 @@ DEPENDPATH += ./Algorithms/inc ./Geometry/inc ./Samples/inc ./Tools/inc ./Pytho PythonAPI/src/PythonInterface_free_functions.cpp \ PythonAPI/src/PythonInterface_global_variables.cpp \ PythonAPI/src/PythonModule.cpp \ + PythonAPI/src/PythonOutputData.cpp \ PythonAPI/src/PythonPlusplusHelper.cpp INCLUDEPATH -= ./PythonAPI/inc diff --git a/Core/Geometry/inc/BasicVector3D.h b/Core/Geometry/inc/BasicVector3D.h index 9c0081b23af9620099db7e92950d6b95bae3659e..bbdc7e4b048830ef8f1c7d170372120189a8afa9 100755 --- a/Core/Geometry/inc/BasicVector3D.h +++ b/Core/Geometry/inc/BasicVector3D.h @@ -19,6 +19,9 @@ #include <iostream> namespace Geometry { +class Transform3D; + + /** * Base class for Point3D<T>, Vector3D<T> and Normal3D<T>. * It defines only common functionality for those classes and @@ -31,13 +34,13 @@ namespace Geometry { protected: T v_[3]; + public: /** * Default constructor. * It is protected - this class should not be instantiated directly. */ BasicVector3D() { v_[0] = 0; v_[1] = 0; v_[2] = 0; } - public: /** * Safe indexing of the coordinates when using with matrices, arrays, etc. */ @@ -162,6 +165,7 @@ namespace Geometry { /** * Sets components in cartesian coordinate system. */ void set(T x1, T y1, T z1) { v_[0] = x1; v_[1] = y1; v_[2] = z1; } + void setXYZ(T x1, T y1, T z1) { v_[0] = x1; v_[1] = y1; v_[2] = z1; } // ------------------------------------------ // Cylindrical coordinate system: rho, phi, z @@ -177,6 +181,10 @@ namespace Geometry { * Gets rho-component in cylindrical coordinate system */ T rho() const { return perp(); } + /** + * Gets rho-component in cylindrical coordinate system */ + T magxy() const { return perp(); } + /** * Sets transverse component keeping phi and z constant. */ void setPerp(T rh) { @@ -341,6 +349,23 @@ namespace Geometry { /** * Rotates around the axis specified by another vector. */ BasicVector3D<T> & rotate(T a, const BasicVector3D<T> & v); + + // --------- + // Specific + // --------- + + void setLambdaAlphaPhi(T lambda, T alpha, T phi) + { + T k = 2.*M_PI/lambda; + v_[0] = k*std::cos(alpha) * std::cos(phi); + v_[1] = k*std::cos(alpha) * std::sin(phi); + v_[2] = k*std::sin(alpha); + } + + /** + * Transformation by Transform3D. */ + BasicVector3D<double> & transform(const Transform3D & m); + }; // /************************************************************************* @@ -560,6 +585,27 @@ namespace Geometry { { return (a.x()!=b.x() || a.y()!=b.y() || a.z()!=b.z()); } + + inline BasicVector3D<double> CrossProduct(const BasicVector3D<double> vectorLeft, const BasicVector3D<double> vectorRight) + { + double x = vectorLeft.y()*vectorRight.z() - vectorLeft.z()*vectorRight.y(); + double y = vectorLeft.z()*vectorRight.x() - vectorLeft.x()*vectorRight.z(); + double z = vectorLeft.x()*vectorRight.y() - vectorLeft.y()*vectorRight.x(); + return BasicVector3D<double> (x, y, z); + } + + inline double DotProduct(const BasicVector3D<double> left, const BasicVector3D<double> right) + { + return left.x()*right.x() + left.y()*right.y() + left.z()*right.z(); + } + + /** + * Transformation of BasicVector3D<double> by Transform3D. + */ + BasicVector3D<double> + operator*(const Transform3D & m, const BasicVector3D<double> & v); + + } /* namespace Geometry */ diff --git a/Core/Geometry/src/BasicVector3D.cpp b/Core/Geometry/src/BasicVector3D.cpp index bf9114593db906af731dcb35f29a73a9c9b56a5b..f3aec452c419c9a3f14d4662375651607e808994 100755 --- a/Core/Geometry/src/BasicVector3D.cpp +++ b/Core/Geometry/src/BasicVector3D.cpp @@ -8,6 +8,7 @@ //#include "CLHEP/Geometry/defs.h" //#include "CLHEP/Geometry/BasicVector3D.h" #include "BasicVector3D.h" +#include "Transform3D.h" namespace Geometry { //-------------------------------------------------------------------------- @@ -321,4 +322,27 @@ namespace Geometry { a.setZ(z); return is; } + + template<> + BasicVector3D<double> & + BasicVector3D<double>::transform(const Transform3D & m) { + double vx = x(), vy = y(), vz = z(); + set(m.xx()*vx + m.xy()*vy + m.xz()*vz, + m.yx()*vx + m.yy()*vy + m.yz()*vz, + m.zx()*vx + m.zy()*vy + m.zz()*vz); + return *this; + } + + + //-------------------------------------------------------------------------- + BasicVector3D<double> + operator*(const Transform3D & m, const BasicVector3D<double> & v) { + double vx = v.x(), vy = v.y(), vz = v.z(); + return BasicVector3D<double> + (m.xx()*vx + m.xy()*vy + m.xz()*vz, + m.yx()*vx + m.yy()*vy + m.yz()*vz, + m.zx()*vx + m.zy()*vy + m.zz()*vz); + } + + } /* namespace HepGeom */ diff --git a/Core/PythonAPI/inc/PythonPlusplusHelper.h b/Core/PythonAPI/inc/PythonPlusplusHelper.h index 2f9f0de7f2aacc98e4161536fecd210e8f10ba72..70f8a996251aa34af5841313c3a12332c76b1d0f 100644 --- a/Core/PythonAPI/inc/PythonPlusplusHelper.h +++ b/Core/PythonAPI/inc/PythonPlusplusHelper.h @@ -15,15 +15,14 @@ //! @date 02.06.2012 #include "Types.h" +#include "BasicVector3D.h" + // there is some weared behavior of pyplusplus // without this definition it gets screwed up as soon as it sees in the code vector<kvector> like in LatticeBasis.h namespace pyplusplus { namespace aliases { - typedef KVector<double > kvector_t; - typedef Geometry::Point3D<double > point3d_t; - typedef Geometry::BasicVector3D<double > basicvector3d_t; - typedef Geometry::Vector3D<double > vector3d_t; + typedef Geometry::BasicVector3D<double > kvector_t; } } @@ -32,12 +31,6 @@ class PythonPlusplusHelper { public: size_t pyplusplus_boost_kvector() { return sizeof(kvector_t); } -// size_t pyplusplus_boost_point3d() { return sizeof(Geometry::Point3D<double >); } -// size_t pyplusplus_boost_basic3d() { return sizeof(Geometry::BasicVector3D<double >); } -// size_t pyplusplus_boost_vector3d() { return sizeof(Geometry::Vector3D<double >); } - size_t pyplusplus_boost_point3d() { return sizeof(point3d_t); } - size_t pyplusplus_boost_basic3d() { return sizeof(basicvector3d_t); } - size_t pyplusplus_boost_vector3d() { return sizeof(vector3d_t); } }; diff --git a/Core/PythonAPI/src/PythonInterface_classes_1.cpp b/Core/PythonAPI/src/PythonInterface_classes_1.cpp index 56b5934d4625581887a6160f93ecc0a9e89fec96..0ffe7af5c33be7bd0dee67cc0ce6ab1ac2097f5f 100644 --- a/Core/PythonAPI/src/PythonInterface_classes_1.cpp +++ b/Core/PythonAPI/src/PythonInterface_classes_1.cpp @@ -31,13 +31,11 @@ #include "NanoParticleDecoration.h" #include "OpticalFresnel.h" #include "ParameterPool.h" -#include "Point3D.h" #include "PythonOutputData.h" #include "PythonPlusplusHelper.h" #include "Transform3D.h" #include "Units.h" #include "Types.h" -#include "Vector3D.h" #include "PythonInterface_classes_1.h" namespace bp = boost::python; @@ -128,24 +126,25 @@ void register_classes_1(){ , (void ( GISASExperiment_wrapper::* )( ) )(&GISASExperiment_wrapper::default_runSimulation) ) .def( "setDetectorParameters" - , (void ( ::GISASExperiment::* )( double,double,::size_t,double,double,::size_t,bool ) )( &::GISASExperiment::setDetectorParameters ) - , ( bp::arg("phi_f_min"), bp::arg("phi_f_max"), bp::arg("n_phi"), bp::arg("alpha_f_min"), bp::arg("alpha_f_max"), bp::arg("n_alpha"), bp::arg("isgisaxs_style")=(bool)(false) ) ); + , (void ( ::GISASExperiment::* )( ::size_t,double,double,::size_t,double,double,bool ) )( &::GISASExperiment::setDetectorParameters ) + , ( bp::arg("n_phi"), bp::arg("phi_f_min"), bp::arg("phi_f_max"), bp::arg("n_alpha"), bp::arg("alpha_f_min"), bp::arg("alpha_f_max"), bp::arg("isgisaxs_style")=(bool)(false) ) ); { //::Geometry::BasicVector3D< double > - typedef bp::class_< Geometry::BasicVector3D< double > > basicvector3d_t_exposer_t; - basicvector3d_t_exposer_t basicvector3d_t_exposer = basicvector3d_t_exposer_t( "basicvector3d_t", bp::init< double, double, double >(( bp::arg("x1"), bp::arg("y1"), bp::arg("z1") )) ); - bp::scope basicvector3d_t_scope( basicvector3d_t_exposer ); + typedef bp::class_< Geometry::BasicVector3D< double > > kvector_t_exposer_t; + kvector_t_exposer_t kvector_t_exposer = kvector_t_exposer_t( "kvector_t", bp::init< >() ); + bp::scope kvector_t_scope( kvector_t_exposer ); bp::scope().attr("X") = (int)Geometry::BasicVector3D<double>::X; bp::scope().attr("Y") = (int)Geometry::BasicVector3D<double>::Y; bp::scope().attr("Z") = (int)Geometry::BasicVector3D<double>::Z; bp::scope().attr("NUM_COORDINATES") = (int)Geometry::BasicVector3D<double>::NUM_COORDINATES; bp::scope().attr("SIZE") = (int)Geometry::BasicVector3D<double>::SIZE; + kvector_t_exposer.def( bp::init< double, double, double >(( bp::arg("x1"), bp::arg("y1"), bp::arg("z1") )) ); { //::Geometry::BasicVector3D< double >::angle typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*angle_function_type )( ::Geometry::BasicVector3D< double > const & ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "angle" , angle_function_type( &::Geometry::BasicVector3D< double >::angle ) , ( bp::arg("v") ) ); @@ -156,7 +155,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*cosTheta_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "cosTheta" , cosTheta_function_type( &::Geometry::BasicVector3D< double >::cosTheta ) ); @@ -166,7 +165,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef ::Geometry::BasicVector3D< double > ( exported_class_t::*cross_function_type )( ::Geometry::BasicVector3D< double > const & ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "cross" , cross_function_type( &::Geometry::BasicVector3D< double >::cross ) , ( bp::arg("v") ) ); @@ -177,7 +176,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*dot_function_type )( ::Geometry::BasicVector3D< double > const & ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "dot" , dot_function_type( &::Geometry::BasicVector3D< double >::dot ) , ( bp::arg("v") ) ); @@ -188,7 +187,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*getPhi_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "getPhi" , getPhi_function_type( &::Geometry::BasicVector3D< double >::getPhi ) ); @@ -198,7 +197,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*getR_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "getR" , getR_function_type( &::Geometry::BasicVector3D< double >::getR ) ); @@ -208,7 +207,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*getTheta_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "getTheta" , getTheta_function_type( &::Geometry::BasicVector3D< double >::getTheta ) ); @@ -218,7 +217,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*mag_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "mag" , mag_function_type( &::Geometry::BasicVector3D< double >::mag ) ); @@ -228,21 +227,31 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*mag2_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "mag2" , mag2_function_type( &::Geometry::BasicVector3D< double >::mag2 ) ); } - basicvector3d_t_exposer.def( bp::self *= bp::other< double >() ); - basicvector3d_t_exposer.def( bp::self += bp::self ); - basicvector3d_t_exposer.def( bp::self -= bp::self ); - basicvector3d_t_exposer.def( bp::self /= bp::other< double >() ); + { //::Geometry::BasicVector3D< double >::magxy + + typedef Geometry::BasicVector3D< double > exported_class_t; + typedef double ( exported_class_t::*magxy_function_type )( ) const; + + kvector_t_exposer.def( + "magxy" + , magxy_function_type( &::Geometry::BasicVector3D< double >::magxy ) ); + + } + kvector_t_exposer.def( bp::self *= bp::other< double >() ); + kvector_t_exposer.def( bp::self += bp::self ); + kvector_t_exposer.def( bp::self -= bp::self ); + kvector_t_exposer.def( bp::self /= bp::other< double >() ); { //::Geometry::BasicVector3D< double >::operator= typedef Geometry::BasicVector3D< double > exported_class_t; typedef ::Geometry::BasicVector3D< double > & ( exported_class_t::*assign_function_type )( ::Geometry::BasicVector3D< double > const & ) ; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "assign" , assign_function_type( &::Geometry::BasicVector3D< double >::operator= ) , ( bp::arg("v") ) @@ -254,7 +263,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*__getitem___function_type )( int ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "__getitem__" , __getitem___function_type( &::Geometry::BasicVector3D< double >::operator[] ) , ( bp::arg("i") ) ); @@ -265,7 +274,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double & ( exported_class_t::*__getitem___function_type )( int ) ; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "__getitem__" , __getitem___function_type( &::Geometry::BasicVector3D< double >::operator[] ) , ( bp::arg("i") ) @@ -277,7 +286,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef ::Geometry::BasicVector3D< double > ( exported_class_t::*orthogonal_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "orthogonal" , orthogonal_function_type( &::Geometry::BasicVector3D< double >::orthogonal ) ); @@ -287,7 +296,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*perp_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "perp" , perp_function_type( &::Geometry::BasicVector3D< double >::perp ) ); @@ -297,7 +306,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*perp_function_type )( ::Geometry::BasicVector3D< double > const & ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "perp" , perp_function_type( &::Geometry::BasicVector3D< double >::perp ) , ( bp::arg("v") ) ); @@ -308,7 +317,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*perp2_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "perp2" , perp2_function_type( &::Geometry::BasicVector3D< double >::perp2 ) ); @@ -318,7 +327,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*perp2_function_type )( ::Geometry::BasicVector3D< double > const & ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "perp2" , perp2_function_type( &::Geometry::BasicVector3D< double >::perp2 ) , ( bp::arg("v") ) ); @@ -329,7 +338,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*phi_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "phi" , phi_function_type( &::Geometry::BasicVector3D< double >::phi ) ); @@ -339,7 +348,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*r_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "r" , r_function_type( &::Geometry::BasicVector3D< double >::r ) ); @@ -349,7 +358,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*rho_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "rho" , rho_function_type( &::Geometry::BasicVector3D< double >::rho ) ); @@ -359,7 +368,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef ::Geometry::BasicVector3D< double > & ( exported_class_t::*rotate_function_type )( double,::Geometry::BasicVector3D< double > const & ) ; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "rotate" , rotate_function_type( &::Geometry::BasicVector3D< double >::rotate ) , ( bp::arg("a"), bp::arg("v") ) @@ -371,7 +380,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef ::Geometry::BasicVector3D< double > & ( exported_class_t::*rotateX_function_type )( double ) ; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "rotateX" , rotateX_function_type( &::Geometry::BasicVector3D< double >::rotateX ) , ( bp::arg("a") ) @@ -383,7 +392,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef ::Geometry::BasicVector3D< double > & ( exported_class_t::*rotateY_function_type )( double ) ; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "rotateY" , rotateY_function_type( &::Geometry::BasicVector3D< double >::rotateY ) , ( bp::arg("a") ) @@ -395,7 +404,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef ::Geometry::BasicVector3D< double > & ( exported_class_t::*rotateZ_function_type )( double ) ; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "rotateZ" , rotateZ_function_type( &::Geometry::BasicVector3D< double >::rotateZ ) , ( bp::arg("a") ) @@ -407,18 +416,29 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef void ( exported_class_t::*set_function_type )( double,double,double ) ; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "set" , set_function_type( &::Geometry::BasicVector3D< double >::set ) , ( bp::arg("x1"), bp::arg("y1"), bp::arg("z1") ) ); + } + { //::Geometry::BasicVector3D< double >::setLambdaAlphaPhi + + typedef Geometry::BasicVector3D< double > exported_class_t; + typedef void ( exported_class_t::*setLambdaAlphaPhi_function_type )( double,double,double ) ; + + kvector_t_exposer.def( + "setLambdaAlphaPhi" + , setLambdaAlphaPhi_function_type( &::Geometry::BasicVector3D< double >::setLambdaAlphaPhi ) + , ( bp::arg("lambda"), bp::arg("alpha"), bp::arg("phi") ) ); + } { //::Geometry::BasicVector3D< double >::setMag typedef Geometry::BasicVector3D< double > exported_class_t; typedef void ( exported_class_t::*setMag_function_type )( double ) ; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "setMag" , setMag_function_type( &::Geometry::BasicVector3D< double >::setMag ) , ( bp::arg("ma") ) ); @@ -429,7 +449,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef void ( exported_class_t::*setPerp_function_type )( double ) ; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "setPerp" , setPerp_function_type( &::Geometry::BasicVector3D< double >::setPerp ) , ( bp::arg("rh") ) ); @@ -440,7 +460,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef void ( exported_class_t::*setPhi_function_type )( double ) ; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "setPhi" , setPhi_function_type( &::Geometry::BasicVector3D< double >::setPhi ) , ( bp::arg("ph") ) ); @@ -451,7 +471,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef void ( exported_class_t::*setR_function_type )( double ) ; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "setR" , setR_function_type( &::Geometry::BasicVector3D< double >::setR ) , ( bp::arg("ma") ) ); @@ -462,7 +482,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef void ( exported_class_t::*setTheta_function_type )( double ) ; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "setTheta" , setTheta_function_type( &::Geometry::BasicVector3D< double >::setTheta ) , ( bp::arg("th") ) ); @@ -473,18 +493,29 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef void ( exported_class_t::*setX_function_type )( double ) ; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "setX" , setX_function_type( &::Geometry::BasicVector3D< double >::setX ) , ( bp::arg("a") ) ); + } + { //::Geometry::BasicVector3D< double >::setXYZ + + typedef Geometry::BasicVector3D< double > exported_class_t; + typedef void ( exported_class_t::*setXYZ_function_type )( double,double,double ) ; + + kvector_t_exposer.def( + "setXYZ" + , setXYZ_function_type( &::Geometry::BasicVector3D< double >::setXYZ ) + , ( bp::arg("x1"), bp::arg("y1"), bp::arg("z1") ) ); + } { //::Geometry::BasicVector3D< double >::setY typedef Geometry::BasicVector3D< double > exported_class_t; typedef void ( exported_class_t::*setY_function_type )( double ) ; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "setY" , setY_function_type( &::Geometry::BasicVector3D< double >::setY ) , ( bp::arg("a") ) ); @@ -495,7 +526,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef void ( exported_class_t::*setZ_function_type )( double ) ; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "setZ" , setZ_function_type( &::Geometry::BasicVector3D< double >::setZ ) , ( bp::arg("a") ) ); @@ -506,17 +537,29 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*theta_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "theta" , theta_function_type( &::Geometry::BasicVector3D< double >::theta ) ); + } + { //::Geometry::BasicVector3D< double >::transform + + typedef Geometry::BasicVector3D< double > exported_class_t; + typedef ::Geometry::BasicVector3D< double > & ( exported_class_t::*transform_function_type )( ::Geometry::Transform3D const & ) ; + + kvector_t_exposer.def( + "transform" + , transform_function_type( &::Geometry::BasicVector3D< double >::transform ) + , ( bp::arg("m") ) + , bp::return_internal_reference< >() ); + } { //::Geometry::BasicVector3D< double >::unit typedef Geometry::BasicVector3D< double > exported_class_t; typedef ::Geometry::BasicVector3D< double > ( exported_class_t::*unit_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "unit" , unit_function_type( &::Geometry::BasicVector3D< double >::unit ) ); @@ -526,7 +569,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*x_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "x" , x_function_type( &::Geometry::BasicVector3D< double >::x ) ); @@ -536,7 +579,7 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*y_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "y" , y_function_type( &::Geometry::BasicVector3D< double >::y ) ); @@ -546,110 +589,22 @@ void register_classes_1(){ typedef Geometry::BasicVector3D< double > exported_class_t; typedef double ( exported_class_t::*z_function_type )( ) const; - basicvector3d_t_exposer.def( + kvector_t_exposer.def( "z" , z_function_type( &::Geometry::BasicVector3D< double >::z ) ); } - basicvector3d_t_exposer.def( bp::self != bp::self ); - basicvector3d_t_exposer.def( bp::other< double >() * bp::self ); - basicvector3d_t_exposer.def( bp::self * bp::self ); - basicvector3d_t_exposer.def( bp::self * bp::other< double >() ); - basicvector3d_t_exposer.def( bp::self + bp::self ); - basicvector3d_t_exposer.def( +bp::self ); - basicvector3d_t_exposer.def( bp::self - bp::self ); - basicvector3d_t_exposer.def( -bp::self ); - basicvector3d_t_exposer.def( bp::self / bp::other< double >() ); - basicvector3d_t_exposer.def( bp::self_ns::str( bp::self ) ); - basicvector3d_t_exposer.def( bp::self == bp::self ); - } - - { //::Geometry::Point3D< double > - typedef bp::class_< Geometry::Point3D< double >, bp::bases< Geometry::BasicVector3D< double > > > point3d_t_exposer_t; - point3d_t_exposer_t point3d_t_exposer = point3d_t_exposer_t( "point3d_t", bp::init< >() ); - bp::scope point3d_t_scope( point3d_t_exposer ); - point3d_t_exposer.def( bp::init< double, double, double >(( bp::arg("x1"), bp::arg("y1"), bp::arg("z1") )) ); - point3d_t_exposer.def( bp::init< double const * >(( bp::arg("a") )) ); - point3d_t_exposer.def( bp::init< Geometry::Point3D< double > const & >(( bp::arg("v") )) ); - point3d_t_exposer.def( bp::init< Geometry::BasicVector3D< double > const & >(( bp::arg("v") )) ); - { //::Geometry::Point3D< double >::distance - - typedef Geometry::Point3D< double > exported_class_t; - typedef double ( exported_class_t::*distance_function_type )( ) const; - - point3d_t_exposer.def( - "distance" - , distance_function_type( &::Geometry::Point3D< double >::distance ) ); - - } - { //::Geometry::Point3D< double >::distance - - typedef Geometry::Point3D< double > exported_class_t; - typedef double ( exported_class_t::*distance_function_type )( ::Geometry::Point3D< double > const & ) const; - - point3d_t_exposer.def( - "distance" - , distance_function_type( &::Geometry::Point3D< double >::distance ) - , ( bp::arg("p") ) ); - - } - { //::Geometry::Point3D< double >::distance2 - - typedef Geometry::Point3D< double > exported_class_t; - typedef double ( exported_class_t::*distance2_function_type )( ) const; - - point3d_t_exposer.def( - "distance2" - , distance2_function_type( &::Geometry::Point3D< double >::distance2 ) ); - - } - { //::Geometry::Point3D< double >::distance2 - - typedef Geometry::Point3D< double > exported_class_t; - typedef double ( exported_class_t::*distance2_function_type )( ::Geometry::Point3D< double > const & ) const; - - point3d_t_exposer.def( - "distance2" - , distance2_function_type( &::Geometry::Point3D< double >::distance2 ) - , ( bp::arg("p") ) ); - - } - { //::Geometry::Point3D< double >::operator= - - typedef Geometry::Point3D< double > exported_class_t; - typedef ::Geometry::Point3D< double > & ( exported_class_t::*assign_function_type )( ::Geometry::Point3D< double > const & ) ; - - point3d_t_exposer.def( - "assign" - , assign_function_type( &::Geometry::Point3D< double >::operator= ) - , ( bp::arg("v") ) - , bp::return_self< >() ); - - } - { //::Geometry::Point3D< double >::operator= - - typedef Geometry::Point3D< double > exported_class_t; - typedef ::Geometry::Point3D< double > & ( exported_class_t::*assign_function_type )( ::Geometry::BasicVector3D< double > const & ) ; - - point3d_t_exposer.def( - "assign" - , assign_function_type( &::Geometry::Point3D< double >::operator= ) - , ( bp::arg("v") ) - , bp::return_self< >() ); - - } - { //::Geometry::Point3D< double >::transform - - typedef Geometry::Point3D< double > exported_class_t; - typedef ::Geometry::Point3D< double > & ( exported_class_t::*transform_function_type )( ::Geometry::Transform3D const & ) ; - - point3d_t_exposer.def( - "transform" - , transform_function_type( &::Geometry::Point3D< double >::transform ) - , ( bp::arg("m") ) - , bp::return_internal_reference< >() ); - - } + kvector_t_exposer.def( bp::self != bp::self ); + kvector_t_exposer.def( bp::other< double >() * bp::self ); + kvector_t_exposer.def( bp::self * bp::self ); + kvector_t_exposer.def( bp::self * bp::other< double >() ); + kvector_t_exposer.def( bp::self + bp::self ); + kvector_t_exposer.def( +bp::self ); + kvector_t_exposer.def( bp::self - bp::self ); + kvector_t_exposer.def( -bp::self ); + kvector_t_exposer.def( bp::self / bp::other< double >() ); + kvector_t_exposer.def( bp::self_ns::str( bp::self ) ); + kvector_t_exposer.def( bp::self == bp::self ); } bp::class_< Geometry::ReflectX3D >( "ReflectX3D", bp::init< bp::optional< double > >(( bp::arg("x")=0 )) ); @@ -826,8 +781,6 @@ void register_classes_1(){ } Transform3D_exposer.def_readonly( "Identity", Geometry::Transform3D::Identity ); - Transform3D_exposer.def( bp::self * bp::other< Geometry::Vector3D< double > >() ); - Transform3D_exposer.def( bp::self * bp::other< Geometry::Point3D< double > >() ); } } diff --git a/Core/PythonAPI/src/PythonInterface_classes_2.cpp b/Core/PythonAPI/src/PythonInterface_classes_2.cpp index 90e56d10a8f3a308a037113215a5e8549d118e25..a4ba713a2473432e352720ef076742b77916dbfd 100644 --- a/Core/PythonAPI/src/PythonInterface_classes_2.cpp +++ b/Core/PythonAPI/src/PythonInterface_classes_2.cpp @@ -30,13 +30,11 @@ #include "NanoParticleDecoration.h" #include "OpticalFresnel.h" #include "ParameterPool.h" -#include "Point3D.h" #include "PythonOutputData.h" #include "PythonPlusplusHelper.h" #include "Transform3D.h" #include "Units.h" #include "Types.h" -#include "Vector3D.h" #include "PythonInterface_classes_2.h" namespace bp = boost::python; @@ -90,52 +88,6 @@ void register_classes_2(){ bp::class_< Geometry::RotateZ3D, bp::bases< Geometry::Rotate3D > >( "RotateZ3D", bp::init< >() ) .def( bp::init< double >(( bp::arg("a") )) ); - { //::Geometry::Vector3D< double > - typedef bp::class_< Geometry::Vector3D< double >, bp::bases< Geometry::BasicVector3D< double > > > vector3d_t_exposer_t; - vector3d_t_exposer_t vector3d_t_exposer = vector3d_t_exposer_t( "vector3d_t", bp::init< >() ); - bp::scope vector3d_t_scope( vector3d_t_exposer ); - vector3d_t_exposer.def( bp::init< double, double, double >(( bp::arg("x1"), bp::arg("y1"), bp::arg("z1") )) ); - vector3d_t_exposer.def( bp::init< double const * >(( bp::arg("a") )) ); - vector3d_t_exposer.def( bp::init< Geometry::Vector3D< double > const & >(( bp::arg("v") )) ); - vector3d_t_exposer.def( bp::init< Geometry::BasicVector3D< double > const & >(( bp::arg("v") )) ); - { //::Geometry::Vector3D< double >::operator= - - typedef Geometry::Vector3D< double > exported_class_t; - typedef ::Geometry::Vector3D< double > & ( exported_class_t::*assign_function_type )( ::Geometry::Vector3D< double > const & ) ; - - vector3d_t_exposer.def( - "assign" - , assign_function_type( &::Geometry::Vector3D< double >::operator= ) - , ( bp::arg("v") ) - , bp::return_self< >() ); - - } - { //::Geometry::Vector3D< double >::operator= - - typedef Geometry::Vector3D< double > exported_class_t; - typedef ::Geometry::Vector3D< double > & ( exported_class_t::*assign_function_type )( ::Geometry::BasicVector3D< double > const & ) ; - - vector3d_t_exposer.def( - "assign" - , assign_function_type( &::Geometry::Vector3D< double >::operator= ) - , ( bp::arg("v") ) - , bp::return_self< >() ); - - } - { //::Geometry::Vector3D< double >::transform - - typedef Geometry::Vector3D< double > exported_class_t; - typedef ::Geometry::Vector3D< double > & ( exported_class_t::*transform_function_type )( ::Geometry::Transform3D const & ) ; - - vector3d_t_exposer.def( - "transform" - , transform_function_type( &::Geometry::Vector3D< double >::transform ) - , ( bp::arg("m") ) - , bp::return_internal_reference< >() ); - - } - } - { //::IMaterial typedef bp::class_< IMaterial > IMaterial_exposer_t; IMaterial_exposer_t IMaterial_exposer = IMaterial_exposer_t( "IMaterial", bp::init< >() ); diff --git a/Core/PythonAPI/src/PythonInterface_classes_3.cpp b/Core/PythonAPI/src/PythonInterface_classes_3.cpp index 0b9626bcbe6723d0f92235197d7aeea6178ff1dc..ca6707014b88e22ff80fe5008593389b78f2b080 100644 --- a/Core/PythonAPI/src/PythonInterface_classes_3.cpp +++ b/Core/PythonAPI/src/PythonInterface_classes_3.cpp @@ -30,13 +30,11 @@ #include "NanoParticleDecoration.h" #include "OpticalFresnel.h" #include "ParameterPool.h" -#include "Point3D.h" #include "PythonOutputData.h" #include "PythonPlusplusHelper.h" #include "Transform3D.h" #include "Units.h" #include "Types.h" -#include "Vector3D.h" #include "PythonInterface_classes_3.h" namespace bp = boost::python; @@ -125,140 +123,6 @@ struct NanoParticleCrystal_wrapper : NanoParticleCrystal, bp::wrapper< NanoParti void register_classes_3(){ - { //::KVector< double > - typedef bp::class_< KVector< double > > kvector_t_exposer_t; - kvector_t_exposer_t kvector_t_exposer = kvector_t_exposer_t( "kvector_t", bp::init< >() ); - bp::scope kvector_t_scope( kvector_t_exposer ); - kvector_t_exposer.def( bp::init< double, double, double >(( bp::arg("x"), bp::arg("y"), bp::arg("z") )) ); - { //::KVector< double >::LambdaAlphaPhi - - typedef KVector< double > exported_class_t; - typedef ::KVector< double > ( *LambdaAlphaPhi_function_type )( double,double,double ); - - kvector_t_exposer.def( - "LambdaAlphaPhi" - , LambdaAlphaPhi_function_type( &::KVector< double >::LambdaAlphaPhi ) - , ( bp::arg("lambda"), bp::arg("alpha"), bp::arg("phi") ) ); - - } - { //::KVector< double >::mag - - typedef KVector< double > exported_class_t; - typedef double ( exported_class_t::*mag_function_type )( ) const; - - kvector_t_exposer.def( - "mag" - , mag_function_type( &::KVector< double >::mag ) ); - - } - { //::KVector< double >::mag2 - - typedef KVector< double > exported_class_t; - typedef double ( exported_class_t::*mag2_function_type )( ) const; - - kvector_t_exposer.def( - "mag2" - , mag2_function_type( &::KVector< double >::mag2 ) ); - - } - { //::KVector< double >::magxy - - typedef KVector< double > exported_class_t; - typedef double ( exported_class_t::*magxy_function_type )( ) const; - - kvector_t_exposer.def( - "magxy" - , magxy_function_type( &::KVector< double >::magxy ) ); - - } - kvector_t_exposer.def( bp::self += bp::self ); - kvector_t_exposer.def( bp::self -= bp::self ); - { //::KVector< double >::operator= - - typedef KVector< double > exported_class_t; - typedef ::KVector< double > & ( exported_class_t::*assign_function_type )( ::KVector< double > const & ) ; - - kvector_t_exposer.def( - "assign" - , assign_function_type( &::KVector< double >::operator= ) - , ( bp::arg("other") ) - , bp::return_self< >() ); - - } - { //::KVector< double >::setLambdaAlphaPhi - - typedef KVector< double > exported_class_t; - typedef void ( exported_class_t::*setLambdaAlphaPhi_function_type )( double,double,double ) ; - - kvector_t_exposer.def( - "setLambdaAlphaPhi" - , setLambdaAlphaPhi_function_type( &::KVector< double >::setLambdaAlphaPhi ) - , ( bp::arg("lambda"), bp::arg("alpha"), bp::arg("phi") ) ); - - } - { //::KVector< double >::setMagThetaPhi - - typedef KVector< double > exported_class_t; - typedef void ( exported_class_t::*setMagThetaPhi_function_type )( double,double,double ) ; - - kvector_t_exposer.def( - "setMagThetaPhi" - , setMagThetaPhi_function_type( &::KVector< double >::setMagThetaPhi ) - , ( bp::arg("mag"), bp::arg("theta"), bp::arg("phi") ) ); - - } - { //::KVector< double >::setXYZ - - typedef KVector< double > exported_class_t; - typedef void ( exported_class_t::*setXYZ_function_type )( double,double,double ) ; - - kvector_t_exposer.def( - "setXYZ" - , setXYZ_function_type( &::KVector< double >::setXYZ ) - , ( bp::arg("x"), bp::arg("y"), bp::arg("z") ) ); - - } - { //::KVector< double >::x - - typedef KVector< double > exported_class_t; - typedef double ( exported_class_t::*x_function_type )( ) const; - - kvector_t_exposer.def( - "x" - , x_function_type( &::KVector< double >::x ) ); - - } - { //::KVector< double >::y - - typedef KVector< double > exported_class_t; - typedef double ( exported_class_t::*y_function_type )( ) const; - - kvector_t_exposer.def( - "y" - , y_function_type( &::KVector< double >::y ) ); - - } - { //::KVector< double >::z - - typedef KVector< double > exported_class_t; - typedef double ( exported_class_t::*z_function_type )( ) const; - - kvector_t_exposer.def( - "z" - , z_function_type( &::KVector< double >::z ) ); - - } - kvector_t_exposer.staticmethod( "LambdaAlphaPhi" ); - kvector_t_exposer.def( bp::self * bp::self ); - kvector_t_exposer.def( bp::other< double >() * bp::self ); - kvector_t_exposer.def( bp::self + bp::self ); - kvector_t_exposer.def( +bp::self ); - kvector_t_exposer.def( bp::self - bp::self ); - kvector_t_exposer.def( -bp::self ); - kvector_t_exposer.def( bp::self - bp::self ); - kvector_t_exposer.def( bp::self_ns::str( bp::self ) ); - } - bp::class_< Lattice >( "Lattice", bp::init< >() ) .def( bp::init< kvector_t const &, kvector_t const &, kvector_t const & >(( bp::arg("a1"), bp::arg("a2"), bp::arg("a3") )) ) .def( diff --git a/Core/PythonAPI/src/PythonInterface_free_functions.cpp b/Core/PythonAPI/src/PythonInterface_free_functions.cpp index 9cd581614c843cdab1d2c4f6528770ce1baaec01..bbf52edb4f4d7c19926c08fb22f5b1afd1909d91 100644 --- a/Core/PythonAPI/src/PythonInterface_free_functions.cpp +++ b/Core/PythonAPI/src/PythonInterface_free_functions.cpp @@ -30,37 +30,35 @@ #include "NanoParticleDecoration.h" #include "OpticalFresnel.h" #include "ParameterPool.h" -#include "Point3D.h" #include "PythonOutputData.h" #include "PythonPlusplusHelper.h" #include "Transform3D.h" #include "Units.h" #include "Types.h" -#include "Vector3D.h" #include "PythonInterface_free_functions.h" namespace bp = boost::python; void register_free_functions(){ - { //::CrossProduct + { //::Geometry::CrossProduct - typedef ::kvector_t ( *CrossProduct_function_type )( ::kvector_t const,::kvector_t const ); + typedef ::Geometry::BasicVector3D< double > ( *CrossProduct_function_type )( ::Geometry::BasicVector3D< double > const,::Geometry::BasicVector3D< double > const ); bp::def( "CrossProduct" - , CrossProduct_function_type( &::CrossProduct ) + , CrossProduct_function_type( &::Geometry::CrossProduct ) , ( bp::arg("vectorLeft"), bp::arg("vectorRight") ) ); } - { //::DotProduct + { //::Geometry::DotProduct - typedef double ( *DotProduct_function_type )( ::kvector_t const,::kvector_t const ); + typedef double ( *DotProduct_function_type )( ::Geometry::BasicVector3D< double > const,::Geometry::BasicVector3D< double > const ); bp::def( "DotProduct" - , DotProduct_function_type( &::DotProduct ) + , DotProduct_function_type( &::Geometry::DotProduct ) , ( bp::arg("left"), bp::arg("right") ) ); } diff --git a/Core/PythonAPI/src/PythonInterface_global_variables.cpp b/Core/PythonAPI/src/PythonInterface_global_variables.cpp index 7ff336753dc302f3ed8706c18827ae3d2e510d1f..cd9fa787f7620f43f575f92103fdda11f159e21d 100644 --- a/Core/PythonAPI/src/PythonInterface_global_variables.cpp +++ b/Core/PythonAPI/src/PythonInterface_global_variables.cpp @@ -30,13 +30,11 @@ #include "NanoParticleDecoration.h" #include "OpticalFresnel.h" #include "ParameterPool.h" -#include "Point3D.h" #include "PythonOutputData.h" #include "PythonPlusplusHelper.h" #include "Transform3D.h" #include "Units.h" #include "Types.h" -#include "Vector3D.h" #include "PythonInterface_global_variables.h" namespace bp = boost::python; diff --git a/Core/PythonAPI/src/PythonOutputData.cpp b/Core/PythonAPI/src/PythonOutputData.cpp index 2433ea9b2779aa4f10b3732b01c767b434ea7e3a..56606f27c33c6d18542dbe29869fcd6d770b2a21 100644 --- a/Core/PythonAPI/src/PythonOutputData.cpp +++ b/Core/PythonAPI/src/PythonOutputData.cpp @@ -24,9 +24,8 @@ PyObject *ExportOutputDataAxis(const OutputData<double > &output, int naxis); /* ************************************************************************* */ int GetOutputDataNdimensions(const GISASExperiment &experiment) { - OutputData<double > *data = experiment.getOutputData(); + const OutputData<double > *data = experiment.getOutputData(); int ndims = data->getNdimensions(); - delete data; return ndims; } @@ -36,9 +35,8 @@ int GetOutputDataNdimensions(const GISASExperiment &experiment) /* ************************************************************************* */ PyObject *GetOutputData(const GISASExperiment &experiment) { - OutputData<double > *data = experiment.getOutputData(); + const OutputData<double > *data = experiment.getOutputData(); PyObject *obj = ExportOutputData(*data); - delete data; return obj; } @@ -49,9 +47,8 @@ PyObject *GetOutputData(const GISASExperiment &experiment) /* ************************************************************************* */ PyObject *GetOutputDataAxis(const GISASExperiment &experiment, int naxis) { - OutputData<double > *data = experiment.getOutputData(); + const OutputData<double > *data = experiment.getOutputData(); PyObject *obj = ExportOutputDataAxis(*data, naxis); - delete data; return obj; } diff --git a/Core/Tools/inc/Types.h b/Core/Tools/inc/Types.h index 56d3a8fd04eb02b5c472943a55dc96fadfa41b81..aa70fc09abbd06ef93c6dc49a08e9094d5ce635d 100644 --- a/Core/Tools/inc/Types.h +++ b/Core/Tools/inc/Types.h @@ -16,164 +16,166 @@ #include <complex> #include <vector> +#include "BasicVector3D.h" typedef std::complex<double > complex_t; +typedef Geometry::BasicVector3D<double> kvector_t; + + +//// we need forward declaration here to be able to redefine ostream as friend +//template<typename T> class KVector; +//template<typename T> std::ostream& operator<< (std::ostream& o, const KVector<T>& ); + +//template<typename T> +//class KVector { +//public: +// KVector() : m_x(0), m_y(0), m_z(0) {} +// KVector(T x, T y, T z) : m_x(x), m_y(y), m_z(z) {} +// void setMagThetaPhi(T mag, T theta, T phi) +// { +// T amag = std::abs(mag); +// m_x = amag * std::sin(theta) * std::cos(phi); +// m_y = amag * std::sin(theta) * std::sin(phi); +// m_z = amag * std::cos(theta); +// // m_mag2 = m_x*m_x + m_y*m_y + m_z*m_z; +// } + +// void setXYZ(T x, T y, T z) { m_x = x; m_y = y; m_z = z; } + +// void setLambdaAlphaPhi(T lambda, T alpha, T phi) +// { +// T k = 2.*M_PI/lambda; +// m_x = k*std::cos(alpha) * std::cos(phi); +// m_y = k*std::cos(alpha) * std::sin(phi); +// m_z = k*std::sin(alpha); +// // m_mag2 = m_x*m_x + m_y*m_y + m_z*m_z; +// } +// inline T x() const { return m_x; } +// inline T y() const { return m_y; } +// inline T z() const { return m_z; } +// inline T mag() const { return std::sqrt(mag2()); } +// inline T mag2() const { return m_x*m_x+m_y*m_y+m_z*m_z; } +// inline T magxy() const { return std::sqrt(m_x*m_x+m_y*m_y); } + +// KVector<T> &operator=(const KVector<T> &other); +// KVector<T> &operator+=(const KVector<T> &other); +// KVector<T> &operator-=(const KVector<T> &other); +// friend std::ostream &operator<< <> (std::ostream &ostr, KVector<T> const &k); + +// static KVector<T> LambdaAlphaPhi(T lambda, T alpha, T phi) +// { +// KVector<T> k; k.setLambdaAlphaPhi(lambda, alpha, phi); +// return k; +// } + +//private: +// T m_x; +// T m_y; +// T m_z; +// // T m_mag2; +//}; + +//template<typename T> KVector<T> operator+(const KVector<T> &a, const KVector<T> &b); +//template<typename T> KVector<T> operator-(const KVector<T> &a, const KVector<T> &b); + + +//template<typename T> KVector<T> operator+(const KVector<T> &a, const KVector<T> &b) +//{ +// KVector<T> target = a; +// target += b; +// return target; +//} + +//template<typename T> KVector<T> operator-(const KVector<T> &a, const KVector<T> &b) +//{ +// KVector<T> target = a; +// target -= b; +// return target; +//} -// we need forward declaration here to be able to redefine ostream as friend -template<typename T> class KVector; -template<typename T> std::ostream& operator<< (std::ostream& o, const KVector<T>& ); - - -template<typename T> -class KVector { -public: - KVector() : m_x(0), m_y(0), m_z(0) {} - KVector(T x, T y, T z) : m_x(x), m_y(y), m_z(z) {} - void setMagThetaPhi(T mag, T theta, T phi) - { - T amag = std::abs(mag); - m_x = amag * std::sin(theta) * std::cos(phi); - m_y = amag * std::sin(theta) * std::sin(phi); - m_z = amag * std::cos(theta); - // m_mag2 = m_x*m_x + m_y*m_y + m_z*m_z; - } - - void setXYZ(T x, T y, T z) { m_x = x; m_y = y; m_z = z; } - - void setLambdaAlphaPhi(T lambda, T alpha, T phi) - { - T k = 2.*M_PI/lambda; - m_x = k*std::cos(alpha) * std::cos(phi); - m_y = k*std::cos(alpha) * std::sin(phi); - m_z = k*std::sin(alpha); - // m_mag2 = m_x*m_x + m_y*m_y + m_z*m_z; - } - inline T x() const { return m_x; } - inline T y() const { return m_y; } - inline T z() const { return m_z; } - inline T mag() const { return std::sqrt(mag2()); } - inline T mag2() const { return m_x*m_x+m_y*m_y+m_z*m_z; } - inline T magxy() const { return std::sqrt(m_x*m_x+m_y*m_y); } - - KVector<T> &operator=(const KVector<T> &other); - KVector<T> &operator+=(const KVector<T> &other); - KVector<T> &operator-=(const KVector<T> &other); - friend std::ostream &operator<< <> (std::ostream &ostr, KVector<T> const &k); - - static KVector<T> LambdaAlphaPhi(T lambda, T alpha, T phi) - { - KVector<T> k; k.setLambdaAlphaPhi(lambda, alpha, phi); - return k; - } - -private: - T m_x; - T m_y; - T m_z; - // T m_mag2; -}; - -template<typename T> KVector<T> operator+(const KVector<T> &a, const KVector<T> &b); -template<typename T> KVector<T> operator-(const KVector<T> &a, const KVector<T> &b); - - -template<typename T> KVector<T> operator+(const KVector<T> &a, const KVector<T> &b) -{ - KVector<T> target = a; - target += b; - return target; -} - -template<typename T> KVector<T> operator-(const KVector<T> &a, const KVector<T> &b) -{ - KVector<T> target = a; - target -= b; - return target; -} - - - - -typedef KVector<double> kvector_t; - -#include "Point3D.h" -#include "BasicVector3D.h" -#include "Vector3D.h" -#include "Transform3D.h" -typedef Geometry::Point3D<double > point3d_t; -typedef Geometry::BasicVector3D<double > basicvector3d_t; -typedef Geometry::Vector3D<double > vector3d_t; -//typedef KVector<complex_t> complex_vector_t; -// -//inline complex_vector_t getComplexVector(kvector_t real_vector) +//typedef KVector<double> kvector_t; + +//#include "Point3D.h" +//#include "BasicVector3D.h" +//#include "Vector3D.h" +//#include "Transform3D.h" + +//typedef Geometry::Point3D<double > point3d_t; +//typedef Geometry::BasicVector3D<double > basicvector3d_t; +//typedef Geometry::Vector3D<double > vector3d_t; + + +////typedef KVector<complex_t> complex_vector_t; +//// +////inline complex_vector_t getComplexVector(kvector_t real_vector) +////{ +//// return complex_vector_t(complex_t(real_vector.x()), +//// complex_t(real_vector.y()), complex_t(real_vector.z())); +////} + +//inline kvector_t CrossProduct(const kvector_t vectorLeft, const kvector_t vectorRight) //{ -// return complex_vector_t(complex_t(real_vector.x()), -// complex_t(real_vector.y()), complex_t(real_vector.z())); +// double x = vectorLeft.y()*vectorRight.z() - vectorLeft.z()*vectorRight.y(); +// double y = vectorLeft.z()*vectorRight.x() - vectorLeft.x()*vectorRight.z(); +// double z = vectorLeft.x()*vectorRight.y() - vectorLeft.y()*vectorRight.x(); +// return kvector_t(x, y, z); //} -inline kvector_t CrossProduct(const kvector_t vectorLeft, const kvector_t vectorRight) -{ - double x = vectorLeft.y()*vectorRight.z() - vectorLeft.z()*vectorRight.y(); - double y = vectorLeft.z()*vectorRight.x() - vectorLeft.x()*vectorRight.z(); - double z = vectorLeft.x()*vectorRight.y() - vectorLeft.y()*vectorRight.x(); - return kvector_t(x, y, z); -} - -inline double DotProduct(const kvector_t left, const kvector_t right) -{ - return left.x()*right.x() + left.y()*right.y() + left.z()*right.z(); -} - -inline kvector_t operator*(double scalar, kvector_t vector) -{ - double x = scalar*vector.x(); - double y = scalar*vector.y(); - double z = scalar*vector.z(); - return kvector_t(x, y, z); -} - -inline kvector_t -operator+(const kvector_t & v) { return v; } - -inline kvector_t -operator+(const kvector_t & a,const kvector_t & b) { - return kvector_t(a.x()+b.x(), a.y()+b.y(), a.z()+b.z()); -} - -inline kvector_t -operator-(const kvector_t & v) { - return kvector_t(-v.x(), -v.y(), -v.z()); -} - -inline kvector_t -operator-(const kvector_t & a,const kvector_t & b) { - return kvector_t(a.x()-b.x(), a.y()-b.y(), a.z()-b.z()); -} +//inline double DotProduct(const kvector_t left, const kvector_t right) +//{ +// return left.x()*right.x() + left.y()*right.y() + left.z()*right.z(); +//} -//inline kvector_t -//operator*(const kvector_t & v, double a) { -// return kvector_t(v.x()*a, v.y()*a, v.z()*a); +//inline kvector_t operator*(double scalar, kvector_t vector) +//{ +// double x = scalar*vector.x(); +// double y = scalar*vector.y(); +// double z = scalar*vector.z(); +// return kvector_t(x, y, z); //} -inline double -operator*(const kvector_t & a,const kvector_t & b) { - return DotProduct(a,b); -} +//inline kvector_t +//operator+(const kvector_t & v) { return v; } + +//inline kvector_t +//operator+(const kvector_t & a,const kvector_t & b) { +// return kvector_t(a.x()+b.x(), a.y()+b.y(), a.z()+b.z()); +//} //inline kvector_t -//operator*(double a, const kvector_t & v) { -// return kvector_t(a*v.x(), a*v.y(), a*v.z()); +//operator-(const kvector_t & v) { +// return kvector_t(-v.x(), -v.y(), -v.z()); //} //inline kvector_t -//operator/(const kvector_t & v, double a) { -// return kvector_t(v.x()/a, v.y()/a, v.z()/a); +//operator-(const kvector_t & a,const kvector_t & b) { +// return kvector_t(a.x()-b.x(), a.y()-b.y(), a.z()-b.z()); +//} + +////inline kvector_t +////operator*(const kvector_t & v, double a) { +//// return kvector_t(v.x()*a, v.y()*a, v.z()*a); +////} + +//inline double +//operator*(const kvector_t & a,const kvector_t & b) { +// return DotProduct(a,b); //} +////inline kvector_t +////operator*(double a, const kvector_t & v) { +//// return kvector_t(a*v.x(), a*v.y(), a*v.z()); +////} + +////inline kvector_t +////operator/(const kvector_t & v, double a) { +//// return kvector_t(v.x()/a, v.y()/a, v.z()/a); +////} + diff --git a/Core/Tools/src/Types.cpp b/Core/Tools/src/Types.cpp index 71fff7674151435d206581fd663fbd2e1df5226a..e80fabe2ae8488c11f00e4becd9e11c5584be4c7 100644 --- a/Core/Tools/src/Types.cpp +++ b/Core/Tools/src/Types.cpp @@ -2,44 +2,44 @@ -template<typename T> -KVector<T> &KVector<T>::operator=(const KVector<T> &other) -{ - m_x=other.m_x; m_y = other.m_y; m_z = other.m_z; //m_mag2 = other.m_mag2; - return *this; -} - -template<typename T> KVector<T> &KVector<T>::operator+=(const KVector<T> &b) -{ - m_x += b.m_x; m_y += b.m_y; m_z += b.m_z; - //m_mag2 = m_x*m_x + m_y*m_y + m_z*m_z; - return *this; -} - -template<typename T> KVector<T> &KVector<T>::operator-=(const KVector<T> &b) -{ - m_x -= b.m_x; m_y -= b.m_y; m_z -= b.m_z; - //m_mag2 = m_x*m_x + m_y*m_y + m_z*m_z; - return *this; -} - - -template<typename T> -std::ostream &operator<<(std::ostream &o, const KVector<T> &a) -{ - o << a.m_x << " " << a.m_y << " " << a.m_z; - return o; -} - - - -// to force compiler to generate necessary code in shared library -template class KVector<double>; -//template KVector<double> operator= <double> (const KVector<double> &a); -//template KVector<double> operator+= <double> (const KVector<double> &a); -//template KVector<double> operator-= <double> (const KVector<double> &a); -template KVector<double> operator+ <double> (const KVector<double> &a, const KVector<double> &b); -template KVector<double> operator- <double> (const KVector<double> &a, const KVector<double> &b); -template std::ostream &operator<< <double> (std::ostream &o, const KVector<double> &b); +//template<typename T> +//KVector<T> &KVector<T>::operator=(const KVector<T> &other) +//{ +// m_x=other.m_x; m_y = other.m_y; m_z = other.m_z; //m_mag2 = other.m_mag2; +// return *this; +//} + +//template<typename T> KVector<T> &KVector<T>::operator+=(const KVector<T> &b) +//{ +// m_x += b.m_x; m_y += b.m_y; m_z += b.m_z; +// //m_mag2 = m_x*m_x + m_y*m_y + m_z*m_z; +// return *this; +//} + +//template<typename T> KVector<T> &KVector<T>::operator-=(const KVector<T> &b) +//{ +// m_x -= b.m_x; m_y -= b.m_y; m_z -= b.m_z; +// //m_mag2 = m_x*m_x + m_y*m_y + m_z*m_z; +// return *this; +//} + + +//template<typename T> +//std::ostream &operator<<(std::ostream &o, const KVector<T> &a) +//{ +// o << a.m_x << " " << a.m_y << " " << a.m_z; +// return o; +//} + + + +//// to force compiler to generate necessary code in shared library +//template class KVector<double>; +////template KVector<double> operator= <double> (const KVector<double> &a); +////template KVector<double> operator+= <double> (const KVector<double> &a); +////template KVector<double> operator-= <double> (const KVector<double> &a); +//template KVector<double> operator+ <double> (const KVector<double> &a, const KVector<double> &b); +//template KVector<double> operator- <double> (const KVector<double> &a, const KVector<double> &b); +//template std::ostream &operator<< <double> (std::ostream &o, const KVector<double> &b); diff --git a/Examples/Performance/perf_history.txt b/Examples/Performance/perf_history.txt index e9a0d71d932a8e53849de5398b8babc0c8a917ee..0e4c1cb27829fd0e42930c654146acf29f06b766 100644 --- a/Examples/Performance/perf_history.txt +++ b/Examples/Performance/perf_history.txt @@ -1,4 +1,23 @@ -# date and time | hostname | system information | FresnelCoeff Pyramid RotatedPyramid MesoCrystal +# date and time | hostname | system information | FresnelCoeff Pyramid RotatedPyramid MesoCrystal -2012-07-24 18:21:18 | jcnsopc73 | macosx64, 2800 MHz, 256 Kb | 82987.5 | 4.14079 | 3.89105 | 0.233918 | -2012-07-24 18:22:36 | jcnsopc73 | macosx64, 2800 MHz, 256 Kb | 82987.5 | 4.14938 | 3.91389 | 0.233918 | +2012-07-24 18:21:18 | jcnsopc73 | macosx64, 2800 MHz | 82987.5 | 4.14079 | 3.89105 | 0.23391 | +2012-07-24 18:22:36 | jcnsopc73 | macosx64, 2800 MHz | 82987.5 | 4.14938 | 3.91389 | 0.23391 | +2012-07-24 18:31:44 | iff1610 | linuxx8664gcc, 2399 MHz | 45248.9 | 3.10559 | 2.90698 | 0.17730 | +2012-07-25 10:32:15 | jcnsopc73 | macosx64, 2800 MHz | 84033.6 | 4.0404 | 3.87597 | 0.23640 | +2012-07-25 12:53:59 | jcnsopc73 | macosx64, 2800 MHz | 81300.8 | 3.99202 | 3.82409 | 0.22321 | +2012-07-25 13:07:19 | jcnsopc73 | macosx64, 2800 MHz | 80000 | 4.08163 | 3.89105 | 0.23446 | +2012-07-25 13:08:31 | jcnsopc73 | macosx64, 2800 MHz | 83333.3 | 4.06504 | 3.861 | 0.22883 | +2012-07-25 13:10:06 | jcnsopc73 | macosx64, 2800 MHz | 84033.6 | 4.05679 | 3.89105 | 0.22857 | + +# switched off debug +2012-07-25 13:18:04 | jcnsopc73 | macosx64, 2800 MHz | 266667 | 12.987 | 12.8205 | 0.70922 | +2012-07-25 13:19:11 | jcnsopc73 | macosx64, 2800 MHz | 256410 | 12.9032 | 12.4224 | 0.70175 | + +# kvector_t -> BasicVector3D < double> : improvement ~10% +2012-07-25 15:39:19 | jcnsopc73 | macosx64, 2800 MHz | 229885 | 11.2994 | 11.4286 | 0.60606 | +2012-07-25 15:40:44 | jcnsopc73 | macosx64, 2800 MHz | 240964 | 11.1732 | 11.5607 | 0.625 | +2012-07-25 15:53:31 | jcnsopc73 | macosx64, 2800 MHz | 238095 | 11.8343 | 11.6279 | 0.60060 | + +# debug is switched on again, and it is the same as before migration in kvector +2012-07-25 15:57:02 | jcnsopc73 | macosx64, 2800 MHz | 80645.2 | 3.92927 | 3.89105 | 0.21254 | +2012-07-25 15:58:36 | jcnsopc73 | macosx64, 2800 MHz | 80971.7 | 3.96825 | 3.80228 | 0.21276 | diff --git a/Examples/UsageWithPython/isgisaxs9_rotated_pyramid.py b/Examples/UsageWithPython/isgisaxs9_rotated_pyramid.py index c3b4f88148dc405cc74eecc57a3757e09d87151b..d428942229e620d3592c86cc264393ce08703631 100644 --- a/Examples/UsageWithPython/isgisaxs9_rotated_pyramid.py +++ b/Examples/UsageWithPython/isgisaxs9_rotated_pyramid.py @@ -58,7 +58,7 @@ multi_layer.addLayer(substrate) # build and run experiment # ------------------------ experiment = GISASExperiment() -experiment.setDetectorParameters(0.0*degree, 2.0*degree, 100, 0.0*degree, 2.0*degree, 100, True) +experiment.setDetectorParameters(100, 0.0*degree, 2.0*degree, 100, 0.0*degree, 2.0*degree, True) experiment.setBeamParameters(1.0*angstrom, -0.2*degree, 0.0*degree) experiment.setSample(multi_layer) diff --git a/Examples/UsageWithPython/test_mesocrystal.py b/Examples/UsageWithPython/test_mesocrystal.py index 1f96c6363af30c59684c7b891a4875a05fcb90d8..3a476d35e36b95543bb3a38138f7597055c0894e 100644 --- a/Examples/UsageWithPython/test_mesocrystal.py +++ b/Examples/UsageWithPython/test_mesocrystal.py @@ -76,7 +76,7 @@ multi_layer.addLayer(substrate_layer) # build and run experiment # ------------------------ experiment = GISASExperiment() -experiment.setDetectorParameters(0.1*degree, 2.0*degree, 100, 0.0*degree, 2.0*degree, 100, True) +experiment.setDetectorParameters(100, 0.1*degree, 2.0*degree, 100, 0.0*degree, 2.0*degree, True) experiment.setBeamParameters(0.77*angstrom, -0.4*degree, 0.0*degree) experiment.setSample(multi_layer) diff --git a/Examples/UsageWithPython/test_vector3d.py b/Examples/UsageWithPython/test_vector3d.py index 71c1363a650c7b287b4fc27e54d854c484693112..70b1078e63c418f21d5cfb062ee43ebbb573a2d2 100644 --- a/Examples/UsageWithPython/test_vector3d.py +++ b/Examples/UsageWithPython/test_vector3d.py @@ -10,14 +10,18 @@ sys.path.append(os.path.abspath( from libScattCore import * -v1=vector3d_t(1,0,0) +v1=kvector_t(1,0,0) print v1 -v2=vector3d_t(0,1,0) +v2=kvector_t(0,1,0) print v2 v3=0.5*v1+v2 print v3 -t = transform3d_t() -print t \ No newline at end of file +v4=kvector_t(1,0,0) + +t = Transform3D() +t = RotateZ3D(45.*degree) +v4.transform(t) +print v4 \ No newline at end of file diff --git a/Macros/BoostPythonGenerator/codegenerator.py b/Macros/BoostPythonGenerator/codegenerator.py index 7c53400b6c7f5fb4e77ce9ac980f1e418b3a168d..1d2ba8802f059f2c3cf3df1f547a2ef21315e145 100644 --- a/Macros/BoostPythonGenerator/codegenerator.py +++ b/Macros/BoostPythonGenerator/codegenerator.py @@ -53,13 +53,13 @@ myFiles=[ 'NanoParticleDecoration.h', 'OpticalFresnel.h', 'ParameterPool.h', - 'Point3D.h', +## 'Point3D.h', 'PythonOutputData.h', 'PythonPlusplusHelper.h', 'Transform3D.h', 'Units.h', 'Types.h', - 'Vector3D.h', +## 'Vector3D.h', ] #'IClusteredNanoParticles.h', diff --git a/Macros/CodeProfiling/run_valgrind.sh b/Macros/CodeProfiling/run_valgrind.sh index 84c33f2f4fd9bd4a748888e17067b0184f76a374..8a760d3c75689b4edda846a5a26df479a672910b 100755 --- a/Macros/CodeProfiling/run_valgrind.sh +++ b/Macros/CodeProfiling/run_valgrind.sh @@ -7,13 +7,14 @@ mkdir -p ./output application=../../App/App #arguments="isgisaxs9 profile" #arguments="isgisaxs10 batch" -arguments="isgisaxs9 batch" +#arguments="isgisaxs9 batch" +arguments="mesocrystal batch profile" focuson=GISASExperiment # ------------------------------------------- # # profiling cpu usage # ------------------------------------------- # -profile_cpu=no +profile_cpu=yes if [ $profile_cpu = "yes" ] then # valgrind --tool=callgrind -v --dump-every-bb=10000000 --dump-instr=yes --trace-jump=yes ./App commandline @@ -25,7 +26,7 @@ fi # ------------------------------------------- # # profiling HEAP usage # ------------------------------------------- # -profile_memory=yes +profile_memory=no if [ $profile_memory = "yes" ] then valgrind --log-file=./output/valgrind.output --dsymutil=yes --num-callers=6 --track-origins=yes --leak-check=yes $application $arguments diff --git a/shared.pri b/shared.pri index 6a825b55f8cd6625dfefe4058149ec6c88f3e05d..05352f8713e809f4a04b3a95aadea381821f2d51 100644 --- a/shared.pri +++ b/shared.pri @@ -10,6 +10,7 @@ lessThan(QT_VERSION, 4.5) { # uncomment to compile with GPERFTOOLS support for code profiling #CONFIG += GPERFTOOLS +#CONFIG += debug CONFIG(GPERFTOOLS) { QMAKE_CXXFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free