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
833c0b17
Commit
833c0b17
authored
4 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
improve comments in exported Py scripts
parent
bf000e16
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Core/Export/SampleToPython.cpp
+16
-16
16 additions, 16 deletions
Core/Export/SampleToPython.cpp
with
16 additions
and
16 deletions
Core/Export/SampleToPython.cpp
+
16
−
16
View file @
833c0b17
...
@@ -102,7 +102,7 @@ std::string SampleToPython::defineMaterials() const
...
@@ -102,7 +102,7 @@ std::string SampleToPython::defineMaterials() const
return
"# No Materials.
\n\n
"
;
return
"# No Materials.
\n\n
"
;
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
indent
()
<<
"# Defin
ing
Materials
\n
"
;
result
<<
indent
()
<<
"# Defin
e
Materials
\n
"
;
std
::
set
<
std
::
string
>
visitedMaterials
;
std
::
set
<
std
::
string
>
visitedMaterials
;
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
if
(
visitedMaterials
.
find
(
it
->
second
)
!=
visitedMaterials
.
end
())
if
(
visitedMaterials
.
find
(
it
->
second
)
!=
visitedMaterials
.
end
())
...
@@ -140,7 +140,7 @@ std::string SampleToPython::defineLayers() const
...
@@ -140,7 +140,7 @@ std::string SampleToPython::defineLayers() const
return
"# No Layers.
\n\n
"
;
return
"# No Layers.
\n\n
"
;
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
ing
Layers
\n
"
;
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
e
Layers
\n
"
;
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
const
Layer
*
layer
=
it
->
first
;
const
Layer
*
layer
=
it
->
first
;
result
<<
indent
()
<<
it
->
second
<<
" = ba.Layer("
result
<<
indent
()
<<
it
->
second
<<
" = ba.Layer("
...
@@ -162,7 +162,7 @@ std::string SampleToPython::defineFormFactors() const
...
@@ -162,7 +162,7 @@ std::string SampleToPython::defineFormFactors() const
return
""
;
return
""
;
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
ing
Form Factors
\n
"
;
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
e
Form Factors
\n
"
;
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
const
IFormFactor
*
p_ff
=
it
->
first
;
const
IFormFactor
*
p_ff
=
it
->
first
;
result
<<
indent
()
<<
it
->
second
<<
" = ba.FormFactor"
<<
p_ff
->
getName
()
<<
"("
result
<<
indent
()
<<
it
->
second
<<
" = ba.FormFactor"
<<
p_ff
->
getName
()
<<
"("
...
@@ -178,7 +178,7 @@ std::string SampleToPython::defineParticles() const
...
@@ -178,7 +178,7 @@ std::string SampleToPython::defineParticles() const
return
""
;
return
""
;
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
ing
Particles
\n
"
;
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
e
Particles
\n
"
;
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
const
Particle
*
p_particle
=
it
->
first
;
const
Particle
*
p_particle
=
it
->
first
;
std
::
string
particle_name
=
it
->
second
;
std
::
string
particle_name
=
it
->
second
;
...
@@ -201,7 +201,7 @@ std::string SampleToPython::defineCoreShellParticles() const
...
@@ -201,7 +201,7 @@ std::string SampleToPython::defineCoreShellParticles() const
return
""
;
return
""
;
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
ing
Core Shell Particles
\n
"
;
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
e
Core Shell Particles
\n
"
;
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
const
ParticleCoreShell
*
p_coreshell
=
it
->
first
;
const
ParticleCoreShell
*
p_coreshell
=
it
->
first
;
result
<<
"
\n
"
result
<<
"
\n
"
...
@@ -223,7 +223,7 @@ std::string SampleToPython::defineParticleDistributions() const
...
@@ -223,7 +223,7 @@ std::string SampleToPython::defineParticleDistributions() const
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
ing
particles with parameter following a distribution
\n
"
;
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
e
particles with parameter following a distribution
\n
"
;
int
index
(
1
);
int
index
(
1
);
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
...
@@ -270,7 +270,7 @@ std::string SampleToPython::defineParticleCompositions() const
...
@@ -270,7 +270,7 @@ std::string SampleToPython::defineParticleCompositions() const
return
""
;
return
""
;
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
ing
composition of particles at specific positions
\n
"
;
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
e
composition of particles at specific positions
\n
"
;
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
const
ParticleComposition
*
p_particle_composition
=
it
->
first
;
const
ParticleComposition
*
p_particle_composition
=
it
->
first
;
std
::
string
particle_composition_name
=
it
->
second
;
std
::
string
particle_composition_name
=
it
->
second
;
...
@@ -293,7 +293,7 @@ std::string SampleToPython::defineLattices2D() const
...
@@ -293,7 +293,7 @@ std::string SampleToPython::defineLattices2D() const
return
""
;
return
""
;
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
ing
2D lattices
\n
"
;
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
e
2D lattices
\n
"
;
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
const
Lattice2D
*
p_lattice
=
it
->
first
;
const
Lattice2D
*
p_lattice
=
it
->
first
;
std
::
string
lattice_name
=
it
->
second
;
std
::
string
lattice_name
=
it
->
second
;
...
@@ -313,7 +313,7 @@ std::string SampleToPython::defineLattices3D() const
...
@@ -313,7 +313,7 @@ std::string SampleToPython::defineLattices3D() const
return
""
;
return
""
;
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
ing
3D lattices
\n
"
;
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
e
3D lattices
\n
"
;
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
const
Lattice3D
*
p_lattice
=
it
->
first
;
const
Lattice3D
*
p_lattice
=
it
->
first
;
std
::
string
lattice_name
=
it
->
second
;
std
::
string
lattice_name
=
it
->
second
;
...
@@ -338,7 +338,7 @@ std::string SampleToPython::defineCrystals() const
...
@@ -338,7 +338,7 @@ std::string SampleToPython::defineCrystals() const
return
""
;
return
""
;
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
ing
crystals: basis particle + lattice
\n
"
;
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
e
crystals: basis particle + lattice
\n
"
;
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
const
Crystal
*
p_crystal
=
it
->
first
;
const
Crystal
*
p_crystal
=
it
->
first
;
std
::
string
crystal_name
=
it
->
second
;
std
::
string
crystal_name
=
it
->
second
;
...
@@ -360,7 +360,7 @@ std::string SampleToPython::defineMesoCrystals() const
...
@@ -360,7 +360,7 @@ std::string SampleToPython::defineMesoCrystals() const
return
""
;
return
""
;
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
ing
mesocrystals
\n
"
;
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
e
mesocrystals
\n
"
;
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
const
MesoCrystal
*
p_mesocrystal
=
it
->
first
;
const
MesoCrystal
*
p_mesocrystal
=
it
->
first
;
std
::
string
mesocrystal_name
=
it
->
second
;
std
::
string
mesocrystal_name
=
it
->
second
;
...
@@ -384,7 +384,7 @@ std::string SampleToPython::defineInterferenceFunctions() const
...
@@ -384,7 +384,7 @@ std::string SampleToPython::defineInterferenceFunctions() const
return
""
;
return
""
;
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
ing
Interference Functions
\n
"
;
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
e
Interference Functions
\n
"
;
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
const
IInterferenceFunction
*
interference
=
it
->
first
;
const
IInterferenceFunction
*
interference
=
it
->
first
;
...
@@ -507,7 +507,7 @@ std::string SampleToPython::defineParticleLayouts() const
...
@@ -507,7 +507,7 @@ std::string SampleToPython::defineParticleLayouts() const
return
""
;
return
""
;
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
ing
Particle Layouts and adding Particles
\n
"
;
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
e
Particle Layouts and adding Particles
\n
"
;
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
const
ParticleLayout
*
iLayout
=
it
->
first
;
const
ParticleLayout
*
iLayout
=
it
->
first
;
if
(
const
ParticleLayout
*
particleLayout
=
dynamic_cast
<
const
ParticleLayout
*>
(
iLayout
))
{
if
(
const
ParticleLayout
*
particleLayout
=
dynamic_cast
<
const
ParticleLayout
*>
(
iLayout
))
{
...
@@ -538,7 +538,7 @@ std::string SampleToPython::defineRoughnesses() const
...
@@ -538,7 +538,7 @@ std::string SampleToPython::defineRoughnesses() const
return
""
;
return
""
;
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
ing
Roughness Parameters
\n
"
;
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
e
Roughness Parameters
\n
"
;
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
result
<<
indent
()
<<
it
->
second
<<
" = ba.LayerRoughness("
result
<<
indent
()
<<
it
->
second
<<
" = ba.LayerRoughness("
<<
pyfmt2
::
argumentList
(
it
->
first
)
<<
")
\n
"
;
<<
pyfmt2
::
argumentList
(
it
->
first
)
<<
")
\n
"
;
...
@@ -551,7 +551,7 @@ std::string SampleToPython::addLayoutsToLayers() const
...
@@ -551,7 +551,7 @@ std::string SampleToPython::addLayoutsToLayers() const
return
""
;
return
""
;
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
"
\n
"
<<
indent
()
<<
"# Add
ing
layouts to layers"
;
result
<<
"
\n
"
<<
indent
()
<<
"# Add layouts to layers"
;
const
auto
layermap
=
m_label
->
layerMap
();
const
auto
layermap
=
m_label
->
layerMap
();
for
(
auto
it
=
layermap
->
begin
();
it
!=
layermap
->
end
();
++
it
)
{
for
(
auto
it
=
layermap
->
begin
();
it
!=
layermap
->
end
();
++
it
)
{
const
Layer
*
layer
=
it
->
first
;
const
Layer
*
layer
=
it
->
first
;
...
@@ -570,7 +570,7 @@ std::string SampleToPython::defineMultiLayers() const
...
@@ -570,7 +570,7 @@ std::string SampleToPython::defineMultiLayers() const
return
"# No MultiLayers.
\n\n
"
;
return
"# No MultiLayers.
\n\n
"
;
std
::
ostringstream
result
;
std
::
ostringstream
result
;
result
<<
std
::
setprecision
(
12
);
result
<<
std
::
setprecision
(
12
);
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
ing
Multilayers
\n
"
;
result
<<
"
\n
"
<<
indent
()
<<
"# Defin
e
Multilayers
\n
"
;
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
for
(
auto
it
=
themap
->
begin
();
it
!=
themap
->
end
();
++
it
)
{
result
<<
indent
()
<<
it
->
second
<<
" = ba.MultiLayer()
\n
"
;
result
<<
indent
()
<<
it
->
second
<<
" = ba.MultiLayer()
\n
"
;
double
ccl
=
it
->
first
->
crossCorrLength
();
double
ccl
=
it
->
first
->
crossCorrLength
();
...
...
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