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
b85e255f
Commit
b85e255f
authored
5 years ago
by
Van Herck, Walter
Browse files
Options
Downloads
Patches
Plain Diff
Fix problem with slicing core shell particles
parent
01682b04
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Core/Particle/Particle.cpp
+2
-0
2 additions, 0 deletions
Core/Particle/Particle.cpp
Core/Particle/ParticleCoreShell.cpp
+8
-3
8 additions, 3 deletions
Core/Particle/ParticleCoreShell.cpp
Core/Scattering/IFormFactor.cpp
+17
-0
17 additions, 0 deletions
Core/Scattering/IFormFactor.cpp
with
27 additions
and
3 deletions
Core/Particle/Particle.cpp
+
2
−
0
View file @
b85e255f
...
...
@@ -69,6 +69,8 @@ SlicedParticle Particle::createSlicedParticle(ZLimits limits) const
P_rotation
.
reset
(
mP_rotation
->
clone
());
std
::
unique_ptr
<
IFormFactor
>
P_temp_ff
(
mP_form_factor
->
createSlicedFormFactor
(
limits
,
*
P_rotation
,
m_position
));
if
(
!
P_temp_ff
)
return
{};
std
::
unique_ptr
<
FormFactorDecoratorMaterial
>
P_ff
(
new
FormFactorDecoratorMaterial
(
*
P_temp_ff
));
double
volume
=
P_temp_ff
->
volume
();
Material
transformed_material
(
...
...
This diff is collapsed.
Click to expand it.
Core/Particle/ParticleCoreShell.cpp
+
8
−
3
View file @
b85e255f
...
...
@@ -53,8 +53,6 @@ SlicedParticle ParticleCoreShell::createSlicedParticle(ZLimits limits) const
P_core
->
rotate
(
*
P_rotation
);
P_core
->
translate
(
m_position
);
auto
sliced_core
=
P_core
->
createSlicedParticle
(
limits
);
if
(
!
sliced_core
.
mP_slicedff
||
sliced_core
.
m_regions
.
size
()
!=
1
)
return
{};
// shell
std
::
unique_ptr
<
Particle
>
P_shell
(
mp_shell
->
clone
());
...
...
@@ -64,6 +62,14 @@ SlicedParticle ParticleCoreShell::createSlicedParticle(ZLimits limits) const
if
(
!
sliced_shell
.
mP_slicedff
)
return
{};
SlicedParticle
result
;
// if core out of limits, return sliced shell
if
(
!
sliced_core
.
mP_slicedff
)
{
result
.
mP_slicedff
.
reset
(
sliced_shell
.
mP_slicedff
.
release
());
result
.
m_regions
.
push_back
(
sliced_shell
.
m_regions
.
back
());
return
result
;
}
// set core ambient material
if
(
sliced_shell
.
m_regions
.
size
()
!=
1
)
return
{};
...
...
@@ -71,7 +77,6 @@ SlicedParticle ParticleCoreShell::createSlicedParticle(ZLimits limits) const
sliced_core
.
mP_slicedff
->
setAmbientMaterial
(
shell_material
);
// construct sliced particle
SlicedParticle
result
;
sliced_shell
.
m_regions
.
back
().
m_volume
-=
sliced_core
.
m_regions
.
back
().
m_volume
;
result
.
mP_slicedff
.
reset
(
new
FormFactorCoreShell
(
sliced_core
.
mP_slicedff
.
release
(),
sliced_shell
.
mP_slicedff
.
release
()));
...
...
This diff is collapsed.
Click to expand it.
Core/Scattering/IFormFactor.cpp
+
17
−
0
View file @
b85e255f
...
...
@@ -25,6 +25,8 @@
namespace
{
bool
ShapeIsContainedInLimits
(
const
IFormFactor
&
formfactor
,
ZLimits
limits
,
const
IRotation
&
rot
,
kvector_t
translation
);
bool
ShapeOutsideLimits
(
const
IFormFactor
&
formfactor
,
ZLimits
limits
,
const
IRotation
&
rot
,
kvector_t
translation
);
}
IFormFactor
::~
IFormFactor
()
{}
...
...
@@ -34,6 +36,8 @@ IFormFactor* IFormFactor::createSlicedFormFactor(ZLimits limits, const IRotation
{
if
(
ShapeIsContainedInLimits
(
*
this
,
limits
,
rot
,
translation
))
return
CreateTransformedFormFactor
(
*
this
,
rot
,
translation
);
if
(
ShapeOutsideLimits
(
*
this
,
limits
,
rot
,
translation
))
return
nullptr
;
if
(
canSliceAnalytically
(
rot
))
return
sliceFormFactor
(
limits
,
rot
,
translation
);
throw
std
::
runtime_error
(
getName
()
+
"::createSlicedFormFactor error: not supported for "
...
...
@@ -96,4 +100,17 @@ bool ShapeIsContainedInLimits(const IFormFactor& formfactor, ZLimits limits,
return
false
;
return
true
;
}
bool
ShapeOutsideLimits
(
const
IFormFactor
&
formfactor
,
ZLimits
limits
,
const
IRotation
&
rot
,
kvector_t
translation
)
{
double
zbottom
=
formfactor
.
bottomZ
(
rot
)
+
translation
.
z
();
double
ztop
=
formfactor
.
topZ
(
rot
)
+
translation
.
z
();
OneSidedLimit
lower_limit
=
limits
.
lowerLimit
();
OneSidedLimit
upper_limit
=
limits
.
upperLimit
();
if
(
!
upper_limit
.
m_limitless
&&
zbottom
>=
upper_limit
.
m_value
)
return
true
;
if
(
!
lower_limit
.
m_limitless
&&
ztop
<=
lower_limit
.
m_value
)
return
true
;
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