BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Definition at line 32 of file MaterialItem.h.
Classes | |
struct | Refractive |
Signals | |
void | dataChanged () const |
Public Member Functions | |
MaterialItem () | |
MaterialItem (const MaterialItem &other) | |
Creates a complete copy, also the identifier is the same. More... | |
DoubleDescriptor | beta () |
QColor | color () const |
std::unique_ptr< Material > | createMaterial () const |
void | createNewIdentifier () |
DoubleDescriptor | delta () |
bool | hasRefractiveIndex () const |
QString | identifier () const |
R3 | magnetization () const |
VectorDescriptor | magnetizationVector () |
QString | matItemName () const |
bool | operator!= (const MaterialItem &other) const |
bool | operator== (const MaterialItem &other) const |
Compares all contents. The inactive contents (e.g. SLD in case of refractive) are not taken into account. More... | |
void | readContentFrom (QXmlStreamReader *reader) |
void | serialize (Streamer &s) |
void | setColor (const QColor &color) |
void | setIdentifier (const QString &id) |
void | setMagnetization (const R3 &magnetization) |
void | setMatItemName (const QString &name) |
void | setRefractiveIndex (double delta, double beta) |
Turns material into refractive index material. More... | |
void | setScatteringLengthDensity (complex_t sld) |
Turns material into SLD based material. More... | |
DoubleDescriptor | sldIm () |
DoubleDescriptor | sldRe () |
void | updateFrom (const MaterialItem &other) |
Updates content from the other material. More... | |
void | writeContentTo (QXmlStreamWriter *writer) const |
Private Member Functions | |
QString | uidForDescriptor (const QString &lastPart) const |
Returns a unique identifier for descriptors. More... | |
Private Attributes | |
QColor | m_color |
std::variant< Refractive, complex_t > | m_data |
QString | m_id |
R3 | m_magnetization |
QString | m_name |
MaterialItem::MaterialItem | ( | ) |
Definition at line 48 of file MaterialItem.cpp.
MaterialItem::MaterialItem | ( | const MaterialItem & | other | ) |
Creates a complete copy, also the identifier is the same.
Note that the base QObject is freshly initialized, not copied from other. Therefore object hierarchy, connections, properties, object name or similar things are not copied. This is of no harm since this class is only derived from QObject to provide data change signaling.
Definition at line 55 of file MaterialItem.cpp.
References other.
DoubleDescriptor MaterialItem::beta | ( | ) |
Definition at line 101 of file MaterialItem.cpp.
References dataChanged(), hasRefractiveIndex(), m_beta, DoubleDescriptor::path, uidForDescriptor(), and unitless.
Referenced by MaterialEditorModel::data(), serialize(), and setRefractiveIndex().
QColor MaterialItem::color | ( | ) | const |
Definition at line 221 of file MaterialItem.cpp.
References m_color.
Referenced by ItemWithMaterial::materialColor(), setColor(), and RealSpaceCanvas::updateScene().
std::unique_ptr< Material > MaterialItem::createMaterial | ( | ) | const |
Definition at line 247 of file MaterialItem.cpp.
References hasRefractiveIndex(), m_beta, m_delta, m_imag, m_magnetization, m_real, and matItemName().
Referenced by ParticleItem::createParticle().
void MaterialItem::createNewIdentifier | ( | ) |
Definition at line 215 of file MaterialItem.cpp.
References m_id.
|
signal |
Referenced by MaterialInplaceForm::MaterialInplaceForm(), MaterialItems::addMaterial(), beta(), delta(), magnetizationVector(), MaterialInplaceForm::selectMaterial(), setColor(), setMagnetization(), setMatItemName(), setRefractiveIndex(), setScatteringLengthDensity(), sldIm(), sldRe(), and updateFrom().
DoubleDescriptor MaterialItem::delta | ( | ) |
Definition at line 84 of file MaterialItem.cpp.
References dataChanged(), hasRefractiveIndex(), m_delta, DoubleDescriptor::path, uidForDescriptor(), and unitless.
Referenced by MaterialEditorModel::data(), serialize(), and setRefractiveIndex().
bool MaterialItem::hasRefractiveIndex | ( | ) | const |
Definition at line 186 of file MaterialItem.cpp.
References m_data.
Referenced by beta(), createMaterial(), MaterialEditorModel::data(), delta(), operator==(), serialize(), setRefractiveIndex(), setScatteringLengthDensity(), sldIm(), sldRe(), and writeContentTo().
QString MaterialItem::identifier | ( | ) | const |
Definition at line 204 of file MaterialItem.cpp.
References m_id.
Referenced by MaterialEditorDialog::removeCurrentMaterial(), ItemWithMaterial::setMaterial(), and uidForDescriptor().
R3 MaterialItem::magnetization | ( | ) | const |
Definition at line 234 of file MaterialItem.cpp.
References m_magnetization.
Referenced by MaterialEditorModel::data(), and setMagnetization().
VectorDescriptor MaterialItem::magnetizationVector | ( | ) |
Definition at line 152 of file MaterialItem.cpp.
References dataChanged(), DoubleDescriptor::get, m_magnetization, DoubleDescriptor::path, DoubleDescriptor::set, VectorDescriptor::uid, uidForDescriptor(), VectorDescriptor::x, VectorDescriptor::y, and VectorDescriptor::z.
QString MaterialItem::matItemName | ( | ) | const |
Definition at line 191 of file MaterialItem.cpp.
References m_name.
Referenced by createMaterial(), MaterialEditorModel::data(), MaterialItems::insertCopy(), and ItemWithMaterial::materialName().
bool MaterialItem::operator!= | ( | const MaterialItem & | other | ) | const |
Definition at line 338 of file MaterialItem.cpp.
References operator==(), and other.
bool MaterialItem::operator== | ( | const MaterialItem & | other | ) | const |
Compares all contents. The inactive contents (e.g. SLD in case of refractive) are not taken into account.
Definition at line 343 of file MaterialItem.cpp.
References hasRefractiveIndex(), m_color, m_data, m_id, m_magnetization, m_name, and other.
Referenced by operator!=().
void MaterialItem::readContentFrom | ( | QXmlStreamReader * | reader | ) |
Definition at line 273 of file MaterialItem.cpp.
References XML::Tags::Id(), m_color, m_data, m_id, m_magnetization, m_name, GUI::Session::XML::readAttribute(), DeserializationException::tooNew(), DeserializationException::tooOld(), and GUI::Session::XML::Version().
void MaterialItem::serialize | ( | Streamer & | s | ) |
Definition at line 299 of file MaterialItem.cpp.
References Streamer::assertVersion(), beta(), delta(), hasRefractiveIndex(), m_color, m_data, m_id, m_magnetization, m_name, Serialize::rwValue(), sldIm(), sldRe(), and Streamer::xmlReader().
void MaterialItem::setColor | ( | const QColor & | color | ) |
Definition at line 226 of file MaterialItem.cpp.
References color(), dataChanged(), and m_color.
Referenced by MaterialEditorModel::setColor().
void MaterialItem::setIdentifier | ( | const QString & | id | ) |
Definition at line 209 of file MaterialItem.cpp.
References m_id.
void MaterialItem::setMagnetization | ( | const R3 & | magnetization | ) |
Definition at line 239 of file MaterialItem.cpp.
References dataChanged(), m_magnetization, and magnetization().
void MaterialItem::setMatItemName | ( | const QString & | name | ) |
Definition at line 196 of file MaterialItem.cpp.
References dataChanged(), m_name, and GUI::RealSpace::Particles::name().
Referenced by MaterialEditorModel::setMaterialItemName().
void MaterialItem::setRefractiveIndex | ( | double | delta, |
double | beta | ||
) |
Turns material into refractive index material.
Set refractive index as in 1 - delta + i * beta
Definition at line 65 of file MaterialItem.cpp.
References beta(), dataChanged(), delta(), hasRefractiveIndex(), and m_data.
void MaterialItem::setScatteringLengthDensity | ( | complex_t | sld | ) |
Turns material into SLD based material.
Definition at line 75 of file MaterialItem.cpp.
References dataChanged(), hasRefractiveIndex(), and m_data.
DoubleDescriptor MaterialItem::sldIm | ( | ) |
Definition at line 135 of file MaterialItem.cpp.
References dataChanged(), hasRefractiveIndex(), m_data, m_imag, DoubleDescriptor::path, uidForDescriptor(), and unitless.
Referenced by MaterialEditorModel::data(), and serialize().
DoubleDescriptor MaterialItem::sldRe | ( | ) |
Definition at line 118 of file MaterialItem.cpp.
References dataChanged(), hasRefractiveIndex(), m_data, m_real, DoubleDescriptor::path, uidForDescriptor(), and unitless.
Referenced by MaterialEditorModel::data(), and serialize().
|
private |
Returns a unique identifier for descriptors.
lastPart will be attached to identify the relevant descriptor.
Definition at line 333 of file MaterialItem.cpp.
References identifier().
Referenced by beta(), delta(), magnetizationVector(), sldIm(), and sldRe().
void MaterialItem::updateFrom | ( | const MaterialItem & | other | ) |
Updates content from the other material.
Does NOT change the identifier. emits dataChanged, if differences exist.
Definition at line 322 of file MaterialItem.cpp.
References dataChanged(), m_color, m_data, m_magnetization, m_name, and other.
void MaterialItem::writeContentTo | ( | QXmlStreamWriter * | writer | ) | const |
Definition at line 257 of file MaterialItem.cpp.
References hasRefractiveIndex(), XML::Tags::Id(), m_beta, m_color, m_data, m_delta, m_id, m_magnetization, m_name, GUI::Session::XML::Version(), and GUI::Session::XML::writeAttribute().
|
private |
Definition at line 105 of file MaterialItem.h.
Referenced by MaterialItem(), color(), operator==(), readContentFrom(), serialize(), setColor(), updateFrom(), and writeContentTo().
|
private |
Definition at line 119 of file MaterialItem.h.
Referenced by hasRefractiveIndex(), operator==(), readContentFrom(), serialize(), setRefractiveIndex(), setScatteringLengthDensity(), sldIm(), sldRe(), updateFrom(), and writeContentTo().
|
private |
Definition at line 104 of file MaterialItem.h.
Referenced by MaterialItem(), createNewIdentifier(), identifier(), operator==(), readContentFrom(), serialize(), setIdentifier(), and writeContentTo().
|
private |
Definition at line 120 of file MaterialItem.h.
Referenced by createMaterial(), magnetization(), magnetizationVector(), operator==(), readContentFrom(), serialize(), setMagnetization(), updateFrom(), and writeContentTo().
|
private |
Definition at line 103 of file MaterialItem.h.
Referenced by matItemName(), operator==(), readContentFrom(), serialize(), setMatItemName(), updateFrom(), and writeContentTo().