diff --git a/App/inc/TestFumiliLMA.h b/App/inc/TestFumiliLMA.h index 54a4489e3fac08eceaf2f81a7c7c267f252a099d..86afed5d0bb262f3bed8497eeb6f7691725073a5 100644 --- a/App/inc/TestFumiliLMA.h +++ b/App/inc/TestFumiliLMA.h @@ -88,15 +88,18 @@ public: class SincXSincYFunctionObject : public IFunctionObject { public: - double operator()(const double *xx, const double *pars ) + double operator()(const double *, const double * ) { - const double x = xx[0]; - const double y = xx[1]; - const double p0=pars[0]; - const double p1=pars[1]; - const double p2=pars[2]; - double value = p0 * MathFunctions::Sinc(x-p1) * MathFunctions::Sinc(y-p2); - return value; +// throw Exceptions::NotImplementedException("Cleanup the code!"); +// const double x = xx[0]; +// const double y = xx[1]; +// const double p0=pars[0]; +// const double p1=pars[1]; +// const double p2=pars[2]; +//// double value = p0 * MathFunctions::Sinc(x-p1) * MathFunctions::Sinc(y-p2); +// return value; + throw Exceptions::NotImplementedException("Cleanup the code!"); + } }; diff --git a/App/src/TestBugs.cpp b/App/src/TestBugs.cpp index d6477344de0f40948d6d727b3e3c7632c39751cf..aa08c3b193f5a642d760793689ad81583c6ca438 100644 --- a/App/src/TestBugs.cpp +++ b/App/src/TestBugs.cpp @@ -38,28 +38,30 @@ void TestBugs::execute() void TestBugs::test_item339() { - std::cout << "TestBugs::test_item339() -> " << std::endl; +// std::cout << "TestBugs::test_item339() -> " << std::endl; - complex_t n_particle(1.0-6e-4, 2e-8); - HomogeneousMaterial mParticle("Particle", n_particle ); +// complex_t n_particle(1.0-6e-4, 2e-8); +// HomogeneousMaterial mParticle("Particle", n_particle ); - FormFactorTruncatedSphere sphere_ff(8.0*Units::nanometer, 8.0*Units::nanometer); +// FormFactorTruncatedSphere sphere_ff(8.0*Units::nanometer, 8.0*Units::nanometer); - Particle particle(mParticle, sphere_ff); +// Particle particle(mParticle, sphere_ff); - InterferenceFunction2DParaCrystal *interf = - InterferenceFunction2DParaCrystal::createHexagonal(20.0*Units::nanometer, - 0.0,20.0*Units::micrometer, 20.0*Units::micrometer); +// InterferenceFunction2DParaCrystal *interf = +// InterferenceFunction2DParaCrystal::createHexagonal(20.0*Units::nanometer, +// 0.0,20.0*Units::micrometer, 20.0*Units::micrometer); - ParticleLayout *decoration = new ParticleLayout(); +// ParticleLayout *decoration = new ParticleLayout(); - decoration->addParticle(particle, 1.0); +// decoration->addParticle(particle, 1.0); - decoration->addInterferenceFunction(interf); +// decoration->addInterferenceFunction(interf); + throw Exceptions::NotImplementedException("Cleanup the code!"); + } diff --git a/App/src/TestDetectorResolution.cpp b/App/src/TestDetectorResolution.cpp index 7cfbb486959cd2da2212c4a71771e9d23e81c2c6..f5f040981e4125b350df9d7b8a5fb42d90d46ac3 100644 --- a/App/src/TestDetectorResolution.cpp +++ b/App/src/TestDetectorResolution.cpp @@ -50,33 +50,35 @@ void TestDetectorResolution::execute() void TestDetectorResolution::initializeSample() { - delete mp_sample; - MultiLayer *p_multi_layer = new MultiLayer(); - complex_t n_air(1.0, 0.0); - complex_t n_substrate(1.0-5e-6, 2e-8); - HomogeneousMaterial air_material("Air", n_air); - HomogeneousMaterial substrate_material("Substrate", n_substrate); - HomogeneousMaterial particle_material("Particle", 5e-5, 2e-8); +// delete mp_sample; +// MultiLayer *p_multi_layer = new MultiLayer(); +// complex_t n_air(1.0, 0.0); +// complex_t n_substrate(1.0-5e-6, 2e-8); +// HomogeneousMaterial air_material("Air", n_air); +// HomogeneousMaterial substrate_material("Substrate", n_substrate); +// HomogeneousMaterial particle_material("Particle", 5e-5, 2e-8); - Layer air_layer; - air_layer.setMaterial(air_material); - Layer substrate_layer; - substrate_layer.setMaterial(substrate_material); - InterferenceFunctionRadialParaCrystal *p_interference_function = - new InterferenceFunctionRadialParaCrystal(20.0*Units::nanometer, - 1e7*Units::nanometer); - FTDistribution1DGauss pdf(7*Units::nanometer); - p_interference_function->setProbabilityDistribution(pdf); - Particle particle(particle_material, FormFactorCylinder(5*Units::nanometer, - 5*Units::nanometer)); - ParticleLayout particle_layout(particle); - particle_layout.addInterferenceFunction(p_interference_function); +// Layer air_layer; +// air_layer.setMaterial(air_material); +// Layer substrate_layer; +// substrate_layer.setMaterial(substrate_material); +// InterferenceFunctionRadialParaCrystal *p_interference_function = +// new InterferenceFunctionRadialParaCrystal(20.0*Units::nanometer, +// 1e7*Units::nanometer); +// FTDistribution1DGauss pdf(7*Units::nanometer); +// p_interference_function->setProbabilityDistribution(pdf); +// Particle particle(particle_material, FormFactorCylinder(5*Units::nanometer, +// 5*Units::nanometer)); +// ParticleLayout particle_layout(particle); +// particle_layout.addInterferenceFunction(p_interference_function); - air_layer.addLayout(particle_layout); +// air_layer.addLayout(particle_layout); + +// p_multi_layer->addLayer(air_layer); +// p_multi_layer->addLayer(substrate_layer); +// mp_sample = p_multi_layer; + throw Exceptions::NotImplementedException("Cleanup the code!"); - p_multi_layer->addLayer(air_layer); - p_multi_layer->addLayer(substrate_layer); - mp_sample = p_multi_layer; } diff --git a/App/src/TestFittingModule2.cpp b/App/src/TestFittingModule2.cpp index 61c785c2896d88f9b37a756fdff50c6693c607e7..3a01758e530b0a84244515acdfa629745104b75a 100644 --- a/App/src/TestFittingModule2.cpp +++ b/App/src/TestFittingModule2.cpp @@ -382,32 +382,34 @@ TestFittingModule2::SampleBuilder::SampleBuilder() ISample *TestFittingModule2::SampleBuilder::buildSample() const { - MultiLayer *p_multi_layer = new MultiLayer(); - complex_t n_air(1.0, 0.0); - complex_t n_substrate(1.0-6e-6, 2e-8); - complex_t n_particle(1.0-6e-4, 2e-8); - HomogeneousMaterial air_material("Air", n_air); - HomogeneousMaterial substrate_material("Substrate", n_substrate); - HomogeneousMaterial particle_material("Particle", n_particle); - Layer air_layer; - air_layer.setMaterial(air_material); - Layer substrate_layer; - substrate_layer.setMaterial(substrate_material); - ParticleLayout particle_layout; - Particle particle1(particle_material, FormFactorCylinder( - m_cylinder_radius, m_cylinder_height) ); - Particle particle2(particle_material, FormFactorPrism3( - m_prism3_length, m_prism3_height) ); - particle_layout.addParticle(particle1, m_cylinder_ratio); - particle_layout.addParticle(particle2, 1.0 - m_cylinder_ratio); - particle_layout.addInterferenceFunction(new InterferenceFunctionNone()); - - air_layer.addLayout(particle_layout); - - p_multi_layer->addLayer(air_layer); - p_multi_layer->addLayer(substrate_layer); - - return p_multi_layer; +// MultiLayer *p_multi_layer = new MultiLayer(); +// complex_t n_air(1.0, 0.0); +// complex_t n_substrate(1.0-6e-6, 2e-8); +// complex_t n_particle(1.0-6e-4, 2e-8); +// HomogeneousMaterial air_material("Air", n_air); +// HomogeneousMaterial substrate_material("Substrate", n_substrate); +// HomogeneousMaterial particle_material("Particle", n_particle); +// Layer air_layer; +// air_layer.setMaterial(air_material); +// Layer substrate_layer; +// substrate_layer.setMaterial(substrate_material); +// ParticleLayout particle_layout; +// Particle particle1(particle_material, FormFactorCylinder( +// m_cylinder_radius, m_cylinder_height) ); +// Particle particle2(particle_material, FormFactorPrism3( +// m_prism3_length, m_prism3_height) ); +// particle_layout.addParticle(particle1, m_cylinder_ratio); +// particle_layout.addParticle(particle2, 1.0 - m_cylinder_ratio); +// particle_layout.addInterferenceFunction(new InterferenceFunctionNone()); + +// air_layer.addLayout(particle_layout); + +// p_multi_layer->addLayer(air_layer); +// p_multi_layer->addLayer(substrate_layer); + +// return p_multi_layer; + throw Exceptions::NotImplementedException("Cleanup the code!"); + } diff --git a/App/src/TestFittingModule3.cpp b/App/src/TestFittingModule3.cpp index a9256f93368d190b7148cb60f9abed0487cc5dbf..fdbaadccfcbe6ada93d1cdbefae406853873dd0d 100644 --- a/App/src/TestFittingModule3.cpp +++ b/App/src/TestFittingModule3.cpp @@ -111,36 +111,38 @@ void TestFittingModule3::initializeSimulation() /* ************************************************************************* */ void TestFittingModule3::initializeSample() { - delete m_sample; - double cylinder_height = 5.0*Units::nanometer; - double cylinder_radius = 5.0*Units::nanometer; - double prism3_length = 10.0*Units::nanometer; - double prism3_height = 5.0*Units::nanometer; - MultiLayer *p_multi_layer = new MultiLayer(); - complex_t n_air(1.0, 0.0); - complex_t n_substrate(1.0-6e-6, 2e-8); - complex_t n_particle(1.0-6e-4, 2e-8); - HomogeneousMaterial air_material("Air", n_air); - HomogeneousMaterial substrate_material("Substrate", n_substrate); - HomogeneousMaterial particle_material("Particle", n_particle); - Layer air_layer; - air_layer.setMaterial(air_material); - Layer substrate_layer; - substrate_layer.setMaterial(substrate_material); - Particle particle1(particle_material, FormFactorCylinder( - cylinder_radius, cylinder_height) ); - Particle particle2(particle_material, FormFactorPrism3( - prism3_length, prism3_height) ); - ParticleLayout particle_layout; - particle_layout.addParticle(particle1, 0.2); - particle_layout.addParticle(particle2, 0.8); - particle_layout.addInterferenceFunction(new InterferenceFunctionNone()); - - air_layer.addLayout(particle_layout); - - p_multi_layer->addLayer(air_layer); - p_multi_layer->addLayer(substrate_layer); - m_sample = p_multi_layer; +// delete m_sample; +// double cylinder_height = 5.0*Units::nanometer; +// double cylinder_radius = 5.0*Units::nanometer; +// double prism3_length = 10.0*Units::nanometer; +// double prism3_height = 5.0*Units::nanometer; +// MultiLayer *p_multi_layer = new MultiLayer(); +// complex_t n_air(1.0, 0.0); +// complex_t n_substrate(1.0-6e-6, 2e-8); +// complex_t n_particle(1.0-6e-4, 2e-8); +// HomogeneousMaterial air_material("Air", n_air); +// HomogeneousMaterial substrate_material("Substrate", n_substrate); +// HomogeneousMaterial particle_material("Particle", n_particle); +// Layer air_layer; +// air_layer.setMaterial(air_material); +// Layer substrate_layer; +// substrate_layer.setMaterial(substrate_material); +// Particle particle1(particle_material, FormFactorCylinder( +// cylinder_radius, cylinder_height) ); +// Particle particle2(particle_material, FormFactorPrism3( +// prism3_length, prism3_height) ); +// ParticleLayout particle_layout; +// particle_layout.addParticle(particle1, 0.2); +// particle_layout.addParticle(particle2, 0.8); +// particle_layout.addInterferenceFunction(new InterferenceFunctionNone()); + +// air_layer.addLayout(particle_layout); + +// p_multi_layer->addLayer(air_layer); +// p_multi_layer->addLayer(substrate_layer); +// m_sample = p_multi_layer; + + throw Exceptions::NotImplementedException("Cleanup the code!"); } diff --git a/App/src/TestFormFactors.cpp b/App/src/TestFormFactors.cpp index 195162c520e62c457a29b70236e2141f91e22595..b3f9f32471b3914cb1ca2ea6044dce157f9a75dc 100644 --- a/App/src/TestFormFactors.cpp +++ b/App/src/TestFormFactors.cpp @@ -128,126 +128,130 @@ void TestFormFactors::execute() void TestFormFactors::run_isgisaxs_simulation(IFormFactor *p_form_factor) { - HomogeneousMaterial air_material("Air", 0.0, 0.0); - HomogeneousMaterial particle_material("Particle", 6e-4, 2e-8); - - //building sample - MultiLayer multi_layer; - Layer air_layer; - air_layer.setMaterial(air_material); - - mp_form_factor=p_form_factor; - Particle particle(particle_material, *mp_form_factor); - ParticleLayout particle_layout(particle); - particle_layout.addInterferenceFunction(new InterferenceFunctionNone()); - air_layer.addLayout(particle_layout); - multi_layer.addLayer(air_layer); - - // building simulation - GISASSimulation simulation(mp_options); - IsGISAXSDetector detector; - detector.setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree, - 100, 0.0*Units::degree, 2.0*Units::degree); - simulation.setDetector(detector); - - simulation.setSample(multi_layer); - simulation.runSimulation(); - std::cout << mp_form_factor->getName().substr(10) <<std::endl; - IntensityDataIOFactory::writeOutputData(*simulation.getOutputData(), - "this_"+mp_form_factor->getName().substr(10)+"_BA.ima"); +// HomogeneousMaterial air_material("Air", 0.0, 0.0); +// HomogeneousMaterial particle_material("Particle", 6e-4, 2e-8); + +// //building sample +// MultiLayer multi_layer; +// Layer air_layer; +// air_layer.setMaterial(air_material); + +// mp_form_factor=p_form_factor; +// Particle particle(particle_material, *mp_form_factor); +// ParticleLayout particle_layout(particle); +// particle_layout.addInterferenceFunction(new InterferenceFunctionNone()); +// air_layer.addLayout(particle_layout); +// multi_layer.addLayer(air_layer); + +// // building simulation +// GISASSimulation simulation(mp_options); +// IsGISAXSDetector detector; +// detector.setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree, +// 100, 0.0*Units::degree, 2.0*Units::degree); +// simulation.setDetector(detector); + +// simulation.setSample(multi_layer); +// simulation.runSimulation(); +// std::cout << mp_form_factor->getName().substr(10) <<std::endl; +// IntensityDataIOFactory::writeOutputData(*simulation.getOutputData(), +// "this_"+mp_form_factor->getName().substr(10)+"_BA.ima"); + throw Exceptions::NotImplementedException("Cleanup the code!"); + } void TestFormFactors::finalise() { - std::vector< CompareStruct > tocompare; - tocompare.push_back( CompareStruct(getOutputPath()+"isgi_cylinder_BA.ima", - "this_Cylinder_BA.ima", - "Cylinder BA Formfactor")); +// std::vector< CompareStruct > tocompare; +// tocompare.push_back( CompareStruct(getOutputPath()+"isgi_cylinder_BA.ima", +// "this_Cylinder_BA.ima", +// "Cylinder BA Formfactor")); + +// tocompare.push_back( CompareStruct(getOutputPath()+"isgi_box_BA.ima", +// "this_Box_BA.ima", "Box BA Formfactor")); - tocompare.push_back( CompareStruct(getOutputPath()+"isgi_box_BA.ima", - "this_Box_BA.ima", "Box BA Formfactor")); +// tocompare.push_back( CompareStruct(getOutputPath()+"isgi_cone_BA.ima", +// "this_Cone_BA.ima", "Cone BA Formfactor")); - tocompare.push_back( CompareStruct(getOutputPath()+"isgi_cone_BA.ima", - "this_Cone_BA.ima", "Cone BA Formfactor")); +// tocompare.push_back( CompareStruct( getOutputPath()+"isgi_cone6_BA.ima", +// "this_Cone6_BA.ima", "Cone6 BA Formfactor")); - tocompare.push_back( CompareStruct( getOutputPath()+"isgi_cone6_BA.ima", - "this_Cone6_BA.ima", "Cone6 BA Formfactor")); +// tocompare.push_back( CompareStruct(getOutputPath()+ +// "isgi_full_sphere_BA.ima", +// "this_FullSphere_BA.ima","Full Sphere BA Formfactor")); - tocompare.push_back( CompareStruct(getOutputPath()+ - "isgi_full_sphere_BA.ima", - "this_FullSphere_BA.ima","Full Sphere BA Formfactor")); +// tocompare.push_back( CompareStruct(getOutputPath()+ +// "isgi_parallelepiped_BA.ima", +// "this_Parallelepiped_BA.ima","Parallelepiped BA Formfactor")); - tocompare.push_back( CompareStruct(getOutputPath()+ - "isgi_parallelepiped_BA.ima", - "this_Parallelepiped_BA.ima","Parallelepiped BA Formfactor")); +// tocompare.push_back( CompareStruct(getOutputPath()+"isgi_prism3_BA.ima", +// "this_Prism3_BA.ima", "Prism3 BA Formfactor")); - tocompare.push_back( CompareStruct(getOutputPath()+"isgi_prism3_BA.ima", - "this_Prism3_BA.ima", "Prism3 BA Formfactor")); +// tocompare.push_back( CompareStruct(getOutputPath()+"isgi_prism6_BA.ima", +// "this_Prism6_BA.ima", "Prism6 BA Formfactor")); - tocompare.push_back( CompareStruct(getOutputPath()+"isgi_prism6_BA.ima", - "this_Prism6_BA.ima", "Prism6 BA Formfactor")); +// tocompare.push_back( CompareStruct(getOutputPath()+"isgi_pyramid_BA.ima", +// "this_Pyramid_BA.ima","Pyramid BA Formfactor")); - tocompare.push_back( CompareStruct(getOutputPath()+"isgi_pyramid_BA.ima", - "this_Pyramid_BA.ima","Pyramid BA Formfactor")); +// tocompare.push_back( CompareStruct(getOutputPath()+"isgi_sphere_BA.ima", +// "this_Sphere_BA.ima","Sphere BA Formfactor")); - tocompare.push_back( CompareStruct(getOutputPath()+"isgi_sphere_BA.ima", - "this_Sphere_BA.ima","Sphere BA Formfactor")); +// tocompare.push_back( CompareStruct(getOutputPath()+ +// "isgi_tetrahedron_BA.ima", +// "this_Tetrahedron_BA.ima","Tetrahedron BA Formfactor")); - tocompare.push_back( CompareStruct(getOutputPath()+ - "isgi_tetrahedron_BA.ima", - "this_Tetrahedron_BA.ima","Tetrahedron BA Formfactor")); +// tocompare.push_back( CompareStruct(getOutputPath()+ +// "isgi_cuboctahedron_BA.ima", +// "this_Cuboctahedron_BA.ima","Cuboctahedron BA Formfactor")); - tocompare.push_back( CompareStruct(getOutputPath()+ - "isgi_cuboctahedron_BA.ima", - "this_Cuboctahedron_BA.ima","Cuboctahedron BA Formfactor")); +// tocompare.push_back( CompareStruct(getOutputPath()+ +// "isgi_aniso_pyramid_BA.ima", +// "this_AnisoPyramid_BA.ima", "AnisoPyramid BA Formfactor")); - tocompare.push_back( CompareStruct(getOutputPath()+ - "isgi_aniso_pyramid_BA.ima", - "this_AnisoPyramid_BA.ima", "AnisoPyramid BA Formfactor")); +// tocompare.push_back( CompareStruct(getOutputPath()+"isgi_ellipsoid_BA.ima", +// "this_EllipsoidalCylinder_BA.ima","EllipsoidalCylinder BA Formfactor")); - tocompare.push_back( CompareStruct(getOutputPath()+"isgi_ellipsoid_BA.ima", - "this_EllipsoidalCylinder_BA.ima","EllipsoidalCylinder BA Formfactor")); +// tocompare.push_back( CompareStruct(getOutputPath()+"isgi_full_spheroid_BA.ima", +// "this_FullSpheroid_BA.ima", "FullSpheroid BA Formfactor")); - tocompare.push_back( CompareStruct(getOutputPath()+"isgi_full_spheroid_BA.ima", - "this_FullSpheroid_BA.ima", "FullSpheroid BA Formfactor")); +// tocompare.push_back( CompareStruct(getOutputPath()+"isgi_spheroid_BA.ima", +// "this_Spheroid_BA.ima", "Spheroid BA Formfactor")); - tocompare.push_back( CompareStruct(getOutputPath()+"isgi_spheroid_BA.ima", - "this_Spheroid_BA.ima", "Spheroid BA Formfactor")); +// tocompare.push_back( CompareStruct(getOutputPath()+ +// "isgi_hemi_ellipsoid_BA.ima","this_HemiEllipsoid_BA.ima", +// "HemiEllipsoid BA Formfactor")); - tocompare.push_back( CompareStruct(getOutputPath()+ - "isgi_hemi_ellipsoid_BA.ima","this_HemiEllipsoid_BA.ima", - "HemiEllipsoid BA Formfactor")); +// const double threshold(2e-10); - const double threshold(2e-10); +// for(size_t i=0; i<tocompare.size(); ++i) { +// OutputData<double> *isgi_data = IntensityDataIOFactory::readOutputData( +// tocompare[i].isginame); +// OutputData<double> *our_data = IntensityDataIOFactory::readOutputData( +// tocompare[i].thisname); - for(size_t i=0; i<tocompare.size(); ++i) { - OutputData<double> *isgi_data = IntensityDataIOFactory::readOutputData( - tocompare[i].isginame); - OutputData<double> *our_data = IntensityDataIOFactory::readOutputData( - tocompare[i].thisname); +// IsGISAXSTools::drawOutputDataComparisonResults(*our_data, *isgi_data, +// tocompare[i].descr, tocompare[i].descr); - IsGISAXSTools::drawOutputDataComparisonResults(*our_data, *isgi_data, - tocompare[i].descr, tocompare[i].descr); +// *our_data -= *isgi_data; +// *our_data /= *isgi_data; - *our_data -= *isgi_data; - *our_data /= *isgi_data; +// double diff(0); +// for(OutputData<double>::const_iterator it = +// our_data->begin(); it!=our_data->end(); ++it) { +// diff+= std::abs(*it); +// } +// diff /= our_data->getAllocatedSize(); - double diff(0); - for(OutputData<double>::const_iterator it = - our_data->begin(); it!=our_data->end(); ++it) { - diff+= std::abs(*it); - } - diff /= our_data->getAllocatedSize(); +// bool status_ok(true); +// if( diff > threshold || MathFunctions::isnan(diff) ) status_ok=false; +// std::cout << m_name << tocompare[i].descr<<" " << diff << " " << +// (status_ok ? "[OK]" : "[FAILED]") << std::endl; - bool status_ok(true); - if( diff > threshold || MathFunctions::isnan(diff) ) status_ok=false; - std::cout << m_name << tocompare[i].descr<<" " << diff << " " << - (status_ok ? "[OK]" : "[FAILED]") << std::endl; +// delete isgi_data; +// delete our_data; +// } - delete isgi_data; - delete our_data; - } + throw Exceptions::NotImplementedException("Cleanup the code!"); } diff --git a/App/src/TestIsGISAXS12.cpp b/App/src/TestIsGISAXS12.cpp index a2d72751e043d407e9c72cda084eee8c2726fc0e..fef9fde9e319dc442c00d6b58512f69f7c27725d 100644 --- a/App/src/TestIsGISAXS12.cpp +++ b/App/src/TestIsGISAXS12.cpp @@ -475,63 +475,65 @@ void TestIsGISAXS12::TestSampleBuilder::init_parameters() ISample *TestIsGISAXS12::TestSampleBuilder::buildSample() const { - MultiLayer *p_multi_layer = new MultiLayer(); - - complex_t n_particle(1.0-6e-4, 2e-8); - HomogeneousMaterial air_material("Air", 0.0, 0.0); - HomogeneousMaterial substrate_material("Substrate", 6e-6, 2e-8); - HomogeneousMaterial particle_material("Particle", n_particle); - - Layer air_layer(air_material); - - // preparing nano particles prototypes for seeding layer's particle_layout - double particle_probability1 = m_particle_probability1; -// double particle_probability2 = 1. - m_particle_probability1; - double particle_probability2 = m_particle_probability2; - - double radius1 = m_particle_radius1; - double radius2 = m_particle_radius2; - double height1 = m_height_aspect_ratio1*radius1; - double height2 = m_height_aspect_ratio2*radius2; - FormFactorCylinder p_ff_cylinder1(radius1, height1); - Particle cylinder1(particle_material, p_ff_cylinder1 ); - - FormFactorCylinder p_ff_cylinder2(radius2, height2); - Particle cylinder2(particle_material, p_ff_cylinder2 ); - - // radius of nanoparticles will be sampled with gaussian probability - int nbins=20; - double sigma1 = radius1*m_dispersion_radius1; - double sigma2 = radius2*m_dispersion_radius2; - int nfwhm(2); // to have xmin=average-nfwhm*FWHM, xmax=average+nfwhm*FWHM (nfwhm = xR/2, where xR is what is defined in isgisaxs *.inp file) - DistributionGaussian gauss1(radius1, sigma1); - DistributionGaussian gauss2(radius2, sigma2); - - ParticleLayout particle_layout; - InterferenceFunctionRadialParaCrystal *p_interference_function = - new InterferenceFunctionRadialParaCrystal(m_interf_distance, - 1e7*Units::nanometer); // peak_distance, corr_length - FTDistribution1DGauss pdf(m_interf_width); - p_interference_function->setProbabilityDistribution(pdf); - particle_layout.addInterferenceFunction(p_interference_function); - - // building nano particles - ParameterDistribution par_distr1("*/radius", gauss1, nbins, nfwhm); - ParticleDistribution particle_collection1(cylinder1, par_distr1); - particle_layout.addParticle(particle_collection1, particle_probability1); - ParameterDistribution par_distr2("*/radius", gauss2, nbins, nfwhm); - ParticleDistribution particle_collection2(cylinder2, par_distr2); - particle_layout.addParticle(particle_collection2, particle_probability2); - - air_layer.addLayout(particle_layout); - - p_multi_layer->addLayer(air_layer); - - Layer substrate_layer; - substrate_layer.setMaterial(substrate_material); - p_multi_layer->addLayer(substrate_layer); - - return p_multi_layer; +// MultiLayer *p_multi_layer = new MultiLayer(); + +// complex_t n_particle(1.0-6e-4, 2e-8); +// HomogeneousMaterial air_material("Air", 0.0, 0.0); +// HomogeneousMaterial substrate_material("Substrate", 6e-6, 2e-8); +// HomogeneousMaterial particle_material("Particle", n_particle); + +// Layer air_layer(air_material); + +// // preparing nano particles prototypes for seeding layer's particle_layout +// double particle_probability1 = m_particle_probability1; +//// double particle_probability2 = 1. - m_particle_probability1; +// double particle_probability2 = m_particle_probability2; + +// double radius1 = m_particle_radius1; +// double radius2 = m_particle_radius2; +// double height1 = m_height_aspect_ratio1*radius1; +// double height2 = m_height_aspect_ratio2*radius2; +// FormFactorCylinder p_ff_cylinder1(radius1, height1); +// Particle cylinder1(particle_material, p_ff_cylinder1 ); + +// FormFactorCylinder p_ff_cylinder2(radius2, height2); +// Particle cylinder2(particle_material, p_ff_cylinder2 ); + +// // radius of nanoparticles will be sampled with gaussian probability +// int nbins=20; +// double sigma1 = radius1*m_dispersion_radius1; +// double sigma2 = radius2*m_dispersion_radius2; +// int nfwhm(2); // to have xmin=average-nfwhm*FWHM, xmax=average+nfwhm*FWHM (nfwhm = xR/2, where xR is what is defined in isgisaxs *.inp file) +// DistributionGaussian gauss1(radius1, sigma1); +// DistributionGaussian gauss2(radius2, sigma2); + +// ParticleLayout particle_layout; +// InterferenceFunctionRadialParaCrystal *p_interference_function = +// new InterferenceFunctionRadialParaCrystal(m_interf_distance, +// 1e7*Units::nanometer); // peak_distance, corr_length +// FTDistribution1DGauss pdf(m_interf_width); +// p_interference_function->setProbabilityDistribution(pdf); +// particle_layout.addInterferenceFunction(p_interference_function); + +// // building nano particles +// ParameterDistribution par_distr1("*/radius", gauss1, nbins, nfwhm); +// ParticleDistribution particle_collection1(cylinder1, par_distr1); +// particle_layout.addParticle(particle_collection1, particle_probability1); +// ParameterDistribution par_distr2("*/radius", gauss2, nbins, nfwhm); +// ParticleDistribution particle_collection2(cylinder2, par_distr2); +// particle_layout.addParticle(particle_collection2, particle_probability2); + +// air_layer.addLayout(particle_layout); + +// p_multi_layer->addLayer(air_layer); + +// Layer substrate_layer; +// substrate_layer.setMaterial(substrate_material); +// p_multi_layer->addLayer(substrate_layer); + +// return p_multi_layer; + throw Exceptions::NotImplementedException("Cleanup the code!"); + } diff --git a/App/src/TestIsGISAXS5.cpp b/App/src/TestIsGISAXS5.cpp index e6971fcbda4511d95c34d14a28b7400e210ad8d8..608426f28f55c7bdb43a2aeeadf7412f08b0161a 100644 --- a/App/src/TestIsGISAXS5.cpp +++ b/App/src/TestIsGISAXS5.cpp @@ -303,46 +303,49 @@ void TestIsGISAXS5::SampleBuilder::init_parameters() ISample *TestIsGISAXS5::SampleBuilder::buildSample() const { - MultiLayer *p_multi_layer = new MultiLayer(); - - complex_t n_particle(1.0 - 6e-4, 2e-8); - HomogeneousMaterial air_material("Air", 0.0, 0.0); - HomogeneousMaterial substrate_material("Substrate", 6e-6, 2e-8); - HomogeneousMaterial particle_material("Particle", n_particle); - - Layer air_layer(air_material); - double height = m_height_aspect_ratio * m_particle_radius; - FormFactorCylinder ff_cylinder(m_particle_radius, height); - Particle cylinder(particle_material, ff_cylinder); - - // radius of nanoparticles will be sampled with gaussian probability - int nbins = 20; - double sigma = m_particle_radius * m_dispersion_radius; - int nfwhm(2); // to have xmin=average-nfwhm*FWHM, xmax=average+nfwhm*FWHM (nfwhm = xR/2, where - // xR is what is defined in isgisaxs *.inp file) - DistributionGaussian gauss(m_particle_radius, sigma); - - ParticleLayout particle_layout; - InterferenceFunctionRadialParaCrystal *p_interference_function - = new InterferenceFunctionRadialParaCrystal( - m_interf_distance, 1e7 * Units::nanometer); // peak_distance, corr_length - FTDistribution1DGauss pdf(m_interf_width); - p_interference_function->setProbabilityDistribution(pdf); - particle_layout.addInterferenceFunction(p_interference_function); - - // building nano particles - ParameterDistribution par_distr("*/radius", gauss, nbins, nfwhm); - ParticleDistribution particle_collection(cylinder, par_distr); - particle_layout.addParticle(particle_collection); - - // add layout to layer - air_layer.addLayout(particle_layout); - - p_multi_layer->addLayer(air_layer); - - Layer substrate_layer; - substrate_layer.setMaterial(substrate_material); - p_multi_layer->addLayer(substrate_layer); - - return p_multi_layer; +// MultiLayer *p_multi_layer = new MultiLayer(); + +// complex_t n_particle(1.0 - 6e-4, 2e-8); +// HomogeneousMaterial air_material("Air", 0.0, 0.0); +// HomogeneousMaterial substrate_material("Substrate", 6e-6, 2e-8); +// HomogeneousMaterial particle_material("Particle", n_particle); + +// Layer air_layer(air_material); +// double height = m_height_aspect_ratio * m_particle_radius; +// FormFactorCylinder ff_cylinder(m_particle_radius, height); +// Particle cylinder(particle_material, ff_cylinder); + +// // radius of nanoparticles will be sampled with gaussian probability +// int nbins = 20; +// double sigma = m_particle_radius * m_dispersion_radius; +// int nfwhm(2); // to have xmin=average-nfwhm*FWHM, xmax=average+nfwhm*FWHM (nfwhm = xR/2, where +// // xR is what is defined in isgisaxs *.inp file) +// DistributionGaussian gauss(m_particle_radius, sigma); + +// ParticleLayout particle_layout; +// InterferenceFunctionRadialParaCrystal *p_interference_function +// = new InterferenceFunctionRadialParaCrystal( +// m_interf_distance, 1e7 * Units::nanometer); // peak_distance, corr_length +// FTDistribution1DGauss pdf(m_interf_width); +// p_interference_function->setProbabilityDistribution(pdf); +// particle_layout.addInterferenceFunction(p_interference_function); + +// // building nano particles +// ParameterDistribution par_distr("*/radius", gauss, nbins, nfwhm); +// ParticleDistribution particle_collection(cylinder, par_distr); +// particle_layout.addParticle(particle_collection); + +// // add layout to layer +// air_layer.addLayout(particle_layout); + +// p_multi_layer->addLayer(air_layer); + +// Layer substrate_layer; +// substrate_layer.setMaterial(substrate_material); +// p_multi_layer->addLayer(substrate_layer); + +// return p_multi_layer; + + throw Exceptions::NotImplementedException("Cleanup the code!"); + } diff --git a/App/src/TestPolarizedMeso.cpp b/App/src/TestPolarizedMeso.cpp index d063c89d7c1d41c4a81d9816e411fdc1b629eb91..c53055b50b240086752ee3500b1d3aff432a0b2c 100644 --- a/App/src/TestPolarizedMeso.cpp +++ b/App/src/TestPolarizedMeso.cpp @@ -78,52 +78,55 @@ void TestPolarizedMeso::execute() MultiLayer* TestPolarizedMeso::createSample() const { - // create mesocrystal - double surface_density = - m_surface_filling_ratio/m_meso_width/m_meso_width; - kvector_t magnetic_field(3.4, 3.4, 3.4); - HomogeneousMagneticMaterial particle_material("nanoparticle",2.84e-5, 4.7e-7, magnetic_field); - - // Create multilayer - MultiLayer *p_multi_layer = new MultiLayer(); - - HomogeneousMaterial air_material("Air", 0.0, 0.0); - HomogeneousMaterial substrate_material("Substrate", 7.57e-6, 1.73e-7); - Layer air_layer; - air_layer.setMaterial(air_material); - Layer substrate_layer; - substrate_layer.setMaterial(substrate_material); - IInterferenceFunction *p_interference_funtion = - new InterferenceFunctionNone(); - ParticleLayout particle_layout; - size_t n_max_phi_rotation_steps = 1; - size_t n_sizes = 2; - - double phi_step = Units::PI/4.0/n_max_phi_rotation_steps; - double phi_start = 0.0; - for (size_t i=0; i<n_max_phi_rotation_steps; ++i) { - for (size_t j=0; j<n_sizes; ++j) { - RotationZ transform(phi_start + i*phi_step); - double meso_size = m_meso_width + j*m_meso_size_steps; - FormFactorBox ff_box(meso_size, meso_size, meso_size); - boost::scoped_ptr<MesoCrystal> meso(createMeso( - m_lattice_length_a, m_lattice_length_c, - particle_material, m_nanoparticle_size, &ff_box) ); - particle_layout.addParticle(*meso, 1.0, kvector_t(0,0,0), transform); - } - } - - particle_layout.setTotalParticleSurfaceDensity(surface_density); - particle_layout.addInterferenceFunction(p_interference_funtion); - - air_layer.addLayout(particle_layout); - - LayerRoughness roughness(m_roughness, 0.3, 500.0*Units::nanometer); - - p_multi_layer->addLayer(air_layer); - p_multi_layer->addLayerWithTopRoughness(substrate_layer, roughness); - - return p_multi_layer; + throw Exceptions::NotImplementedException("Cleanup the code!"); + +// // create mesocrystal +// double surface_density = +// m_surface_filling_ratio/m_meso_width/m_meso_width; +// kvector_t magnetic_field(3.4, 3.4, 3.4); +// HomogeneousMagneticMaterial particle_material("nanoparticle",2.84e-5, 4.7e-7, magnetic_field); + +// // Create multilayer +// MultiLayer *p_multi_layer = new MultiLayer(); + +// HomogeneousMaterial air_material("Air", 0.0, 0.0); +// HomogeneousMaterial substrate_material("Substrate", 7.57e-6, 1.73e-7); +// Layer air_layer; +// air_layer.setMaterial(air_material); +// Layer substrate_layer; +// substrate_layer.setMaterial(substrate_material); +// IInterferenceFunction *p_interference_funtion = +// new InterferenceFunctionNone(); +// ParticleLayout particle_layout; +// size_t n_max_phi_rotation_steps = 1; +// size_t n_sizes = 2; + +// double phi_step = Units::PI/4.0/n_max_phi_rotation_steps; +// double phi_start = 0.0; +// for (size_t i=0; i<n_max_phi_rotation_steps; ++i) { +// for (size_t j=0; j<n_sizes; ++j) { +// RotationZ transform(phi_start + i*phi_step); +// double meso_size = m_meso_width + j*m_meso_size_steps; +// FormFactorBox ff_box(meso_size, meso_size, meso_size); +// boost::scoped_ptr<MesoCrystal> meso(createMeso( +// m_lattice_length_a, m_lattice_length_c, +// particle_material, m_nanoparticle_size, &ff_box) ); +// particle_layout.addParticle(*meso, 1.0, kvector_t(0,0,0), transform); +// } +// } + +// particle_layout.setTotalParticleSurfaceDensity(surface_density); +// particle_layout.addInterferenceFunction(p_interference_funtion); + +// air_layer.addLayout(particle_layout); + +// LayerRoughness roughness(m_roughness, 0.3, 500.0*Units::nanometer); + +// p_multi_layer->addLayer(air_layer); +// p_multi_layer->addLayerWithTopRoughness(substrate_layer, roughness); + +// return p_multi_layer; + return 0; } MesoCrystal* TestPolarizedMeso::createMeso(double a, double c, diff --git a/App/src/TestRipple1.cpp b/App/src/TestRipple1.cpp index bd7adf56f100744656a1a8a34f3d32a204572a8e..24884ea46a478fe0998cd12649a0c608fc82d694 100644 --- a/App/src/TestRipple1.cpp +++ b/App/src/TestRipple1.cpp @@ -173,37 +173,40 @@ void TestRipple1::TestSampleBuilder::init_parameters() ISample *TestRipple1::TestSampleBuilder::buildSample() const { - MultiLayer *p_multi_layer = new MultiLayer(); +// MultiLayer *p_multi_layer = new MultiLayer(); - complex_t n_particle(1.0-6e-4, 2e-8); - HomogeneousMaterial air_material("Air", 0.0, 0.0); - HomogeneousMaterial substrate_material("Substrate", 6e-6, 2e-8); - HomogeneousMaterial particle_material("Particle", n_particle); +// complex_t n_particle(1.0-6e-4, 2e-8); +// HomogeneousMaterial air_material("Air", 0.0, 0.0); +// HomogeneousMaterial substrate_material("Substrate", 6e-6, 2e-8); +// HomogeneousMaterial particle_material("Particle", n_particle); - Layer air_layer(air_material); - FormFactorRipple1 ff_ripple1(m_l, m_w, m_h); - Particle ripple(particle_material, ff_ripple1); +// Layer air_layer(air_material); +// FormFactorRipple1 ff_ripple1(m_l, m_w, m_h); +// Particle ripple(particle_material, ff_ripple1); - ParticleLayout particle_layout; - particle_layout.addParticle(ripple, 1.0); - InterferenceFunctionRadialParaCrystal *p_interference_function = - new InterferenceFunctionRadialParaCrystal(m_interf_distance, - 1e7*Units::nanometer); // peak_distance, corr_length - FTDistribution1DGauss pdf(m_interf_width); - p_interference_function->setProbabilityDistribution(pdf); - particle_layout.addInterferenceFunction(p_interference_function); +// ParticleLayout particle_layout; +// particle_layout.addParticle(ripple, 1.0); +// InterferenceFunctionRadialParaCrystal *p_interference_function = +// new InterferenceFunctionRadialParaCrystal(m_interf_distance, +// 1e7*Units::nanometer); // peak_distance, corr_length +// FTDistribution1DGauss pdf(m_interf_width); +// p_interference_function->setProbabilityDistribution(pdf); +// particle_layout.addInterferenceFunction(p_interference_function); - // making layer holding all whose nano particles - air_layer.addLayout(particle_layout); +// // making layer holding all whose nano particles +// air_layer.addLayout(particle_layout); - p_multi_layer->addLayer(air_layer); +// p_multi_layer->addLayer(air_layer); + +// Layer substrate_layer; +// substrate_layer.setMaterial(substrate_material); +// p_multi_layer->addLayer(substrate_layer); + +// return p_multi_layer; + throw Exceptions::NotImplementedException("Cleanup the code!"); - Layer substrate_layer; - substrate_layer.setMaterial(substrate_material); - p_multi_layer->addLayer(substrate_layer); - return p_multi_layer; } void TestRipple1::plot_results() diff --git a/App/src/TestRipple2.cpp b/App/src/TestRipple2.cpp index 507334cd7bcebf4a95aa4ec9b496b1723f0ce44f..a0e49fc840c039b225c6099d5a8b1efd01c93a6c 100644 --- a/App/src/TestRipple2.cpp +++ b/App/src/TestRipple2.cpp @@ -175,37 +175,38 @@ void TestRipple2::TestSampleBuilder::init_parameters() ISample *TestRipple2::TestSampleBuilder::buildSample() const { - MultiLayer *p_multi_layer = new MultiLayer(); +// MultiLayer *p_multi_layer = new MultiLayer(); - complex_t n_particle(1.0-6e-4, 2e-8); - HomogeneousMaterial air_material("Air", 0.0, 0.0); - HomogeneousMaterial substrate_material("Substrate", 6e-6, 2e-8); - HomogeneousMaterial particle_material("Particle", n_particle); +// complex_t n_particle(1.0-6e-4, 2e-8); +// HomogeneousMaterial air_material("Air", 0.0, 0.0); +// HomogeneousMaterial substrate_material("Substrate", 6e-6, 2e-8); +// HomogeneousMaterial particle_material("Particle", n_particle); - Layer air_layer(air_material); - FormFactorRipple2 ff_ripple2(m_l, m_w, m_h, m_d); - Particle ripple(particle_material, ff_ripple2 ); +// Layer air_layer(air_material); +// FormFactorRipple2 ff_ripple2(m_l, m_w, m_h, m_d); +// Particle ripple(particle_material, ff_ripple2 ); - ParticleLayout particle_layout; - particle_layout.addParticle(ripple, 1.0); - InterferenceFunctionRadialParaCrystal *p_interference_function = - new InterferenceFunctionRadialParaCrystal(m_interf_distance, - 1e7*Units::nanometer); // peak_distance, corr_length - FTDistribution1DGauss pdf(m_interf_width); - p_interference_function->setProbabilityDistribution(pdf); - particle_layout.addInterferenceFunction(p_interference_function); +// ParticleLayout particle_layout; +// particle_layout.addParticle(ripple, 1.0); +// InterferenceFunctionRadialParaCrystal *p_interference_function = +// new InterferenceFunctionRadialParaCrystal(m_interf_distance, +// 1e7*Units::nanometer); // peak_distance, corr_length +// FTDistribution1DGauss pdf(m_interf_width); +// p_interference_function->setProbabilityDistribution(pdf); +// particle_layout.addInterferenceFunction(p_interference_function); - // making layer holding all whose nano particles - air_layer.addLayout(particle_layout); +// // making layer holding all whose nano particles +// air_layer.addLayout(particle_layout); - p_multi_layer->addLayer(air_layer); +// p_multi_layer->addLayer(air_layer); - Layer substrate_layer; - substrate_layer.setMaterial(substrate_material); - p_multi_layer->addLayer(substrate_layer); +// Layer substrate_layer; +// substrate_layer.setMaterial(substrate_material); +// p_multi_layer->addLayer(substrate_layer); - return p_multi_layer; +// return p_multi_layer; + throw Exceptions::NotImplementedException("Cleanup the code!"); } void TestRipple2::plot_results() diff --git a/App/src/TestRootTree.cpp b/App/src/TestRootTree.cpp index a1df920e08ec311aa6d24ef85fa39643562f09e8..31b249839b4e65c4d68393da8629889d34e993dc 100644 --- a/App/src/TestRootTree.cpp +++ b/App/src/TestRootTree.cpp @@ -377,54 +377,55 @@ void TestRootTree::simple_read() //! -void TestRootTree::initializeMesoCrystal( - double meso_alpha, double meso_phi, double nanopart_radius) +void TestRootTree::initializeMesoCrystal(double /* meso_alpha */, double /* meso_phi*/, double /*nanopart_radius*/) { - (void)nanopart_radius; - delete mp_sample; - // create mesocrystal - double meso_radius = 300*Units::nanometer; - double surface_filling_ratio = 0.25; - double surface_density = surface_filling_ratio/Units::PI/meso_radius/meso_radius; - complex_t n_particle(1.0-1.55e-5, 1.37e-6); - complex_t avg_n_squared_meso = 0.7886*n_particle*n_particle + 0.2114; - complex_t n_avg = std::sqrt(surface_filling_ratio*avg_n_squared_meso + - 1.0 - surface_filling_ratio); -// complex_t n_particle_adapted = std::sqrt(n_avg*n_avg + n_particle*n_particle - 1.0); -// FormFactorCylinder ff_meso(meso_radius, 0.2*Units::micrometer); - - // Create multilayer - MultiLayer *p_multi_layer = new MultiLayer(); - complex_t n_air(1.0, 0.0); - complex_t n_substrate(1.0-7.57e-6, 1.73e-7); - - HomogeneousMaterial air_material("Air", n_air); - HomogeneousMaterial average_layer_material("Averagelayer", n_avg); - HomogeneousMaterial substrate_material("Substrate", n_substrate); - Layer air_layer; - air_layer.setMaterial(air_material); - Layer avg_layer; - avg_layer.setMaterial(average_layer_material); - avg_layer.setThickness(0.2*Units::micrometer); - Layer substrate_layer; - substrate_layer.setMaterial(substrate_material); - IInterferenceFunction *p_interference_funtion = - new InterferenceFunctionNone(); - ParticleLayout particle_layout; - - //double R = nanopart_radius; - RotationZ transform1(meso_phi); - RotationY transform2(meso_alpha); - - particle_layout.setTotalParticleSurfaceDensity(surface_density); - particle_layout.addInterferenceFunction(p_interference_funtion); - - avg_layer.addLayout(particle_layout); - - p_multi_layer->addLayer(air_layer); - p_multi_layer->addLayer(avg_layer); - p_multi_layer->addLayer(substrate_layer); - mp_sample = p_multi_layer; +// (void)nanopart_radius; +// delete mp_sample; +// // create mesocrystal +// double meso_radius = 300*Units::nanometer; +// double surface_filling_ratio = 0.25; +// double surface_density = surface_filling_ratio/Units::PI/meso_radius/meso_radius; +// complex_t n_particle(1.0-1.55e-5, 1.37e-6); +// complex_t avg_n_squared_meso = 0.7886*n_particle*n_particle + 0.2114; +// complex_t n_avg = std::sqrt(surface_filling_ratio*avg_n_squared_meso + +// 1.0 - surface_filling_ratio); +//// complex_t n_particle_adapted = std::sqrt(n_avg*n_avg + n_particle*n_particle - 1.0); +//// FormFactorCylinder ff_meso(meso_radius, 0.2*Units::micrometer); + +// // Create multilayer +// MultiLayer *p_multi_layer = new MultiLayer(); +// complex_t n_air(1.0, 0.0); +// complex_t n_substrate(1.0-7.57e-6, 1.73e-7); + +// HomogeneousMaterial air_material("Air", n_air); +// HomogeneousMaterial average_layer_material("Averagelayer", n_avg); +// HomogeneousMaterial substrate_material("Substrate", n_substrate); +// Layer air_layer; +// air_layer.setMaterial(air_material); +// Layer avg_layer; +// avg_layer.setMaterial(average_layer_material); +// avg_layer.setThickness(0.2*Units::micrometer); +// Layer substrate_layer; +// substrate_layer.setMaterial(substrate_material); +// IInterferenceFunction *p_interference_funtion = +// new InterferenceFunctionNone(); +// ParticleLayout particle_layout; + +// //double R = nanopart_radius; +// RotationZ transform1(meso_phi); +// RotationY transform2(meso_alpha); + +// particle_layout.setTotalParticleSurfaceDensity(surface_density); +// particle_layout.addInterferenceFunction(p_interference_funtion); + +// avg_layer.addLayout(particle_layout); + +// p_multi_layer->addLayer(air_layer); +// p_multi_layer->addLayer(avg_layer); +// p_multi_layer->addLayer(substrate_layer); +// mp_sample = p_multi_layer; + + throw Exceptions::NotImplementedException("Cleanup the code!"); } diff --git a/CHANGELOG b/CHANGELOG index c14374f2cad9cede24eac20e6bdbf5d00cb8b561..4f0bf4550a78a87fa0d181dab432cbf33186156b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,52 @@ +BornAgain-1.5.0, released 2016.02.15 + > API changes + 1) FTDecayFunctions introduced to use together with lattices (setDecayFunction) + FTDistributions are used, as before, with paracrystals. + > Summary: + 1) Core: interference function calculates particle densities automatically + 2) GUI: 1D interference function, Rectangular detector, Mask editor + 3) GUI: Selection of axes (degrees, radians,number of bins, Q-space) for intensity data + 3) Documentation: new tutorials on web site (rectangular detector, fitting, data treatment, rectangular grating) + 4) Various bugfixes + * Bug #1276: Fix thread concurrency while repoorting progress update in DWBASimulattion + * Bug #1297: Reading ASCII intensity files not culture invariant + * Bug #1298: Mac os x: BornAgain.app crashes (cannot load the QtNetwork library) + * Bug #1302: Script updates following API change + * Bug #1303: Functional test montecarlo_integration.py fails + * Feature #1035: Revise IFormFactor::getRadius and IFormFactor::getHeight + * Feature #1045: Use interference funtion's properties to set total particle surface density + * Feature #1148: MacOS: provide generation of dmg installer using Qt5.5 + * Feature #1149: MacOS: provide Maverick compilation using MacMini and vagrant + * Feature #1184: Implement transformation to q-space for intensity image + * Feature #1211: Switch to C++-11 for the whole project + * Feature #1213: Implement choice of detector in GUI + * Feature #1230: GUI mask editor: implement mask editor basic functionality + * Feature #1231: GUI mask editor: integrate mask editor into InstrumentView + * Feature #1232: GUI mask editor: provide transform from C++ domain to GUI domain + * Feature #1233: GUI mask editor: provide transform from C++ domain to python domain + * Feature #1234: GUI mask editor: provide functional tests for all 3 domains + * Feature #1235: GUI mask editor: integrate IntensityData widget into GraphicsScene + * Feature #1246: Investigate refactoring of ParameterizedItem structure + * Feature #1259: Add 1D lattice interference function to GUI + * Feature #1260: Windows: installer should create PYTHONPATH environment variable in system scope and not in user scope + * Feature #1266: GUI: Implement collapsable Accordion widget + * Feature #1267: GUI: implement update online notification widget + * Feature #1272: GUI: provide run of the fitting in GUI thread + * Feature #1275: Provide rectangle detector examples and functional tests + * Feature #1283: Provide functional test for all formfactors, when they are rotated and in the presence of absorption + * Documentation #1261: Drupal: update installation instructions, tutorials for coming release 1.5 + * Documentation #1262: Fix IsGISAXS references in form factor section + * Documentation #1269: Update documentation for new phi angle definition + * Refactoring #1061: describe or remove morphology mode + * Refactoring #1236: Clean up remote git branches + * Refactoring #1237: GUI: generate distributed parameter names from GUI sample model instead of core model + * Refactoring #1264: Refactor ParameterizedItem's different naming schemes + * Refactoring #1265: Refactor RectangularDetector API to correspond with the tutorial + * Refactoring #1268: Change phi angle convention + * Refactoring #1270: Clarify and refactor different naming properties of ParameterizedItem + * Refactoring #1271: Investigate necessity of having a separate list for subitems and refactor accordingly + * Refactoring #1278: Deprecated declarations by compiling on new systems + BornAgain-1.4.0, released 2015.10.30 > No API changes > Summary: diff --git a/Core/Samples/inc/BAVersion.h b/Core/Samples/inc/BAVersion.h index de40bd97620795c5a63ee3868a42ed84bcfa1ea8..0eca23da93c3573c879053d1ded36b35b7cef761 100644 --- a/Core/Samples/inc/BAVersion.h +++ b/Core/Samples/inc/BAVersion.h @@ -22,7 +22,7 @@ namespace BornAgain { const int major_version_number = 1; - const int minor_version_number = 4; + const int minor_version_number = 5; const int patch_version_number = 0; inline int GetMajorVersionNumber() { return major_version_number; } diff --git a/Core/Tools/inc/IntegratorReal.h b/Core/Tools/inc/IntegratorReal.h index 052c461fa0df4a6b1d1436a5f603c485b5d1bda5..c0f4248ed9acaded7048706acf8325eefc038689 100644 --- a/Core/Tools/inc/IntegratorReal.h +++ b/Core/Tools/inc/IntegratorReal.h @@ -75,9 +75,9 @@ P_integrator_real<T> make_integrator_real(const T *object, real_integrand<T> mem template<class T> IntegratorReal<T>::IntegratorReal( const T *p_object, real_integrand<T> p_member_function) - : m_cb { p_object, p_member_function } - , mp_gsl_workspace { nullptr } + : mp_gsl_workspace { nullptr } { + m_cb = CallBackHolder{ p_object, p_member_function }; mp_gsl_workspace = gsl_integration_workspace_alloc(200); } diff --git a/Core/Tools/src/INamed.cpp b/Core/Tools/src/INamed.cpp index 86fe64855432963ac1425615b84f2e34e99f9443..7751d6fc3b21cb9be9e88d7455d59b5596b70acc 100644 --- a/Core/Tools/src/INamed.cpp +++ b/Core/Tools/src/INamed.cpp @@ -23,7 +23,7 @@ INamed::INamed() } INamed::INamed(std::string name) - : m_name { std::move(name) } + : m_name ( std::move(name) ) { } diff --git a/Core/Tools/src/IParameterized.cpp b/Core/Tools/src/IParameterized.cpp index 24c0f649b6d7c78fd777ef75fa3bff9e32900802..11ba5e0cc433521fabf534174a0b29faa1a1a0d7 100644 --- a/Core/Tools/src/IParameterized.cpp +++ b/Core/Tools/src/IParameterized.cpp @@ -91,7 +91,7 @@ ParameterPattern::ParameterPattern() } ParameterPattern::ParameterPattern(std::string root_object) - : m_pattern { "/" + root_object } + : m_pattern ( "/" + root_object ) { } diff --git a/Doc/Doxygen/Doxyfile b/Doc/Doxygen/Doxyfile index 361e2f225ce2c949a109fdd42a80f1ac31f2d5a2..f0e54c195426166b8497495289752d62a08b9c2f 100644 --- a/Doc/Doxygen/Doxyfile +++ b/Doc/Doxygen/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = "BornAgain" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.4.0 +PROJECT_NUMBER = 1.5.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/Doc/UserManual/UserManualVersion.tex b/Doc/UserManual/UserManualVersion.tex index 884b96a4cc08d25c5f5b4f31058e9851fa11bd34..b51b08beedad97b8aae9c2d8bdb8ccfb99e1cc2c 100644 --- a/Doc/UserManual/UserManualVersion.tex +++ b/Doc/UserManual/UserManualVersion.tex @@ -4,4 +4,4 @@ % using cmake/scripts/UserManualVersion.tex.in \newcommand{\UserManualVersionNumber} -{1.4$+$} +{1.5.0} diff --git a/Examples/Demos/simul_demo_lattice1.py b/Examples/Demos/simul_demo_lattice1.py index f3c519c5b2db16498ce686538274aba8c486fa01..1954e4d658223154d431bc8af5e15d817743bd74 100644 --- a/Examples/Demos/simul_demo_lattice1.py +++ b/Examples/Demos/simul_demo_lattice1.py @@ -28,8 +28,8 @@ def RunSimulation(): # interference function interference = InterferenceFunction2DLattice.createSquare(10.0*nanometer) - pdf = FTDistribution2DCauchy(300.0*nanometer/2.0/M_PI, 100.0*nanometer/2.0/M_PI) - interference.setProbabilityDistribution(pdf) + pdf = FTDecayFunction2DCauchy(300.0*nanometer/2.0/M_PI, 100.0*nanometer/2.0/M_PI) + interference.setDecayFunction(pdf) particle_layout.addInterferenceFunction(interference) # top air layer diff --git a/Examples/Demos/simul_demo_lattice2.py b/Examples/Demos/simul_demo_lattice2.py index 6638aa7521d4c795fb56ab4bc3c70c90ed987b7b..89a0019e37c77511f5120addf8abe408830bdd47 100644 --- a/Examples/Demos/simul_demo_lattice2.py +++ b/Examples/Demos/simul_demo_lattice2.py @@ -33,8 +33,8 @@ def RunSimulation(): # interference function interference = InterferenceFunction2DLattice.createSquare(10.0*nanometer) - pdf = FTDistribution2DCauchy(300.0*nanometer/2.0/M_PI, 100.0*nanometer/2.0/M_PI) - interference.setProbabilityDistribution(pdf) + pdf = FTDecayFunction2DCauchy(300.0*nanometer/2.0/M_PI, 100.0*nanometer/2.0/M_PI) + interference.setDecayFunction(pdf) particle_layout1.addInterferenceFunction(interference) particle_layout2.addInterferenceFunction(interference) diff --git a/Examples/Demos/simul_demo_polarization.py b/Examples/Demos/simul_demo_polarization.py deleted file mode 100644 index c052ab22c30db536b697bea32245a1933054dca7..0000000000000000000000000000000000000000 --- a/Examples/Demos/simul_demo_polarization.py +++ /dev/null @@ -1,98 +0,0 @@ -''' -Simulation demo: Cylinder and/or sphere on substrate -''' - -import numpy -import matplotlib -import math -from bornagain import * - -# ---------------------------------- -# describe sample and run simulation -# ---------------------------------- -def RunSimulation(): - # defining materials - magnetic_field_layer = kvector_t(0.0, 6.0, 0.0) - magnetic_field_particle = kvector_t(1.7, 1.7, 1.7) - mAir = HomogeneousMaterial("Air", 0.0, 0.0) - mSubstrate = HomogeneousMaterial("Substrate", 6e-6, 2e-8) - mLayer = HomogeneousMagneticMaterial("Layer", 3e-6, 2e-8, magnetic_field_layer) - mParticle = HomogeneousMagneticMaterial("Particle", 6e-4, 2e-8, magnetic_field_particle) - - # collection of particles - cylinder_ff = FormFactorCylinder(2 * nanometer, 5 * nanometer) - cylinder = Particle(mParticle, cylinder_ff) -# sphere_ff = FormFactorFullSphere(4 * nanometer) -# sphere = Particle(mParticle, sphere_ff) - particle_layout = ParticleLayout() - particle_layout.addParticle(cylinder) -# particle_layout.addParticle(sphere) -# interference = InterferenceFunctionRadialParaCrystal(20 * nanometer, 2 * nanometer) -# pdf = FTDistribution1DGauss(2 * nanometer) -# interference.setProbabilityDistribution(pdf) -# particle_layout.addInterferenceFunction(interference) - - # air layer with particles and substrate form multi layer - air_layer = Layer(mAir) - intermediate_layer = Layer(mLayer) - intermediate_layer.addLayout(particle_layout) - substrate_layer = Layer(mSubstrate) - multi_layer = MultiLayer() - multi_layer.addLayer(air_layer) - multi_layer.addLayer(intermediate_layer) - multi_layer.addLayer(substrate_layer) - - # build and run experiment - simulation = GISASSimulation() - simulation.setDetectorParameters(100, -4.0 * degree, 4.0 * degree, 100, 0.0 * degree, 8.0 * degree) - simulation.setBeamParameters(1.0 * angstrom, 0.2 * degree, 0.0 * degree) - simulation.setSample(multi_layer) - simulation.runSimulation() - # intensity data components - - intensity_pp = simulation.getPolarizedIntensityData(0, 0).getArray() - intensity_pm = simulation.getPolarizedIntensityData(0, 1).getArray() - intensity_mp = simulation.getPolarizedIntensityData(1, 0).getArray() - intensity_mm = simulation.getPolarizedIntensityData(1, 1).getArray() - - return intensity_pp, intensity_pm, intensity_mp, intensity_mm - - -#------------------------------------------------------------- -# main() -#------------------------------------------------------------- -if __name__ == '__main__': - intensity_pp, intensity_pm, intensity_mp, intensity_mm = RunSimulation() - plt.subplot(2, 2, 1) - plt.title('Intensity ++') - im = plt.imshow(intensity_pp+1, - norm=matplotlib.colors.LogNorm(), - extent=[-4.0, 4.0, 0, 8.0]) - plt.colorbar(im) - plt.xlabel(r'$\phi_f$', fontsize=20) - plt.ylabel(r'$\alpha_f$', fontsize=20) - plt.subplot(2, 2, 2) - plt.title('Intensity +-') - im = plt.imshow(intensity_pm+1, - norm=matplotlib.colors.LogNorm(), - extent=[-4.0, 4.0, 0, 8.0]) - plt.colorbar(im) - plt.xlabel(r'$\phi_f$', fontsize=20) - plt.ylabel(r'$\alpha_f$', fontsize=20) - plt.subplot(2, 2, 3) - plt.title('Intensity -+') - im = plt.imshow(intensity_mp+1, - norm=matplotlib.colors.LogNorm(), - extent=[-4.0, 4.0, 0, 8.0]) - plt.colorbar(im) - plt.xlabel(r'$\phi_f$', fontsize=20) - plt.ylabel(r'$\alpha_f$', fontsize=20) - plt.subplot(2, 2, 4) - plt.title('Intensity --') - im = plt.imshow(intensity_mm+1, - norm=matplotlib.colors.LogNorm(), - extent=[-4.0, 4.0, 0, 8.0]) - plt.colorbar(im) - plt.xlabel(r'$\phi_f$', fontsize=20) - plt.ylabel(r'$\alpha_f$', fontsize=20) - plt.show() diff --git a/Examples/cpp/CylindersAndPrisms/modules/FindBornAgain.cmake b/Examples/cpp/CylindersAndPrisms/modules/FindBornAgain.cmake index 6af50792b0c544362b47550d5b5d460404674667..1b7f1007c88ace39e29cefeb77cc9be543e8c8a9 100644 --- a/Examples/cpp/CylindersAndPrisms/modules/FindBornAgain.cmake +++ b/Examples/cpp/CylindersAndPrisms/modules/FindBornAgain.cmake @@ -6,8 +6,8 @@ set(BORNAGAINSYS $ENV{BORNAGAINSYS}) if(BORNAGAINSYS) - set(BORNAGAIN_LIBRARY_DIR ${BORNAGAINSYS}/lib/BornAgain-1.4) - set(BORNAGAIN_INCLUDE_DIR ${BORNAGAINSYS}/include/BornAgain-1.4) + set(BORNAGAIN_LIBRARY_DIR ${BORNAGAINSYS}/lib/BornAgain-1.5) + set(BORNAGAIN_INCLUDE_DIR ${BORNAGAINSYS}/include/BornAgain-1.5) endif() find_library (BORNAGAIN_CORE BornAgainCore diff --git a/Examples/python/fitting/ex01_SampleParametersIntro/SampleParametersIntro.py b/Examples/python/fitting/ex01_SampleParametersIntro/SampleParametersIntro.py index 6b7c9369d86cac50cd2b9b1eb66a7034a5d7f5aa..733770fb43e293192502fb1b29411bad6ce69223 100644 --- a/Examples/python/fitting/ex01_SampleParametersIntro/SampleParametersIntro.py +++ b/Examples/python/fitting/ex01_SampleParametersIntro/SampleParametersIntro.py @@ -73,7 +73,7 @@ def run_simulations(): # simulation #2 # one sample parameter (height of the cylinder) is changed using exact parameter name sample.setParameterValue( - "/MultiLayer/Layer0/ParticleLayout/ParticleInfo0/Particle/FormFactorCylinder/height", 10.0*nanometer) + "/MultiLayer/Layer0/ParticleLayout/Particle0/Cylinder/Height", 10.0*nanometer) simulation.setSample(sample) simulation.runSimulation() @@ -81,16 +81,16 @@ def run_simulations(): # simulation #3 # all parameters matching criteria will be changed (height of the cylinder in this case) - sample.setParameterValue("*/FormFactorCylinder/height", 100.0*nanometer) + sample.setParameterValue("*/Cylinder/Height", 100.0*nanometer) simulation.setSample(sample) simulation.runSimulation() results.append(simulation.getIntensityData()) # simulation #4 # all parameters which are matching criteria will be changed - sample.setParameterValue("*/FormFactorCylinder/height", 10.0*nanometer) + sample.setParameterValue("*/Cylinder/Height", 10.0*nanometer) # both FormFactorPrism3/half_side and FormFactorPrism3/height will be set to 10 nanometer - sample.setParameterValue("*/FormFactorPrism3/*", 10.0*nanometer) + sample.setParameterValue("*/Prism3/*", 10.0*nanometer) simulation.setSample(sample) simulation.runSimulation() results.append(simulation.getIntensityData()) diff --git a/Examples/python/fitting/ex03_FitSpheresInHexLattice/FitSpheresInHexLattice.py b/Examples/python/fitting/ex03_FitSpheresInHexLattice/FitSpheresInHexLattice.py index f21b86aa6e0188c5ac5287c20e1a9e7ebad6f1f1..802f4040f6e29dea09bf19e5d7b03109621f5656 100644 --- a/Examples/python/fitting/ex03_FitSpheresInHexLattice/FitSpheresInHexLattice.py +++ b/Examples/python/fitting/ex03_FitSpheresInHexLattice/FitSpheresInHexLattice.py @@ -23,8 +23,8 @@ def get_sample(radius=5*nanometer, lattice_constant=10*nanometer): particle_layout.addParticle(sphere) interference = InterferenceFunction2DLattice.createHexagonal(lattice_constant) - pdf = FTDistribution2DCauchy(10*nanometer, 10*nanometer) - interference.setProbabilityDistribution(pdf) + pdf = FTDecayFunction2DCauchy(10*nanometer, 10*nanometer) + interference.setDecayFunction(pdf) particle_layout.addInterferenceFunction(interference) diff --git a/Examples/python/fitting/ex03_FitSpheresInHexLattice/FitSpheresInHexLattice_builder.py b/Examples/python/fitting/ex03_FitSpheresInHexLattice/FitSpheresInHexLattice_builder.py index 8fe6d6bb58d3f32e52d990fbbc58cf9e396ac197..195fded88d3af49b27e1e1b55a12a9f7a49562dc 100644 --- a/Examples/python/fitting/ex03_FitSpheresInHexLattice/FitSpheresInHexLattice_builder.py +++ b/Examples/python/fitting/ex03_FitSpheresInHexLattice/FitSpheresInHexLattice_builder.py @@ -38,8 +38,8 @@ class MySampleBuilder(ISampleBuilder): particle_layout.addParticle(sphere) interference = InterferenceFunction2DLattice.createHexagonal(self.lattice_constant.value) - pdf = FTDistribution2DCauchy(10*nanometer, 10*nanometer) - interference.setProbabilityDistribution(pdf) + pdf = FTDecayFunction2DCauchy(10*nanometer, 10*nanometer) + interference.setDecayFunction(pdf) particle_layout.addInterferenceFunction(interference) diff --git a/Examples/python/fitting/ex10_FitGALAXIData/FitGALAXIData.py b/Examples/python/fitting/ex10_FitGALAXIData/FitGALAXIData.py index 980b3c34cb19e45761e01df1d3d0b9d44a700a2f..5b34fb1f9428c6edc98f66d7f71758f6929c02e4 100644 --- a/Examples/python/fitting/ex10_FitGALAXIData/FitGALAXIData.py +++ b/Examples/python/fitting/ex10_FitGALAXIData/FitGALAXIData.py @@ -73,13 +73,15 @@ def run_fitting(): fit_suite.addFitParameter("*sigma", 0.55, ba.AttLimits.limited(0.2, 0.8), 0.01*ba.nanometer) fit_suite.addFitParameter("*distance", 27.*ba.nanometer, ba.AttLimits.limited(20, 70), 0.1*ba.nanometer) - strategy1 = ba.FitStrategyAdjustMinimizer("Genetic") - strategy1.getMinimizerOptions().setMaxIterations(3) - fit_suite.addFitStrategy(strategy1) - - # Second fit strategy will use another algorithm. It will use best parameters found from previous minimization round. - strategy2 = ba.FitStrategyAdjustMinimizer("Minuit2", "Migrad") - fit_suite.addFitStrategy(strategy2) + use_two_minimizers_strategy = False + if use_two_minimizers_strategy: + strategy1 = ba.FitStrategyAdjustMinimizer("Genetic") + strategy1.getMinimizerOptions().setMaxIterations(3) + fit_suite.addFitStrategy(strategy1) + + # Second fit strategy will use another algorithm. It will use best parameters found from previous minimization round. + strategy2 = ba.FitStrategyAdjustMinimizer("Minuit2", "Migrad") + fit_suite.addFitStrategy(strategy2) # running fit fit_suite.runFit() diff --git a/Examples/python/simulation/ex01_BasicParticles/CylindersWithSizeDistribution.py b/Examples/python/simulation/ex01_BasicParticles/CylindersWithSizeDistribution.py index e32738a8591801e6445b262cde83ee1eda1dc681..fc6afb6f732bd30d21ffda8f76593b60c8c12165 100644 --- a/Examples/python/simulation/ex01_BasicParticles/CylindersWithSizeDistribution.py +++ b/Examples/python/simulation/ex01_BasicParticles/CylindersWithSizeDistribution.py @@ -30,9 +30,9 @@ def get_sample(): sigma = 0.2*radius gauss_distr = DistributionGaussian(radius, sigma) - par_distr = ParameterDistribution("*/radius", gauss_distr, nparticles, nfwhm) + par_distr = ParameterDistribution("/Particle/Cylinder/Radius", gauss_distr, nparticles, nfwhm) # by uncommenting the line below the height of cylinders can be scaled proportionally to the radius - #par_distr.linkParameter("*/height") + #par_distr.linkParameter("/Particle/Cylinder/Height") part_coll = ParticleDistribution(cylinder, par_distr) # assembling the sample diff --git a/Examples/python/simulation/ex01_BasicParticles/TwoTypesOfCylindersWithSizeDistribution.py b/Examples/python/simulation/ex01_BasicParticles/TwoTypesOfCylindersWithSizeDistribution.py index 1b9066b79ccb09192372bc00c10960f914cc95dd..39c515a8c3d0e285bfc2ff05616ae3d912a5bd5d 100644 --- a/Examples/python/simulation/ex01_BasicParticles/TwoTypesOfCylindersWithSizeDistribution.py +++ b/Examples/python/simulation/ex01_BasicParticles/TwoTypesOfCylindersWithSizeDistribution.py @@ -31,7 +31,7 @@ def get_sample(): gauss_distr1 = DistributionGaussian(radius1, sigma1) - par_distr1 = ParameterDistribution("*/radius", gauss_distr1, nparticles, nfwhm) + par_distr1 = ParameterDistribution("/Particle/Cylinder/Radius", gauss_distr1, nparticles, nfwhm) part_coll1 = ParticleDistribution(cylinder1, par_distr1) # collection of particles #2 @@ -44,7 +44,7 @@ def get_sample(): gauss_distr2 = DistributionGaussian(radius2, sigma2) - par_distr2 = ParameterDistribution("*/radius", gauss_distr2, nparticles, nfwhm) + par_distr2 = ParameterDistribution("/Particle/Cylinder/Radius", gauss_distr2, nparticles, nfwhm) part_coll2 = ParticleDistribution(cylinder2, par_distr2) # assembling the sample diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/CosineRipplesAtRectLattice.py b/Examples/python/simulation/ex03_InterferenceFunctions/CosineRipplesAtRectLattice.py index 14de2a3886b9ba00d25f709aa4be9f887952a1df..cf6ff07a48313e6bc776ec17d79130f7deed2e52 100644 --- a/Examples/python/simulation/ex03_InterferenceFunctions/CosineRipplesAtRectLattice.py +++ b/Examples/python/simulation/ex03_InterferenceFunctions/CosineRipplesAtRectLattice.py @@ -27,8 +27,8 @@ def get_sample(): particle_layout.addParticle(ripple, 1.0) interference = InterferenceFunction2DLattice(200.0*nanometer, 50.0*nanometer, 90.0*degree, 0.0*degree) - pdf = FTDistribution2DCauchy(1000.*nanometer/2./numpy.pi, 100.*nanometer/2./numpy.pi) - interference.setProbabilityDistribution(pdf) + pdf = FTDecayFunction2DCauchy(1000.*nanometer/2./numpy.pi, 100.*nanometer/2./numpy.pi) + interference.setDecayFunction(pdf) particle_layout.addInterferenceFunction(interference) # assemble the sample diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/Interference1DLattice.py b/Examples/python/simulation/ex03_InterferenceFunctions/Interference1DLattice.py index 673acd8f0f8982f6711d67293b1f6058b3c2b597..ed801b10b621876e52df9db243174ebcfb4ffab2 100644 --- a/Examples/python/simulation/ex03_InterferenceFunctions/Interference1DLattice.py +++ b/Examples/python/simulation/ex03_InterferenceFunctions/Interference1DLattice.py @@ -23,8 +23,8 @@ def get_sample(): lattice_length = 30.0*nanometer lattice_rotation_angle = 0.0*degree interference = InterferenceFunction1DLattice(lattice_length, lattice_rotation_angle) - pdf = FTDistribution1DCauchy(20./2./numpy.pi*nanometer) - interference.setProbabilityDistribution(pdf) + pdf = FTDecayFunction1DCauchy(20./2./numpy.pi*nanometer) + interference.setDecayFunction(pdf) box_ff = FormFactorBox(1000*nanometer, 10*nanometer, 15.0*nanometer) box = Particle(m_particle, box_ff) diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DCenteredSquareLattice.py b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DCenteredSquareLattice.py index b75b9696054645ad6037359ccd095850a86690c7..f81ff98a8d30a72513c4a975f3bdf0d132fd2b50 100644 --- a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DCenteredSquareLattice.py +++ b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DCenteredSquareLattice.py @@ -21,8 +21,8 @@ def get_sample(): # collection of particles interference = InterferenceFunction2DLattice.createSquare(25.0*nanometer) - pdf = FTDistribution2DCauchy(300.0*nanometer/2.0/numpy.pi, 100.0*nanometer/2.0/numpy.pi) - interference.setProbabilityDistribution(pdf) + pdf = FTDecayFunction2DCauchy(300.0*nanometer/2.0/numpy.pi, 100.0*nanometer/2.0/numpy.pi) + interference.setDecayFunction(pdf) particle_layout = ParticleLayout() position1 = kvector_t(0.0, 0.0, 0.0) diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DLatticeSumOfRotated.py b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DLatticeSumOfRotated.py index ff280ae59bbbfc6620d1c4ad47db3aa40a51921f..70b208cb1eaa8843eac39377fbe1bc3dc865b52e 100644 --- a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DLatticeSumOfRotated.py +++ b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DLatticeSumOfRotated.py @@ -21,8 +21,8 @@ def get_sample(xi_value): substrate_layer = Layer(m_substrate) p_interference_function = InterferenceFunction2DLattice.createSquare(25.0*nanometer, xi_value) - pdf = FTDistribution2DCauchy(300.0*nanometer/2.0/numpy.pi, 100.0*nanometer/2.0/numpy.pi) - p_interference_function.setProbabilityDistribution(pdf) + pdf = FTDecayFunction2DCauchy(300.0*nanometer/2.0/numpy.pi, 100.0*nanometer/2.0/numpy.pi) + p_interference_function.setDecayFunction(pdf) particle_layout = ParticleLayout() ff_cyl = FormFactorCylinder(3.0*nanometer, 3.0*nanometer) diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DRotatedSquareLattice.py b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DRotatedSquareLattice.py index cf55fb758527840cd70be9f90f6c5b94f28ecfff..1e56f6c4ded77635e5c25986c82bb3d87bd9eab0 100644 --- a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DRotatedSquareLattice.py +++ b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DRotatedSquareLattice.py @@ -21,9 +21,9 @@ def get_sample(): # collection of particles interference = InterferenceFunction2DLattice.createSquare(25.0*nanometer, 30.0*degree) - pdf = FTDistribution2DCauchy(300.0*nanometer/2.0/numpy.pi, 100.0*nanometer/2.0/numpy.pi) + pdf = FTDecayFunction2DCauchy(300.0*nanometer/2.0/numpy.pi, 100.0*nanometer/2.0/numpy.pi) pdf.setGamma(30.0*degree) - interference.setProbabilityDistribution(pdf) + interference.setDecayFunction(pdf) cylinder_ff = FormFactorCylinder(3.*nanometer, 3.*nanometer) cylinder = Particle(m_particle, cylinder_ff) diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DSquareLattice.py b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DSquareLattice.py index 21a558137a42cb4a9b50d799de0953a91fb9e43d..7bae844060cf8195c6de64b3c29ad965a1857daa 100644 --- a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DSquareLattice.py +++ b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DSquareLattice.py @@ -21,8 +21,8 @@ def get_sample(): # collection of particles interference = InterferenceFunction2DLattice.createSquare(25.0*nanometer) - pdf = FTDistribution2DCauchy(300.0*nanometer/2.0/numpy.pi, 100.0*nanometer/2.0/numpy.pi) - interference.setProbabilityDistribution(pdf) + pdf = FTDecayFunction2DCauchy(300.0*nanometer/2.0/numpy.pi, 100.0*nanometer/2.0/numpy.pi) + interference.setDecayFunction(pdf) cylinder_ff = FormFactorCylinder(3.*nanometer, 3.*nanometer) cylinder = Particle(m_particle, cylinder_ff) diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/RectangularGrating.py b/Examples/python/simulation/ex03_InterferenceFunctions/RectangularGrating.py index 9fc62aa93f5d315aa44ac9cd0be64ab1958e31a2..034598ea8d4b8066bda369a42a169e69c12b2c72 100644 --- a/Examples/python/simulation/ex03_InterferenceFunctions/RectangularGrating.py +++ b/Examples/python/simulation/ex03_InterferenceFunctions/RectangularGrating.py @@ -25,8 +25,8 @@ def get_sample(lattice_rotation_angle=45.0*deg): # collection of particles interference = InterferenceFunction1DLattice(lattice_length, lattice_rotation_angle) - pdf = FTDistribution1DCauchy(1000.0) - interference.setProbabilityDistribution(pdf) + pdf = FTDecayFunction1DCauchy(1000.0) + interference.setDecayFunction(pdf) box_ff = FormFactorBox(box_length, box_width, box_height) box = Particle(m_particle, box_ff) diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/SpheresAtHexLattice.py b/Examples/python/simulation/ex03_InterferenceFunctions/SpheresAtHexLattice.py index 366337b01480d4fc37f1ca07c278d493438c96e4..6741637742092d0d23ae04ba52e321acb6a09162 100644 --- a/Examples/python/simulation/ex03_InterferenceFunctions/SpheresAtHexLattice.py +++ b/Examples/python/simulation/ex03_InterferenceFunctions/SpheresAtHexLattice.py @@ -24,8 +24,8 @@ def get_sample(): particle_layout.addParticle(sphere) interference = InterferenceFunction2DLattice.createHexagonal(20.0*nanometer) - pdf = FTDistribution2DCauchy(10*nanometer, 10*nanometer) - interference.setProbabilityDistribution(pdf) + pdf = FTDecayFunction2DCauchy(10*nanometer, 10*nanometer) + interference.setDecayFunction(pdf) particle_layout.addInterferenceFunction(interference) diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/TriangularRipple.py b/Examples/python/simulation/ex03_InterferenceFunctions/TriangularRipple.py index 2efe6db9c40bcd4aee769212d5b10ae72017cf16..8a7f087fa4763cf6709ad0df9905d1613b9a684e 100644 --- a/Examples/python/simulation/ex03_InterferenceFunctions/TriangularRipple.py +++ b/Examples/python/simulation/ex03_InterferenceFunctions/TriangularRipple.py @@ -27,8 +27,8 @@ def get_sample(): particle_layout.addParticle(ripple, 1.0) interference = InterferenceFunction2DLattice(200.0*nanometer, 50.0*nanometer, 90.0*degree, 0.0*degree) - pdf = FTDistribution2DGauss(1000.*nanometer/2./numpy.pi, 100.*nanometer/2./numpy.pi) - interference.setProbabilityDistribution(pdf) + pdf = FTDecayFunction2DGauss(1000.*nanometer/2./numpy.pi, 100.*nanometer/2./numpy.pi) + interference.setDecayFunction(pdf) particle_layout.addInterferenceFunction(interference) # air layer with particles and substrate form multi layer diff --git a/Examples/python/simulation/ex04_ComplexShapes/HexagonalLatticesWithBasis.py b/Examples/python/simulation/ex04_ComplexShapes/HexagonalLatticesWithBasis.py index 36eedd285a657e9113b34d61a4a2465be7a7d5b6..fcee8794a6a522d3bced34417c7059c70d585747 100644 --- a/Examples/python/simulation/ex04_ComplexShapes/HexagonalLatticesWithBasis.py +++ b/Examples/python/simulation/ex04_ComplexShapes/HexagonalLatticesWithBasis.py @@ -30,8 +30,8 @@ def get_sample(): particle_layout.addParticle(basis) interference = InterferenceFunction2DLattice.createHexagonal(radius*2.0) - pdf = FTDistribution2DCauchy(10*nanometer, 10*nanometer) - interference.setProbabilityDistribution(pdf) + pdf = FTDecayFunction2DCauchy(10*nanometer, 10*nanometer) + interference.setDecayFunction(pdf) particle_layout.addInterferenceFunction(interference) diff --git a/Examples/python/simulation/ex05_BeamAndDetector/OffSpecularSimulation.py b/Examples/python/simulation/ex05_BeamAndDetector/OffSpecularSimulation.py index 95d590e16978e0308345f0246c2ca3edb8c13a1f..bf89876620a03e737df3abd843694213dd2229bc 100644 --- a/Examples/python/simulation/ex05_BeamAndDetector/OffSpecularSimulation.py +++ b/Examples/python/simulation/ex05_BeamAndDetector/OffSpecularSimulation.py @@ -25,8 +25,8 @@ def get_sample(): lattice_length = 100.0*nanometer lattice_rotation_angle = 0.0*degree interference = InterferenceFunction1DLattice(lattice_length, lattice_rotation_angle) - pdf = FTDistribution1DCauchy(1e+6) - interference.setProbabilityDistribution(pdf) + pdf = FTDecayFunction1DCauchy(1e+6) + interference.setDecayFunction(pdf) box_ff = FormFactorBox(1000*nanometer, 20*nanometer, 10.0*nanometer) box = Particle(m_particle, box_ff) diff --git a/GUI/coregui/Views/MaskWidgets/EllipseView.cpp b/GUI/coregui/Views/MaskWidgets/EllipseView.cpp index 12d2c4e8fcacd4820d8a6cb9db701052bd8ca505..e84f33e8662e7a49d89e028b75b76503a37e229d 100644 --- a/GUI/coregui/Views/MaskWidgets/EllipseView.cpp +++ b/GUI/coregui/Views/MaskWidgets/EllipseView.cpp @@ -176,7 +176,7 @@ void EllipseView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void EllipseView::update_view() { - prepareGeometryChange(); +// prepareGeometryChange(); update_bounding_rect(); update_position(); update(); diff --git a/GUI/coregui/Views/MaskWidgets/IntensityDataView.cpp b/GUI/coregui/Views/MaskWidgets/IntensityDataView.cpp index 0390e03eb4b11cc5eeaa6f3babefe1f9a5343d6e..185fe3389d89025be0b041aa6ce5b116f41d681a 100644 --- a/GUI/coregui/Views/MaskWidgets/IntensityDataView.cpp +++ b/GUI/coregui/Views/MaskWidgets/IntensityDataView.cpp @@ -29,7 +29,7 @@ IntensityDataView::IntensityDataView() void IntensityDataView::update_view() { - prepareGeometryChange(); +// prepareGeometryChange(); m_bounding_rect = m_adaptor->getViewportRectangle(); update(); } diff --git a/GUI/coregui/Views/MaskWidgets/MaskAllView.cpp b/GUI/coregui/Views/MaskWidgets/MaskAllView.cpp index 4407cddb05efdf86ee8d80bb156e43cbc677ee60..b5c9b019678ff762e113f8a3fe6cf14e5b0bf4bd 100644 --- a/GUI/coregui/Views/MaskWidgets/MaskAllView.cpp +++ b/GUI/coregui/Views/MaskWidgets/MaskAllView.cpp @@ -30,7 +30,7 @@ MaskAllView::MaskAllView() void MaskAllView::update_view() { - prepareGeometryChange(); +// prepareGeometryChange(); m_bounding_rect = m_adaptor->getViewportRectangle(); update(); } diff --git a/GUI/coregui/Views/MaskWidgets/MaskContainerView.cpp b/GUI/coregui/Views/MaskWidgets/MaskContainerView.cpp index aa423ed2b85cd61636eaab800659ce6d914eb7e1..b78d60be6111abd0d17c862a461e4154a6ef9f87 100644 --- a/GUI/coregui/Views/MaskWidgets/MaskContainerView.cpp +++ b/GUI/coregui/Views/MaskWidgets/MaskContainerView.cpp @@ -29,7 +29,7 @@ MaskContainerView::MaskContainerView() void MaskContainerView::update_view() { - prepareGeometryChange(); +// prepareGeometryChange(); m_bounding_rect = m_adaptor->getViewportRectangle(); update(); } diff --git a/GUI/coregui/Views/MaskWidgets/MaskGraphicsScene.cpp b/GUI/coregui/Views/MaskWidgets/MaskGraphicsScene.cpp index 447be2ceda532562de944af576a669136e6d3e36..e42f715c95acb0a82f9c1a54ddff8884e800ae1e 100644 --- a/GUI/coregui/Views/MaskWidgets/MaskGraphicsScene.cpp +++ b/GUI/coregui/Views/MaskWidgets/MaskGraphicsScene.cpp @@ -284,6 +284,11 @@ void MaskGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event) return; } + if(isValidForPolygonDrawing(event)) { + processPolygonItem(event); + return; + } + if(isValidForLineDrawing(event)) { processLineItem(event); return; @@ -294,11 +299,6 @@ void MaskGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event) return; } - if(isValidForPolygonDrawing(event)) { - processPolygonItem(event); - return; - } - if(isValidForRectangleDrawing(event)) { processRectangleItem(event); return; @@ -325,7 +325,11 @@ void MaskGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) } QGraphicsScene::mouseMoveEvent(event); - m_currentMousePosition = event->scenePos(); + + if( (isDrawingInProgress() && m_context.isPolygonMode()) || m_context.isLineMode()) { + m_currentMousePosition = event->scenePos(); + invalidate(); + } } //! Finalizes item drawing or pass events to other items @@ -359,7 +363,6 @@ void MaskGraphicsScene::drawForeground(QPainter *painter, const QRectF &) if(PolygonView *polygon = getCurrentPolygon()) { painter->setPen(QPen(Qt::black, 1, Qt::DashLine)); painter->drawLine(QLineF(polygon->getLastAddedPoint(), m_currentMousePosition)); - invalidate(); } else { if(m_context.isLineMode()) { const QRectF &plot_scene_rectangle = m_adaptor->getViewportRectangle(); @@ -376,8 +379,6 @@ void MaskGraphicsScene::drawForeground(QPainter *painter, const QRectF &) QPointF p2(plot_scene_rectangle.right(), m_currentMousePosition.y()); painter->drawLine(QLineF(p1, p2)); } - invalidate(); - } } } @@ -735,10 +736,11 @@ PolygonView *MaskGraphicsScene::getCurrentPolygon() const PolygonView *result(0); if(isDrawingInProgress() && m_context.isPolygonMode()) { if(m_currentItem) { - if(IMaskView *view = m_ItemToView[m_currentItem]) { - if(view->type() == MaskEditorHelper::POLYGON) - result = dynamic_cast<PolygonView *>(view); - } +// if(IMaskView *view = m_ItemToView[m_currentItem]) { +// if(view->type() == MaskEditorHelper::POLYGON) +// result = dynamic_cast<PolygonView *>(view); +// } + result = dynamic_cast<PolygonView *>(m_ItemToView[m_currentItem]); } } return result; diff --git a/GUI/coregui/Views/MaskWidgets/MaskGraphicsScene.h b/GUI/coregui/Views/MaskWidgets/MaskGraphicsScene.h index 82079044eb680051faee709bb6ff7c6d32584292..7cbd82c7d793270659204b3ce0237444deb2d2f8 100644 --- a/GUI/coregui/Views/MaskWidgets/MaskGraphicsScene.h +++ b/GUI/coregui/Views/MaskWidgets/MaskGraphicsScene.h @@ -71,7 +71,7 @@ protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - void drawForeground(QPainter *painter, const QRectF &); + void drawForeground(QPainter *painter, const QRectF &rect); void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); private: diff --git a/GUI/coregui/Views/MaskWidgets/PolygonView.cpp b/GUI/coregui/Views/MaskWidgets/PolygonView.cpp index dff870afa12103b408036b9e275b99bb36141fc1..5b748b19afb4e4e229f35c8bd69ddc2888045cdb 100644 --- a/GUI/coregui/Views/MaskWidgets/PolygonView.cpp +++ b/GUI/coregui/Views/MaskWidgets/PolygonView.cpp @@ -84,6 +84,7 @@ bool PolygonView::closePolygonIfNecessary() childItem->setCursor(Qt::SizeAllCursor); } m_item->setRegisteredProperty(PolygonItem::P_ISCLOSED, true); + update(); } return isClosedPolygon(); } @@ -138,7 +139,7 @@ void PolygonView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void PolygonView::update_view() { - prepareGeometryChange(); +// prepareGeometryChange(); update_polygon(); update(); } diff --git a/GUI/coregui/Views/MaskWidgets/RectangleView.cpp b/GUI/coregui/Views/MaskWidgets/RectangleView.cpp index 37df3031eea4f762720684b6ca3dc21af023daee..9667c98d7e3530102a8a8e99cc75a938402856fc 100644 --- a/GUI/coregui/Views/MaskWidgets/RectangleView.cpp +++ b/GUI/coregui/Views/MaskWidgets/RectangleView.cpp @@ -178,7 +178,7 @@ void RectangleView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void RectangleView::update_view() { - prepareGeometryChange(); +// prepareGeometryChange(); update_bounding_rect(); update_position(); update(); diff --git a/GUI/coregui/Views/SampleDesigner/DesignerScene.cpp b/GUI/coregui/Views/SampleDesigner/DesignerScene.cpp index e5f641e4b6ceed98b2a9e98aec666f8c3f7fe7af..c2494500753e0db66f6f8c5ed55ae679bb2ef0a0 100644 --- a/GUI/coregui/Views/SampleDesigner/DesignerScene.cpp +++ b/GUI/coregui/Views/SampleDesigner/DesignerScene.cpp @@ -338,11 +338,9 @@ void DesignerScene::deleteSelectedItems() //! shows appropriate layer interface to drop while moving ILayerView void DesignerScene::drawForeground(QPainter *painter, const QRectF & /* rect */) { - ILayerView *layer = dynamic_cast<ILayerView *>(mouseGrabberItem()); - if (layer && !m_layer_interface_line.isNull()) { + if (isLayerDragged()) { painter->setPen(QPen(Qt::darkBlue, 2, Qt::DashLine)); painter->drawLine(m_layer_interface_line); - invalidate(); } } @@ -452,6 +450,14 @@ const DesignerMimeData *DesignerScene::checkDragEvent(QGraphicsSceneDragDropEven return mimeData; } +void DesignerScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + if(isLayerDragged()) { + invalidate(); // to redraw vertical dashed line which denotes where to drag the layer + } + QGraphicsScene::mouseMoveEvent(event); +} + //! Returns true if there is MultiLayerView nearby during drag event. bool DesignerScene::isMultiLayerNearby(QGraphicsSceneDragDropEvent *event) { @@ -490,6 +496,15 @@ bool DesignerScene::isAcceptedByMultiLayer(const DesignerMimeData *mimeData, QGr return false; } +bool DesignerScene::isLayerDragged() const +{ + ILayerView *layer = dynamic_cast<ILayerView *>(mouseGrabberItem()); + if (layer && !m_layer_interface_line.isNull()) { + return true; + } + return false; +} + void DesignerScene::onSmartAlign() { m_aligner->smartAlign(); diff --git a/GUI/coregui/Views/SampleDesigner/DesignerScene.h b/GUI/coregui/Views/SampleDesigner/DesignerScene.h index c1012d048b302a04e6d6ee552163e003cdf760d9..006319cc85ef365072fefbe3024f644394e47188 100644 --- a/GUI/coregui/Views/SampleDesigner/DesignerScene.h +++ b/GUI/coregui/Views/SampleDesigner/DesignerScene.h @@ -82,6 +82,7 @@ public slots: protected: void drawForeground(QPainter* painter, const QRectF& rect); const DesignerMimeData *checkDragEvent(QGraphicsSceneDragDropEvent * event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); private: @@ -93,6 +94,7 @@ private: bool isMultiLayerNearby(QGraphicsSceneDragDropEvent *event); void adjustSceneRect(); bool isAcceptedByMultiLayer(const DesignerMimeData *mimeData, QGraphicsSceneDragDropEvent *event); + bool isLayerDragged() const; SampleModel *m_sampleModel; InstrumentModel *m_instrumentModel; diff --git a/GUI/coregui/mainwindow/actionmanager.cpp b/GUI/coregui/mainwindow/actionmanager.cpp index f8302161852be5a039d34b91bc486e56b9f3107a..385b6cdb588c58ad13f2b9f1ba41eeb4593dae6d 100644 --- a/GUI/coregui/mainwindow/actionmanager.cpp +++ b/GUI/coregui/mainwindow/actionmanager.cpp @@ -21,6 +21,7 @@ #include "stringutils.h" #include "UpdateNotifier.h" #include <QMenuBar> +#include <QMenu> #include <QShortcut> #include <QSettings> #include <QFileInfo> @@ -56,44 +57,44 @@ void ActionManager::createActions() Q_ASSERT(projectManager); // new project action - QIcon icon = QIcon::fromTheme(QLatin1String("document-new"), QIcon(QLatin1String(Constants::ICON_NEWFILE))); - m_newAction = new QAction(icon, tr("&New Project"), m_mainWindow); +// QIcon icon = QIcon::fromTheme(QLatin1String("document-new"), QIcon(QLatin1String(Constants::ICON_NEWFILE))); + m_newAction = new QAction(tr("&New Project"), m_mainWindow); m_newAction->setShortcuts(QKeySequence::New); m_newAction->setStatusTip(tr("Create a new project")); connect(m_newAction, SIGNAL(triggered()), projectManager, SLOT(newProject()) ); // open project action - icon = QIcon::fromTheme(QLatin1String("document-open"), QIcon(QLatin1String(Constants::ICON_OPENFILE))); - m_openAction = new QAction(icon, tr("&Open Project"), m_mainWindow); +// icon = QIcon::fromTheme(QLatin1String("document-open"), QIcon(QLatin1String(Constants::ICON_OPENFILE))); + m_openAction = new QAction(tr("&Open Project"), m_mainWindow); m_openAction->setShortcuts(QKeySequence::Open); m_openAction->setStatusTip(tr("Open an existing project")); connect(m_openAction, SIGNAL(triggered()), projectManager, SLOT(openProject()) ); // save project action - icon = QIcon::fromTheme(QLatin1String("document-save"), QIcon(QLatin1String(Constants::ICON_SAVEFILE))); - m_saveAction = new QAction(icon, tr("&Save Project"), m_mainWindow); +// icon = QIcon::fromTheme(QLatin1String("document-save"), QIcon(QLatin1String(Constants::ICON_SAVEFILE))); + m_saveAction = new QAction(tr("&Save Project"), m_mainWindow); m_saveAction->setShortcuts(QKeySequence::Save); m_saveAction->setStatusTip(tr("Save project")); m_saveAction->setShortcutContext(Qt::ApplicationShortcut); connect(m_saveAction, SIGNAL(triggered()), projectManager, SLOT(saveProject()) ); // save-as project action - icon = QIcon::fromTheme(QLatin1String("document-save-as")); - m_saveAsAction = new QAction(icon, tr("Save &As..."), m_mainWindow); +// icon = QIcon::fromTheme(QLatin1String("document-save-as")); + m_saveAsAction = new QAction(tr("Save &As..."), m_mainWindow); m_saveAsAction->setShortcuts(QKeySequence::SaveAs); m_saveAsAction->setStatusTip(tr("Save project under different name")); connect(m_saveAsAction, SIGNAL(triggered()), projectManager, SLOT(saveProjectAs()) ); // exit application action - icon = QIcon::fromTheme(QLatin1String("application-exit")); - m_exitAction = new QAction(icon, tr("E&xit Application"), this); +// icon = QIcon::fromTheme(QLatin1String("application-exit")); + m_exitAction = new QAction(tr("E&xit Application"), this); m_exitAction->setShortcuts(QKeySequence::Quit); m_exitAction->setStatusTip(tr("Exit the application")); connect(m_exitAction, SIGNAL(triggered()), m_mainWindow, SLOT(close())); // about application action - icon = QIcon::fromTheme(QLatin1String("help-about")); - m_aboutAction = new QAction(icon, tr("About &BornAgain"), this); +// icon = QIcon::fromTheme(QLatin1String("help-about")); + m_aboutAction = new QAction(tr("About &BornAgain"), this); //m_aboutAction->setShortcuts(QKeySequence::HelpContents); m_aboutAction->setStatusTip(tr("About the application")); connect(m_aboutAction, SIGNAL(triggered()), m_mainWindow, SLOT(onAboutApplication())); @@ -103,7 +104,7 @@ void ActionManager::createActions() void ActionManager::createMenus() { - m_menuBar = new QMenuBar; // No parent (System menu bar on Mac OS X) + m_menuBar = new QMenuBar(0); // No parent (System menu bar on Mac OS X) if (!Utils::HostOsInfo::isMacHost()) m_mainWindow->setMenuBar(m_menuBar); @@ -124,9 +125,10 @@ void ActionManager::createMenus() m_fileMenu->addAction(m_exitAction); // Settings Menu - m_settingsMenu = m_menuBar->addMenu(tr("&Settings")); + m_settingsMenu = new QMenu("Settings", m_mainWindow); + aboutToShowSettings(); // MacOS feature: action should exist already, otherwise menuBar will not add menu connect(m_settingsMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowSettings())); - + m_menuBar->addMenu(m_settingsMenu); // Help Menu m_helpMenu = m_menuBar->addMenu(tr("&Help")); diff --git a/GUI/coregui/mainwindow/mainwindow.cpp b/GUI/coregui/mainwindow/mainwindow.cpp index 379000e245d5662898f1c0d504d750d0d9ec4dbb..d5d871976575b8c531abeafa544269c8e6246ee8 100644 --- a/GUI/coregui/mainwindow/mainwindow.cpp +++ b/GUI/coregui/mainwindow/mainwindow.cpp @@ -99,7 +99,7 @@ MainWindow::MainWindow(QWidget *parent) QCoreApplication::setOrganizationName(QLatin1String(Constants::APPLICATION_NAME)); createModels(); - testGUIObjectBuilder(); +// testGUIObjectBuilder(); if (!Utils::HostOsInfo::isMacHost()) diff --git a/VERSION.cmake b/VERSION.cmake index a07b1258e405dc4208f9ff16b24010b8a3328c90..e5a9c516e71b06ef709d94e26824d857bc211af9 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -1,3 +1,3 @@ set(BornAgain_VERSION_MAJOR 1) -set(BornAgain_VERSION_MINOR 4) +set(BornAgain_VERSION_MINOR 5) set(BornAgain_VERSION_PATCH 0) diff --git a/cmake/modules/FindTIFF.cmake b/cmake/modules/FindTIFF.cmake index 62362413dae0b243b9ae9c628092a3c38a47233f..bfafacaa84f3d2f5c52e00ab62d7c9798fbfa903 100644 --- a/cmake/modules/FindTIFF.cmake +++ b/cmake/modules/FindTIFF.cmake @@ -32,12 +32,12 @@ # License text for the above reference.) if(WIN32) - find_path(TIFF_INCLUDE_DIR tiff.h PATHS ${CMAKE_INCLUDE_PATH}/libtiff) + find_path(TIFF_INCLUDE_DIR tiff.h PATHS ${CMAKE_INCLUDE_PATH}/libtiff NO_SYSTEM_ENVIRONMENT_PATH) else() find_path(TIFF_INCLUDE_DIR tiff.h) endif() -set(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3) +set(TIFF_NAMES ${TIFF_NAMES} libtiff tiff libtiff3 tiff3) find_library(TIFF_LIBRARY NAMES ${TIFF_NAMES}) if(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h") diff --git a/cmake/scripts/fix_apple_bundle.py b/cmake/scripts/fix_apple_bundle.py index e8f4d5858692ee27b1c3bf8a86f5b0df024d4a74..97152edd44fff9be1e549363ce4b5388133f6c11 100644 --- a/cmake/scripts/fix_apple_bundle.py +++ b/cmake/scripts/fix_apple_bundle.py @@ -34,8 +34,8 @@ def bundle_plugins_path(): return os.path.join(bundle_dir(), "Contents", "PlugIns") -def bundle_main_executable(): - return os.path.join(bundle_dir(), "Contents", "MacOS", "BornAgain") +def bundle_main_executables(): + return [os.path.join(bundle_dir(), "Contents", "MacOS", "BornAgain")] def bundle_python_library(): @@ -50,9 +50,26 @@ def qtplugins_path(): return os.path.join(os.environ['QTDIR'], "plugins") +def bundle_libraries(): + return glob.glob(os.path.join(bundle_dir(), "Contents", "lib", "BornAgain-*", "*")) + + +def bundle_plugins(): + return glob.glob(os.path.join(bundle_plugins_path(), "*", "*")) + + def bornagain_binaries(): - result = glob.glob(os.path.join(bundle_dir(), "Contents", "lib", "BornAgain-*", "*")) - result.append(bundle_main_executable()) + return bundle_main_executables() + bundle_libraries() + bundle_plugins() + + +def get_list_of_files(dirname): + """ + returns recursive list of files in given directory and its subdirectories + """ + result = [] + for root, directories, filenames in os.walk(dirname): + for filename in filenames: + result.append(os.path.join(root,filename)) return result @@ -71,7 +88,17 @@ def copy_file_to_dir(file_name, dest_dir): Copies file to the destination directory. If destination doesn't exists, it will be created. """ make_dir(dest_dir) - shutil.copyfile(file_name, os.path.join(dest_dir, os.path.basename(file_name))) + dest_file = os.path.join(dest_dir, os.path.basename(file_name)) + shutil.copyfile(file_name, dest_file) + return dest_file + + +def copy_file_to_file(source, destination): + """ + Copies file to another. If destination directory doesn't exists, it will be created. + """ + make_dir(os.path.dirname(destination)) + shutil.copyfile(source, destination) def otool(filename): @@ -103,6 +130,28 @@ def fixDependency(filename, old, new): return +def is_system_dependency(dependency): + """ + Returns True if this is system file dependency + """ + non_dependency_patterns = ['/usr/lib', '/System'] + for pat in non_dependency_patterns: + if dependency.startswith(pat): + return True + return False + + +def is_rpath_dependency(dependency): + """ + Returns True if this is rpath like dependency + """ + non_dependency_patterns = ['@'] + for pat in non_dependency_patterns: + if dependency.startswith(pat): + return True + return False + + def is_python_framework_dependency(dependency): """ Returns True if this dependency is python library @@ -127,22 +176,71 @@ def is_to_bundle_dependency(dependency): Returns True if this dependency should be moved to the bundle. Qt libraries and Python framework are special case and will be treated separately. """ - if not os.path.exists(dependency): - return False - non_dependency_patterns = ['@', '/usr/lib', '/System'] - for pat in non_dependency_patterns: - if dependency.startswith(pat): - return False - if is_python_framework_dependency(dependency): + if is_system_dependency(dependency): return False - if is_qt_framework_dependency(dependency): + if "libBornAgain" in dependency: + # our own libraries are already in place and have right libId's return False return True +def get_dependency_libId(dependency): + """ + Returns libId of this dependency + """ + libname = os.path.basename(dependency) + + if is_python_framework_dependency(dependency): + return "@rpath/" + bundle_python_library() + + if is_qt_framework_dependency(dependency): + return "@rpath/" + libname +".framework/Versions/5/"+libname + + # all other libraries + return "@rpath/" + libname + + +def get_dependency_orig_location(dependency): + """ + Returns dependency original location. In most cases it is just "dependency" itself (i.e. path to file). + If dependency contains @rpath, then we are trying to guess where original files might be + """ + + if os.path.exists(dependency): + return dependency + + result = None + + if is_python_framework_dependency(dependency): + result = get_python_library_location() + + elif is_qt_framework_dependency(dependency): + libname = os.path.basename(dependency) + libpath = os.path.join(libname+".framework", "Versions", "5") + result = os.path.join(qtlibs_path(), libpath, libname) + + return result + + +def get_dependency_dest_location(dependency): + """ + Return new location of the dependency in the bundle + """ + libname = os.path.basename(dependency) + + if is_python_framework_dependency(dependency): + return os.path.join(bundle_frameworks_path(), bundle_python_library()) + + if is_qt_framework_dependency(dependency): + libpath = os.path.join(libname+".framework", "Versions", "5") + return os.path.join(bundle_frameworks_path(), libpath, libname) + + return os.path.join(bundle_frameworks_path(), libname) + + def get_special_dependency_id(dependency): """ Returns libId if this dependency requires special attention (i.e. Python framework) @@ -197,7 +295,6 @@ def copy_python_framework(): setId(destfile, libId) - def copy_qt_libraries(): print "--> Copying Qt libraries" libs = ['QtCore', 'QtDBus', 'QtDesigner', 'QtGui', 'QtPrintSupport', 'QtWidgets', 'QtXml', 'QtSvg', 'QtNetwork'] @@ -209,7 +306,6 @@ def copy_qt_libraries(): if os.path.exists(srcfile): dstdir = os.path.join(bundle_frameworks_path(), libpath) copy_file_to_dir(srcfile, dstdir) - print def copy_qt_plugins(): @@ -220,8 +316,8 @@ def copy_qt_plugins(): print name, srcfile = os.path.join(qtplugins_path(), name) dstdir = os.path.join(bundle_plugins_path(), os.path.dirname(name)) - copy_file_to_dir(srcfile, dstdir) - print + dstfile = copy_file_to_dir(srcfile, dstdir) + setId(dstfile, os.path.basename(dstfile)) def process_dependency(dependency): @@ -229,28 +325,44 @@ def process_dependency(dependency): Copies external dependency library into Frameworks directory (if it is not already there) and sets corresponding library Id for it. Returns library Id and new location to the user. """ - libname = os.path.basename(dependency) - libId = "@rpath/" + libname - new_location = os.path.join(bundle_frameworks_path(), libname) - if os.path.exists(new_location): + + libId = get_dependency_libId(dependency) + origLocation = get_dependency_orig_location(dependency) + destLocation = get_dependency_dest_location(dependency) + + print " ------" + if libId == dependency: + print " selfDependency" + return None, None + + if origLocation == None: + print " origLocation >", origLocation + return libId, None + + print " origLocation >", origLocation + print " destLocation >", destLocation + print " libId >", libId + + if os.path.exists(destLocation): return libId, None - print "copying dependency", dependency - copy_file_to_dir(dependency, bundle_frameworks_path()) - setId(new_location, libId) - return libId, new_location + print " copying to >", destLocation + copy_file_to_file(origLocation, destLocation) + setId(destLocation, libId) + return libId, destLocation def walk_through_dependencies(file_name): + print "============================" + print "walk_through ", file_name for dependency in otool(file_name): + print "---> ", file_name, dependency if is_to_bundle_dependency(dependency): libId, new_location = process_dependency(dependency) - fixDependency(file_name, dependency, libId) - if new_location: - walk_through_dependencies(new_location) - else: - libId = get_special_dependency_id(dependency) + print "to Bundle", libId, new_location if libId: fixDependency(file_name, dependency, libId) + if new_location: + walk_through_dependencies(new_location) def copy_dependencies(): @@ -259,14 +371,39 @@ def copy_dependencies(): walk_through_dependencies(binfile) +def validate_dependencies(): + """ + Analyse whole bundle for missed dependencies + """ + binaries = bornagain_binaries() + libraries = get_list_of_files(bundle_frameworks_path()) + file_list = binaries+libraries + files_with_missed_dependencies = [] + for file_name in file_list: + for dependency in otool(file_name): + if is_system_dependency(dependency) or is_rpath_dependency(dependency): + continue + if os.path.basename(file_name) in dependency: + # self dependency (libId) + continue + files_with_missed_dependencies.append(file_name) + break + + if len(files_with_missed_dependencies): + print "Error! Still unresolved dependencies." + print files_with_missed_dependencies + raise Exception("Unresolved dependencies!") + + def fix_apple_bundle(): print '-'*80 print "Fixing OS X bundle at '{0}'".format(bundle_dir()) print '-'*80 - copy_python_framework() - copy_qt_libraries() + # copy_python_framework() + # copy_qt_libraries() copy_qt_plugins() copy_dependencies() + validate_dependencies() print "Done!" diff --git a/dev-tools/git-utils/lines_of_code.png b/dev-tools/git-utils/lines_of_code.png index 6478c315b9f9fb482c27a0a70f433d8aab0d2f36..565a0d58d46f908749aa5b46a42afd5b25ca75e7 100644 Binary files a/dev-tools/git-utils/lines_of_code.png and b/dev-tools/git-utils/lines_of_code.png differ diff --git a/dev-tools/log/perf_history.txt b/dev-tools/log/perf_history.txt index d03957adbc041889330b438e5809509e239f28bd..0c50c8d3360f4c7f01df465af5e6481c22a738c3 100644 --- a/dev-tools/log/perf_history.txt +++ b/dev-tools/log/perf_history.txt @@ -495,4 +495,6 @@ # PreRelease. If I try to backup mP_specular_info->getInCoefficients(alpha_i, 0.0, wavelength)); in InterferenceFunctionStrategy | 2015-10-29 09:41:25 | jcnsopc126 | linuxx8664gcc | 0 | 19.921 | 2.416 | 0.984 | 1.654 | 0.778 | 3.333 | 1.027 | 2.923 | 1.505 | 2.359 | 2.942 | - +# PreRelease-1.5.0 +| date | hostname | sysinfo | tr | total | MultiLayer | CylindersInD | RotatedPyram | CoreShell | SquareLattic | RadialParaCr | HexParaCryst | SSCA | Mesocrystal | PolMagCyl | +| 2016-02-11 14:10:57 | jcnsopc126 | linuxx8664gcc | 0 | 18.247 | 1.981 | 0.920 | 1.418 | 0.696 | 2.578 | 0.950 | 3.899 | 1.381 | 2.008 | 2.417 |