Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fluidparticles
MigFlow
Commits
7fbca02d
Commit
7fbca02d
authored
Jul 10, 2017
by
Matthieu Constant
Browse files
visu for different grains
parent
9b51f5e3
Changes
2
Hide whitespace changes
Inline
Side-by-side
scontactplot/ObjectCollection.cc
View file @
7fbca02d
...
@@ -141,6 +141,8 @@ void ObjectCollection::display()
...
@@ -141,6 +141,8 @@ void ObjectCollection::display()
}
}
}
else
{
}
else
{
int
nTotPart
=
1
;
int
nTotPart
=
1
;
double
rMax
=
*
max_element
(
radius
.
begin
(),
radius
.
end
());
double
mMax
=
*
max_element
(
mass
.
begin
(),
mass
.
end
());
for
(
size_t
i
=
0
;
i
<
radius
.
size
()
/
nTotPart
;
++
i
)
{
for
(
size_t
i
=
0
;
i
<
radius
.
size
()
/
nTotPart
;
++
i
)
{
glEnableClientState
(
GL_VERTEX_ARRAY
);
glEnableClientState
(
GL_VERTEX_ARRAY
);
glVertexPointer
(
2
,
GL_FLOAT
,
0
,
&
circleGeom
[
0
]);
glVertexPointer
(
2
,
GL_FLOAT
,
0
,
&
circleGeom
[
0
]);
...
@@ -148,10 +150,10 @@ void ObjectCollection::display()
...
@@ -148,10 +150,10 @@ void ObjectCollection::display()
glTranslatef
(
coord
[
i
*
2
*
nTotPart
],
coord
[
i
*
2
*
nTotPart
+
1
],
0
);
glTranslatef
(
coord
[
i
*
2
*
nTotPart
],
coord
[
i
*
2
*
nTotPart
+
1
],
0
);
glScalef
(
radius
[
nTotPart
*
i
],
radius
[
nTotPart
*
i
],
1.
);
glScalef
(
radius
[
nTotPart
*
i
],
radius
[
nTotPart
*
i
],
1.
);
if
(
!
fixed
[
i
])
{
if
(
!
fixed
[
i
])
{
glColor4f
(
0.2
,
0.2
,
0
.6
,
0.5
);
glColor4f
(
(
mass
[
nTotPart
*
i
]
/
mMax
)
*
(
radius
[
nTotPart
*
i
]
/
rMax
),
0
,
0
,
0.5
);
glDrawArrays
(
GL_TRIANGLE_FAN
,
0
,
circleGeom
.
size
()
/
2
);
glDrawArrays
(
GL_TRIANGLE_FAN
,
0
,
circleGeom
.
size
()
/
2
);
}
}
glColor4f
(
0.4
,
0
.4
,
0.
8
,
1
);
glColor4f
(
(
mass
[
nTotPart
*
i
]
/
mMax
)
*
(
radius
[
nTotPart
*
i
]
/
rMax
),
0
,
0
,
0.
5
);
glDrawArrays
(
GL_LINE_STRIP
,
1
,
circleGeom
.
size
()
/
2
-
1
);
glDrawArrays
(
GL_LINE_STRIP
,
1
,
circleGeom
.
size
()
/
2
-
1
);
glDisableClientState
(
GL_VERTEX_ARRAY
);
glDisableClientState
(
GL_VERTEX_ARRAY
);
glPopMatrix
();
glPopMatrix
();
...
@@ -172,7 +174,7 @@ void ObjectCollection::display()
...
@@ -172,7 +174,7 @@ void ObjectCollection::display()
auto
&
triangles
=
_mesh
.
elements
(
MSH_TRI_3
);
auto
&
triangles
=
_mesh
.
elements
(
MSH_TRI_3
);
auto
&
nodes
=
_mesh
.
nodes
();
auto
&
nodes
=
_mesh
.
nodes
();
glColor4f
(
1
.0
,
0.0
,
0.0
,
1
);
glColor4f
(
0
.0
,
0.0
,
0.0
,
1
0
);
for
(
auto
triangle
:
triangles
)
{
for
(
auto
triangle
:
triangles
)
{
glBegin
(
GL_LINE_STRIP
);
glBegin
(
GL_LINE_STRIP
);
...
@@ -185,8 +187,8 @@ void ObjectCollection::display()
...
@@ -185,8 +187,8 @@ void ObjectCollection::display()
glEnd
();
glEnd
();
}
}
/*
for (int i=0; i < _pressure.nData(); ++i) {
/*
for (int i=0; i < _pressure.nData(); ++i) {
int idElement;
int idElement;
std::vector<double> data;
std::vector<double> data;
_pressure.data(i,idElement,data);
_pressure.data(i,idElement,data);
...
@@ -236,7 +238,7 @@ int ObjectCollection::read(int step) {
...
@@ -236,7 +238,7 @@ int ObjectCollection::read(int step) {
if
(
step
==
-
1
)
if
(
step
==
-
1
)
step
=
_step
;
step
=
_step
;
std
::
ostringstream
oss2
;
std
::
ostringstream
oss2
;
//oss2 << _basename << "/
p
_" <<std::setw(5)<<std::setfill('0')<< step << ".msh";
//oss2 << _basename << "/
fluid
_" <<std::setw(5)<<std::setfill('0')<< step << ".msh";
//_pressure.load(oss2.str().c_str());
//_pressure.load(oss2.str().c_str());
std
::
ostringstream
oss
;
std
::
ostringstream
oss
;
...
@@ -249,6 +251,7 @@ int ObjectCollection::read(int step) {
...
@@ -249,6 +251,7 @@ int ObjectCollection::read(int step) {
return
0
;
return
0
;
_step
=
step
;
_step
=
step
;
radius
.
clear
();
radius
.
clear
();
mass
.
clear
();
coord
.
clear
();
coord
.
clear
();
segcoord
.
clear
();
segcoord
.
clear
();
tricoord
.
clear
();
tricoord
.
clear
();
...
@@ -282,6 +285,7 @@ int ObjectCollection::read(int step) {
...
@@ -282,6 +285,7 @@ int ObjectCollection::read(int step) {
double
r
,
m
;
double
r
,
m
;
hf
>>
r
>>
m
;
hf
>>
r
>>
m
;
radius
.
push_back
(
r
);
radius
.
push_back
(
r
);
mass
.
push_back
(
m
);
fixed
.
push_back
(
false
);
fixed
.
push_back
(
false
);
}
}
else
if
(
type
==
"D"
)
{
else
if
(
type
==
"D"
)
{
...
@@ -289,6 +293,7 @@ int ObjectCollection::read(int step) {
...
@@ -289,6 +293,7 @@ int ObjectCollection::read(int step) {
double
r
;
double
r
;
hf
>>
r
>>
tag
;
hf
>>
r
>>
tag
;
radius
.
push_back
(
r
);
radius
.
push_back
(
r
);
mass
.
push_back
(
0
);
fixed
.
push_back
(
true
);
fixed
.
push_back
(
true
);
}
}
else
if
(
type
==
"S"
){
else
if
(
type
==
"S"
){
...
@@ -497,7 +502,7 @@ void ObjectCollection::start_ffmpeg(const std::string filename)
...
@@ -497,7 +502,7 @@ void ObjectCollection::start_ffmpeg(const std::string filename)
int
xywh
[
4
];
int
xywh
[
4
];
glGetIntegerv
(
GL_VIEWPORT
,
xywh
);
glGetIntegerv
(
GL_VIEWPORT
,
xywh
);
std
::
ostringstream
oss
;
std
::
ostringstream
oss
;
oss
<<
"ffmpeg -r
3
0 -f rawvideo -pix_fmt rgba -s "
<<
xywh
[
2
]
<<
"x"
oss
<<
"ffmpeg -r
1
0 -f rawvideo -pix_fmt rgba -s "
<<
xywh
[
2
]
<<
"x"
<<
xywh
[
3
]
<<
" -i - -y -vf vflip "
<<
filename
;
<<
xywh
[
3
]
<<
" -i - -y -vf vflip "
<<
filename
;
_ffmpeg
=
popen
(
oss
.
str
().
c_str
(),
"w"
);
_ffmpeg
=
popen
(
oss
.
str
().
c_str
(),
"w"
);
}
}
...
...
scontactplot/ObjectCollection.h
View file @
7fbca02d
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
class
ObjectCollection
{
class
ObjectCollection
{
std
::
vector
<
float
>
radius
,
coordorig
;
std
::
vector
<
float
>
radius
,
coordorig
;
std
::
vector
<
float
>
mass
;
std
::
vector
<
bool
>
fixed
;
std
::
vector
<
bool
>
fixed
;
std
::
vector
<
float
>
coord
,
segcoord
,
tricoord
;
std
::
vector
<
float
>
coord
,
segcoord
,
tricoord
;
std
::
vector
<
float
>
circleGeom
;
std
::
vector
<
float
>
circleGeom
;
...
...
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