Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
a5cabb0c
Commit
a5cabb0c
authored
2 years ago
by
Mikhail Svechnikov
Browse files
Options
Downloads
Patches
Plain Diff
clang-format
parent
2a405c97
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1152
GUI: MaterialItem: derive descriptors from properties
Pipeline
#81258
failed
2 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/Model/Descriptor/VectorProperty.cpp
+3
-2
3 additions, 2 deletions
GUI/Model/Descriptor/VectorProperty.cpp
GUI/Model/Sample/MaterialItem.cpp
+13
-9
13 additions, 9 deletions
GUI/Model/Sample/MaterialItem.cpp
with
16 additions
and
11 deletions
GUI/Model/Descriptor/VectorProperty.cpp
+
3
−
2
View file @
a5cabb0c
...
@@ -29,9 +29,10 @@ void VectorProperty::init(const QString& label, const QString& tooltip,
...
@@ -29,9 +29,10 @@ void VectorProperty::init(const QString& label, const QString& tooltip,
m_descriptor
.
uid
=
[
this
]
{
return
m_uid
;
};
m_descriptor
.
uid
=
[
this
]
{
return
m_uid
;
};
}
}
bool
VectorProperty
::
operator
==
(
const
VectorProperty
&
other
)
const
bool
VectorProperty
::
operator
==
(
const
VectorProperty
&
other
)
const
{
{
return
(
m_value
==
other
.
m_value
)
&&
(
m_uid
==
other
.
m_uid
)
&&
(
m_persistentTag
==
other
.
m_persistentTag
);
return
(
m_value
==
other
.
m_value
)
&&
(
m_uid
==
other
.
m_uid
)
&&
(
m_persistentTag
==
other
.
m_persistentTag
);
}
}
...
...
This diff is collapsed.
Click to expand it.
GUI/Model/Sample/MaterialItem.cpp
+
13
−
9
View file @
a5cabb0c
...
@@ -12,9 +12,9 @@
...
@@ -12,9 +12,9 @@
//
//
// ************************************************************************************************
// ************************************************************************************************
#include
"GUI/Model/Sample/MaterialItem.h"
#include
"Base/Util/Assert.h"
#include
"Base/Util/Assert.h"
#include
"GUI/Model/Descriptor/VectorDescriptor.h"
#include
"GUI/Model/Descriptor/VectorDescriptor.h"
#include
"GUI/Model/Sample/MaterialItem.h"
#include
"GUI/Support/XML/Serialize.h"
#include
"GUI/Support/XML/Serialize.h"
#include
"GUI/Support/XML/UtilXML.h"
#include
"GUI/Support/XML/UtilXML.h"
#include
"GUI/Util/DeserializationException.h"
#include
"GUI/Util/DeserializationException.h"
...
@@ -46,11 +46,15 @@ MaterialItem::MaterialItem()
...
@@ -46,11 +46,15 @@ MaterialItem::MaterialItem()
m_color
=
Qt
::
red
;
m_color
=
Qt
::
red
;
m_id
=
QUuid
::
createUuid
().
toString
();
m_id
=
QUuid
::
createUuid
().
toString
();
m_delta
.
init
(
"Delta"
,
"Delta of refractive index (n = 1 - delta + i*beta)"
,
0.0
,
Unit
::
unitless
,
"delta"
);
m_delta
.
init
(
"Delta"
,
"Delta of refractive index (n = 1 - delta + i*beta)"
,
0.0
,
Unit
::
unitless
,
m_beta
.
init
(
"Beta"
,
"Beta of refractive index (n = 1 - delta + i*beta)"
,
0.0
,
Unit
::
unitless
,
"beta"
);
"delta"
);
m_beta
.
init
(
"Beta"
,
"Beta of refractive index (n = 1 - delta + i*beta)"
,
0.0
,
Unit
::
unitless
,
"beta"
);
m_sldRe
.
init
(
"SLD, real"
,
"Real part of SLD (SLD = real - i*imag), AA^{-2}"
,
0.0
,
Unit
::
unitless
,
"sldRe"
);
m_sldRe
.
init
(
"SLD, real"
,
"Real part of SLD (SLD = real - i*imag), AA^{-2}"
,
0.0
,
m_sldIm
.
init
(
"SLD, imaginary"
,
"Imaginary part of SLD (SLD = real - i*imag), AA^{-2}"
,
0.0
,
Unit
::
unitless
,
"sldIm"
);
Unit
::
unitless
,
"sldRe"
);
m_sldIm
.
init
(
"SLD, imaginary"
,
"Imaginary part of SLD (SLD = real - i*imag), AA^{-2}"
,
0.0
,
Unit
::
unitless
,
"sldIm"
);
m_magnetization
.
init
(
"Magnetization"
,
"Magnetization (A/m)"
,
"A/m"
,
"magnetization"
);
m_magnetization
.
init
(
"Magnetization"
,
"Magnetization (A/m)"
,
"A/m"
,
"magnetization"
);
}
}
...
@@ -71,7 +75,7 @@ MaterialItem::MaterialItem(const MaterialItem& other)
...
@@ -71,7 +75,7 @@ MaterialItem::MaterialItem(const MaterialItem& other)
void
MaterialItem
::
setRefractiveIndex
(
const
double
delta
,
const
double
beta
)
void
MaterialItem
::
setRefractiveIndex
(
const
double
delta
,
const
double
beta
)
{
{
if
(
m_delta
.
get
()
==
delta
&&
m_beta
.
get
()
==
beta
)
if
(
m_delta
.
get
()
==
delta
&&
m_beta
.
get
()
==
beta
)
return
;
return
;
m_delta
.
set
(
delta
);
m_delta
.
set
(
delta
);
...
@@ -175,8 +179,8 @@ void MaterialItem::setMagnetization(const R3& magnetization)
...
@@ -175,8 +179,8 @@ void MaterialItem::setMagnetization(const R3& magnetization)
std
::
unique_ptr
<
Material
>
MaterialItem
::
createMaterial
()
const
std
::
unique_ptr
<
Material
>
MaterialItem
::
createMaterial
()
const
{
{
if
(
hasRefractiveIndex
())
if
(
hasRefractiveIndex
())
return
std
::
make_unique
<
Material
>
(
return
std
::
make_unique
<
Material
>
(
RefractiveMaterial
(
RefractiveMaterial
(
matItemName
().
toStdString
(),
m_delta
.
get
(),
m_beta
.
get
(),
m_magnetization
));
matItemName
().
toStdString
(),
m_delta
.
get
(),
m_beta
.
get
(),
m_magnetization
));
return
std
::
make_unique
<
Material
>
(
return
std
::
make_unique
<
Material
>
(
MaterialBySLD
(
matItemName
().
toStdString
(),
m_sldRe
.
get
(),
m_sldIm
.
get
(),
m_magnetization
));
MaterialBySLD
(
matItemName
().
toStdString
(),
m_sldRe
.
get
(),
m_sldIm
.
get
(),
m_magnetization
));
...
@@ -221,7 +225,7 @@ void MaterialItem::updateFrom(const MaterialItem& other)
...
@@ -221,7 +225,7 @@ void MaterialItem::updateFrom(const MaterialItem& other)
bool
MaterialItem
::
operator
==
(
const
MaterialItem
&
other
)
const
bool
MaterialItem
::
operator
==
(
const
MaterialItem
&
other
)
const
{
{
if
(
m_useRefractiveIndex
!=
other
.
m_useRefractiveIndex
)
if
(
m_useRefractiveIndex
!=
other
.
m_useRefractiveIndex
)
return
false
;
return
false
;
if
(
hasRefractiveIndex
())
{
if
(
hasRefractiveIndex
())
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment