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
9fe7f52f
Commit
9fe7f52f
authored
1 year ago
by
Mikhail Svechnikov
Browse files
Options
Downloads
Patches
Plain Diff
common polarization
parent
0245401d
No related branches found
No related tags found
1 merge request
!1908
BeamScan now contains vector of Beams
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Base/Math/Numeric.cpp
+6
-0
6 additions, 0 deletions
Base/Math/Numeric.cpp
Base/Math/Numeric.h
+4
-0
4 additions, 0 deletions
Base/Math/Numeric.h
Sim/Scan/BeamScan.cpp
+22
-1
22 additions, 1 deletion
Sim/Scan/BeamScan.cpp
Sim/Scan/BeamScan.h
+4
-0
4 additions, 0 deletions
Sim/Scan/BeamScan.h
with
36 additions
and
1 deletion
Base/Math/Numeric.cpp
+
6
−
0
View file @
9fe7f52f
...
...
@@ -40,3 +40,9 @@ bool Numeric::almostEqual(double a, double b, int ulp)
constexpr
double
eps
=
std
::
numeric_limits
<
double
>::
epsilon
();
return
std
::
abs
(
a
-
b
)
<=
eps
*
ulp
*
(
std
::
abs
(
a
)
+
std
::
abs
(
b
))
/
2
;
}
bool
Numeric
::
almostEqual
(
const
R3
&
a
,
const
R3
&
b
,
int
ulp
)
{
return
almostEqual
(
a
.
x
(),
b
.
x
(),
ulp
)
&&
almostEqual
(
a
.
y
(),
b
.
y
(),
ulp
)
&&
almostEqual
(
a
.
z
(),
b
.
z
(),
ulp
);
}
This diff is collapsed.
Click to expand it.
Base/Math/Numeric.h
+
4
−
0
View file @
9fe7f52f
...
...
@@ -15,6 +15,8 @@
#ifndef BORNAGAIN_BASE_MATH_NUMERIC_H
#define BORNAGAIN_BASE_MATH_NUMERIC_H
#include
<heinz/Vectors3D.h>
void
check_scalar
(
double
a
,
double
b
,
int
ulp
);
#ifndef SWIG
...
...
@@ -28,6 +30,8 @@ double relativeDifference(double a, double b);
//! Returns true if two doubles agree within machine epsilon times ulp (units in the last place).
bool
almostEqual
(
double
a
,
double
b
,
int
ulp
);
bool
almostEqual
(
const
R3
&
a
,
const
R3
&
b
,
int
ulp
);
}
// namespace Numeric
...
...
This diff is collapsed.
Click to expand it.
Sim/Scan/BeamScan.cpp
+
22
−
1
View file @
9fe7f52f
...
...
@@ -100,7 +100,7 @@ std::vector<const Beam*> BeamScan::scanPoints() const
bool
BeamScan
::
isCommonIntensity
()
const
{
double
ref
=
m_scanPoints
.
front
().
intensity
();
const
auto
ref
=
m_scanPoints
.
front
().
intensity
();
for
(
const
auto
&
b
:
m_scanPoints
)
if
(
!
Numeric
::
almostEqual
(
b
.
intensity
(),
ref
,
1
))
return
false
;
...
...
@@ -119,6 +119,27 @@ void BeamScan::setCommonIntensity(double val)
b
.
setIntensity
(
val
);
}
bool
BeamScan
::
isCommonPolarization
()
const
{
const
auto
ref
=
m_scanPoints
.
front
().
polVector
();
for
(
const
auto
&
b
:
m_scanPoints
)
if
(
!
Numeric
::
almostEqual
(
b
.
polVector
(),
ref
,
1
))
return
false
;
return
true
;
}
R3
BeamScan
::
commonPolarization
()
const
{
ASSERT
(
isCommonPolarization
());
return
m_scanPoints
.
front
().
polVector
();
}
void
BeamScan
::
setCommonPolarization
(
const
R3
&
pol
)
{
for
(
auto
&
b
:
m_scanPoints
)
b
.
setPolarization
(
pol
);
}
SpinMatrix
BeamScan
::
polarizerMatrix
()
const
{
return
m_beamPolarization
?
SpinMatrix
::
FromBlochVector
(
*
m_beamPolarization
)
...
...
This diff is collapsed.
Click to expand it.
Sim/Scan/BeamScan.h
+
4
−
0
View file @
9fe7f52f
...
...
@@ -107,6 +107,10 @@ public:
double
commonIntensity
()
const
;
void
setCommonIntensity
(
double
val
);
bool
isCommonPolarization
()
const
;
R3
commonPolarization
()
const
;
void
setCommonPolarization
(
const
R3
&
pol
);
protected
:
const
std
::
unique_ptr
<
const
Scale
>
m_axis
;
double
m_intensity
=
1
;
//!< Fudge factor to adjust for imperfect normalization of exp. data
...
...
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