Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openmole
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
RoiArthurB
openmole
Commits
55b23c98
Commit
55b23c98
authored
Mar 20, 2020
by
Romain Reuillon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Tool] enh: simplify method signature
parent
d3f66d76
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
12 deletions
+15
-12
openmole/core/org.openmole.core.workflow/src/main/scala/org/openmole/core/workflow/mole/CSVHook.scala
.../main/scala/org/openmole/core/workflow/mole/CSVHook.scala
+6
-2
openmole/plugins/org.openmole.plugin.method.evolution/src/main/scala/org/openmole/plugin/method/evolution/SavePopulationHook.scala
...openmole/plugin/method/evolution/SavePopulationHook.scala
+2
-2
openmole/plugins/org.openmole.plugin.method.sensitivity/src/main/scala/org/openmole/plugin/method/sensitivity/MorrisHook.scala
...a/org/openmole/plugin/method/sensitivity/MorrisHook.scala
+3
-3
openmole/plugins/org.openmole.plugin.method.sensitivity/src/main/scala/org/openmole/plugin/method/sensitivity/SaltelliHook.scala
...org/openmole/plugin/method/sensitivity/SaltelliHook.scala
+2
-2
openmole/third-parties/org.openmole.tool.file/src/main/scala/org/openmole/tool/file/package.scala
....file/src/main/scala/org/openmole/tool/file/package.scala
+2
-3
No files found.
openmole/core/org.openmole.core.workflow/src/main/scala/org/openmole/core/workflow/mole/CSVHook.scala
View file @
55b23c98
...
...
@@ -40,9 +40,13 @@ object CSVHook {
output
match
{
case
WritableOutput
.
FileValue
(
file
)
⇒
val
f
=
file
.
from
(
context
)
if
(
format
.
overwrite
&&
!
f
.
isEmpty
)
f
.
delete
()
val
create
=
format
.
overwrite
||
f
.
isEmpty
val
h
=
if
(
f
.
isEmpty
)
Some
(
headerLine
)
else
None
f
.
withPrintStream
(
append
=
true
,
create
=
true
)
{
ps
⇒
csv
.
writeVariablesToCSV
(
ps
,
h
,
vs
,
format
.
arrayOnRow
)
}
if
(
create
)
f
.
withPrintStream
(
create
=
true
)
{
ps
⇒
csv
.
writeVariablesToCSV
(
ps
,
h
,
vs
,
format
.
arrayOnRow
)
}
else
f
.
withPrintStream
(
append
=
true
,
create
=
true
)
{
ps
⇒
csv
.
writeVariablesToCSV
(
ps
,
h
,
vs
,
format
.
arrayOnRow
)
}
case
WritableOutput
.
PrintStreamValue
(
ps
)
⇒
val
header
=
Some
(
headerLine
)
csv
.
writeVariablesToCSV
(
ps
,
header
,
vs
,
format
.
arrayOnRow
)
...
...
openmole/plugins/org.openmole.plugin.method.evolution/src/main/scala/org/openmole/plugin/method/evolution/SavePopulationHook.scala
View file @
55b23c98
...
...
@@ -47,7 +47,7 @@ object SavePopulationHook {
output
match
{
case
WritableOutput
.
FileValue
(
dir
)
⇒
(
dir
/
ExpandedString
(
"population${"
+
t
.
generationPrototype
.
name
+
"}.csv"
)).
from
(
context
).
withPrintStream
(
overwrite
=
false
,
create
=
true
)
{
ps
⇒
(
dir
/
ExpandedString
(
"population${"
+
t
.
generationPrototype
.
name
+
"}.csv"
)).
from
(
context
).
withPrintStream
(
create
=
true
)
{
ps
⇒
csv
.
writeVariablesToCSV
(
ps
,
Some
(
headerLine
),
...
...
@@ -88,7 +88,7 @@ object SaveLastPopulationHook {
val
values
=
SavePopulationHook
.
resultVariables
(
t
).
from
(
context
).
map
(
_
.
value
)
def
headerLine
=
csv
.
header
(
SavePopulationHook
.
resultVariables
(
t
).
from
(
context
).
map
(
_
.
prototype
.
array
),
values
)
file
.
from
(
context
).
withPrintStream
(
overwrite
=
true
,
create
=
true
)
{
ps
⇒
file
.
from
(
context
).
withPrintStream
(
create
=
true
)
{
ps
⇒
csv
.
writeVariablesToCSV
(
ps
,
Some
(
headerLine
),
...
...
openmole/plugins/org.openmole.plugin.method.sensitivity/src/main/scala/org/openmole/plugin/method/sensitivity/MorrisHook.scala
View file @
55b23c98
...
...
@@ -16,15 +16,15 @@ object MorrisHook {
val
dir
=
dirFC
.
from
(
context
)
dir
.
mkdirs
()
(
dir
/
"mu.csv"
).
withPrintStream
(
overwrite
=
true
)
{
ps
⇒
(
dir
/
"mu.csv"
).
withPrintStream
()
{
ps
⇒
Sensitivity
.
writeResults
(
ps
,
inputs
,
dsl
.
data
.
outputs
,
Morris
.
mu
(
_
,
_
)).
from
(
context
)
}
(
dir
/
"muStar.csv"
).
withPrintStream
(
overwrite
=
true
)
{
ps
⇒
(
dir
/
"muStar.csv"
).
withPrintStream
()
{
ps
⇒
Sensitivity
.
writeResults
(
ps
,
inputs
,
dsl
.
data
.
outputs
,
Morris
.
muStar
(
_
,
_
)).
from
(
context
)
}
(
dir
/
"sigma.csv"
).
withPrintStream
(
overwrite
=
true
)
{
ps
⇒
(
dir
/
"sigma.csv"
).
withPrintStream
()
{
ps
⇒
Sensitivity
.
writeResults
(
ps
,
inputs
,
dsl
.
data
.
outputs
,
Morris
.
sigma
(
_
,
_
)).
from
(
context
)
}
case
WritableOutput
.
PrintStreamValue
(
ps
)
⇒
...
...
openmole/plugins/org.openmole.plugin.method.sensitivity/src/main/scala/org/openmole/plugin/method/sensitivity/SaltelliHook.scala
View file @
55b23c98
...
...
@@ -15,11 +15,11 @@ object SaltelliHook {
case
WritableOutput
.
FileValue
(
dirFC
)
⇒
val
dir
=
dirFC
.
from
(
context
)
(
dir
/
"firstOrderIndices.csv"
).
withPrintStream
(
overwrite
=
true
,
create
=
true
)
{
ps
⇒
(
dir
/
"firstOrderIndices.csv"
).
withPrintStream
(
create
=
true
)
{
ps
⇒
Sensitivity
.
writeResults
(
ps
,
inputs
,
dsl
.
data
.
outputs
,
Saltelli
.
firstOrder
(
_
,
_
)).
from
(
context
)
}
(
dir
/
"totalOrderIndices.csv"
).
withPrintStream
(
overwrite
=
true
)
{
ps
⇒
(
dir
/
"totalOrderIndices.csv"
).
withPrintStream
()
{
ps
⇒
Sensitivity
.
writeResults
(
ps
,
inputs
,
dsl
.
data
.
outputs
,
Saltelli
.
totalOrder
(
_
,
_
)).
from
(
context
)
}
case
WritableOutput
.
PrintStreamValue
(
ps
)
⇒
...
...
openmole/third-parties/org.openmole.tool.file/src/main/scala/org/openmole/tool/file/package.scala
View file @
55b23c98
...
...
@@ -419,10 +419,9 @@ package file {
def
withOutputStream
[
T
]
=
withClosable
[
OutputStream
,
T
](
bufferedOutputStream
())(
_
)
def
withPrintStream
[
T
](
append
:
Boolean
=
false
,
overwrite
:
Boolean
=
true
,
create
:
Boolean
=
false
)
=
{
def
arg
=
append
||
!
overwrite
def
withPrintStream
[
T
](
append
:
Boolean
=
false
,
create
:
Boolean
=
false
)
=
{
if
(
create
)
file
.
createParentDir
withClosable
[
PrintStream
,
T
](
new
PrintStream
(
file
.
bufferedOutputStream
(
a
rg
)))
_
withClosable
[
PrintStream
,
T
](
new
PrintStream
(
file
.
bufferedOutputStream
(
a
ppend
=
append
)))
_
}
def
withFileOutputStream
[
T
]
=
withClosable
[
FileOutputStream
,
T
](
new
FileOutputStream
(
file
))(
_
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment