Skip to content
Snippets Groups Projects
Commit 20c49b11 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

enable 2d graphs for high order line datasets

parent 1a74194b
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,7 @@ void drawContext::drawText2d() ...@@ -51,7 +51,7 @@ void drawContext::drawText2d()
static bool getGraphData(PView *p, std::vector<double> &x, double &xmin, static bool getGraphData(PView *p, std::vector<double> &x, double &xmin,
double &xmax, std::vector<std::vector<double> > &y) double &xmax, std::vector<std::vector<double> > &y)
{ {
PViewData *data = p->getData(); PViewData *data = p->getData(true); // use adaptive data if available
PViewOptions *opt = p->getOptions(); PViewOptions *opt = p->getOptions();
if(data->hasMultipleMeshes()) return false; // cannot handle multi-mesh if(data->hasMultipleMeshes()) return false; // cannot handle multi-mesh
...@@ -80,13 +80,25 @@ static bool getGraphData(PView *p, std::vector<double> &x, double &xmin, ...@@ -80,13 +80,25 @@ static bool getGraphData(PView *p, std::vector<double> &x, double &xmin,
int dim = data->getDimension(0, ent, i); int dim = data->getDimension(0, ent, i);
if(dim < 2){ if(dim < 2){
int numNodes = data->getNumNodes(0, ent, i); int numNodes = data->getNumNodes(0, ent, i);
// reorder the nodes for high order line elements
std::vector<int> reorder(numNodes);
if(numNodes < 3){
for(int j = 0; j < numNodes; j++)
reorder[j] = j;
}
else{
reorder[0] = 0;
reorder[numNodes - 1] = 1;
for(int j = 1; j < numNodes - 1; j++)
reorder[j] = 1 + j;
}
for(int ts = space ? opt->timeStep : 0; ts < opt->timeStep + 1; ts++){ for(int ts = space ? opt->timeStep : 0; ts < opt->timeStep + 1; ts++){
int numComp = data->getNumComponents(ts, ent, i); int numComp = data->getNumComponents(ts, ent, i);
for(int j = 0; j < numNodes; j++){ for(int j = 0; j < numNodes; j++){
double val[9], xyz[3]; double val[9], xyz[3];
data->getNode(ts, ent, i, j, xyz[0], xyz[1], xyz[2]); data->getNode(ts, ent, i, reorder[j], xyz[0], xyz[1], xyz[2]);
for(int k = 0; k < numComp; k++) for(int k = 0; k < numComp; k++)
data->getValue(ts, ent, i, j, k, val[k]); data->getValue(ts, ent, i, reorder[j], k, val[k]);
double vy = ComputeScalarRep(numComp, val); double vy = ComputeScalarRep(numComp, val);
if(space){ if(space){
// store offset to origin + distance to first point // store offset to origin + distance to first point
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment