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
46e99b85
Commit
46e99b85
authored
10 years ago
by
Van Herck, Walter
Browse files
Options
Downloads
Patches
Plain Diff
Implemented comparison of magnetic materials
parent
4359ae5d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Core/Tools/inc/LabelSample.h
+1
-1
1 addition, 1 deletion
Core/Tools/inc/LabelSample.h
Core/Tools/src/LabelSample.cpp
+17
-9
17 additions, 9 deletions
Core/Tools/src/LabelSample.cpp
with
18 additions
and
10 deletions
Core/Tools/inc/LabelSample.h
+
1
−
1
View file @
46e99b85
...
@@ -60,7 +60,7 @@ public:
...
@@ -60,7 +60,7 @@ public:
private:
private:
bool
definesSameMaterial
(
IMaterial
*
left
,
IMaterial
*
right
)
const
;
bool
definesSameMaterial
(
const
IMaterial
*
left
,
const
IMaterial
*
right
)
const
;
std
::
map
<
const
IFormFactor
*
,
std
::
string
>
m_formFactorLabel
;
std
::
map
<
const
IFormFactor
*
,
std
::
string
>
m_formFactorLabel
;
std
::
map
<
const
IInterferenceFunction
*
,
std
::
string
>
m_interferenceFunctionLabel
;
std
::
map
<
const
IInterferenceFunction
*
,
std
::
string
>
m_interferenceFunctionLabel
;
std
::
map
<
const
Layer
*
,
std
::
string
>
m_layerLabel
;
std
::
map
<
const
Layer
*
,
std
::
string
>
m_layerLabel
;
...
...
This diff is collapsed.
Click to expand it.
Core/Tools/src/LabelSample.cpp
+
17
−
9
View file @
46e99b85
...
@@ -132,8 +132,7 @@ void LabelSample::insertMaterial(const IMaterial *sample)
...
@@ -132,8 +132,7 @@ void LabelSample::insertMaterial(const IMaterial *sample)
std
::
map
<
const
IMaterial
*
,
std
::
string
>::
const_iterator
iEnd
=
m_materialLabel
.
end
();
std
::
map
<
const
IMaterial
*
,
std
::
string
>::
const_iterator
iEnd
=
m_materialLabel
.
end
();
while
(
it
!=
iEnd
)
while
(
it
!=
iEnd
)
{
{
if
(
it
->
first
->
getName
()
==
sample
->
getName
()
&&
if
(
definesSameMaterial
(
it
->
first
,
sample
)
)
it
->
first
->
getRefractiveIndex
()
==
sample
->
getRefractiveIndex
()
)
{
{
m_materialLabel
[
sample
]
=
it
->
second
;
m_materialLabel
[
sample
]
=
it
->
second
;
break
;
break
;
...
@@ -142,9 +141,9 @@ void LabelSample::insertMaterial(const IMaterial *sample)
...
@@ -142,9 +141,9 @@ void LabelSample::insertMaterial(const IMaterial *sample)
}
}
if
(
it
==
iEnd
)
if
(
it
==
iEnd
)
{
{
std
::
ostringstream
inter
;
std
::
ostringstream
label_stream
;
inter
<<
"Material_"
<<
m_materialLabel
.
size
()
+
1
;
label_stream
<<
"Material_"
<<
m_materialLabel
.
size
()
+
1
;
m_materialLabel
[
sample
]
=
inter
.
str
();
m_materialLabel
[
sample
]
=
label_stream
.
str
();
}
}
}
}
...
@@ -169,7 +168,6 @@ void LabelSample::setLabel(const ILayout *sample)
...
@@ -169,7 +168,6 @@ void LabelSample::setLabel(const ILayout *sample)
m_ILayoutLabel
[
sample
]
=
inter
.
str
();;
m_ILayoutLabel
[
sample
]
=
inter
.
str
();;
}
}
void
LabelSample
::
setLabel
(
const
Layer
*
sample
)
void
LabelSample
::
setLabel
(
const
Layer
*
sample
)
{
{
std
::
ostringstream
inter
;
std
::
ostringstream
inter
;
...
@@ -216,7 +214,7 @@ void LabelSample::setLabel(const ParticleInfo *sample)
...
@@ -216,7 +214,7 @@ void LabelSample::setLabel(const ParticleInfo *sample)
m_particleInfoLabel
[
sample
]
=
inter
.
str
();;
m_particleInfoLabel
[
sample
]
=
inter
.
str
();;
}
}
bool
LabelSample
::
definesSameMaterial
(
IMaterial
*
left
,
IMaterial
*
right
)
const
bool
LabelSample
::
definesSameMaterial
(
const
IMaterial
*
left
,
const
IMaterial
*
right
)
const
{
{
// Non-magnetic materials
// Non-magnetic materials
if
(
left
->
isScalarMaterial
()
&&
right
->
isScalarMaterial
())
{
if
(
left
->
isScalarMaterial
()
&&
right
->
isScalarMaterial
())
{
...
@@ -228,8 +226,18 @@ bool LabelSample::definesSameMaterial(IMaterial *left, IMaterial *right) const
...
@@ -228,8 +226,18 @@ bool LabelSample::definesSameMaterial(IMaterial *left, IMaterial *right) const
}
}
// Magnetic materials TODO
// Magnetic materials TODO
else
if
(
!
left
->
isScalarMaterial
()
&&
!
right
->
isScalarMaterial
())
{
else
if
(
!
left
->
isScalarMaterial
()
&&
!
right
->
isScalarMaterial
())
{
if
(
left
->
getName
()
==
right
->
getName
()
&&
const
HomogeneousMagneticMaterial
*
p_left
=
left
->
getRefractiveIndex
()
==
right
->
getRefractiveIndex
()
)
{
dynamic_cast
<
const
HomogeneousMagneticMaterial
*>
(
left
);
const
HomogeneousMagneticMaterial
*
p_right
=
dynamic_cast
<
const
HomogeneousMagneticMaterial
*>
(
right
);
if
(
!
p_left
||
!
p_right
)
{
throw
Exceptions
::
RuntimeErrorException
(
"LabelSample::definesSameMaterial: "
"non-scalar materials should be of type "
"HomogeneousMagneticMaterial"
);
}
if
(
p_left
->
getName
()
==
p_right
->
getName
()
&&
p_left
->
getRefractiveIndex
()
==
p_right
->
getRefractiveIndex
()
&&
p_left
->
getMagneticField
()
==
p_right
->
getMagneticField
()
)
{
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
...
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