diff --git a/Core/Core.pro b/Core/Core.pro index 478989e965cd64530e777ca4fee303d76cc7875f..cac09cab965193b5180ae5973922c94dbf4675ee 100644 --- a/Core/Core.pro +++ b/Core/Core.pro @@ -96,7 +96,6 @@ SOURCES += \ \ Samples/src/Crystal.cpp \ Samples/src/DiffuseParticleInfo.cpp \ - Samples/src/HomogeneousMaterial.cpp \ Samples/src/ICompositeIterator.cpp \ Samples/src/ICompositeSample.cpp \ Samples/src/IMaterial.cpp \ diff --git a/Core/Samples/inc/Crystal.h b/Core/Samples/inc/Crystal.h index 3e42545902acd4a2bb195a44ada55b6c04a3eea4..481d9c14242e25a4c18ddeaeb7fcdaeb525b1b5f 100644 --- a/Core/Samples/inc/Crystal.h +++ b/Core/Samples/inc/Crystal.h @@ -21,26 +21,22 @@ #include "Lattice.h" #include "LatticeBasis.h" -//! A crystal structure with a form factor as a basis +//! A crystal structure with a form factor as a basis. class Crystal : public IClusteredParticles { -public: - //! @brief constructor - //! @param lattice_basis the basis which is repeated in the lattice structure - //! @param lattice the crystal lattice, described by its basis vectors + public: Crystal(const LatticeBasis &lattice_basis, const Lattice &lattice); ~Crystal(); virtual Crystal *clone() const; virtual void setAmbientRefractiveIndex(complex_t refractive_index) - { - mp_lattice_basis->setAmbientRefractiveIndex(refractive_index); - } + { mp_lattice_basis->setAmbientRefractiveIndex(refractive_index); } - virtual IFormFactor *createTotalFormFactor(const IFormFactor &meso_crystal_form_factor - , complex_t ambient_refractive_index) const; + virtual IFormFactor *createTotalFormFactor( + const IFormFactor &meso_crystal_form_factor, + complex_t ambient_refractive_index) const; Lattice getLattice() const { return m_lattice; } Particle *createBasis() const { return mp_lattice_basis->clone(); } @@ -52,7 +48,7 @@ public: virtual std::vector<DiffuseParticleInfo *> *createDiffuseParticleInfo( const ParticleInfo &parent_info) const; -private: + private: Lattice m_lattice; LatticeBasis *mp_lattice_basis; double m_dw_factor; diff --git a/Core/Samples/inc/DiffuseParticleInfo.h b/Core/Samples/inc/DiffuseParticleInfo.h index 2471e47fc17274e4d480fabe85622597ad0b7b83..83d4a18f4ee5c119de20d25892d66791702b24a8 100644 --- a/Core/Samples/inc/DiffuseParticleInfo.h +++ b/Core/Samples/inc/DiffuseParticleInfo.h @@ -22,8 +22,10 @@ class DiffuseParticleInfo: public ParticleInfo { -public: - DiffuseParticleInfo(Particle *p_particle, Geometry::Transform3D *transform=0, double depth=0, double abundance=0); + public: + DiffuseParticleInfo( + Particle *p_particle, Geometry::Transform3D *transform=0, + double depth=0, double abundance=0); virtual ~DiffuseParticleInfo(); //! scale abundance @@ -38,14 +40,17 @@ public: //! get number of particles per containing mesocrystal double getNumberPerMeso() const { return m_number_per_meso; } - DiffuseParticleInfo *clone() const { throw NotImplementedException("DiffuseParticleInfo::clone() -> Error: not implemented"); } + DiffuseParticleInfo *clone() const + { throw NotImplementedException( + "DiffuseParticleInfo::clone() -> Error: not implemented"); + } //! set the range of height void setHeightRange(double height_range) { m_height_range = height_range; } //! get the range of height double getHeightRange() const { return m_height_range; } -protected: + protected: double m_number_per_meso; double m_height_range; }; diff --git a/Core/Samples/inc/HomogeneousMaterial.h b/Core/Samples/inc/HomogeneousMaterial.h index 17b9de932a915427e90e1c9658eabbed3bdc8449..cd7190605b61fd0fc40549f0bce247205db01c83 100644 --- a/Core/Samples/inc/HomogeneousMaterial.h +++ b/Core/Samples/inc/HomogeneousMaterial.h @@ -3,7 +3,7 @@ // BornAgain: simulate and fit scattering at grazing incidence // //! @file Samples/inc/HomogeneousMaterial.h -//! @brief Defines class HomogeneousMaterial. +//! @brief Defines and fully implements class HomogeneousMaterial. //! //! @homepage http://apps.jcns.fz-juelich.de/BornAgain //! @license GNU General Public License v3 or higher (see COPYING) @@ -19,32 +19,54 @@ #include "IMaterial.h" #include "Types.h" -//! A homogeneous material with refraction index +//! A homogeneous material with refraction index. class HomogeneousMaterial : public IMaterial { public: HomogeneousMaterial(); - HomogeneousMaterial(const complex_t &refractive_index); - HomogeneousMaterial(const std::string &name, const complex_t &refractive_index); - HomogeneousMaterial(const std::string &name, double refractive_index_real, double refractive_index_imag ); - HomogeneousMaterial(const HomogeneousMaterial &other); - HomogeneousMaterial &operator=(const HomogeneousMaterial &other); + HomogeneousMaterial(const complex_t &refractive_index) + : IMaterial("noname"), m_refractive_index(refractive_index) {} + HomogeneousMaterial(const std::string &name, + const complex_t &refractive_index) + : IMaterial(name), m_refractive_index(refractive_index) {} + HomogeneousMaterial(const std::string &name, + double refractive_index_real, + double refractive_index_imag ) + : IMaterial(name), + m_refractive_index(complex_t(refractive_index_real, + refractive_index_imag)) {} + // Copy constructor. + HomogeneousMaterial(const HomogeneousMaterial &other) + : IMaterial(other), m_refractive_index(other.m_refractive_index) {} virtual ~HomogeneousMaterial() {} - /// return refractive index of the material + HomogeneousMaterial &operator=(const HomogeneousMaterial &other) + { + if(this != &other) + { + IMaterial::operator=(other); + m_refractive_index = other.m_refractive_index; + } + return *this; + } + + //! Return refractive index. complex_t getRefractiveIndex() const { return m_refractive_index; } - /// set refractive index of he material - void setRefractiveIndex(complex_t refractive_index) { m_refractive_index = refractive_index; } + //! Set refractive index. + void setRefractiveIndex(complex_t refractive_index) + { m_refractive_index = refractive_index; } protected: - //! print material class - virtual void print(std::ostream &ostr) const { - ostr << " " << getName() << " " << this << " R" << m_refractive_index; - } + //! Dump contents to stream. + virtual void print(std::ostream &ostr) const + { + ostr << " " << getName() << " " << this << + " R" << m_refractive_index; + } - complex_t m_refractive_index; ///< complex index of refraction + complex_t m_refractive_index; //!< complex index of refraction }; #endif // HOMOGENEOUSMATERIAL_H diff --git a/Core/Samples/inc/ParticleInfo.h b/Core/Samples/inc/ParticleInfo.h index c785c144b825f32407f5d9bf313a95cbd4181818..1d84f797764dcf415ff1c74006559e88b5be519a 100644 --- a/Core/Samples/inc/ParticleInfo.h +++ b/Core/Samples/inc/ParticleInfo.h @@ -24,45 +24,43 @@ class ParticleInfo : public ICompositeSample { -public: - //! constructor for particle info having transformation property and abundance - ParticleInfo(Particle *p_particle, Geometry::Transform3D *transform=0, double depth=0, double abundance=0); - ParticleInfo(const Particle &p_particle, const Geometry::Transform3D &transform, double depth=0, double abundance=0); - + public: + ParticleInfo(Particle *p_particle, + Geometry::Transform3D *transform=0, + double depth=0, double abundance=0); + ParticleInfo(const Particle& p_particle, + const Geometry::Transform3D& transform, + double depth=0, double abundance=0); virtual ~ParticleInfo(); - //! clone particle info virtual ParticleInfo *clone() const; - //! return particle + //! Return particle. const Particle *getParticle() const { return mp_particle; } - //! return particle transformation + //! Return transformation. const Geometry::Transform3D *getTransform3D() const { return mp_transform; } - //! set particle transformation + //! Set transformation. void setTransform(const Geometry::Transform3D &transform) { delete mp_transform; mp_transform = new Geometry::Transform3D(transform); } - //! return particle depth + //! Return depth. double getDepth() const { return m_depth;} - //! set particle depth + //! Set depth. void setDepth(double depth) { m_depth = depth; } - //! return particle abundance + //! Return abundance. double getAbundance() const { return m_abundance; } - //! set particle abundance + //! Set abundance. void setAbundance(double abundance) { m_abundance = abundance; } protected: -// ParticleInfo &operator=(const ParticleInfo &right); -// ParticleInfo(const ParticleInfo &source); - - //! initialize pool parameters, i.e. register some of class members for later access via parameter pool + //! register some class members for later access via parameter pool virtual void init_parameters(); Particle *mp_particle; @@ -71,4 +69,4 @@ protected: double m_abundance; }; -#endif // PARTICLEINFO_H +#endif /* PARTICLEINFO_H */ diff --git a/Core/Samples/src/HomogeneousMaterial.cpp b/Core/Samples/src/HomogeneousMaterial.cpp deleted file mode 100644 index a99ecdd947d8e94a517143e229f0c8affe60f038..0000000000000000000000000000000000000000 --- a/Core/Samples/src/HomogeneousMaterial.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// ************************************************************************** // -// -// BornAgain: simulate and fit scattering at grazing incidence -// -//! @file Samples/src/HomogeneousMaterial.cpp -//! @brief Implements class HomogeneousMaterial. -//! -//! @homepage http://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 -// -// ************************************************************************** // - -#include "HomogeneousMaterial.h" - -HomogeneousMaterial::HomogeneousMaterial() -{ -} - -HomogeneousMaterial::HomogeneousMaterial(const complex_t &refractive_index) - : IMaterial("noname"), m_refractive_index(refractive_index) -{ -} - -HomogeneousMaterial::HomogeneousMaterial(const std::string &name, const complex_t &refractive_index) - : IMaterial(name), m_refractive_index(refractive_index) -{ -} - -HomogeneousMaterial::HomogeneousMaterial(const std::string &name, double refractive_index_real, double refractive_index_imag) - : IMaterial(name), m_refractive_index(refractive_index_real, refractive_index_imag) -{ -} - -HomogeneousMaterial::HomogeneousMaterial(const HomogeneousMaterial &other) : IMaterial(other) -{ - m_refractive_index = other.m_refractive_index; -} - -HomogeneousMaterial &HomogeneousMaterial::operator=(const HomogeneousMaterial &other) -{ - if(this != &other) - { - IMaterial::operator=(other); - m_refractive_index = other.m_refractive_index; - } - return *this; -}