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
d2dbb75f
Commit
d2dbb75f
authored
9 years ago
by
Van Herck, Walter
Browse files
Options
Downloads
Patches
Plain Diff
Fixed some scoped_ptr issues in Particle
parent
fea32cc8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Core/Samples/src/Particle.cpp
+43
-47
43 additions, 47 deletions
Core/Samples/src/Particle.cpp
with
43 additions
and
47 deletions
Core/Samples/src/Particle.cpp
+
43
−
47
View file @
d2dbb75f
...
...
@@ -18,120 +18,116 @@
#include
"Materials.h"
#include
<boost/scoped_ptr.hpp>
Particle
::
Particle
()
{
setName
(
"Particle"
);
}
Particle
::
Particle
(
const
IMaterial
&
p_material
)
:
mP_material
(
p_material
.
clone
())
Particle
::
Particle
(
const
IMaterial
&
p_material
)
:
mP_material
(
p_material
.
clone
())
{
setName
(
"Particle"
);
}
Particle
::
Particle
(
const
IMaterial
&
p_material
,
const
IFormFactor
&
form_factor
)
:
mP_material
(
p_material
.
clone
())
,
mP_form_factor
(
form_factor
.
clone
())
:
mP_material
(
p_material
.
clone
()),
mP_form_factor
(
form_factor
.
clone
())
{
setName
(
"Particle"
);
registerChild
(
mP_form_factor
.
get
());
}
Particle
::
Particle
(
const
IMaterial
&
p_material
,
const
IFormFactor
&
form_factor
,
const
IRotation
&
rotation
)
:
mP_material
(
p_material
.
clone
())
,
mP_form_factor
(
form_factor
.
clone
())
Particle
::
Particle
(
const
IMaterial
&
p_material
,
const
IFormFactor
&
form_factor
,
const
IRotation
&
rotation
)
:
mP_material
(
p_material
.
clone
()),
mP_form_factor
(
form_factor
.
clone
())
{
setName
(
"Particle"
);
mP_rotation
.
reset
(
rotation
.
clone
());
registerChild
(
mP_form_factor
.
get
());
}
Particle
::~
Particle
()
{
}
Particle
*
Particle
::
clone
()
const
Particle
*
Particle
::
clone
()
const
{
Particle
*
result
=
new
Particle
();
if
(
mP_form_factor
.
get
())
result
->
setFormFactor
(
*
mP_form_factor
);
result
->
setMaterial
(
*
mP_material
);
result
->
setAmbientMaterial
(
*
mP_ambient_material
);
if
(
mP_rotation
.
get
())
result
->
setTransformation
(
*
mP_rotation
);
if
(
mP_form_factor
.
get
())
result
->
setFormFactor
(
*
mP_form_factor
);
if
(
mP_material
.
get
())
result
->
setMaterial
(
*
mP_material
);
if
(
mP_ambient_material
.
get
())
result
->
setAmbientMaterial
(
*
mP_ambient_material
);
if
(
mP_rotation
.
get
())
result
->
setTransformation
(
*
mP_rotation
);
result
->
setName
(
getName
());
return
result
;
}
Particle
*
Particle
::
cloneInvertB
()
const
Particle
*
Particle
::
cloneInvertB
()
const
{
Particle
*
result
=
new
Particle
();
if
(
mP_form_factor
.
get
())
result
->
setFormFactor
(
*
mP_form_factor
);
if
(
mP_form_factor
.
get
())
result
->
setFormFactor
(
*
mP_form_factor
);
if
(
mP_material
.
get
())
if
(
mP_material
.
get
())
result
->
mP_material
.
reset
(
Materials
::
createInvertedMaterial
(
mP_material
.
get
()));
if
(
mP_ambient_material
)
result
->
mP_ambient_material
.
reset
(
Materials
::
createInvertedMaterial
(
mP_ambient_material
.
get
()));
if
(
mP_ambient_material
.
get
())
result
->
mP_ambient_material
.
reset
(
Materials
::
createInvertedMaterial
(
mP_ambient_material
.
get
()));
if
(
mP_rotation
.
get
())
result
->
mP_rotation
.
reset
(
mP_rotation
->
clone
());
if
(
mP_rotation
.
get
())
result
->
mP_rotation
.
reset
(
mP_rotation
->
clone
());
result
->
setName
(
getName
()
+
"_inv"
);
return
result
;
}
IFormFactor
*
Particle
::
createFormFactor
(
complex_t
wavevector_scattering_factor
)
const
IFormFactor
*
Particle
::
createFormFactor
(
complex_t
wavevector_scattering_factor
)
const
{
IFormFactor
*
p_transformed_ff
=
createTransformedFormFactor
();
if
(
!
p_transformed_ff
)
{
return
0
;
}
FormFactorDecoratorMaterial
*
p_ff
=
new
FormFactorDecoratorMaterial
(
p_transformed_ff
,
wavevector_scattering_factor
);
if
(
mP_rotation
.
get
())
{
boost
::
scoped_ptr
<
const
IMaterial
>
transformed_material
(
mP_material
->
createTransformedMaterial
(
*
mP_rotation
));
p_ff
->
setMaterial
(
*
transformed_material
);
}
else
{
p_ff
->
setMaterial
(
*
mP_material
);
FormFactorDecoratorMaterial
*
p_ff
=
new
FormFactorDecoratorMaterial
(
p_transformed_ff
,
wavevector_scattering_factor
);
if
(
mP_material
.
get
())
{
if
(
mP_rotation
.
get
())
{
boost
::
scoped_ptr
<
const
IMaterial
>
transformed_material
(
mP_material
->
createTransformedMaterial
(
*
mP_rotation
));
p_ff
->
setMaterial
(
*
transformed_material
);
}
else
{
p_ff
->
setMaterial
(
*
mP_material
);
}
}
p_ff
->
setAmbientMaterial
(
*
mP_ambient_material
);
if
(
mP_ambient_material
.
get
())
p_ff
->
setAmbientMaterial
(
*
mP_ambient_material
);
return
p_ff
;
}
void
Particle
::
setFormFactor
(
const
IFormFactor
&
form_factor
)
{
if
(
&
form_factor
!=
mP_form_factor
.
get
())
{
deregisterChild
(
mP_form_factor
.
get
());
if
(
mP_form_factor
.
get
())
deregisterChild
(
mP_form_factor
.
get
());
mP_form_factor
.
reset
(
form_factor
.
clone
());
registerChild
(
mP_form_factor
.
get
());
}
}
IFormFactor
*
Particle
::
createTransformedFormFactor
()
const
IFormFactor
*
Particle
::
createTransformedFormFactor
()
const
{
if
(
!
mP_form_factor
.
get
())
return
0
;
if
(
!
mP_form_factor
.
get
())
return
0
;
IFormFactor
*
p_result
;
if
(
mP_rotation
.
get
())
{
p_result
=
new
FormFactorDecoratorTransformation
(
mP_form_factor
->
clone
(),
*
mP_rotation
);
}
else
{
if
(
mP_rotation
.
get
())
{
p_result
=
new
FormFactorDecoratorTransformation
(
mP_form_factor
->
clone
(),
*
mP_rotation
);
}
else
{
p_result
=
mP_form_factor
->
clone
();
}
return
p_result
;
}
void
Particle
::
applyTransformationToSubParticles
(
const
IRotation
&
rotation
)
void
Particle
::
applyTransformationToSubParticles
(
const
IRotation
&
rotation
)
{
(
void
)
rotation
;
return
;
...
...
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