Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
waLBerla
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
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
Ravi Ayyala
waLBerla
Commits
d2abdc21
Commit
d2abdc21
authored
4 years ago
by
Grigorii Drozdov
Browse files
Options
Downloads
Patches
Plain Diff
fix: save exact particles state
parent
7fc2ff66
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
apps/benchmarks/CNT/Config.cpp
+15
-5
15 additions, 5 deletions
apps/benchmarks/CNT/Config.cpp
apps/benchmarks/CNT/InitializeCNTs.cpp
+23
-6
23 additions, 6 deletions
apps/benchmarks/CNT/InitializeCNTs.cpp
with
38 additions
and
11 deletions
apps/benchmarks/CNT/Config.cpp
+
15
−
5
View file @
d2abdc21
...
@@ -50,10 +50,11 @@ void saveConfig(const shared_ptr<data::ParticleStorage>& ps,
...
@@ -50,10 +50,11 @@ void saveConfig(const shared_ptr<data::ParticleStorage>& ps,
sb
<<
static_cast
<
double
>
(
p
.
getPosition
()[
1
]);
sb
<<
static_cast
<
double
>
(
p
.
getPosition
()[
1
]);
sb
<<
static_cast
<
double
>
(
p
.
getPosition
()[
2
]);
sb
<<
static_cast
<
double
>
(
p
.
getPosition
()[
2
]);
Vec3
orient
=
p
.
getRotation
().
getMatrix
()
*
Vec3
(
1
,
0
,
0
);
Quaternion
q
=
p
.
getRotation
().
getQuaternion
();
// Now orient has the shape (sin(th)cos(ph), sin(th)sin(ph), cos(th))
sb
<<
static_cast
<
double
>
(
q
[
0
]);
sb
<<
static_cast
<
double
>
(
std
::
acos
(
orient
[
2
]));
sb
<<
static_cast
<
double
>
(
q
[
1
]);
sb
<<
static_cast
<
double
>
(
std
::
atan2
(
orient
[
1
],
orient
[
0
]));
sb
<<
static_cast
<
double
>
(
q
[
2
]);
sb
<<
static_cast
<
double
>
(
q
[
3
]);
sb
<<
static_cast
<
double
>
(
p
.
getLinearVelocity
()[
0
]);
sb
<<
static_cast
<
double
>
(
p
.
getLinearVelocity
()[
0
]);
sb
<<
static_cast
<
double
>
(
p
.
getLinearVelocity
()[
1
]);
sb
<<
static_cast
<
double
>
(
p
.
getLinearVelocity
()[
1
]);
...
@@ -62,6 +63,15 @@ void saveConfig(const shared_ptr<data::ParticleStorage>& ps,
...
@@ -62,6 +63,15 @@ void saveConfig(const shared_ptr<data::ParticleStorage>& ps,
sb
<<
static_cast
<
double
>
(
p
.
getAngularVelocity
()[
0
]);
sb
<<
static_cast
<
double
>
(
p
.
getAngularVelocity
()[
0
]);
sb
<<
static_cast
<
double
>
(
p
.
getAngularVelocity
()[
1
]);
sb
<<
static_cast
<
double
>
(
p
.
getAngularVelocity
()[
1
]);
sb
<<
static_cast
<
double
>
(
p
.
getAngularVelocity
()[
2
]);
sb
<<
static_cast
<
double
>
(
p
.
getAngularVelocity
()[
2
]);
sb
<<
static_cast
<
double
>
(
p
.
getOldForce
()[
0
]);
sb
<<
static_cast
<
double
>
(
p
.
getOldForce
()[
1
]);
sb
<<
static_cast
<
double
>
(
p
.
getOldForce
()[
2
]);
sb
<<
static_cast
<
double
>
(
p
.
getOldTorque
()[
0
]);
sb
<<
static_cast
<
double
>
(
p
.
getOldTorque
()[
1
]);
sb
<<
static_cast
<
double
>
(
p
.
getOldTorque
()[
2
]);
}
}
switch
(
io_mode
)
switch
(
io_mode
)
...
@@ -74,7 +84,7 @@ void saveConfig(const shared_ptr<data::ParticleStorage>& ps,
...
@@ -74,7 +84,7 @@ void saveConfig(const shared_ptr<data::ParticleStorage>& ps,
WALBERLA_ROOT_SECTION
()
WALBERLA_ROOT_SECTION
()
{
{
uint_t
dataSize
=
sizeof
(
mpi
::
RecvBuffer
::
ElementType
)
*
rb
.
size
();
uint_t
dataSize
=
sizeof
(
mpi
::
RecvBuffer
::
ElementType
)
*
rb
.
size
();
size_t
size
=
rb
.
size
()
/
1
04
;
size_t
size
=
rb
.
size
()
/
1
68
;
std
::
ofstream
binfile
;
std
::
ofstream
binfile
;
binfile
.
open
(
filename
+
".sav"
,
std
::
ios
::
out
|
std
::
ios
::
binary
);
binfile
.
open
(
filename
+
".sav"
,
std
::
ios
::
out
|
std
::
ios
::
binary
);
binfile
.
write
((
char
*
)
&
size
,
sizeof
(
size_t
));
binfile
.
write
((
char
*
)
&
size
,
sizeof
(
size_t
));
...
...
This diff is collapsed.
Click to expand it.
apps/benchmarks/CNT/InitializeCNTs.cpp
+
23
−
6
View file @
d2abdc21
...
@@ -164,27 +164,43 @@ int64_t loadCNTs(const std::string& filename,
...
@@ -164,27 +164,43 @@ int64_t loadCNTs(const std::string& filename,
double
x
;
double
x
;
double
y
;
double
y
;
double
z
;
double
z
;
double
theta
;
double
q0
;
double
phi
;
double
q1
;
double
q2
;
double
q3
;
double
vx
;
double
vx
;
double
vy
;
double
vy
;
double
vz
;
double
vz
;
double
wx
;
double
wx
;
double
wy
;
double
wy
;
double
wz
;
double
wz
;
double
fx
;
double
fy
;
double
fz
;
double
tx
;
double
ty
;
double
tz
;
binfile
.
read
((
char
*
)
&
sID
,
sizeof
(
int64_t
));
binfile
.
read
((
char
*
)
&
sID
,
sizeof
(
int64_t
));
binfile
.
read
((
char
*
)
&
cID
,
sizeof
(
int64_t
));
binfile
.
read
((
char
*
)
&
cID
,
sizeof
(
int64_t
));
binfile
.
read
((
char
*
)
&
x
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
x
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
y
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
y
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
z
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
z
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
theta
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
q0
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
phi
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
q1
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
q2
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
q3
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
vx
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
vx
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
vy
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
vy
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
vz
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
vz
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
wx
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
wx
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
wy
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
wy
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
wz
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
wz
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
fx
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
fy
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
fz
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
tx
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
ty
,
sizeof
(
double
));
binfile
.
read
((
char
*
)
&
tz
,
sizeof
(
double
));
Vec3
pos
;
Vec3
pos
;
pos
[
0
]
=
real_c
(
x
);
pos
[
0
]
=
real_c
(
x
);
pos
[
1
]
=
real_c
(
y
);
pos
[
1
]
=
real_c
(
y
);
...
@@ -198,10 +214,11 @@ int64_t loadCNTs(const std::string& filename,
...
@@ -198,10 +214,11 @@ int64_t loadCNTs(const std::string& filename,
sp
.
setInteractionRadius
(
kernel
::
cnt
::
outer_radius
);
sp
.
setInteractionRadius
(
kernel
::
cnt
::
outer_radius
);
sp
.
setSegmentID
(
sID
);
sp
.
setSegmentID
(
sID
);
sp
.
setClusterID
(
cID
);
sp
.
setClusterID
(
cID
);
sp
.
getRotationRef
().
rotate
(
Vec3
(
0
_r
,
1
_r
,
0
_r
),
-
0.5
_r
*
math
::
pi
+
real_c
(
theta
));
sp
.
setRotation
(
Rot3
(
Quaternion
(
q0
,
q1
,
q2
,
q3
)));
sp
.
getRotationRef
().
rotate
(
Vec3
(
0
_r
,
0
_r
,
1
_r
),
real_c
(
phi
));
sp
.
setLinearVelocity
(
Vec3
(
real_c
(
vx
),
real_c
(
vy
),
real_c
(
vz
)));
sp
.
setLinearVelocity
(
Vec3
(
real_c
(
vx
),
real_c
(
vy
),
real_c
(
vz
)));
sp
.
setAngularVelocity
(
Vec3
(
real_c
(
wx
),
real_c
(
wy
),
real_c
(
wz
)));
sp
.
setAngularVelocity
(
Vec3
(
real_c
(
wx
),
real_c
(
wy
),
real_c
(
wz
)));
sp
.
setOldForce
(
Vec3
(
real_c
(
fx
),
real_c
(
fy
),
real_c
(
fz
)));
sp
.
setOldTorque
(
Vec3
(
real_c
(
tx
),
real_c
(
ty
),
real_c
(
tz
)));
numParticles
++
;
numParticles
++
;
}
}
}
}
...
...
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