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
dbdde667
"pub/src/func.cpp" did not exist on "1f8652f90ef0e0bb7601138e392fa7e88e85e24e"
Commit
dbdde667
authored
6 years ago
by
Van Herck, Walter
Browse files
Options
Downloads
Patches
Plain Diff
Don't try to load outputdata from non-existing file
parent
ea52cacb
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/InputOutput/IntensityDataIOFactory.cpp
+19
-4
19 additions, 4 deletions
Core/InputOutput/IntensityDataIOFactory.cpp
GUI/coregui/Models/JobItemUtils.cpp
+2
-1
2 additions, 1 deletion
GUI/coregui/Models/JobItemUtils.cpp
with
21 additions
and
5 deletions
Core/InputOutput/IntensityDataIOFactory.cpp
+
19
−
4
View file @
dbdde667
...
@@ -18,14 +18,22 @@
...
@@ -18,14 +18,22 @@
#include
"OutputDataWriteFactory.h"
#include
"OutputDataWriteFactory.h"
#include
"SimulationResult.h"
#include
"SimulationResult.h"
#include
<fstream>
#include
<memory>
#include
<memory>
namespace
{
bool
FileExists
(
const
std
::
string
&
filename
);
}
OutputData
<
double
>*
IntensityDataIOFactory
::
readOutputData
(
const
std
::
string
&
file_name
)
OutputData
<
double
>*
IntensityDataIOFactory
::
readOutputData
(
const
std
::
string
&
file_name
)
{
{
auto
*
reader
=
OutputDataReadFactory
::
getReader
(
file_name
);
if
(
!
FileExists
(
file_name
))
auto
*
result
=
reader
->
getOutputData
();
return
nullptr
;
delete
reader
;
std
::
unique_ptr
<
OutputDataReader
>
P_reader
(
OutputDataReadFactory
::
getReader
(
file_name
));
return
result
;
if
(
P_reader
)
return
P_reader
->
getOutputData
();
return
nullptr
;
}
}
IHistogram
*
IntensityDataIOFactory
::
readIntensityData
(
const
std
::
string
&
file_name
)
IHistogram
*
IntensityDataIOFactory
::
readIntensityData
(
const
std
::
string
&
file_name
)
...
@@ -55,3 +63,10 @@ void IntensityDataIOFactory::writeSimulationResult(const SimulationResult& resul
...
@@ -55,3 +63,10 @@ void IntensityDataIOFactory::writeSimulationResult(const SimulationResult& resul
std
::
unique_ptr
<
OutputData
<
double
>>
P_data
(
result
.
data
());
std
::
unique_ptr
<
OutputData
<
double
>>
P_data
(
result
.
data
());
writeOutputData
(
*
P_data
,
file_name
);
writeOutputData
(
*
P_data
,
file_name
);
}
}
namespace
{
bool
FileExists
(
const
std
::
string
&
filename
)
{
std
::
ifstream
fs
(
filename
);
return
fs
.
is_open
();
}
}
This diff is collapsed.
Click to expand it.
GUI/coregui/Models/JobItemUtils.cpp
+
2
−
1
View file @
dbdde667
...
@@ -106,7 +106,8 @@ void JobItemUtils::loadIntensityData(DataItem *intensityItem, const QString &pro
...
@@ -106,7 +106,8 @@ void JobItemUtils::loadIntensityData(DataItem *intensityItem, const QString &pro
{
{
QString
filename
=
intensityItem
->
fileName
(
projectDir
);
QString
filename
=
intensityItem
->
fileName
(
projectDir
);
auto
data
=
IntensityDataIOFactory
::
readOutputData
(
filename
.
toStdString
());
auto
data
=
IntensityDataIOFactory
::
readOutputData
(
filename
.
toStdString
());
intensityItem
->
setOutputData
(
data
);
if
(
data
)
intensityItem
->
setOutputData
(
data
);
}
}
...
...
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