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
bb875a5a
Commit
bb875a5a
authored
1 year ago
by
Wuttke, Joachim
Committed by
Wuttke, Joachim
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
merge fct
parent
60013462
No related branches found
No related tags found
1 merge request
!2052
simplify SampleValidator (class -> namespace)
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/Model/Sample/SampleValidator.cpp
+8
-13
8 additions, 13 deletions
GUI/Model/Sample/SampleValidator.cpp
GUI/Model/Sample/SampleValidator.h
+0
-2
0 additions, 2 deletions
GUI/Model/Sample/SampleValidator.h
with
8 additions
and
15 deletions
GUI/Model/Sample/SampleValidator.cpp
+
8
−
13
View file @
bb875a5a
...
@@ -21,18 +21,6 @@
...
@@ -21,18 +21,6 @@
#include
"GUI/Model/Sample/ParticleLayoutItem.h"
#include
"GUI/Model/Sample/ParticleLayoutItem.h"
#include
"GUI/Model/Sample/SampleItem.h"
#include
"GUI/Model/Sample/SampleItem.h"
void
SampleValidator
::
validateItem
(
const
ItemWithParticles
*
item
)
{
if
(
const
auto
*
p
=
dynamic_cast
<
const
CoreAndShellItem
*>
(
item
))
{
if
(
!
p
->
coreItem
())
addMessage
(
"Sim/shell particle doesn't have core defined."
);
if
(
!
p
->
shellItem
())
addMessage
(
"Sim/shell particle doesn't have shell defined."
);
}
else
if
(
const
auto
*
p
=
dynamic_cast
<
const
CompoundItem
*>
(
item
))
if
(
p
->
itemsWithParticles
().
isEmpty
())
addMessage
(
"Particle composition doesn't have any particles."
);
}
void
SampleValidator
::
addMessage
(
const
QString
&
m
)
void
SampleValidator
::
addMessage
(
const
QString
&
m
)
{
{
m_messages
+=
QString
(
"* "
)
+
m
+
"
\n
"
;
m_messages
+=
QString
(
"* "
)
+
m
+
"
\n
"
;
...
@@ -55,7 +43,14 @@ bool SampleValidator::isValidSample(const SampleItem* sample)
...
@@ -55,7 +43,14 @@ bool SampleValidator::isValidSample(const SampleItem* sample)
if
(
layout
->
itemsWithParticles
().
isEmpty
())
if
(
layout
->
itemsWithParticles
().
isEmpty
())
addMessage
(
"Particle layout doesn't contain any particles."
);
addMessage
(
"Particle layout doesn't contain any particles."
);
for
(
const
auto
*
particle
:
layout
->
containedItemsWithParticles
())
{
for
(
const
auto
*
particle
:
layout
->
containedItemsWithParticles
())
{
validateItem
(
particle
);
if
(
const
auto
*
p
=
dynamic_cast
<
const
CoreAndShellItem
*>
(
particle
))
{
if
(
!
p
->
coreItem
())
addMessage
(
"Sim/shell particle doesn't have core defined."
);
if
(
!
p
->
shellItem
())
addMessage
(
"Sim/shell particle doesn't have shell defined."
);
}
else
if
(
const
auto
*
p
=
dynamic_cast
<
const
CompoundItem
*>
(
particle
))
if
(
p
->
itemsWithParticles
().
isEmpty
())
addMessage
(
"Particle composition doesn't have any particles."
);
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
GUI/Model/Sample/SampleValidator.h
+
0
−
2
View file @
bb875a5a
...
@@ -29,8 +29,6 @@ public:
...
@@ -29,8 +29,6 @@ public:
QString
getValidationMessage
()
const
{
return
m_messages
;
}
QString
getValidationMessage
()
const
{
return
m_messages
;
}
private
:
private
:
void
validateItem
(
const
ItemWithParticles
*
item
);
//! Adds this message to the report.
//! Adds this message to the report.
void
addMessage
(
const
QString
&
m
);
void
addMessage
(
const
QString
&
m
);
...
...
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