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
7ccdf763
Commit
7ccdf763
authored
7 months ago
by
Mikhail Svechnikov
Browse files
Options
Downloads
Patches
Plain Diff
LayerInterface always has non-nullptr roughness
parent
485a7141
No related branches found
No related tags found
1 merge request
!2710
Use non-nullptr LayerRoughness to distinguish between real layer interfaces and automated slice interfaces
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Sample/Interface/LayerInterface.cpp
+8
-27
8 additions, 27 deletions
Sample/Interface/LayerInterface.cpp
Sample/Interface/LayerInterface.h
+3
-11
3 additions, 11 deletions
Sample/Interface/LayerInterface.h
Sample/Multilayer/MultiLayer.cpp
+2
-4
2 additions, 4 deletions
Sample/Multilayer/MultiLayer.cpp
with
13 additions
and
42 deletions
Sample/Interface/LayerInterface.cpp
+
8
−
27
View file @
7ccdf763
...
...
@@ -16,10 +16,15 @@
#include
"Base/Util/Assert.h"
#include
"Sample/Interface/LayerRoughness.h"
LayerInterface
::
LayerInterface
()
:
m_top_layer
(
nullptr
)
,
m_bottom_layer
(
nullptr
)
LayerInterface
::
LayerInterface
(
const
Layer
*
top_layer
,
const
Layer
*
bottom_layer
,
const
LayerRoughness
*
layerRoughness
)
:
m_top_layer
(
top_layer
)
,
m_bottom_layer
(
bottom_layer
)
,
m_roughness
(
layerRoughness
)
{
ASSERT
(
top_layer
);
ASSERT
(
bottom_layer
);
ASSERT
(
layerRoughness
);
}
LayerInterface
::~
LayerInterface
()
=
default
;
...
...
@@ -29,35 +34,11 @@ LayerInterface* LayerInterface::clone() const
throw
std
::
runtime_error
(
"LayerInterface::clone -> Not allowed to clone."
);
}
LayerInterface
*
LayerInterface
::
createInterface
(
const
Layer
*
top_layer
,
const
Layer
*
bottom_layer
,
const
LayerRoughness
*
roughness
)
{
auto
*
result
=
new
LayerInterface
();
result
->
setLayersTopBottom
(
top_layer
,
bottom_layer
);
if
(
roughness
)
result
->
setRoughness
(
roughness
);
return
result
;
}
void
LayerInterface
::
setRoughness
(
const
LayerRoughness
*
roughness
)
{
m_roughness
.
reset
(
roughness
);
}
std
::
vector
<
const
INode
*>
LayerInterface
::
nodeChildren
()
const
{
return
std
::
vector
<
const
INode
*>
()
<<
m_roughness
;
}
//! Sets links to the layers above and below the interface.
void
LayerInterface
::
setLayersTopBottom
(
const
Layer
*
top_layer
,
const
Layer
*
bottom_layer
)
{
ASSERT
(
top_layer
&&
bottom_layer
);
m_top_layer
=
top_layer
;
m_bottom_layer
=
bottom_layer
;
}
std
::
string
LayerInterface
::
validate
()
const
{
return
""
;
...
...
This diff is collapsed.
Click to expand it.
Sample/Interface/LayerInterface.h
+
3
−
11
View file @
7ccdf763
...
...
@@ -24,22 +24,17 @@
class
Layer
;
class
LayerRoughness
;
//! Interface between two layers,
possibly
with roughness.
//! Interface between two layers,
always
with roughness.
class
LayerInterface
:
public
ISampleNode
{
public:
LayerInterface
(
const
Layer
*
top_layer
,
const
Layer
*
bottom_layer
,
const
LayerRoughness
*
layerRoughness
);
~
LayerInterface
()
override
;
LayerInterface
*
clone
()
const
override
;
std
::
string
className
()
const
final
{
return
"LayerInterface"
;
}
//! Creates rough interface between two layers
static
LayerInterface
*
createInterface
(
const
Layer
*
top_layer
,
const
Layer
*
bottom_layer
,
const
LayerRoughness
*
roughness
);
//! Sets roughness of the interface.
void
setRoughness
(
const
LayerRoughness
*
roughness
);
//! Returns roughness of the interface.
const
LayerRoughness
*
roughness
()
const
;
...
...
@@ -52,9 +47,6 @@ public:
std
::
string
validate
()
const
override
;
private
:
void
setLayersTopBottom
(
const
Layer
*
top_layer
,
const
Layer
*
bottom_layer
);
LayerInterface
();
const
Layer
*
m_top_layer
;
//!< pointer to the layer above interface
const
Layer
*
m_bottom_layer
;
//!< pointer to the layer below interface
std
::
unique_ptr
<
const
LayerRoughness
>
m_roughness
;
//!< roughness of the interface
...
...
This diff is collapsed.
Click to expand it.
Sample/Multilayer/MultiLayer.cpp
+
2
−
4
View file @
7ccdf763
...
...
@@ -70,10 +70,8 @@ void MultiLayer::addLayerExec(const Layer& layer, const LayerRoughness* roughnes
if
(
numberOfLayers
())
{
// not the top layer
const
Layer
*
last_layer
=
m_layers
.
back
();
const
LayerRoughness
*
new_roughness
=
roughness
&&
roughness
->
sigma
()
!=
0.0
?
roughness
->
clone
()
:
nullptr
;
m_interfaces
.
push_back
(
LayerInterface
::
createInterface
(
last_layer
,
new_layer
,
new_roughness
));
const
LayerRoughness
*
new_roughness
=
roughness
?
roughness
->
clone
()
:
new
LayerRoughness
;
m_interfaces
.
push_back
(
new
LayerInterface
(
last_layer
,
new_layer
,
new_roughness
));
}
else
{
// the top layer
if
(
new_layer
->
thickness
()
!=
0.0
)
...
...
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