diff --git a/App/App.pro b/App/App.pro index 3332d775fbd5840a96fd1ffa4a0998c89431b5bc..e35e6e812297b377f141f993aee425b7a4310427 100644 --- a/App/App.pro +++ b/App/App.pro @@ -86,7 +86,8 @@ SOURCES += \ src/TestSpecularMatrix.cpp \ src/TestToySimulation.cpp \ src/TreeEventStructure.cpp \ - src/main.cpp + src/main.cpp \ + src/TestBugs.cpp HEADERS += \ @@ -146,7 +147,7 @@ HEADERS += \ inc/TestSpecularMatrix.h \ inc/TestToySimulation.h \ inc/TreeEventStructure.h \ - inc/Version.h \ + inc/TestBugs.h myIncludes = $$PWD/inc \ $${FUNCTIONAL_TESTS}/IsGISAXS06 \ diff --git a/App/inc/TestBugs.h b/App/inc/TestBugs.h new file mode 100644 index 0000000000000000000000000000000000000000..23d1f3c1eefa5ce0685b611f71b49be1c7fcdf83 --- /dev/null +++ b/App/inc/TestBugs.h @@ -0,0 +1,19 @@ +#ifndef TESTBUGS_H +#define TESTBUGS_H + +#include "IFunctionalTest.h" + + +class TestBugs : public IFunctionalTest +{ +public: + TestBugs(); + virtual ~TestBugs(){} + + virtual void execute(); + + void test_item339(); + +}; + +#endif // TESTBUGS_H diff --git a/App/inc/Version.h b/App/inc/Version.h deleted file mode 100644 index 0f580d264a3060e6345697fb96159cf539d4d3f3..0000000000000000000000000000000000000000 --- a/App/inc/Version.h +++ /dev/null @@ -1,26 +0,0 @@ -// ************************************************************************** // -// -// BornAgain: simulate and fit scattering at grazing incidence -// -//! @file App/inc/Version.h -//! @brief Defines namespace AppVersion. -// -//! Homepage: apps.jcns.fz-juelich.de/BornAgain -//! License: GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2013 -//! @authors Scientific Computing Group at MLZ Garching -//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke -// -// ************************************************************************** // - -#ifndef VERSION_H_ -#define VERSION_H_ - -namespace AppVersion { - const std::string g_app_name = "Born Again Functional tests"; - const std::string g_app_version_number = "v0.8.1"; -} - -#endif /* VERSION_H_ */ - - diff --git a/App/src/FunctionalTestFactory.cpp b/App/src/FunctionalTestFactory.cpp index b554fffdc4f0d7003eb81b4eee4f78599d730ffc..47324fcfa0346b2bb723ca841de80e461bd24b2b 100644 --- a/App/src/FunctionalTestFactory.cpp +++ b/App/src/FunctionalTestFactory.cpp @@ -14,6 +14,7 @@ // ************************************************************************** // #include "FunctionalTestFactory.h" +#include "TestBugs.h" #include "TestConvolution.h" #include "TestDetectorResolution.h" #include "TestDiffuseReflection.h" @@ -26,13 +27,13 @@ #include "TestFourier.h" #include "TestFresnelCoeff.h" #include "TestFumiliLMA.h" -#include "TestIsGISAXS1.h" #include "TestIsGISAXS10.h" #include "TestIsGISAXS11.h" #include "TestIsGISAXS12.h" #include "TestIsGISAXS13.h" #include "TestIsGISAXS14.h" #include "TestIsGISAXS15.h" +#include "TestIsGISAXS1.h" #include "TestIsGISAXS2.h" #include "TestIsGISAXS3.h" #include "TestIsGISAXS4.h" @@ -303,5 +304,9 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory) "specularmatrix", IFactoryCreateFunction<TestSpecularMatrix, IFunctionalTest>, "functional test: specular reflectivity with matrix formalism"); + p_test_factory->registerItem( + "testbugs", + IFactoryCreateFunction<TestBugs , IFunctionalTest>, + "functional test: test bugs reported in Redmine"); } diff --git a/App/src/TestBugs.cpp b/App/src/TestBugs.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7af1e2254a313965b28d0b1de6fb18af4f1e4132 --- /dev/null +++ b/App/src/TestBugs.cpp @@ -0,0 +1,99 @@ +#include "TestBugs.h" +#include "MultiLayer.h" +#include "MaterialManager.h" +#include "Units.h" +#include "FormFactorSphere.h" +#include "Particle.h" +#include "ParticleDecoration.h" +#include "InterferenceFunction2DParaCrystal.h" + +#include <iostream> + +TestBugs::TestBugs() +{ + +} + + +void TestBugs::execute() +{ + test_item339(); +} + + +void TestBugs::test_item339() +{ + std::cout << "TestBugs::test_item339() -> " << std::endl; + +// const IMaterial *mAmbience = +// MaterialManager::getHomogeneousMaterial("Air", 0.0, 0.0 ); + +// const IMaterial *mSubstrate = +// MaterialManager::getHomogeneousMaterial("Substrate", 6e-6, 2e-8 ); + + complex_t n_particle(1.0-6e-4, 2e-8); + const IMaterial *mParticle = + MaterialManager::getHomogeneousMaterial("Particle", n_particle ); + + + FormFactorSphere *sphere_ff = new FormFactorSphere(8.0*Units::nanometer, 8.0*Units::nanometer); + + Particle *particle = new Particle(mParticle, sphere_ff); + + InterferenceFunction2DParaCrystal *interf = + InterferenceFunction2DParaCrystal::createHexagonal(20.0*Units::nanometer, + 0.0,20.0*Units::micrometer, 20.0*Units::micrometer); + + + ParticleDecoration *decoration = new ParticleDecoration(); + + decoration->addParticle(particle,0., 1.0); + + + + decoration->addInterferenceFunction(interf); +} + + + + +/* + +# defining materials + +sphere_ff = ba.FormFactorSphere(8 * ba.nanometer, 8 * ba.nanometer) +#sphere = ba.Particle(n_particle, sphere_ff) +sphere = ba.Particle(mParticle, sphere_ff) + +interference = ba.InterferenceFunction2DParaCrystal.createHexagonal(20.0*ba.nanometer, 0.0,20.0*ba.micrometer, 20.0*ba.micrometer) +#pdf = ba.FTDistribution2DCauchy(1.0*ba.nanometer, 1.0*ba.nanometer) +#interference.setProbabilityDistributions(pdf, pdf) + +particle_decoration = ba.ParticleDecoration() +particle_decoration.addParticle(sphere, 0., 1.) +print 'before addInterferenceFunction' +particle_decoration.addInterferenceFunction(interference) +print 'after addInterferenceFunction' + +# air layer with particles and substrate form multi layer +air_layer = ba.Layer(mAmbience) +air_layer.setDecoration(particle_decoration) +substrate_layer = ba.Layer(mSubstrate, 0) + +multi_layer = ba.MultiLayer() +multi_layer.addLayer(air_layer) +multi_layer.addLayer(substrate_layer) + +# build and run experiment +simulation = ba.Simulation() +simulation.setDetectorParameters(487/5, -1.4 * ba.degree, 0.15 * ba.degree, + 407/5, 0. * ba.degree, 1.4 * ba.degree, True) +simulation.setBeamParameters(.96 * ba.angstrom, 0.5 * ba.degree, 0.0 * ba.degree) +simulation.setSample(multi_layer) +simulation.runSimulation() +## intensity data +return ba.GetOutputData(simulation) + + +*/ + diff --git a/App/src/main.cpp b/App/src/main.cpp index 185ff88ff198c91b87dc78b89b80502fbc434436..6a6815ea85207827773b67ae13ee875683150488 100644 --- a/App/src/main.cpp +++ b/App/src/main.cpp @@ -34,7 +34,7 @@ int main(int argc, char **argv) Utils::EnableFloatingPointExceptions(); std::cout << AppVersion::g_app_name << " " - << AppVersion::g_app_version_number << std::endl; + << AppVersion::GetVersionNumber() << std::endl; FunctionalTestFactory test_factory; RegisterFunctionalTests(&test_factory); diff --git a/Core/Core.pro b/Core/Core.pro index 8b03c8cb797705e0b1ea59147ba53406b32fa6f0..9a4a87c85be53c8c91eb6b69032d554bbad189c9 100644 --- a/Core/Core.pro +++ b/Core/Core.pro @@ -302,7 +302,8 @@ HEADERS += \ StandardSamples/IsGISAXS06Builder.h \ StandardSamples/IsGISAXS09Builder.h \ Algorithms/inc/LayerStrategyBuilder.h \ - Algorithms/inc/DecoratedLayerDWBASimulation.h + Algorithms/inc/DecoratedLayerDWBASimulation.h \ + Samples/inc/Version.h contains(CONFIG, BORNAGAIN_PYTHON) { include($$PWD/python_module.pri) diff --git a/Core/FormFactors/inc/FormFactorBox.h b/Core/FormFactors/inc/FormFactorBox.h index 50a7badf0dd16351de671eca1d2a044d9b321b8c..493a4f7e83c7b39809c1256d44f6db81c43bd4a1 100644 --- a/Core/FormFactors/inc/FormFactorBox.h +++ b/Core/FormFactors/inc/FormFactorBox.h @@ -29,8 +29,7 @@ class FormFactorBox : public IFormFactorBorn ~FormFactorBox() {} - FormFactorBox *clone() const - { return new FormFactorBox(m_radius, m_width, m_height ); } + FormFactorBox *clone() const; virtual void accept(ISampleVisitor *visitor) const { visitor->visit(this); } diff --git a/Core/FormFactors/inc/FormFactorDecoratorDebyeWaller.h b/Core/FormFactors/inc/FormFactorDecoratorDebyeWaller.h index 53f7bdb1253740950082ba874d2d989898a51b49..951542fe428906fd53709868abee4e69f421527a 100644 --- a/Core/FormFactors/inc/FormFactorDecoratorDebyeWaller.h +++ b/Core/FormFactors/inc/FormFactorDecoratorDebyeWaller.h @@ -61,8 +61,11 @@ class FormFactorDecoratorDebyeWaller : public IFormFactorDecorator virtual FormFactorDecoratorDebyeWaller *clone() const { - return new FormFactorDecoratorDebyeWaller( + + FormFactorDecoratorDebyeWaller *result = new FormFactorDecoratorDebyeWaller( mp_form_factor->clone(), m_h_dw_factor, m_r_dw_factor); + result->setName(getName()); + return result; } virtual complex_t evaluate( diff --git a/Core/FormFactors/inc/FormFactorDecoratorFactor.h b/Core/FormFactors/inc/FormFactorDecoratorFactor.h index 5937fd5ae2741217273eebc41840a34ae332f495..64d70b1a81ab6292b4c650210511aa0c446e4d5b 100644 --- a/Core/FormFactors/inc/FormFactorDecoratorFactor.h +++ b/Core/FormFactors/inc/FormFactorDecoratorFactor.h @@ -45,7 +45,9 @@ inline FormFactorDecoratorFactor::FormFactorDecoratorFactor( inline FormFactorDecoratorFactor* FormFactorDecoratorFactor::clone() const { - return new FormFactorDecoratorFactor(mp_form_factor->clone(), m_factor); + FormFactorDecoratorFactor *result = new FormFactorDecoratorFactor(mp_form_factor->clone(), m_factor); + result->setName(getName()); + return result; } inline complex_t FormFactorDecoratorFactor::evaluate(const cvector_t& k_i, const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const diff --git a/Core/FormFactors/inc/FormFactorDecoratorRefractiveIndex.h b/Core/FormFactors/inc/FormFactorDecoratorRefractiveIndex.h index 983f255103c044d8e0a47c6573c42c1f9c9d522b..9aff5e804daf2218b345ec7c3d36edd7d45add72 100644 --- a/Core/FormFactors/inc/FormFactorDecoratorRefractiveIndex.h +++ b/Core/FormFactors/inc/FormFactorDecoratorRefractiveIndex.h @@ -28,6 +28,8 @@ class FormFactorDecoratorRefractiveIndex : public FormFactorDecoratorFactor FormFactorDecoratorRefractiveIndex *clone() const; + virtual complex_t getAmbientRefractiveIndex() const { return m_refractive_index; } + virtual void setAmbientRefractiveIndex(const complex_t& ambient_refractive_index); private: complex_t getRefractiveIndexFactor(const complex_t& ambient_index, const complex_t& particle_index) const; @@ -50,10 +52,11 @@ inline FormFactorDecoratorRefractiveIndex::~FormFactorDecoratorRefractiveIndex() inline FormFactorDecoratorRefractiveIndex* FormFactorDecoratorRefractiveIndex::clone() const { - FormFactorDecoratorRefractiveIndex *p_new = + FormFactorDecoratorRefractiveIndex *result = new FormFactorDecoratorRefractiveIndex(mp_form_factor->clone(), m_refractive_index); - p_new->m_factor = m_factor; - return p_new; + result->m_factor = m_factor; + result->setName(getName()); + return result; } inline void FormFactorDecoratorRefractiveIndex::setAmbientRefractiveIndex( diff --git a/Core/FormFactors/inc/FormFactorDecoratorTransformation.h b/Core/FormFactors/inc/FormFactorDecoratorTransformation.h index 5212fbc4fba07d2b08665114fb6d95c64d4e5c1d..cb5fa3dd66944c8070ec34129c7726ca6704b047 100644 --- a/Core/FormFactors/inc/FormFactorDecoratorTransformation.h +++ b/Core/FormFactors/inc/FormFactorDecoratorTransformation.h @@ -36,11 +36,7 @@ class FormFactorDecoratorTransformation : public IFormFactorDecorator virtual ~FormFactorDecoratorTransformation() {} - virtual FormFactorDecoratorTransformation *clone() const - { - return new FormFactorDecoratorTransformation( - mp_form_factor->clone(), mP_transform); - } + virtual FormFactorDecoratorTransformation *clone() const; virtual complex_t evaluate( const cvector_t& k_i, const Bin1DCVector& k_f_bin, diff --git a/Core/FormFactors/inc/FormFactorSphere.h b/Core/FormFactors/inc/FormFactorSphere.h index cbc2e41b4cf4df414a82f176dd6d2fd63495a01e..be914fd4437f5f065e439e48feaa8b3e4fffc7e2 100644 --- a/Core/FormFactors/inc/FormFactorSphere.h +++ b/Core/FormFactors/inc/FormFactorSphere.h @@ -29,8 +29,7 @@ class FormFactorSphere : public IFormFactorBorn ~FormFactorSphere() { delete m_integrator; } - virtual FormFactorSphere *clone() const - { return new FormFactorSphere(m_radius, m_height); } + virtual FormFactorSphere *clone() const; virtual void accept(ISampleVisitor *visitor) const { visitor->visit(this); } diff --git a/Core/FormFactors/inc/FormFactorSphereGaussianRadius.h b/Core/FormFactors/inc/FormFactorSphereGaussianRadius.h index 38f1fd482057b3f85befd107f6175b367e3a48d2..e12819cf91bc47abae1a97914843580afa239b21 100644 --- a/Core/FormFactors/inc/FormFactorSphereGaussianRadius.h +++ b/Core/FormFactors/inc/FormFactorSphereGaussianRadius.h @@ -66,9 +66,10 @@ inline FormFactorSphereGaussianRadius::FormFactorSphereGaussianRadius(double mea inline FormFactorSphereGaussianRadius* FormFactorSphereGaussianRadius::clone() const { - FormFactorSphereGaussianRadius *p_clone = + FormFactorSphereGaussianRadius *result = new FormFactorSphereGaussianRadius(m_mean, m_sigma); - return p_clone; + result->setName(getName()); + return result; } inline FormFactorSphereGaussianRadius::~FormFactorSphereGaussianRadius() diff --git a/Core/FormFactors/src/FormFactorBox.cpp b/Core/FormFactors/src/FormFactorBox.cpp index 4ef4867edb923d48b7375f78d56b3eb607fa4be9..96e0205f58a6cdd90aa09756a3d0581065067eb7 100644 --- a/Core/FormFactors/src/FormFactorBox.cpp +++ b/Core/FormFactors/src/FormFactorBox.cpp @@ -16,6 +16,15 @@ #include "FormFactorBox.h" #include "MathFunctions.h" + +FormFactorBox *FormFactorBox::clone() const +{ + FormFactorBox *result = new FormFactorBox(m_radius, m_width, m_height); + result->setName(getName()); + return result; +} + + complex_t FormFactorBox::evaluate_for_q(const cvector_t& q) const { complex_t qxR = m_radius*q.x(); diff --git a/Core/FormFactors/src/FormFactorCone.cpp b/Core/FormFactors/src/FormFactorCone.cpp index 3679e2be5870757fbbbb1c7d7b60d91938c7f5b6..5190b1d6a745a65747febc94ab7bad39bf03d117 100644 --- a/Core/FormFactors/src/FormFactorCone.cpp +++ b/Core/FormFactors/src/FormFactorCone.cpp @@ -41,8 +41,9 @@ void FormFactorCone::init_parameters() FormFactorCone* FormFactorCone::clone() const { - FormFactorCone* ffCone = new FormFactorCone(m_radius, m_height, m_alpha); - return ffCone; + FormFactorCone* result = new FormFactorCone(m_radius, m_height, m_alpha); + result->setName(getName()); + return result; } //! Real part of the integral. diff --git a/Core/FormFactors/src/FormFactorCrystal.cpp b/Core/FormFactors/src/FormFactorCrystal.cpp index cbba5d856b91b51a126ea3df4166db211bc6121f..d31453aa26b036051adad3de9aec7937ab8ab923 100644 --- a/Core/FormFactors/src/FormFactorCrystal.cpp +++ b/Core/FormFactors/src/FormFactorCrystal.cpp @@ -23,6 +23,7 @@ FormFactorCrystal::FormFactorCrystal( , m_ambient_refractive_index(ambient_refractive_index) , m_max_rec_length(0.0) { + setName("FormFactorCrystal"); mp_particle = p_crystal.createBasis(); mp_basis_form_factor = mp_particle->createFormFactor(); mp_meso_form_factor = meso_crystal_form_factor.clone(); @@ -40,9 +41,10 @@ FormFactorCrystal::~FormFactorCrystal() FormFactorCrystal* FormFactorCrystal::clone() const { Crystal np_crystal(*mp_particle, m_lattice); - FormFactorCrystal *p_new = new FormFactorCrystal(np_crystal, + FormFactorCrystal *result = new FormFactorCrystal(np_crystal, *mp_meso_form_factor, m_ambient_refractive_index); - return p_new; + result->setName(getName()); + return result; } void FormFactorCrystal::setAmbientRefractiveIndex( diff --git a/Core/FormFactors/src/FormFactorCylinder.cpp b/Core/FormFactors/src/FormFactorCylinder.cpp index cf5fd9c8c59fb4a7f29512ff842cce6814bc0e48..2382bc928456367cb8c5e8217fa2b2818972d289 100644 --- a/Core/FormFactors/src/FormFactorCylinder.cpp +++ b/Core/FormFactors/src/FormFactorCylinder.cpp @@ -38,7 +38,9 @@ void FormFactorCylinder::init_parameters() FormFactorCylinder* FormFactorCylinder::clone() const { - return new FormFactorCylinder(m_height, m_radius); + FormFactorCylinder *result = new FormFactorCylinder(m_height, m_radius); + result->setName(getName()); + return result; } complex_t FormFactorCylinder::evaluate_for_q(const cvector_t& q) const diff --git a/Core/FormFactors/src/FormFactorDWBA.cpp b/Core/FormFactors/src/FormFactorDWBA.cpp index 931cbd53cb5a994d201cf5164dc58aca3316e33b..65c7c18158b58ec3af9a0bebbe19e64e3002fa9c 100644 --- a/Core/FormFactors/src/FormFactorDWBA.cpp +++ b/Core/FormFactors/src/FormFactorDWBA.cpp @@ -51,9 +51,10 @@ void FormFactorDWBA::calculateTerms(const cvector_t& k_i, const Bin1DCVector& k_ FormFactorDWBA* FormFactorDWBA::clone() const { - FormFactorDWBA *p_new = new FormFactorDWBA(mp_form_factor->clone()); - p_new->setReflectionTransmissionFunction(*mp_RT); - return p_new; + FormFactorDWBA *result = new FormFactorDWBA(mp_form_factor->clone()); + result->setReflectionTransmissionFunction(*mp_RT); + result->setName(getName()); + return result; } diff --git a/Core/FormFactors/src/FormFactorDecoratorTransformation.cpp b/Core/FormFactors/src/FormFactorDecoratorTransformation.cpp index a1a98e896dc1852ade79417d4c49a3d3d09b0409..7911104d5c773f6c4f3c635a63f6a630496bb9fc 100644 --- a/Core/FormFactors/src/FormFactorDecoratorTransformation.cpp +++ b/Core/FormFactors/src/FormFactorDecoratorTransformation.cpp @@ -15,6 +15,16 @@ #include "FormFactorDecoratorTransformation.h" -// Everything done inline: Efficiency reasons? Proven useful? + + +FormFactorDecoratorTransformation *FormFactorDecoratorTransformation::clone() const +{ + FormFactorDecoratorTransformation *result = new FormFactorDecoratorTransformation( + mp_form_factor->clone(), mP_transform); + + result->setName(getName()); + return result; +} + diff --git a/Core/FormFactors/src/FormFactorFullSphere.cpp b/Core/FormFactors/src/FormFactorFullSphere.cpp index c9a1a028424f503f78353844d612bed37cffea48..91b7836b9f91d2c69c27307e2a9cd7bc54adbcab 100644 --- a/Core/FormFactors/src/FormFactorFullSphere.cpp +++ b/Core/FormFactors/src/FormFactorFullSphere.cpp @@ -36,8 +36,9 @@ void FormFactorFullSphere::init_parameters() FormFactorFullSphere* FormFactorFullSphere::clone() const { - FormFactorFullSphere *p_clone = new FormFactorFullSphere(m_radius); - return p_clone; + FormFactorFullSphere *result = new FormFactorFullSphere(m_radius); + result->setName(getName()); + return result; } complex_t FormFactorFullSphere::evaluate_for_q(const cvector_t& q) const diff --git a/Core/FormFactors/src/FormFactorFullSpheroid.cpp b/Core/FormFactors/src/FormFactorFullSpheroid.cpp index f041ec6fe1c96cafcacae062221e156c563d9eca..584b9e2f30891e72b81ad5480b4b19bfd5049728 100644 --- a/Core/FormFactors/src/FormFactorFullSpheroid.cpp +++ b/Core/FormFactors/src/FormFactorFullSpheroid.cpp @@ -36,9 +36,10 @@ void FormFactorFullSpheroid::init_parameters() FormFactorFullSpheroid* FormFactorFullSpheroid::clone() const { - FormFactorFullSpheroid* ffFullSpheroid = + FormFactorFullSpheroid* result = new FormFactorFullSpheroid(m_radius, m_height); - return ffFullSpheroid; + result->setName(getName()); + return result; } complex_t FormFactorFullSpheroid::evaluate_for_q(const cvector_t& q) const diff --git a/Core/FormFactors/src/FormFactorGauss.cpp b/Core/FormFactors/src/FormFactorGauss.cpp index 9c7dffec6272ba4c362c60ef8cdf12ef0e469f83..ced5ab3c938d09ce334665ec3c9719ee1f2b4a21 100644 --- a/Core/FormFactors/src/FormFactorGauss.cpp +++ b/Core/FormFactors/src/FormFactorGauss.cpp @@ -47,8 +47,9 @@ void FormFactorGauss::init_parameters() FormFactorGauss* FormFactorGauss::clone() const { - FormFactorGauss *p_clone = new FormFactorGauss(m_height, m_width); - return p_clone; + FormFactorGauss *result = new FormFactorGauss(m_height, m_width); + result->setName(getName()); + return result; } complex_t FormFactorGauss::evaluate_for_q(const cvector_t& q) const diff --git a/Core/FormFactors/src/FormFactorHemiSpheroid.cpp b/Core/FormFactors/src/FormFactorHemiSpheroid.cpp index 06bf63be682c62bc95840b26c13ef4ed6ff0251f..314a085d61ccb920d59deb3f3095b600c1649eac 100644 --- a/Core/FormFactors/src/FormFactorHemiSpheroid.cpp +++ b/Core/FormFactors/src/FormFactorHemiSpheroid.cpp @@ -44,9 +44,10 @@ void FormFactorHemiSpheroid::init_parameters() FormFactorHemiSpheroid* FormFactorHemiSpheroid::clone() const { - FormFactorHemiSpheroid* ffSpheroid = + FormFactorHemiSpheroid* result = new FormFactorHemiSpheroid(m_radius, m_width, m_height); - return ffSpheroid; + result->setName(getName()); + return result; } //! Real part of the integral. diff --git a/Core/FormFactors/src/FormFactorLorentz.cpp b/Core/FormFactors/src/FormFactorLorentz.cpp index 8b81697bd16a0c936a789c79541f61b640695a52..9087c5578661f101b5d92526caab04fb67016d06 100644 --- a/Core/FormFactors/src/FormFactorLorentz.cpp +++ b/Core/FormFactors/src/FormFactorLorentz.cpp @@ -45,8 +45,9 @@ void FormFactorLorentz::init_parameters() FormFactorLorentz* FormFactorLorentz::clone() const { - FormFactorLorentz *p_clone = new FormFactorLorentz(m_height, m_width); - return p_clone; + FormFactorLorentz *result = new FormFactorLorentz(m_height, m_width); + result->setName(getName()); + return result; } complex_t FormFactorLorentz::evaluate_for_q(const cvector_t& q) const diff --git a/Core/FormFactors/src/FormFactorParallelepiped.cpp b/Core/FormFactors/src/FormFactorParallelepiped.cpp index 4d7d4d161014b57b34d780c42caf5536bd5df3fa..88aad45364bba103075a7867029742674d0e9168 100644 --- a/Core/FormFactors/src/FormFactorParallelepiped.cpp +++ b/Core/FormFactors/src/FormFactorParallelepiped.cpp @@ -20,13 +20,16 @@ FormFactorParallelepiped::FormFactorParallelepiped(double height, double radius) : m_height(height) , m_radius(radius) { + setName("FormFactorParallelepiped"); + init_parameters(); } FormFactorParallelepiped* FormFactorParallelepiped::clone() const { - FormFactorParallelepiped *p_clone = + FormFactorParallelepiped *result = new FormFactorParallelepiped(m_height, m_radius); - return p_clone; + result->setName(getName()); + return result; } complex_t FormFactorParallelepiped::evaluate_for_q(const cvector_t& q) const diff --git a/Core/FormFactors/src/FormFactorPrism3.cpp b/Core/FormFactors/src/FormFactorPrism3.cpp index 10a68c9b8fe23e68a95f1e16144a7263e00f707a..f3ad7bd6570eea57d002bd8427ccfac7038766a8 100644 --- a/Core/FormFactors/src/FormFactorPrism3.cpp +++ b/Core/FormFactors/src/FormFactorPrism3.cpp @@ -36,8 +36,9 @@ void FormFactorPrism3::init_parameters() FormFactorPrism3* FormFactorPrism3::clone() const { - FormFactorPrism3 *p_clone = new FormFactorPrism3(m_height, m_half_side ); - return p_clone; + FormFactorPrism3 *result = new FormFactorPrism3(m_height, m_half_side ); + result->setName(getName()); + return result; } complex_t FormFactorPrism3::evaluate_for_q(const cvector_t& q) const diff --git a/Core/FormFactors/src/FormFactorPrism6.cpp b/Core/FormFactors/src/FormFactorPrism6.cpp index 349ec977d7d8994ef8c739fd63ddf7e1a9439a8e..b9caa360bfac583729b30b8d94cf627805d2b99b 100644 --- a/Core/FormFactors/src/FormFactorPrism6.cpp +++ b/Core/FormFactors/src/FormFactorPrism6.cpp @@ -36,7 +36,9 @@ void FormFactorPrism6::init_parameters() FormFactorPrism6* FormFactorPrism6::clone() const { - return new FormFactorPrism6(m_height, m_half_side); + FormFactorPrism6 *result = new FormFactorPrism6(m_height, m_half_side); + result->setName(getName()); + return result; } complex_t FormFactorPrism6::evaluate_for_q(const cvector_t& q) const diff --git a/Core/FormFactors/src/FormFactorPyramid.cpp b/Core/FormFactors/src/FormFactorPyramid.cpp index 67551f070b49d14cb0222c20ef17fbc1ac0dd93f..3a41b40d3830046f2fe75aec6ccb16b158928ff9 100644 --- a/Core/FormFactors/src/FormFactorPyramid.cpp +++ b/Core/FormFactors/src/FormFactorPyramid.cpp @@ -37,9 +37,10 @@ void FormFactorPyramid::init_parameters() FormFactorPyramid* FormFactorPyramid::clone() const { - FormFactorPyramid *p_clone = + FormFactorPyramid *result = new FormFactorPyramid(m_height, m_half_side, m_alpha); - return p_clone; + result->setName(getName()); + return result; } complex_t FormFactorPyramid::evaluate_for_q(const cvector_t& q) const diff --git a/Core/FormFactors/src/FormFactorSphere.cpp b/Core/FormFactors/src/FormFactorSphere.cpp index 1c42f88d3633b75c8d17f849d48091e02ee6d6f3..01e2481aae3cec2be42cf677355b2b37b633ac8b 100644 --- a/Core/FormFactors/src/FormFactorSphere.cpp +++ b/Core/FormFactors/src/FormFactorSphere.cpp @@ -42,6 +42,14 @@ void FormFactorSphere::init_parameters() registerParameter("height", &m_height); } +FormFactorSphere *FormFactorSphere::clone() const +{ + FormFactorSphere *result = new FormFactorSphere(m_radius, m_height); + result->setName(getName()); + return result; +} + + //! Integrand for complex formfactor. complex_t FormFactorSphere::Integrand(double Z, void* params) const diff --git a/Core/FormFactors/src/FormFactorTethraedron.cpp b/Core/FormFactors/src/FormFactorTethraedron.cpp index 975ad7230c657bbaa0ad0929047796fef513fe4b..15d0274743b3b0e9133c9ab3456f20919749a345 100644 --- a/Core/FormFactors/src/FormFactorTethraedron.cpp +++ b/Core/FormFactors/src/FormFactorTethraedron.cpp @@ -38,9 +38,10 @@ void FormFactorTethraedron::init_parameters() FormFactorTethraedron* FormFactorTethraedron::clone() const { - FormFactorTethraedron *p_clone = + FormFactorTethraedron *result = new FormFactorTethraedron(m_height, m_half_side, m_alpha); - return p_clone; + result->setName(getName()); + return result; } complex_t FormFactorTethraedron::evaluate_for_q(const cvector_t& q) const diff --git a/Core/FormFactors/src/FormFactorWeighted.cpp b/Core/FormFactors/src/FormFactorWeighted.cpp index 76ba87fb7204cd0c7c23fb1573328717a79758c6..367665a22cc7afc16fc08c5005f434d292738ac3 100644 --- a/Core/FormFactors/src/FormFactorWeighted.cpp +++ b/Core/FormFactors/src/FormFactorWeighted.cpp @@ -29,11 +29,12 @@ FormFactorWeighted::~FormFactorWeighted() FormFactorWeighted* FormFactorWeighted::clone() const { - FormFactorWeighted *p_new = new FormFactorWeighted(); + FormFactorWeighted *result = new FormFactorWeighted(); for (size_t index=0; index<m_form_factors.size(); ++index) { - p_new->addFormFactor(*m_form_factors[index], m_weights[index]); + result->addFormFactor(*m_form_factors[index], m_weights[index]); } - return p_new; + result->setName(getName()); + return result; } void FormFactorWeighted::addFormFactor(const IFormFactor& form_factor, diff --git a/Core/PythonAPI/inc/PythonCoreList.h b/Core/PythonAPI/inc/PythonCoreList.h index 73aa060f44de066e7fdfb374b230024ece11900d..d4954d3339ccd409eed775f245610907a86c4fe4 100644 --- a/Core/PythonAPI/inc/PythonCoreList.h +++ b/Core/PythonAPI/inc/PythonCoreList.h @@ -79,6 +79,7 @@ #include "StochasticSampledParameter.h" #include "Types.h" #include "Units.h" +#include "Version.h" //! file containig additional exposers #include "PythonCoreExposer.h" diff --git a/Core/PythonAPI/src/PythonInterface_free_functions.pypp.cpp b/Core/PythonAPI/src/PythonInterface_free_functions.pypp.cpp index 3bad3113fb18596a94eced00a426f9db4a214f17..c4dc38feb3b97ce6f47c2756403cd01dfb6138b6 100644 --- a/Core/PythonAPI/src/PythonInterface_free_functions.pypp.cpp +++ b/Core/PythonAPI/src/PythonInterface_free_functions.pypp.cpp @@ -27,6 +27,26 @@ void register_free_functions(){ } + { //::AppVersion::GetMajorVersionNumber + + typedef int ( *GetMajorVersionNumber_function_type )( ); + + bp::def( + "GetMajorVersionNumber" + , GetMajorVersionNumber_function_type( &::AppVersion::GetMajorVersionNumber ) ); + + } + + { //::AppVersion::GetMinorVersionNumber + + typedef int ( *GetMinorVersionNumber_function_type )( ); + + bp::def( + "GetMinorVersionNumber" + , GetMinorVersionNumber_function_type( &::AppVersion::GetMinorVersionNumber ) ); + + } + { //::GetOutputData typedef ::PyObject * ( *GetOutputData_function_type )( ::Simulation const & ); @@ -60,6 +80,26 @@ void register_free_functions(){ } + { //::AppVersion::GetPatchVersionNumber + + typedef int ( *GetPatchVersionNumber_function_type )( ); + + bp::def( + "GetPatchVersionNumber" + , GetPatchVersionNumber_function_type( &::AppVersion::GetPatchVersionNumber ) ); + + } + + { //::AppVersion::GetVersionNumber + + typedef ::std::string ( *GetVersionNumber_function_type )( ); + + bp::def( + "GetVersionNumber" + , GetVersionNumber_function_type( &::AppVersion::GetVersionNumber ) ); + + } + { //::Units::deg2rad typedef double ( *deg2rad_function_type )( double ); diff --git a/Core/Samples/inc/InterferenceFunction2DParaCrystal.h b/Core/Samples/inc/InterferenceFunction2DParaCrystal.h index 75698366474f84e60680a62c4f496a762788c6eb..ffb5a5bc0523ea9c35104004858b095d05b6c688 100644 --- a/Core/Samples/inc/InterferenceFunction2DParaCrystal.h +++ b/Core/Samples/inc/InterferenceFunction2DParaCrystal.h @@ -18,21 +18,16 @@ #include "IInterferenceFunction.h" #include "FTDistributions.h" +#include <iostream> -//! ? class InterferenceFunction2DParaCrystal : public IInterferenceFunction { public: InterferenceFunction2DParaCrystal(double length_1, double length_2, double alpha_lattice, double xi=0.0, double corr_length=0.0); virtual ~InterferenceFunction2DParaCrystal(); - virtual InterferenceFunction2DParaCrystal *clone() const { - InterferenceFunction2DParaCrystal *p_new = new InterferenceFunction2DParaCrystal(m_lattice_lengths[0], m_lattice_lengths[1], m_alpha_lattice, m_xi, m_corr_length); - p_new->setDomainSizes(m_domain_sizes[0], m_domain_sizes[1]); - p_new->setProbabilityDistributions(*m_pdfs[0], *m_pdfs[1]); - p_new->setIntegrationOverXi(m_integrate_xi); - return p_new; - } + + virtual InterferenceFunction2DParaCrystal *clone() const; virtual void accept(ISampleVisitor *visitor) const { visitor->visit(this); } diff --git a/Core/Samples/inc/Particle.h b/Core/Samples/inc/Particle.h index 3fd71c6473ed9a65e21f871ac4825d6dbe377593..eaea4c7ec0e8fc274a1b537189d4fa05dd62e25a 100644 --- a/Core/Samples/inc/Particle.h +++ b/Core/Samples/inc/Particle.h @@ -44,13 +44,7 @@ class BA_CORE_API_ Particle : public ICompositeSample m_ambient_refractive_index = refractive_index; } - virtual IFormFactor* createFormFactor() const - { - FormFactorDecoratorRefractiveIndex *p_ff = new FormFactorDecoratorRefractiveIndex( - mp_form_factor->clone(), getRefractiveIndex()); - p_ff->setAmbientRefractiveIndex(m_ambient_refractive_index); - return p_ff; - } + virtual IFormFactor* createFormFactor() const; //! Sets the form factor of the particle (not including scattering factor from refractive index) virtual void setSimpleFormFactor(IFormFactor* p_form_factor) @@ -84,7 +78,7 @@ class BA_CORE_API_ Particle : public ICompositeSample return 0; } - virtual bool hasDistributedFormFactor() const { return mp_form_factor->isDistributedFormFactor(); } + virtual bool hasDistributedFormFactor() const; virtual std::vector<ParticleInfo *> createDistributedParticles(size_t samples_per_particle, double factor) const; @@ -95,12 +89,27 @@ class BA_CORE_API_ Particle : public ICompositeSample //!< pointer to the form factor }; +inline IFormFactor* Particle::createFormFactor() const +{ + if(!mp_form_factor) return 0; + FormFactorDecoratorRefractiveIndex *p_ff = new FormFactorDecoratorRefractiveIndex( + mp_form_factor->clone(), getRefractiveIndex()); + p_ff->setAmbientRefractiveIndex(m_ambient_refractive_index); + return p_ff; +} + + inline complex_t Particle::getRefractiveIndex() const { const HomogeneousMaterial *material = dynamic_cast<const HomogeneousMaterial *>(m_material); return (material ? material->getRefractiveIndex() : complex_t(0,0)); } +inline bool Particle::hasDistributedFormFactor() const +{ + return ( !mp_form_factor ? false : mp_form_factor->isDistributedFormFactor() ); +} + #endif // PARTICLE_H diff --git a/Core/Samples/inc/Version.h b/Core/Samples/inc/Version.h new file mode 100644 index 0000000000000000000000000000000000000000..15f775cdab2e1c333ec32b13659a7b6c6a8dbd9d --- /dev/null +++ b/Core/Samples/inc/Version.h @@ -0,0 +1,49 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file App/inc/Version.h +//! @brief Defines namespace AppVersion. +// +//! Homepage: apps.jcns.fz-juelich.de/BornAgain +//! License: GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2013 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke +// +// ************************************************************************** // + +#ifndef VERSION_H_ +#define VERSION_H_ + +#include <string> +#include <sstream> + +namespace AppVersion { + const std::string g_app_name = "BornAgain"; + const int major_version_number = 0; + const int minor_version_number = 8; + const int patch_version_number = 2; + + inline int GetMajorVersionNumber() { return major_version_number; } + inline int GetMinorVersionNumber() { return minor_version_number; } + inline int GetPatchVersionNumber() { return patch_version_number; } + + inline std::string GetVersionNumber() + { + std::ostringstream ostr; + ostr << major_version_number + << "." + << minor_version_number + << "." + << patch_version_number ; + + return ostr.str(); + } + +} + + + +#endif /* VERSION_H_ */ + diff --git a/Core/Samples/src/InterferenceFunction2DParaCrystal.cpp b/Core/Samples/src/InterferenceFunction2DParaCrystal.cpp index 9f6f12e10cce22ca208d6b6ac17b61f1c51cebdd..0e0112183df20f5f73f9159daa58ca70e1e01e7d 100644 --- a/Core/Samples/src/InterferenceFunction2DParaCrystal.cpp +++ b/Core/Samples/src/InterferenceFunction2DParaCrystal.cpp @@ -42,17 +42,23 @@ InterferenceFunction2DParaCrystal::InterferenceFunction2DParaCrystal(double leng InterferenceFunction2DParaCrystal::~InterferenceFunction2DParaCrystal() { - for (size_t i=0; i<2; ++i) { - if (m_pdfs[i]) delete m_pdfs[i]; - } + for (size_t i=0; i<2; ++i) delete m_pdfs[i]; +} + +InterferenceFunction2DParaCrystal *InterferenceFunction2DParaCrystal::clone() const { + InterferenceFunction2DParaCrystal *p_new = new InterferenceFunction2DParaCrystal(m_lattice_lengths[0], m_lattice_lengths[1], m_alpha_lattice, m_xi, m_corr_length); + p_new->setDomainSizes(m_domain_sizes[0], m_domain_sizes[1]); + if(m_pdfs[0] && m_pdfs[1]) + p_new->setProbabilityDistributions(*m_pdfs[0], *m_pdfs[1]); + p_new->setIntegrationOverXi(m_integrate_xi); + return p_new; } + void InterferenceFunction2DParaCrystal::setProbabilityDistributions( const IFTDistribution2D& pdf_1, const IFTDistribution2D& pdf_2) { - for (size_t i=0; i<2; ++i) { - if (m_pdfs[i]) delete m_pdfs[i]; - } + for (size_t i=0; i<2; ++i) delete m_pdfs[i]; m_pdfs[0] = pdf_1.clone(); m_pdfs[1] = pdf_2.clone(); } @@ -136,10 +142,10 @@ double InterferenceFunction2DParaCrystal::interferenceForXi(double xi, void *par double InterferenceFunction2DParaCrystal::interference1D(double qx, double qy, double xi, size_t index) const { if (index > 1) { - throw OutOfBoundsException("Index of interference function probability must be < 2"); + throw OutOfBoundsException("InterferenceFunction2DParaCrystal::interference1D() -> Error! Index of interference function probability must be < 2"); } if (!m_pdfs[0] || !m_pdfs[1]) { - throw NullPointerException("Probability distributions for interference funtion not properly initialized"); + throw NullPointerException("InterferenceFunction2DParaCrystal::interference1D() -> Error! Probability distributions for interference funtion not properly initialized"); } double result; int n = (int)std::abs(m_domain_sizes[index]/m_lattice_lengths[index]); diff --git a/Core/Samples/src/MaterialManager.cpp b/Core/Samples/src/MaterialManager.cpp index 6ab618451483b57c4587d1f4b5b4c8ac1876e6f8..cea706ce4da9656c340207a44b5382f667c821ae 100644 --- a/Core/Samples/src/MaterialManager.cpp +++ b/Core/Samples/src/MaterialManager.cpp @@ -68,7 +68,7 @@ const IMaterial *MaterialManager::this_getHomogeneousMaterial( HomogeneousMaterial *non_const_mat = const_cast<HomogeneousMaterial *>(old); non_const_mat->setRefractiveIndex(refractive_index); - msglog(MSG::WARNING) << "MaterialManager::addHomogeneousMaterial()" << + msglog(MSG::ERROR) << "MaterialManager::addHomogeneousMaterial()" << "-> Redefining refractive index for material '" << name << "'"; } return mat; diff --git a/Core/Samples/src/Particle.cpp b/Core/Samples/src/Particle.cpp index 60bac2343473a5ad7069df62376003886a39e813..5fb19c232ed8877eb8427206b36cfa3b980ff36f 100644 --- a/Core/Samples/src/Particle.cpp +++ b/Core/Samples/src/Particle.cpp @@ -52,15 +52,21 @@ Particle::~Particle() Particle* Particle::clone() const { - IFormFactor *p_form_factor = mp_form_factor->clone(); + IFormFactor *p_form_factor(0); + if(mp_form_factor) p_form_factor = mp_form_factor->clone(); + Particle *p_new = new Particle(m_material, p_form_factor); p_new->setAmbientRefractiveIndex(m_ambient_refractive_index); + + p_new->setName(getName()); return p_new; } std::vector<ParticleInfo*> Particle::createDistributedParticles( size_t samples_per_particle, double factor) const { + if(!mp_form_factor) throw NullPointerException("Particle::createDistributedParticles() -> No formfactor is defined."); + std::vector<ParticleInfo*> result; if (mp_form_factor->isDistributedFormFactor()) { std::vector<IFormFactor *> form_factors; diff --git a/Doc/CHANGELOG b/Doc/CHANGELOG index 466213216ae994ade6380ee7f316a0ed9432e280..cf1e868692f54f404eff7f7619c15a53f28ed2ba 100644 --- a/Doc/CHANGELOG +++ b/Doc/CHANGELOG @@ -1 +1,18 @@ -BornAgain-<version>, first source archive release, <date> + + +BornAgain-0.8.2 2013.07.30 + * Particle interface changed to accept HomogeneousMaterial + +BornAgain-0.8.1 2013.07.26 + * CMake based build system + * PythonAPI automatic code generation redesign + * User Manual v0.1 + * libBornAgainFit + * FunctionalTest collection + + +BornAgain-0.7.0 2013.04.10 + * First public release + + + diff --git a/Doc/UserManual/Installation.tex b/Doc/UserManual/Installation.tex index 764b144eb72a813bc9b28dbeb1d92f2ac442d41d..810be61e1ab2c2d7dbc785c6010136b5f5281397 100644 --- a/Doc/UserManual/Installation.tex +++ b/Doc/UserManual/Installation.tex @@ -23,7 +23,7 @@ To successfully build \BornAgain\ a number of prerequisite packages must be inst \item boost library ($\geq 1.48$) \item GNU scientific library ($\geq 1.15$) \item fftw3 library ($\geq 3.3$) -\item python ($\geq 2.7$), python-devel, python-numpy-devel +\item python ($\geq 2.7$, $< 3.0$), python-devel, python-numpy-devel \end{itemize} \vspace*{2mm} @@ -67,7 +67,7 @@ sudo zypper install libroot-* root-plugin-* root-system-* root-ttf libeigen3-dev % Ubuntu 13.04 % --------------- \noindent -{\large\bf Ubuntu 13.04} \newline +{\large\bf Ubuntu 12.10, 13.04} \newline Installing required packages \begin{lstlisting}[language=shell, style=commandline] sudo apt-get install git cmake libgsl0-dev libboost-all-dev libfftw3-dev python-dev python-numpy diff --git a/Doc/UserManual/UserManual.pdf b/Doc/UserManual/UserManual.pdf index 8a5dffcab9a99b0aaa2e5f305762c7db93116d65..9e9e6f557430ba3a47f8c544086592fd08e6398f 100644 Binary files a/Doc/UserManual/UserManual.pdf and b/Doc/UserManual/UserManual.pdf differ diff --git a/Doc/UserManual/UserManual.tex b/Doc/UserManual/UserManual.tex index e43e8c0b98c1cd5cd2aea5123f84859e89215bd8..f67083dec9e2f94fa90b98f07e6347093a6bbc85 100644 --- a/Doc/UserManual/UserManual.tex +++ b/Doc/UserManual/UserManual.tex @@ -164,14 +164,14 @@ License: Creative Common CC-BY-SA \\ \maketitle \tableofcontents -\lstlistoflistings +%\lstlistoflistings %\listoffigures -\listoftables +%\listoftables -%\input{Introduction} -%\input{QuickStart} -%\input{SoftwareArchitecture} -%\input{Installation} +\input{Introduction} +\input{QuickStart} +\input{SoftwareArchitecture} +\input{Installation} \input{Examples} %\input{Fitting} diff --git a/Examples/python/ex001_CylindersAndPrisms/CylindersAndPrisms.py b/Examples/python/ex001_CylindersAndPrisms/CylindersAndPrisms.py index 3dc904bc4fd5bf616bdde9b14e8d79cafefb3d01..024eb901bca21ff8512fd1f60f77834819b0110a 100644 --- a/Examples/python/ex001_CylindersAndPrisms/CylindersAndPrisms.py +++ b/Examples/python/ex001_CylindersAndPrisms/CylindersAndPrisms.py @@ -18,17 +18,19 @@ def RunSimulation(): # defining materials mAmbience = MaterialManager.getHomogeneousMaterial("Air", 0.0, 0.0 ) mSubstrate = MaterialManager.getHomogeneousMaterial("Substrate", 6e-6, 2e-8 ) + mParticle = MaterialManager.getHomogeneousMaterial("Particle", 6e-4, 2e-8 ) + # collection of particles - n_particle = complex(1.0-6e-4, 2e-8) cylinder_ff = FormFactorCylinder(5*nanometer, 5*nanometer) - cylinder = Particle(n_particle, cylinder_ff) + cylinder = Particle(mParticle, cylinder_ff) prism_ff = FormFactorPrism3(5*nanometer, 5*nanometer) - prism = Particle(n_particle, prism_ff) + prism = Particle(mParticle, prism_ff) particle_decoration = ParticleDecoration() particle_decoration.addParticle(cylinder, 0.0, 0.5) particle_decoration.addParticle(prism, 0.0, 0.5) interference = InterferenceFunctionNone() particle_decoration.addInterferenceFunction(interference) + # air layer with particles and substrate form multi layer air_layer = Layer(mAmbience) air_layer.setDecoration(particle_decoration) diff --git a/Examples/python/ex002_CylindersWithSizeDistribution/CylindersWithSizeDistribution.py b/Examples/python/ex002_CylindersWithSizeDistribution/CylindersWithSizeDistribution.py index 8f4000f5da0004c20ba60c0744c063327c62d171..5b6c2c582c6977694a3ffbc3e43f9e75bf0a5592 100644 --- a/Examples/python/ex002_CylindersWithSizeDistribution/CylindersWithSizeDistribution.py +++ b/Examples/python/ex002_CylindersWithSizeDistribution/CylindersWithSizeDistribution.py @@ -16,16 +16,17 @@ from utils.show2d import PlotNumpyArray def RunSimulation(): # defining materials mAmbience = MaterialManager.getHomogeneousMaterial("Air", 0.0, 0.0 ) + mParticle = MaterialManager.getHomogeneousMaterial("Particle", 6e-4, 2e-8 ) + # collection of particles - n_particle = complex(1.0-6e-4, 2e-8) radius1 = 5.0*nanometer radius2 = 10.0*nanometer height1 = radius1 height2 = radius2 cylinder_ff1 = FormFactorCylinder(height1, radius1) - cylinder1 = Particle(n_particle, cylinder_ff1) + cylinder1 = Particle(mParticle, cylinder_ff1) cylinder_ff2 = FormFactorCylinder(height2, radius2) - cylinder2 = Particle(n_particle, cylinder_ff2) + cylinder2 = Particle(mParticle, cylinder_ff2) nbins = 150 sigma1 = radius1*0.2 sigma2 = radius2*0.02 diff --git a/Examples/python/ex003_CylinderFormfactor/CylinderFormfactorInBA.py b/Examples/python/ex003_CylinderFormfactor/CylinderFormfactorInBA.py index 5f323babfb4add4aa4f5370e072d54bd2e126a5c..aa6acf2dbde9d881f6dfe49cce124cd479fc4e80 100644 --- a/Examples/python/ex003_CylinderFormfactor/CylinderFormfactorInBA.py +++ b/Examples/python/ex003_CylinderFormfactor/CylinderFormfactorInBA.py @@ -19,10 +19,11 @@ def RunSimulation(): # defining materials mAmbience = MaterialManager.getHomogeneousMaterial("Air", 0.0, 0.0 ) mSubstrate = MaterialManager.getHomogeneousMaterial("Substrate", 6e-6, 2e-8 ) + mParticle = MaterialManager.getHomogeneousMaterial("Particle", 6e-4, 2e-8 ) + # collection of particles - n_particle = complex(1.0-6e-4, 2e-8) cylinder_ff = FormFactorCylinder(5*nanometer, 5*nanometer) - cylinder = Particle(n_particle, cylinder_ff) + cylinder = Particle(mParticle, cylinder_ff) particle_decoration = ParticleDecoration() particle_decoration.addParticle(cylinder, 0.0, 1.0) interference = InterferenceFunctionNone() diff --git a/Examples/python/ex003_CylinderFormfactor/CylinderFormfactorInBASize.py b/Examples/python/ex003_CylinderFormfactor/CylinderFormfactorInBASize.py index 8f09efd5d78bc47a663e5ec741f8d31f6a00461f..427ffa637330e8b8af11b493d0182a276495974a 100644 --- a/Examples/python/ex003_CylinderFormfactor/CylinderFormfactorInBASize.py +++ b/Examples/python/ex003_CylinderFormfactor/CylinderFormfactorInBASize.py @@ -19,16 +19,16 @@ def RunSimulation(): # defining materials mAmbience = MaterialManager.getHomogeneousMaterial("Air", 0.0, 0.0 ) mSubstrate = MaterialManager.getHomogeneousMaterial("Substrate", 6e-6, 2e-8 ) + mParticle = MaterialManager.getHomogeneousMaterial("Particle", 6e-4, 2e-8 ) multi_layer = MultiLayer() - n_particle = complex(1.0-6e-4, 2e-8) cylinder_ff = FormFactorCylinder(5*nanometer, 5*nanometer) particle_decoration = ParticleDecoration() # preparing prototype of nano particle radius = 5*nanometer sigma = 0.2*radius - nano_particle = Particle(n_particle, cylinder_ff) + nano_particle = Particle(mParticle, cylinder_ff) # radius of nanoparticles will be sampled with gaussian probability nbins = 100 nfwhm = 2 diff --git a/Examples/python/ex003_CylinderFormfactor/CylinderFormfactorInDWBA.py b/Examples/python/ex003_CylinderFormfactor/CylinderFormfactorInDWBA.py index b9820a6b1171967a814ea7c765e3ed8a82f6e8ef..03408d5dda7d274c77e1fb02574d3c283ac1fb9d 100644 --- a/Examples/python/ex003_CylinderFormfactor/CylinderFormfactorInDWBA.py +++ b/Examples/python/ex003_CylinderFormfactor/CylinderFormfactorInDWBA.py @@ -20,10 +20,12 @@ def RunSimulation(): # defining materials mAmbience = MaterialManager.getHomogeneousMaterial("Air", 0.0, 0.0 ) mSubstrate = MaterialManager.getHomogeneousMaterial("Substrate", 6e-6, 2e-8 ) + mParticle = MaterialManager.getHomogeneousMaterial("Particle", 6e-4, 2e-8 ) + # collection of particles n_particle = complex(1.0-6e-4, 2e-8) cylinder_ff = FormFactorCylinder(5*nanometer, 5*nanometer) - cylinder = Particle(n_particle, cylinder_ff) + cylinder = Particle(mParticle, cylinder_ff) particle_decoration = ParticleDecoration() particle_decoration.addParticle(cylinder, 0.0, 1.0) interference = InterferenceFunctionNone() diff --git a/Examples/python/ex004_CylindersParaCrystal/CylindersParaCrystal_1DDL.py b/Examples/python/ex004_CylindersParaCrystal/CylindersParaCrystal_1DDL.py index fb13f47931ad32ef9f1996edf80acdb8d280bfce..7697469d72a0168129f0f6658997fbb5dfff49ad 100644 --- a/Examples/python/ex004_CylindersParaCrystal/CylindersParaCrystal_1DDL.py +++ b/Examples/python/ex004_CylindersParaCrystal/CylindersParaCrystal_1DDL.py @@ -18,10 +18,11 @@ def RunSimulation(): # defining materials mAmbience = MaterialManager.getHomogeneousMaterial("Air", 0.0, 0.0 ) mSubstrate = MaterialManager.getHomogeneousMaterial("Substrate", 6e-6, 2e-8 ) + mParticle = MaterialManager.getHomogeneousMaterial("Particle", 6e-4, 2e-8 ) + # collection of particles - n_particle = complex(1.0-6e-4, 2e-8) cylinder_ff = FormFactorCylinder(5*nanometer, 5*nanometer) - cylinder = Particle(n_particle, cylinder_ff) + cylinder = Particle(mParticle, cylinder_ff) interference = InterferenceFunction1DParaCrystal(20.0*nanometer,7*nanometer, 1e3*nanometer) particle_decoration = ParticleDecoration() particle_decoration.addParticle(cylinder, 0.0, 1.0) diff --git a/Examples/python/ex004_CylindersParaCrystal/CylindersParaCrystal_2DDL.py b/Examples/python/ex004_CylindersParaCrystal/CylindersParaCrystal_2DDL.py index 2cab1a776f25577e063a62fa1d9fb8a784a937b3..37b687ab5d69d69715b940a4545a85e854891fa0 100644 --- a/Examples/python/ex004_CylindersParaCrystal/CylindersParaCrystal_2DDL.py +++ b/Examples/python/ex004_CylindersParaCrystal/CylindersParaCrystal_2DDL.py @@ -18,11 +18,12 @@ def RunSimulation(): # defining materials mAmbience = MaterialManager.getHomogeneousMaterial("Air", 0.0, 0.0 ) mSubstrate = MaterialManager.getHomogeneousMaterial("Substrate", 6e-6, 2e-8 ) + mParticle = MaterialManager.getHomogeneousMaterial("Particle", 6e-4, 2e-8 ) + # collection of particles - n_particle = complex(1.0-6e-4, 2e-8) cylinder_ff = FormFactorCylinder(5*nanometer, 5*nanometer) - cylinder = Particle(n_particle, cylinder_ff) + cylinder = Particle(mParticle, cylinder_ff) interference = InterferenceFunction2DParaCrystal.createHexagonal(20.0*nanometer, 0.0,20.0*micrometer, 20.0*micrometer) pdf = FTDistribution2DCauchy(1.0*nanometer, 1.0*nanometer) diff --git a/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder1.py b/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder1.py index dc7099565110f0e45a95b5a70c007c3c77841e48..57edeb33dcfb56464c28a20771f50849df93c217 100644 --- a/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder1.py +++ b/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder1.py @@ -19,6 +19,8 @@ def RunSimulation(): # defining materials mAmbience = MaterialManager.getHomogeneousMaterial("Air", 0.0, 0.0 ) mSubstrate = MaterialManager.getHomogeneousMaterial("Substrate", 6e-6, 2e-8 ) + mParticle = MaterialManager.getHomogeneousMaterial("Particle", 6e-4, 2e-8 ) + # collection of particles lattice_params = Lattice2DIFParameters() lattice_params.m_length_1 = 10.0*nanometer @@ -36,7 +38,7 @@ def RunSimulation(): n_particle = complex(1.0-6e-4, 2e-8) cylinder_ff = FormFactorCylinder(5*nanometer, 5*nanometer) - cylinder = Particle(n_particle, cylinder_ff.clone()) + cylinder = Particle(mParticle, cylinder_ff.clone()) position = kvector_t(0.0, 0.0, 0.0) particle_decoration = ParticleDecoration() particle_info = PositionParticleInfo(cylinder, position, 1.0) diff --git a/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder2.py b/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder2.py index 15fe033d9ac8e9b006199220c18da033ad8d1183..cd3d743fddfc91282163a6f6a3810f65567d406c 100644 --- a/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder2.py +++ b/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder2.py @@ -19,6 +19,8 @@ def RunSimulation(): # defining materials mAmbience = MaterialManager.getHomogeneousMaterial("Air", 0.0, 0.0 ) mSubstrate = MaterialManager.getHomogeneousMaterial("Substrate", 6e-6, 2e-8 ) + mParticle = MaterialManager.getHomogeneousMaterial("Particle", 6e-4, 2e-8 ) + # collection of particles lattice_params = Lattice2DIFParameters() lattice_params.m_length_1 = 10.0*nanometer @@ -33,12 +35,11 @@ def RunSimulation(): pdf = FTDistribution2DCauchy(300.0*nanometer/2.0/M_PI, 100.0*nanometer/2.0/M_PI) interference.setProbabilityDistribution(pdf) - n_particle = complex(1.0-6e-4, 2e-8) particle_decoration = ParticleDecoration() position = kvector_t(0.0, 0.0, 0.0) # particle 1 cylinder_ff = FormFactorCylinder(5*nanometer, 5*nanometer) - cylinder = Particle(n_particle, cylinder_ff) + cylinder = Particle(mParticle, cylinder_ff) position = kvector_t(0.0, 0.0, 0.0) particle_info = PositionParticleInfo(cylinder, position, 1.0) particle_decoration.addParticleInfo(particle_info) diff --git a/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder3.py b/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder3.py index 189df50280b97a9d0f6b473d16f216aa1f6502f7..3c4d38b637bc39df43e17c50e2449687151f5c69 100644 --- a/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder3.py +++ b/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder3.py @@ -19,6 +19,8 @@ def RunSimulation(): # defining materials mAmbience = MaterialManager.getHomogeneousMaterial("Air", 0.0, 0.0 ) mSubstrate = MaterialManager.getHomogeneousMaterial("Substrate", 6e-6, 2e-8 ) + mParticle = MaterialManager.getHomogeneousMaterial("Particle", 6e-4, 2e-8 ) + # collection of particles lattice_params = Lattice2DIFParameters() lattice_params.m_length_1 = 10.0*nanometer @@ -34,9 +36,8 @@ def RunSimulation(): pdf.setGamma(30.0*degree) interference.setProbabilityDistribution(pdf) - n_particle = complex(1.0-6e-4, 2e-8) cylinder_ff = FormFactorCylinder(5*nanometer, 5*nanometer) - cylinder = Particle(n_particle, cylinder_ff) + cylinder = Particle(mParticle, cylinder_ff) position = kvector_t(0.0, 0.0, 0.0) particle_decoration = ParticleDecoration() particle_info = PositionParticleInfo(cylinder, position, 1.0) diff --git a/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder4.py b/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder4.py index baa13cad49b95a979eb52bda1fe1a0b513a35375..a0b9b23f8843df94a6db95a990f588189ae543bc 100644 --- a/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder4.py +++ b/Examples/python/ex006_LatticeWithDisorder/LatticeWithDisorder4.py @@ -51,9 +51,10 @@ def RunSimulation(): # IsGISAXS6 functional test sample builder for varying xi angle def buildSample(xi_value): - n_particle = complex(1.0-6e-4, 2e-8) mAmbience = MaterialManager.getHomogeneousMaterial("Air", 0.0, 0.0 ) mSubstrate = MaterialManager.getHomogeneousMaterial("Substrate", 6e-6, 2e-8 ) + mParticle = MaterialManager.getHomogeneousMaterial("Particle", 6e-4, 2e-8 ) + air_layer = Layer(mAmbience) substrate_layer = Layer(mSubstrate) @@ -74,7 +75,7 @@ def buildSample(xi_value): # particle ff_cyl = FormFactorCylinder(5.0*nanometer, 5.0*nanometer) position = kvector_t(0.0, 0.0, 0.0) - cylinder = Particle(n_particle, ff_cyl.clone()) + cylinder = Particle(mParticle, ff_cyl.clone()) particle_info = PositionParticleInfo( cylinder, position, 1.0) particle_decoration.addParticleInfo(particle_info) particle_decoration.addInterferenceFunction(p_interference_function) diff --git a/Examples/python/ex009_RotatedPyramids/Pyramids.py b/Examples/python/ex009_RotatedPyramids/Pyramids.py index 7a1bf2494405f1cb0c1f6778cc2cee7b6b0af79e..37bda6d81ee9d4da7da9b4996bae558b5f454090 100644 --- a/Examples/python/ex009_RotatedPyramids/Pyramids.py +++ b/Examples/python/ex009_RotatedPyramids/Pyramids.py @@ -18,10 +18,11 @@ def RunSimulation(): # defining materials mAmbience = MaterialManager.getHomogeneousMaterial("Air", 0.0, 0.0 ) mSubstrate = MaterialManager.getHomogeneousMaterial("Substrate", 6e-6, 2e-8 ) + mParticle = MaterialManager.getHomogeneousMaterial("Particle", 6e-4, 2e-8 ) + # collection of particles - n_particle = complex(1.0-6e-4, 2e-8) pyramid_ff = FormFactorPyramid(5*nanometer, 5*nanometer, deg2rad(54.73 ) ) - pyramid = Particle(n_particle, pyramid_ff) + pyramid = Particle(mParticle, pyramid_ff) interference = InterferenceFunctionNone() particle_decoration = ParticleDecoration() particle_decoration.addParticle(pyramid, 0.0, 1.0) diff --git a/Examples/python/ex009_RotatedPyramids/RotatedPyramids.py b/Examples/python/ex009_RotatedPyramids/RotatedPyramids.py index 74054b5895ceb728f548289d6817a3049d583b39..565e0a3945946c18273697ecf149cde5c2a52201 100644 --- a/Examples/python/ex009_RotatedPyramids/RotatedPyramids.py +++ b/Examples/python/ex009_RotatedPyramids/RotatedPyramids.py @@ -17,10 +17,11 @@ def RunSimulation(): # defining materials mAmbience = MaterialManager.getHomogeneousMaterial("Air", 0.0, 0.0 ) mSubstrate = MaterialManager.getHomogeneousMaterial("Substrate", 6e-6, 2e-8 ) + mParticle = MaterialManager.getHomogeneousMaterial("Particle", 6e-4, 2e-8 ) + # collection of particles - n_particle = complex(1.0-6e-4, 2e-8) pyramid_ff = FormFactorPyramid(5*nanometer, 5*nanometer, deg2rad(54.73 ) ) - pyramid = Particle(n_particle, pyramid_ff) + pyramid = Particle(mParticle, pyramid_ff) interference = InterferenceFunctionNone() angle_around_z = 45.*degree #rotatez3d = RotateZ3D(angle_around_z) diff --git a/INSTALL b/INSTALL index fc4482446292a5a556039c2b449f38ebbdc8fa37..458906f213d9b6600f6024e60b1df1dc829546e9 100644 --- a/INSTALL +++ b/INSTALL @@ -1,6 +1,6 @@ Brief Installation instruction for BornAgain framework -Detailed installation instructions can be found in User Guide available at +Detailed installation instructions can be found at http://apps.jcns.fz-juelich.de/BornAgain diff --git a/README b/README index 295da33bff196bbb6620f112b980534720f6c6fe..e132126f8462e0b139d6fad84c89687f8cc0dee0 100644 --- a/README +++ b/README @@ -1,8 +1,10 @@ A software to simulate and fit neutron and x-ray scattering at grazing incidence (GISANS and GISAXS), using distorted-wave Born approximation (DWBA). -license : GNU General Public License v3 or higher (see Doc/COPYING) -homepage: http://apps.jcns.fz-juelich.de/BornAgain +license : GNU General Public License v3 or higher (see Doc/COPYING) +homepage : http://apps.jcns.fz-juelich.de/BornAgain +Installation : see INSTALL +changelog : see Doc/CHANGELOG diff --git a/Tests/BugReports/test_item339.py b/Tests/BugReports/test_item339.py new file mode 100644 index 0000000000000000000000000000000000000000..f748f8d205f837237f6fb10b661896dede0ad2cc --- /dev/null +++ b/Tests/BugReports/test_item339.py @@ -0,0 +1,70 @@ +import sys +#sys.path.append('/usr/local/lib') + + +import pylab +import matplotlib +import numpy +import os + +sys.path.append(os.path.abspath( + os.path.join(os.path.split(__file__)[0], '..', '..', 'lib') + )) +import libBornAgainCore as ba + + +# ---------------------------------- +# describe sample and run simulation +# ---------------------------------- +def RunSimulation(): + # defining materials + mAmbience = ba.MaterialManager.getHomogeneousMaterial("Air", 0.0, 0.0 ) + mSubstrate = ba.MaterialManager.getHomogeneousMaterial("Substrate", 6e-6, 2e-8 ) + + # collection of particles + n_particle = complex(1.0-6e-4, 2e-8) + mParticle = ba.MaterialManager.getHomogeneousMaterial("Particle", n_particle ) + + sphere_ff = ba.FormFactorSphere(8 * ba.nanometer, 8 * ba.nanometer) + #sphere = ba.Particle(n_particle, sphere_ff) + sphere = ba.Particle(mParticle, sphere_ff) + + interference = ba.InterferenceFunction2DParaCrystal.createHexagonal(20.0*ba.nanometer, 0.0,20.0*ba.micrometer, 20.0*ba.micrometer) + #pdf = ba.FTDistribution2DCauchy(1.0*ba.nanometer, 1.0*ba.nanometer) + #interference.setProbabilityDistributions(pdf, pdf) + + particle_decoration = ba.ParticleDecoration() + particle_decoration.addParticle(sphere, 0., 1.) + print 'before addInterferenceFunction' + particle_decoration.addInterferenceFunction(interference) + print 'after addInterferenceFunction' + + # air layer with particles and substrate form multi layer + air_layer = ba.Layer(mAmbience) + air_layer.setDecoration(particle_decoration) + substrate_layer = ba.Layer(mSubstrate, 0) + + multi_layer = ba.MultiLayer() + multi_layer.addLayer(air_layer) + multi_layer.addLayer(substrate_layer) + + # build and run experiment + simulation = ba.Simulation() + simulation.setDetectorParameters(487/5, -1.4 * ba.degree, 0.15 * ba.degree, + 407/5, 0. * ba.degree, 1.4 * ba.degree, True) + simulation.setBeamParameters(.96 * ba.angstrom, 0.5 * ba.degree, 0.0 * ba.degree) + simulation.setSample(multi_layer) + simulation.runSimulation() + ## intensity data + return ba.GetOutputData(simulation) + + +#------------------------------------------------------------- +# main() +#------------------------------------------------------------- +if __name__ == '__main__': + result = RunSimulation() + 1 # log scale + pylab.imshow(numpy.rot90(result, 1), + norm=matplotlib.colors.LogNorm(), + extent=[-1.4, .15, 0, 1.4]) + pylab.show() \ No newline at end of file diff --git a/Tests/UnitTests/TestCore/LayerTest.h b/Tests/UnitTests/TestCore/LayerTest.h index af5d5004bf75082bef031835c08638d873b18a90..2873c1cda0dbc851232cd467de94ffba3bcbb7ef 100644 --- a/Tests/UnitTests/TestCore/LayerTest.h +++ b/Tests/UnitTests/TestCore/LayerTest.h @@ -20,7 +20,6 @@ class LayerTest : public ::testing::Test TEST_F(LayerTest, LayerInitialState) { Layer layer; - EXPECT_EQ(NULL, layer.getMaterial()); EXPECT_EQ(NULL, layer.getDecoration()); EXPECT_EQ(0, layer.getThickness()); @@ -32,7 +31,6 @@ TEST_F(LayerTest, LayerInitialState) EXPECT_EQ(NULL, layer.createDiffuseDWBASimulation()); Layer *new_layer = layer.clone(); - EXPECT_EQ(NULL, new_layer->getMaterial()); EXPECT_EQ(NULL, new_layer->getDecoration()); EXPECT_EQ(0, new_layer->getThickness()); diff --git a/Tests/UnitTests/TestCore/ParticleTest.h b/Tests/UnitTests/TestCore/ParticleTest.h new file mode 100644 index 0000000000000000000000000000000000000000..a14d3163133606227425cfa3aab0f21cc84fbd58 --- /dev/null +++ b/Tests/UnitTests/TestCore/ParticleTest.h @@ -0,0 +1,79 @@ +#ifndef PARTICLETEST_H +#define PARTICLETEST_H + +#include "Particle.h" +#include "Units.h" +#include "HomogeneousMaterial.h" +#include "ParticleInfo.h" +#include "FormFactorFullSphere.h" +#include <iostream> + +class ParticleTest : public ::testing::Test +{ + protected: + ParticleTest(){} + virtual ~ParticleTest(){} + +}; + + +TEST_F(ParticleTest, ParticleInitialState) +{ + Particle particle; + EXPECT_EQ(NULL, particle.getMaterial()); + EXPECT_EQ(complex_t(0,0), particle.getRefractiveIndex()); + EXPECT_EQ(NULL, particle.getSimpleFormFactor()); + EXPECT_FALSE(particle.hasDistributedFormFactor()); + EXPECT_EQ(NULL, particle.createFormFactor()); + ASSERT_THROW(particle.createDistributedParticles(0,0).size(), NullPointerException); + EXPECT_EQ("Particle", particle.getName()); + + Particle *particle2 = particle.clone(); + EXPECT_EQ(NULL, particle2->getMaterial()); + EXPECT_EQ(complex_t(0,0), particle2->getRefractiveIndex()); + EXPECT_EQ(NULL, particle2->getSimpleFormFactor()); + EXPECT_FALSE(particle2->hasDistributedFormFactor()); + EXPECT_EQ(NULL, particle2->createFormFactor()); + ASSERT_THROW(particle2->createDistributedParticles(0,0).size(), NullPointerException); + EXPECT_EQ("Particle", particle2->getName()); + delete particle2; +} + + +TEST_F(ParticleTest, ParticleConstructors) +{ + const IMaterial *mat = MaterialManager::getHomogeneousMaterial("Air",0,0); + + Particle *p1 = new Particle(mat); + EXPECT_EQ("Air", p1->getMaterial()->getName()); + EXPECT_EQ(complex_t(1,0), p1->getRefractiveIndex()); + EXPECT_EQ(NULL, p1->getSimpleFormFactor()); + EXPECT_FALSE(p1->hasDistributedFormFactor()); + EXPECT_EQ(NULL, p1->createFormFactor()); + ASSERT_THROW(p1->createDistributedParticles(0,0).size(), NullPointerException); + delete p1; + + FormFactorFullSphere sphere(1.0); + Particle *p2 = new Particle(mat, sphere); + EXPECT_EQ("FormFactorFullSphere", p2->getSimpleFormFactor()->getName()); + EXPECT_EQ(1, p2->getSimpleFormFactor()->getRadius()); + EXPECT_FALSE(p2->hasDistributedFormFactor()); + EXPECT_TRUE(dynamic_cast<FormFactorDecoratorRefractiveIndex *>(p2->createFormFactor())); + EXPECT_EQ(complex_t(1,0), + dynamic_cast<FormFactorDecoratorRefractiveIndex *>(p2->createFormFactor())->getAmbientRefractiveIndex()); + delete p2; + + FormFactorFullSphere *sphere3 = new FormFactorFullSphere(1.0); + sphere3->setName("sphere3"); + Particle *p3 = new Particle(mat, sphere3); + EXPECT_EQ(sphere3, p3->getSimpleFormFactor()); + + Particle *p4 = p3->clone(); + EXPECT_EQ("sphere3", p4->getSimpleFormFactor()->getName()); + + delete p3; + delete p4; +} + + +#endif // PARTICLETEST_H diff --git a/Tests/UnitTests/TestCore/TestCore.pro b/Tests/UnitTests/TestCore/TestCore.pro index 4587fc15bb4aa94dfdb22dd2dca155fff4d02f8b..02db7463bcfb8888b114dd8a35caefae77d2e468 100644 --- a/Tests/UnitTests/TestCore/TestCore.pro +++ b/Tests/UnitTests/TestCore/TestCore.pro @@ -29,11 +29,13 @@ HEADERS += \ RealParameterWrapperTest.h \ SimulationTest.h \ ThreadInfoTest.h \ - LayerTest.h + LayerTest.h \ + ParticleTest.h #OBJECTS_DIR = obj INCLUDEPATH += $${PWD}/../../../ThirdParty/gtest/gtest-1.6.0/include +DEPENDPATH += ./ ############################################################################### # generating package dependency flags diff --git a/Tests/UnitTests/TestCore/main.cpp b/Tests/UnitTests/TestCore/main.cpp index 2a4a4291a0e706a8a9c9a3de753da1dbf91d64f1..accc811ef9986ad1d7c736d61538eacb6af2f8d1 100644 --- a/Tests/UnitTests/TestCore/main.cpp +++ b/Tests/UnitTests/TestCore/main.cpp @@ -13,6 +13,7 @@ #include "OutputDataIteratorTest.h" #include "OutputDataTest.h" #include "ParameterPoolTest.h" +#include "ParticleTest.h" #include "RealParameterWrapperTest.h" #include "SimulationTest.h" #include "ThreadInfoTest.h" diff --git a/dev-tools/profiling/run_valgrind.sh b/dev-tools/profiling/run_valgrind.sh index 0f2e9b9f5d052ffe1e8d2a159d4d1bc5ff2fe0a5..ad4b709880b2042f33fc783e4f4d5086f86d5f8b 100755 --- a/dev-tools/profiling/run_valgrind.sh +++ b/dev-tools/profiling/run_valgrind.sh @@ -9,7 +9,8 @@ application=../../App/App #arguments="isgisaxs10 batch" #arguments="isgisaxs9 batch" #arguments="isgisaxs2 batch profile" -arguments="--isgisaxs09 --batch" +#arguments="--isgisaxs09 --batch" +arguments="--testbugs --batch" focuson=GISASExperiment # ------------------------------------------- # diff --git a/dev-tools/python-bindings/MakePyCore.py b/dev-tools/python-bindings/MakePyCore.py index d6105dbf00bd0149f1eaef53a89b344cd53beecf..c5d0df958d4738e839be757932f9d8bd2a420820 100644 --- a/dev-tools/python-bindings/MakePyCore.py +++ b/dev-tools/python-bindings/MakePyCore.py @@ -210,6 +210,8 @@ def ManualClassTunings(mb): # including back methods which have been excluded by our pointer policy for fun in cl.member_functions(): if fun.name == "setMaterial":fun.include() + for fun in cl.member_functions(): + if("void ( ::Layer::* )( ::IDecoration * )" in fun.decl_string): fun.exclude() cl.constructors().include() # including back constructors with pointers # cl = mb.class_("Simulation") @@ -222,7 +224,12 @@ def ManualClassTunings(mb): cl.member_functions( ).exclude() # mb.namespace( "MathFunctions" ).free_function("GenerateNormalRandom").include() - + # + mb.namespace( "AppVersion" ).free_function("GetMajorVersionNumber").include() + mb.namespace( "AppVersion" ).free_function("GetMinorVersionNumber").include() + mb.namespace( "AppVersion" ).free_function("GetPatchVersionNumber").include() + mb.namespace( "AppVersion" ).free_function("GetVersionNumber").include() + # excluding specific member functions def ManualExcludeMemberFunctions(mb):