Skip to content
Snippets Groups Projects
Commit afb8f4c2 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Merge branch 'trythings' into develop

parents cb2b394d fe94f7d8
No related branches found
No related tags found
No related merge requests found
......@@ -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 \
......
......@@ -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;
......
......@@ -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;
};
......
......@@ -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
......@@ -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 */
// ************************************************************************** //
//
// 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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment