MCPcopy Create free account
hub / github.com/boutproject/BOUT-dev / N_VMaxNorm

Function N_VMaxNorm

externalpackages/PVODE/source/nvector.cpp:438–470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436
437
438real N_VMaxNorm(N_Vector x)
439{
440 integer N;
441 real max = ZERO, *xd, gmax;
442 machEnvType machenv;
443
444 N = x->length;
445 xd = x->data;
446 machenv = x->machEnv;
447
448#ifndef _OPENMP
449 for (integer i=0; i < N; i++, xd++) {
450 if (ABS(*xd) > max) max = ABS(*xd);
451 }
452#else
453 #pragma omp parallel
454 {
455 real max2 = ZERO;
456 #pragma omp for nowait
457 for (integer i=0; i < N; i++) {
458 if (ABS(xd[i]) > max2)
459 max2 = ABS(xd[i]);
460 }
461 #pragma omp critical
462 {
463 if(max2 > max)
464 max = max2;
465 }
466 }
467#endif
468 gmax = PVecAllReduce(max, 2, machenv);
469 return(gmax);
470}
471
472
473real N_VWrmsNorm(N_Vector x, N_Vector w)

Callers 1

CVUpperBoundH0Function · 0.85

Calls 1

PVecAllReduceFunction · 0.85

Tested by

no test coverage detected