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
8c1acf1e
Commit
8c1acf1e
authored
1 year ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
Beam hold parameters directly, not through INode's m_P; add checks
parent
926a0f54
No related branches found
No related tags found
1 merge request
!1863
make class Beam cloneable, and don't use m_P.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Device/Beam/Beam.cpp
+11
-14
11 additions, 14 deletions
Device/Beam/Beam.cpp
Device/Beam/Beam.h
+4
-5
4 additions, 5 deletions
Device/Beam/Beam.h
with
15 additions
and
19 deletions
Device/Beam/Beam.cpp
+
11
−
14
View file @
8c1acf1e
...
...
@@ -22,28 +22,21 @@ using std::numbers::pi;
//... Constructors, destructors:
Beam
::
Beam
(
std
::
vector
<
double
>
P
)
:
INode
(
P
)
,
m_intensity
(
m_P
[
0
])
,
m_wavelength
(
m_P
[
1
])
,
m_alpha
(
m_P
[
2
])
,
m_phi
(
m_P
[
3
])
{
ASSERT
(
m_intensity
>
0
);
ASSERT
(
m_alpha
>=
0
);
precompute
();
}
Beam
::
Beam
(
double
intensity
,
double
wavelength
,
double
alpha
,
double
phi
)
:
Beam
(
std
::
vector
<
double
>
{
intensity
,
wavelength
,
alpha
,
phi
})
:
INode
()
,
m_intensity
(
intensity
)
,
m_wavelength
(
wavelength
)
,
m_alpha
(
alpha
)
,
m_phi
(
phi
)
{
precompute
();
}
Beam
::~
Beam
()
=
default
;
Beam
*
Beam
::
clone
()
const
{
Beam
*
result
=
new
Beam
(
m_
P
);
Beam
*
result
=
new
Beam
(
m_
intensity
,
m_wavelength
,
m_alpha
,
m_phi
);
result
->
m_shape_factor
=
m_shape_factor
;
result
->
m_polarization
=
m_polarization
;
return
result
;
...
...
@@ -89,6 +82,7 @@ const IFootprint* Beam::footprint() const
void
Beam
::
setIntensity
(
double
intensity
)
{
m_intensity
=
intensity
;
precompute
();
}
void
Beam
::
setWavelength
(
double
wavelength
)
...
...
@@ -129,6 +123,9 @@ void Beam::setPolarization(const R3 polarization)
//! To be called whenever wavelength or alpha or phi has changed.
void
Beam
::
precompute
()
{
ASSERT
(
m_intensity
>
0
);
ASSERT
(
m_wavelength
>=
0
);
ASSERT
(
m_alpha
>=
0
);
m_wavenumber
=
(
2
*
pi
)
/
m_wavelength
;
m_k
=
vecOfKAlphaPhi
(
m_wavenumber
,
-
m_alpha
,
-
m_phi
);
}
This diff is collapsed.
Click to expand it.
Device/Beam/Beam.h
+
4
−
5
View file @
8c1acf1e
...
...
@@ -82,14 +82,13 @@ public:
private
:
Beam
();
// needed by Swig
#ifndef SWIG
Beam
(
std
::
vector
<
double
>
P
);
void
precompute
();
double
&
m_intensity
;
//!< beam intensity (neutrons/sec)
double
&
m_wavelength
;
double
&
m_alpha
;
double
&
m_phi
;
double
m_intensity
;
//!< beam intensity (neutrons/sec)
double
m_wavelength
;
double
m_alpha
;
double
m_phi
;
std
::
shared_ptr
<
IFootprint
>
m_shape_factor
;
//!< footprint correction handler
R3
m_polarization
;
//!< Bloch vector encoding the beam's polarization
...
...
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