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

modif to sum point values

parent d1ec78bb
No related branches found
No related tags found
No related merge requests found
...@@ -77,7 +77,8 @@ PView *GMSH_IntegratePlugin::execute(PView * v) ...@@ -77,7 +77,8 @@ PView *GMSH_IntegratePlugin::execute(PView * v)
List_Add(data2->SP, &y); List_Add(data2->SP, &y);
List_Add(data2->SP, &z); List_Add(data2->SP, &z);
for(int step = 0; step < data1->getNumTimeSteps(); step++){ for(int step = 0; step < data1->getNumTimeSteps(); step++){
double res = 0; double res = 0, resv[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
bool simpleSum = false;
for(int ent = 0; ent < data1->getNumEntities(step); ent++){ for(int ent = 0; ent < data1->getNumEntities(step); ent++){
for(int ele = 0; ele < data1->getNumElements(step, ent); ele++){ for(int ele = 0; ele < data1->getNumElements(step, ent); ele++){
if(data1->skipElement(step, ent, ele)) continue; if(data1->skipElement(step, ent, ele)) continue;
...@@ -86,7 +87,7 @@ PView *GMSH_IntegratePlugin::execute(PView * v) ...@@ -86,7 +87,7 @@ PView *GMSH_IntegratePlugin::execute(PView * v)
bool scalar = (numComp == 1); bool scalar = (numComp == 1);
bool circulation = (numComp == 3 && numEdges == 1); bool circulation = (numComp == 3 && numEdges == 1);
bool flux = (numComp == 3 && (numEdges == 3 || numEdges == 4)); bool flux = (numComp == 3 && (numEdges == 3 || numEdges == 4));
if(!scalar && !circulation && !flux) continue; //if(!scalar && !circulation && !flux) continue;
int numNodes = data1->getNumNodes(step, ent, ele); int numNodes = data1->getNumNodes(step, ent, ele);
int dim = data1->getDimension(step, ent, ele); int dim = data1->getDimension(step, ent, ele);
double x[8], y[8], z[8], val[8 * 3]; double x[8], y[8], z[8], val[8 * 3];
...@@ -95,19 +96,31 @@ PView *GMSH_IntegratePlugin::execute(PView * v) ...@@ -95,19 +96,31 @@ PView *GMSH_IntegratePlugin::execute(PView * v)
for(int comp = 0; comp < numComp; comp++) for(int comp = 0; comp < numComp; comp++)
data1->getValue(step, ent, ele, nod, comp, val[numComp * nod + comp]); data1->getValue(step, ent, ele, nod, comp, val[numComp * nod + comp]);
} }
elementFactory factory; if(numNodes == 1){
element *element = factory.create(numNodes, dim, x, y, z); simpleSum = true;
if(!element) continue; for(int comp = 0; comp < numComp; comp++)
if(scalar) resv[comp] += val[comp];
res += element->integrate(val); }
else if(circulation) else{
res += element->integrateCirculation(val); elementFactory factory;
else if(flux) element *element = factory.create(numNodes, dim, x, y, z);
res += element->integrateFlux(val); if(!element) continue;
delete element; if(scalar)
res += element->integrate(val);
else if(circulation)
res += element->integrateCirculation(val);
else if(flux)
res += element->integrateFlux(val);
delete element;
}
} }
} }
Msg::Info("Step %d: integral = %.16g", step, res); if(simpleSum)
Msg::Info("Step %d: sum = %g %g %g %g %g %g %g %g %g", step, resv[0],
resv[1], resv[2], resv[3], resv[4], resv[5], resv[6], resv[7],
resv[8], resv[9]);
else
Msg::Info("Step %d: integral = %.16g", step, res);
List_Add(data2->SP, &res); List_Add(data2->SP, &res);
} }
data2->NbSP = 1; data2->NbSP = 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment