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
388021dc
Commit
388021dc
authored
3 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
+ debmsg
parent
662ece38
No related branches found
No related tags found
1 merge request
!560
Resolve Decorator Pattern in IFormFactor hierarchy
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Sample/Particle/IParticle.cpp
+3
-0
3 additions, 0 deletions
Sample/Particle/IParticle.cpp
Sample/Scattering/DecoratedFF.cpp
+3
-0
3 additions, 0 deletions
Sample/Scattering/DecoratedFF.cpp
Sample/Scattering/IBornFF.cpp
+7
-2
7 additions, 2 deletions
Sample/Scattering/IBornFF.cpp
with
13 additions
and
2 deletions
Sample/Particle/IParticle.cpp
+
3
−
0
View file @
388021dc
...
...
@@ -15,6 +15,7 @@
#include
"Sample/Particle/IParticle.h"
#include
"Sample/Particle/ParticleInSlice.h"
#include
"Sample/Scattering/Rotations.h"
#include
<iostream>
IParticle
::~
IParticle
()
=
default
;
...
...
@@ -66,5 +67,7 @@ std::vector<std::unique_ptr<IParticle>> IParticle::decompose() const
ZLimits
IParticle
::
zSpan
()
const
{
std
::
unique_ptr
<
IFormFactor
>
ff
(
createFormFactor
());
std
::
cout
<<
"DEBUG IParticle::zSpan "
<<
ff
->
bottomZ
(
nullptr
)
<<
" to "
<<
ff
->
topZ
(
nullptr
)
<<
std
::
endl
;
return
{
ff
->
bottomZ
(
nullptr
),
ff
->
topZ
(
nullptr
)};
}
This diff is collapsed.
Click to expand it.
Sample/Scattering/DecoratedFF.cpp
+
3
−
0
View file @
388021dc
...
...
@@ -98,6 +98,7 @@ complex_t DecoratedFF::theFF(const WavevectorInfo& wavevectors) const
-
m_ambient_material
->
scalarSubtrSLD
(
wavevectors2
))
*
result
;
if
(
m_position
)
result
*=
exp_I
(
m_position
->
dot
(
wavevectors
.
getQ
()));
std
::
cout
<<
"DEBUG DFF::thePol "
<<
result
<<
std
::
endl
;
return
result
;
}
...
...
@@ -132,6 +133,7 @@ double DecoratedFF::bottomZ(const IRotation* rotation) const
double
result
=
m_ff
->
bottomZ
(
total_rotation
.
get
());
if
(
m_position
)
result
+=
(
rotation
?
rotation
->
transformed
(
*
m_position
)
:
*
m_position
).
z
();
std
::
cout
<<
"DEBUG DFF::botZ "
<<
result
<<
std
::
endl
;
return
result
;
}
...
...
@@ -144,5 +146,6 @@ double DecoratedFF::topZ(const IRotation* rotation) const
double
result
=
m_ff
->
topZ
(
total_rotation
.
get
());
if
(
m_position
)
result
+=
(
rotation
?
rotation
->
transformed
(
*
m_position
)
:
*
m_position
).
z
();
std
::
cout
<<
"DEBUG DFF::topZ "
<<
result
<<
std
::
endl
;
return
result
;
}
This diff is collapsed.
Click to expand it.
Sample/Scattering/IBornFF.cpp
+
7
−
2
View file @
388021dc
...
...
@@ -18,6 +18,7 @@
#include
"Base/Vector/WavevectorInfo.h"
#include
"Sample/Scattering/Rotations.h"
#include
"Sample/Shapes/IShape3D.h"
#include
<iostream>
#include
<stdexcept>
namespace
{
...
...
@@ -66,14 +67,18 @@ double IBornFF::bottomZ(const IRotation* rotation) const
{
if
(
!
m_shape3D
)
throw
std
::
runtime_error
(
"Bug: Form factor has no m_shape3D, cannot compute bottom z"
);
return
BottomZ
(
m_shape3D
->
vertices
(),
rotation
);
double
result
=
BottomZ
(
m_shape3D
->
vertices
(),
rotation
);
std
::
cout
<<
"DEBUG IBornFF::botZ "
<<
result
<<
std
::
endl
;
return
result
;
}
double
IBornFF
::
topZ
(
const
IRotation
*
rotation
)
const
{
if
(
!
m_shape3D
)
throw
std
::
runtime_error
(
"Bug: Form factor has no m_shape3D, cannot compute top z"
);
return
TopZ
(
m_shape3D
->
vertices
(),
rotation
);
double
result
=
TopZ
(
m_shape3D
->
vertices
(),
rotation
);
std
::
cout
<<
"DEBUG IBornFF::topZ "
<<
result
<<
std
::
endl
;
return
result
;
}
bool
IBornFF
::
canSliceAnalytically
(
const
IRotation
*
rotation
)
const
...
...
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