parallel getminmax

This commit is contained in:
Joachim Schoeberl 2013-07-09 20:52:59 +00:00
parent b5d914880a
commit c68278cd67

View File

@ -2380,6 +2380,9 @@ namespace netgen
void VisualSceneSolution :: void VisualSceneSolution ::
GetMinMax (int funcnr, int comp, double & minv, double & maxv) const GetMinMax (int funcnr, int comp, double & minv, double & maxv) const
{ {
static int timer1 = NgProfiler::CreateTimer ("getminmax, vol");
static int timer2 = NgProfiler::CreateTimer ("getminmax, surf");
#ifdef PARALLEL #ifdef PARALLEL
if (id == 0) if (id == 0)
{ {
@ -2403,10 +2406,14 @@ namespace netgen
if (sol->draw_volume) if (sol->draw_volume)
{ {
NgProfiler::RegionTimer reg1 (timer1);
int ne = mesh->GetNE(); int ne = mesh->GetNE();
#pragma omp parallel for
for (int i = 0; i < ne; i++) for (int i = 0; i < ne; i++)
{ {
bool considerElem = GetValue (sol, i, 0.333, 0.333, 0.333, comp, val); bool considerElem = GetValue (sol, i, 0.333, 0.333, 0.333, comp, val);
#pragma omp critical(getminmaxvol)
if (considerElem) if (considerElem)
{ {
if (val > maxv || !hasit) maxv = val; if (val > maxv || !hasit) maxv = val;
@ -2417,6 +2424,8 @@ namespace netgen
} }
if (sol->draw_surface) if (sol->draw_surface)
{ {
NgProfiler::RegionTimer reg2 (timer2);
int nse = mesh->GetNSE(); int nse = mesh->GetNSE();
for (int i = 0; i < nse; i++) for (int i = 0; i < nse; i++)
{ {