Commit 7fbca02d authored by Matthieu Constant's avatar Matthieu Constant
Browse files

visu for different grains

parent 9b51f5e3
......@@ -141,6 +141,8 @@ void ObjectCollection::display()
}
}else {
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) {
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, &circleGeom[0]);
......@@ -148,10 +150,10 @@ void ObjectCollection::display()
glTranslatef(coord[i * 2 * nTotPart], coord[i * 2 * nTotPart + 1], 0);
glScalef(radius[nTotPart*i], radius[nTotPart*i], 1.);
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);
}
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);
glDisableClientState(GL_VERTEX_ARRAY);
glPopMatrix();
......@@ -172,7 +174,7 @@ void ObjectCollection::display()
auto &triangles = _mesh.elements(MSH_TRI_3);
auto &nodes = _mesh.nodes();
glColor4f(1.0, 0.0, 0.0, 1);
glColor4f(0.0, 0.0, 0.0, 10);
for (auto triangle : triangles) {
glBegin(GL_LINE_STRIP);
......@@ -185,8 +187,8 @@ void ObjectCollection::display()
glEnd();
}
/*
for (int i=0; i < _pressure.nData(); ++i) {
/*for (int i=0; i < _pressure.nData(); ++i) {
int idElement;
std::vector<double> data;
_pressure.data(i,idElement,data);
......@@ -236,7 +238,7 @@ int ObjectCollection::read(int step) {
if (step == -1)
step = _step;
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());
std::ostringstream oss;
......@@ -249,6 +251,7 @@ int ObjectCollection::read(int step) {
return 0;
_step = step;
radius.clear();
mass.clear();
coord.clear();
segcoord.clear();
tricoord.clear();
......@@ -282,6 +285,7 @@ int ObjectCollection::read(int step) {
double r, m;
hf >> r >> m;
radius.push_back(r);
mass.push_back(m);
fixed.push_back(false);
}
else if (type == "D") {
......@@ -289,6 +293,7 @@ int ObjectCollection::read(int step) {
double r;
hf >> r >> tag;
radius.push_back(r);
mass.push_back(0);
fixed.push_back(true);
}
else if (type == "S"){
......@@ -497,7 +502,7 @@ void ObjectCollection::start_ffmpeg(const std::string filename)
int xywh[4];
glGetIntegerv(GL_VIEWPORT, xywh);
std::ostringstream oss;
oss << "ffmpeg -r 30 -f rawvideo -pix_fmt rgba -s " << xywh[2] << "x"
oss << "ffmpeg -r 10 -f rawvideo -pix_fmt rgba -s " << xywh[2] << "x"
<< xywh[3] << " -i - -y -vf vflip " << filename;
_ffmpeg = popen(oss.str().c_str(), "w");
}
......
......@@ -8,6 +8,7 @@
class ObjectCollection {
std::vector<float> radius, coordorig;
std::vector<float> mass;
std::vector<bool> fixed;
std::vector<float> coord, segcoord, tricoord;
std::vector<float> circleGeom;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment