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
34d059cd
Commit
34d059cd
authored
3 years ago
by
Matthias Puchner
Browse files
Options
Downloads
Patches
Plain Diff
complete Lattice2DItems' serialization
parent
f19bd1bf
No related branches found
No related tags found
1 merge request
!573
Sample item serialization
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/Model/Sample/Lattice2DItems.cpp
+24
-0
24 additions, 0 deletions
GUI/Model/Sample/Lattice2DItems.cpp
GUI/Model/Sample/Lattice2DItems.h
+12
-1
12 additions, 1 deletion
GUI/Model/Sample/Lattice2DItems.h
with
36 additions
and
1 deletion
GUI/Model/Sample/Lattice2DItems.cpp
+
24
−
0
View file @
34d059cd
...
...
@@ -15,6 +15,7 @@
#include
"GUI/Model/Sample/Lattice2DItems.h"
#include
"Base/Const/Units.h"
#include
"Base/Util/Assert.h"
#include
"GUI/Model/Session/Serializer.h"
#include
"Sample/Lattice/Lattice2D.h"
Lattice2DItem
::
Lattice2DItem
()
...
...
@@ -56,6 +57,15 @@ std::unique_ptr<Lattice2D> BasicLattice2DItem::createLattice() const
Units
::
deg2rad
(
latticeRotationAngle
()));
}
void
BasicLattice2DItem
::
serialize
(
Serializer
&
s
)
{
s
.
assertVersion
(
0
);
s
.
rw
(
m_latticeRotationAngle
);
s
.
rw
(
m_length1
);
s
.
rw
(
m_length2
);
s
.
rw
(
m_angle
);
}
DoubleDescriptor
BasicLattice2DItem
::
latticeLength1
()
const
{
return
m_length1
;
...
...
@@ -99,6 +109,13 @@ std::unique_ptr<Lattice2D> SquareLattice2DItem::createLattice() const
return
std
::
make_unique
<
SquareLattice2D
>
(
m_length
,
Units
::
deg2rad
(
latticeRotationAngle
()));
}
void
SquareLattice2DItem
::
serialize
(
Serializer
&
s
)
{
s
.
assertVersion
(
0
);
s
.
rw
(
m_latticeRotationAngle
);
s
.
rw
(
m_length
);
}
DoubleDescriptor
SquareLattice2DItem
::
latticeLength
()
const
{
return
m_length
;
...
...
@@ -122,6 +139,13 @@ std::unique_ptr<Lattice2D> HexagonalLattice2DItem::createLattice() const
return
std
::
make_unique
<
HexagonalLattice2D
>
(
m_length
,
Units
::
deg2rad
(
latticeRotationAngle
()));
}
void
HexagonalLattice2DItem
::
serialize
(
Serializer
&
s
)
{
s
.
assertVersion
(
0
);
s
.
rw
(
m_latticeRotationAngle
);
s
.
rw
(
m_length
);
}
DoubleDescriptor
HexagonalLattice2DItem
::
latticeLength
()
const
{
return
m_length
;
...
...
This diff is collapsed.
Click to expand it.
GUI/Model/Sample/Lattice2DItems.h
+
12
−
1
View file @
34d059cd
...
...
@@ -21,6 +21,7 @@
class
Lattice2D
;
class
DoubleDescriptor
;
class
Serializer
;
class
Lattice2DItem
{
protected:
...
...
@@ -29,19 +30,23 @@ protected:
public:
virtual
~
Lattice2DItem
()
=
default
;
virtual
std
::
unique_ptr
<
Lattice2D
>
createLattice
()
const
=
0
;
virtual
void
serialize
(
Serializer
&
s
)
=
0
;
double
unitCellArea
()
const
;
DoubleDescriptor
latticeRotationAngle
()
const
;
void
setLatticeRotationAngle
(
double
angle
);
pr
ivate
:
pr
otected
:
DoubleProperty
m_latticeRotationAngle
;
};
// -------------------------------------------------------------------------------------
class
BasicLattice2DItem
:
public
Lattice2DItem
{
public:
BasicLattice2DItem
();
std
::
unique_ptr
<
Lattice2D
>
createLattice
()
const
override
;
void
serialize
(
Serializer
&
s
)
override
;
DoubleDescriptor
latticeLength1
()
const
;
void
setLatticeLength1
(
double
length1
);
...
...
@@ -58,10 +63,13 @@ private:
DoubleProperty
m_angle
;
};
// -------------------------------------------------------------------------------------
class
SquareLattice2DItem
:
public
Lattice2DItem
{
public:
SquareLattice2DItem
();
std
::
unique_ptr
<
Lattice2D
>
createLattice
()
const
override
;
void
serialize
(
Serializer
&
s
)
override
;
DoubleDescriptor
latticeLength
()
const
;
void
setLatticeLength
(
double
length
);
...
...
@@ -70,10 +78,13 @@ private:
DoubleProperty
m_length
;
};
// -------------------------------------------------------------------------------------
class
HexagonalLattice2DItem
:
public
Lattice2DItem
{
public:
HexagonalLattice2DItem
();
std
::
unique_ptr
<
Lattice2D
>
createLattice
()
const
override
;
void
serialize
(
Serializer
&
s
)
override
;
DoubleDescriptor
latticeLength
()
const
;
void
setLatticeLength
(
double
length
);
...
...
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