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
ab8498fa
Commit
ab8498fa
authored
7 years ago
by
Van Herck, Walter
Browse files
Options
Downloads
Patches
Plain Diff
Layer: remove private copy constructor and refactor clone and cloneInvertB
parent
32ec7781
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Core/Multilayer/Layer.cpp
+9
-17
9 additions, 17 deletions
Core/Multilayer/Layer.cpp
Core/Multilayer/Layer.h
+0
-1
0 additions, 1 deletion
Core/Multilayer/Layer.h
with
9 additions
and
18 deletions
Core/Multilayer/Layer.cpp
+
9
−
17
View file @
ab8498fa
...
@@ -36,16 +36,20 @@ Layer::Layer(HomogeneousMaterial material, double thickness)
...
@@ -36,16 +36,20 @@ Layer::Layer(HomogeneousMaterial material, double thickness)
Layer
::~
Layer
()
Layer
::~
Layer
()
{}
{}
Layer
*
Layer
::
clone
()
const
Layer
*
Layer
::
clone
()
const
{
{
return
new
Layer
(
*
this
);
Layer
*
p_result
=
shallowClone
();
p_result
->
m_n_slices
=
m_n_slices
;
for
(
auto
p_layout
:
layouts
())
p_result
->
addLayout
(
*
p_layout
);
return
p_result
;
}
}
Layer
*
Layer
::
cloneInvertB
()
const
Layer
*
Layer
::
cloneInvertB
()
const
{
{
Layer
*
p_
clone
=
new
Layer
(
m_material
.
inverted
(),
m_thickness
);
Layer
*
p_
result
=
shallowClone
(
);
p_
clone
->
m_B_field
=
-
m_B_field
;
p_
result
->
m_B_field
=
-
m_B_field
;
return
p_
clone
;
return
p_
result
;
}
}
SafePointerVector
<
Layer
>
Layer
::
cloneSliced
(
ZLimits
limits
,
Layer
::
ELayerType
layer_type
)
const
SafePointerVector
<
Layer
>
Layer
::
cloneSliced
(
ZLimits
limits
,
Layer
::
ELayerType
layer_type
)
const
...
@@ -160,18 +164,6 @@ void Layer::initBField(kvector_t h_field, double b_z)
...
@@ -160,18 +164,6 @@ void Layer::initBField(kvector_t h_field, double b_z)
m_B_field
.
setZ
(
b_z
);
m_B_field
.
setZ
(
b_z
);
}
}
Layer
::
Layer
(
const
Layer
&
other
)
:
m_material
(
other
.
m_material
)
{
setName
(
other
.
getName
());
m_thickness
=
other
.
m_thickness
;
m_n_slices
=
other
.
m_n_slices
;
m_B_field
=
other
.
m_B_field
;
for
(
auto
p_layout
:
other
.
layouts
())
addLayout
(
*
p_layout
);
registerThickness
();
}
Layer
*
Layer
::
shallowClone
()
const
Layer
*
Layer
::
shallowClone
()
const
{
{
Layer
*
p_result
=
new
Layer
(
m_material
,
m_thickness
);
Layer
*
p_result
=
new
Layer
(
m_material
,
m_thickness
);
...
...
This diff is collapsed.
Click to expand it.
Core/Multilayer/Layer.h
+
0
−
1
View file @
ab8498fa
...
@@ -81,7 +81,6 @@ public:
...
@@ -81,7 +81,6 @@ public:
static
constexpr
double
Magnetic_Permeability
=
4e-7
*
M_PI
;
static
constexpr
double
Magnetic_Permeability
=
4e-7
*
M_PI
;
private
:
private
:
Layer
(
const
Layer
&
other
);
//! Clone the layer without its layouts
//! Clone the layer without its layouts
Layer
*
shallowClone
()
const
;
Layer
*
shallowClone
()
const
;
//! Clone and offsets the particles in the z-direction
//! Clone and offsets the particles in the z-direction
...
...
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