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
9826054e
Commit
9826054e
authored
2 years ago
by
Mikhail Svechnikov
Browse files
Options
Downloads
Patches
Plain Diff
fix R3 calls exported to python
parent
d67b0bb9
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1440
Fix R3 calls exported to python
Pipeline
#91657
passed
2 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Sim/Export/SampleToPython.cpp
+3
-3
3 additions, 3 deletions
Sim/Export/SampleToPython.cpp
Sim/Export/SimulationToPython.cpp
+4
-3
4 additions, 3 deletions
Sim/Export/SimulationToPython.cpp
with
7 additions
and
6 deletions
Sim/Export/SampleToPython.cpp
+
3
−
3
View file @
9826054e
...
@@ -77,7 +77,7 @@ void setPositionInformation(const IParticle* particle, std::string name, std::os
...
@@ -77,7 +77,7 @@ void setPositionInformation(const IParticle* particle, std::string name, std::os
if
(
pos
==
R3
())
if
(
pos
==
R3
())
return
;
return
;
result
<<
indent
()
<<
name
<<
"_position = R3("
<<
Py
::
Fmt
::
printNm
(
pos
.
x
())
<<
", "
result
<<
indent
()
<<
name
<<
"_position =
ba.
R3("
<<
Py
::
Fmt
::
printNm
(
pos
.
x
())
<<
", "
<<
Py
::
Fmt
::
printNm
(
pos
.
y
())
<<
", "
<<
Py
::
Fmt
::
printNm
(
pos
.
z
())
<<
")
\n
"
;
<<
Py
::
Fmt
::
printNm
(
pos
.
y
())
<<
", "
<<
Py
::
Fmt
::
printNm
(
pos
.
z
())
<<
")
\n
"
;
result
<<
indent
()
<<
name
<<
".translate("
<<
name
<<
"_position)
\n
"
;
result
<<
indent
()
<<
name
<<
".translate("
<<
name
<<
"_position)
\n
"
;
}
}
...
@@ -111,7 +111,7 @@ std::string defineMaterials(const MaterialKeyHandler& matHandler)
...
@@ -111,7 +111,7 @@ std::string defineMaterials(const MaterialKeyHandler& matHandler)
<<
Py
::
Fmt
::
printDouble
(
material_data
.
imag
())
<<
")
\n
"
;
<<
Py
::
Fmt
::
printDouble
(
material_data
.
imag
())
<<
")
\n
"
;
}
else
{
}
else
{
R3
magnetic_field
=
p_material
->
magnetization
();
R3
magnetic_field
=
p_material
->
magnetization
();
result
<<
indent
()
<<
"magnetic_field = R3("
<<
magnetic_field
.
x
()
<<
", "
result
<<
indent
()
<<
"magnetic_field =
ba.
R3("
<<
magnetic_field
.
x
()
<<
", "
<<
magnetic_field
.
y
()
<<
", "
<<
magnetic_field
.
z
()
<<
")
\n
"
;
<<
magnetic_field
.
y
()
<<
", "
<<
magnetic_field
.
z
()
<<
")
\n
"
;
result
<<
indent
()
<<
matHandler
.
mat2key
(
p_material
)
<<
" = ba."
<<
factory_name
->
second
result
<<
indent
()
<<
matHandler
.
mat2key
(
p_material
)
<<
" = ba."
<<
factory_name
->
second
<<
"(
\"
"
<<
p_material
->
materialName
();
<<
"(
\"
"
<<
p_material
->
materialName
();
...
@@ -468,7 +468,7 @@ std::string defineMultiLayers(const ComponentKeyHandler& objHandler)
...
@@ -468,7 +468,7 @@ std::string defineMultiLayers(const ComponentKeyHandler& objHandler)
auto
external_field
=
s
->
externalField
();
auto
external_field
=
s
->
externalField
();
if
(
external_field
.
mag
()
>
0.0
)
{
if
(
external_field
.
mag
()
>
0.0
)
{
std
::
string
field_name
=
key
+
"_external_field"
;
std
::
string
field_name
=
key
+
"_external_field"
;
result
<<
indent
()
<<
field_name
<<
" = R3("
result
<<
indent
()
<<
field_name
<<
" =
ba.
R3("
<<
Py
::
Fmt
::
printScientificDouble
(
external_field
.
x
())
<<
", "
<<
Py
::
Fmt
::
printScientificDouble
(
external_field
.
x
())
<<
", "
<<
Py
::
Fmt
::
printScientificDouble
(
external_field
.
y
())
<<
", "
<<
Py
::
Fmt
::
printScientificDouble
(
external_field
.
y
())
<<
", "
<<
Py
::
Fmt
::
printScientificDouble
(
external_field
.
z
())
<<
")
\n
"
;
<<
Py
::
Fmt
::
printScientificDouble
(
external_field
.
z
())
<<
")
\n
"
;
...
...
This diff is collapsed.
Click to expand it.
Sim/Export/SimulationToPython.cpp
+
4
−
3
View file @
9826054e
...
@@ -135,7 +135,7 @@ std::string definePolarizationAnalyzer(const PolFilter& analyzer, const std::str
...
@@ -135,7 +135,7 @@ std::string definePolarizationAnalyzer(const PolFilter& analyzer, const std::str
if
(
analyzer_direction
.
mag
()
>
0.0
)
{
if
(
analyzer_direction
.
mag
()
>
0.0
)
{
std
::
string
direction_name
=
"analyzer_direction"
;
std
::
string
direction_name
=
"analyzer_direction"
;
result
<<
indent
()
<<
direction_name
<<
" = R3("
result
<<
indent
()
<<
direction_name
<<
" =
ba.
R3("
<<
Py
::
Fmt
::
printDouble
(
analyzer_direction
.
x
())
<<
", "
<<
Py
::
Fmt
::
printDouble
(
analyzer_direction
.
x
())
<<
", "
<<
Py
::
Fmt
::
printDouble
(
analyzer_direction
.
y
())
<<
", "
<<
Py
::
Fmt
::
printDouble
(
analyzer_direction
.
y
())
<<
", "
<<
Py
::
Fmt
::
printDouble
(
analyzer_direction
.
z
())
<<
")
\n
"
;
<<
Py
::
Fmt
::
printDouble
(
analyzer_direction
.
z
())
<<
")
\n
"
;
...
@@ -231,8 +231,9 @@ std::string defineBeamPolarization(const Beam& beam)
...
@@ -231,8 +231,9 @@ std::string defineBeamPolarization(const Beam& beam)
auto
bloch_vector
=
beam
.
polVector
();
auto
bloch_vector
=
beam
.
polVector
();
if
(
bloch_vector
.
mag
()
>
0.0
)
{
if
(
bloch_vector
.
mag
()
>
0.0
)
{
std
::
string
beam_polMatrices
=
"beam_polMatrices"
;
std
::
string
beam_polMatrices
=
"beam_polMatrices"
;
result
<<
indent
()
<<
beam_polMatrices
<<
" = R3("
<<
Py
::
Fmt
::
printDouble
(
bloch_vector
.
x
())
result
<<
indent
()
<<
beam_polMatrices
<<
" = ba.R3("
<<
", "
<<
Py
::
Fmt
::
printDouble
(
bloch_vector
.
y
())
<<
", "
<<
Py
::
Fmt
::
printDouble
(
bloch_vector
.
x
())
<<
", "
<<
Py
::
Fmt
::
printDouble
(
bloch_vector
.
y
())
<<
", "
<<
Py
::
Fmt
::
printDouble
(
bloch_vector
.
z
())
<<
")
\n
"
;
<<
Py
::
Fmt
::
printDouble
(
bloch_vector
.
z
())
<<
")
\n
"
;
result
<<
indent
()
<<
"beam.setPolarization("
<<
beam_polMatrices
<<
")
\n
"
;
result
<<
indent
()
<<
"beam.setPolarization("
<<
beam_polMatrices
<<
")
\n
"
;
}
}
...
...
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