/home/kcamus/qaas_runs/169-443-9681/intel/AMG/build/AMG/AMG/parcsr_ls/par_lr_interp.c: 1393 - 1748
--------------------------------------------------------------------------------

1393:          for (i = start+1; i <= stop; i++)
[...]
1469:        for (i = start; i < stop; i++)
1470:        {
1471:          jj_begin_row = P_diag_i[i];        
1472:          jj_begin_row_offd = P_offd_i[i];
1473:          jj_counter = jj_begin_row;
1474:          jj_counter_offd = jj_begin_row_offd;
[...]
1480:          if (CF_marker[i] >= 0)
1481:          {
1482:            P_diag_j[jj_counter]    = fine_to_coarse[i];
1483:            P_diag_data[jj_counter] = one;
[...]
1491:          else if (CF_marker[i] != -3)
1492:          {
1493:            strong_f_marker--;
1494:            for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++)
[...]
1503:              if (CF_marker[i1] >= 0)
1504:              {
1505:                if (P_marker[i1] < jj_begin_row)
1506:                {
1507:                  P_marker[i1] = jj_counter;
1508:                  P_diag_j[jj_counter]    = fine_to_coarse[i1];
1509:                  P_diag_data[jj_counter] = zero;
1510:                  jj_counter++;
1511:                }
1512:              }
1513:              else  if (CF_marker[i1] != -3)
1514:              {
1515:                P_marker[i1] = strong_f_marker;
1516:                for (kk = S_diag_i[i1]; kk < S_diag_i[i1+1]; kk++)
1517:                {
1518:                  k1 = S_diag_j[kk];
1519:                  if (CF_marker[k1] >= 0)
1520:                  {
1521:                    if(P_marker[k1] < jj_begin_row)
1522:                    {
1523:                      P_marker[k1] = jj_counter;
1524:                      P_diag_j[jj_counter] = fine_to_coarse[k1];
1525:                      P_diag_data[jj_counter] = zero;
1526:                      jj_counter++;
1527:                    }
1528:                  }
1529:                }
1530:                if(num_procs > 1)
1531:                {
1532:                  for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++)
1533:                  {
1534:                    if(col_offd_S_to_A)
1535:                     k1 = col_offd_S_to_A[S_offd_j[kk]];
1536:                    else
1537:                     k1 = S_offd_j[kk];
1538:                    if(CF_marker_offd[k1] >= 0)
1539:                    {
1540:                      if(P_marker_offd[k1] < jj_begin_row_offd)
1541:                      {
1542:                        P_marker_offd[k1] = jj_counter_offd;
1543:                        P_offd_j[jj_counter_offd] = k1;
1544:                        P_offd_data[jj_counter_offd] = zero;
1545:                        jj_counter_offd++;
[...]
1553:            if ( num_procs > 1)
1554:            {
1555:              for (jj=S_offd_i[i]; jj < S_offd_i[i+1]; jj++)
1556:              {
1557:                i1 = S_offd_j[jj];
1558:                if(col_offd_S_to_A)
1559:                  i1 = col_offd_S_to_A[i1];
1560:                if ( CF_marker_offd[i1] >= 0)
1561:                {
1562:                  if(P_marker_offd[i1] < jj_begin_row_offd)
1563:                  {
1564:                    P_marker_offd[i1] = jj_counter_offd;
1565:                    P_offd_j[jj_counter_offd] = i1;
1566:                    P_offd_data[jj_counter_offd] = zero;
1567:                    jj_counter_offd++;
1568:                  }
1569:                }
1570:                else if (CF_marker_offd[i1] != -3)
1571:                {
1572:                  P_marker_offd[i1] = strong_f_marker;
1573:                  for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++)
1574:                  {
1575:                    k1 = Sop_j[kk];
1576:                    /* Find local col number */
1577:                    if(k1 >= col_1 && k1 < col_n)
1578:                    {
1579:                      loc_col = k1-col_1;
1580:                      if(P_marker[loc_col] < jj_begin_row)
1581:                      {
1582:                        P_marker[loc_col] = jj_counter;
1583:                        P_diag_j[jj_counter] = fine_to_coarse[loc_col];
1584:                        P_diag_data[jj_counter] = zero;
1585:                        jj_counter++;
1586:                      }
1587:                    }
1588:                    else
1589:                    { 
1590:                      loc_col = -k1 - 1;
1591:                      if(P_marker_offd[loc_col] < jj_begin_row_offd)
1592:                      {
1593:                        P_marker_offd[loc_col] = jj_counter_offd;
1594:                        P_offd_j[jj_counter_offd]=loc_col;
1595:                        P_offd_data[jj_counter_offd] = zero;
1596:                        jj_counter_offd++;
[...]
1607:            diagonal = A_diag_data[A_diag_i[i]];
1608:            
1609:            for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++)
1610:            { /* i1 is a c-point and strongly influences i, accumulate
1611:               * a_(i,i1) into interpolation weight */
1612:              i1 = A_diag_j[jj];
1613:              if (P_marker[i1] >= jj_begin_row)
1614:              {
1615:                P_diag_data[P_marker[i1]] += A_diag_data[jj];
1616:              }
1617:              else if(P_marker[i1] == strong_f_marker)
1618:              {
1619:                sum = zero;
1620:                sgn = 1;
1621:                if(A_diag_data[A_diag_i[i1]] < 0) sgn = -1;
1622:                /* Loop over row of A for point i1 and calculate the sum
1623:                 * of the connections to c-points that strongly influence i. */
1624:                for(jj1 = A_diag_i[i1]+1; jj1 < A_diag_i[i1+1]; jj1++)
1625:                {
1626:                  i2 = A_diag_j[jj1];
1627:                  if((P_marker[i2] >= jj_begin_row || i2 == i) && (sgn*A_diag_data[jj1]) < 0)
1628:                    sum += A_diag_data[jj1];
1629:                }
1630:                if(num_procs > 1)
1631:                {
1632:                  for(jj1 = A_offd_i[i1]; jj1< A_offd_i[i1+1]; jj1++)
1633:                  {
1634:                    i2 = A_offd_j[jj1];
1635:                    if(P_marker_offd[i2] >= jj_begin_row_offd &&
1636:                       (sgn*A_offd_data[jj1]) < 0)
1637:                       sum += A_offd_data[jj1];
1638:                  }
1639:                }
1640:                if(sum != 0)
1641:                {
1642:                  distribute = A_diag_data[jj]/sum;
1643:                  /* Loop over row of A for point i1 and do the distribution */
1644:                  for(jj1 = A_diag_i[i1]+1; jj1 < A_diag_i[i1+1]; jj1++)
1645:                  {
1646:                    i2 = A_diag_j[jj1];
1647:                    if(P_marker[i2] >= jj_begin_row && (sgn*A_diag_data[jj1]) < 0)
1648:                       P_diag_data[P_marker[i2]] += 
1649:                       distribute*A_diag_data[jj1];
1650:                        if(i2 == i && (sgn*A_diag_data[jj1]) < 0)
1651:                          diagonal += distribute*A_diag_data[jj1];
1652:                  }
1653:                  if(num_procs > 1)
1654:                  {
1655:                    for(jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++)
1656:                    {
1657:                      i2 = A_offd_j[jj1];
1658:                      if(P_marker_offd[i2] >= jj_begin_row_offd &&
1659:                                 (sgn*A_offd_data[jj1]) < 0)
1660:                        P_offd_data[P_marker_offd[i2]] +=
[...]
1667:                  diagonal += A_diag_data[jj];
1668:                }
1669:              }
1670:              /* neighbor i1 weakly influences i, accumulate a_(i,i1) into
1671:               * diagonal */
1672:              else if (CF_marker[i1] != -3)
1673:              {
1674:                if(num_functions == 1 || dof_func[i] == dof_func[i1])
1675:                  diagonal += A_diag_data[jj];
1676:              }
1677:            }
1678:            if(num_procs > 1)
1679:            {
1680:              for(jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++)
1681:              {
1682:                i1 = A_offd_j[jj];
1683:                if(P_marker_offd[i1] >= jj_begin_row_offd)
1684:                  P_offd_data[P_marker_offd[i1]] += A_offd_data[jj];
1685:                else if(P_marker_offd[i1] == strong_f_marker)
1686:                {
1687:                  sum = zero;
1688:                  for(jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++)
1689:                  {
1690:                    k1 = A_ext_j[jj1];
1691:                    if(k1 >= col_1 && k1 < col_n)
1692:                    { /* diag */
1693:                      loc_col = k1 - col_1;
1694:                      if(P_marker[loc_col] >= jj_begin_row || loc_col == i)
1695:                        sum += A_ext_data[jj1];
1696:                    }
1697:                    else
1698:                    { 
1699:                      loc_col = -k1 - 1;
1700:                      if(P_marker_offd[loc_col] >= jj_begin_row_offd)
1701:                        sum += A_ext_data[jj1];
1702:                    }
1703:                  }
1704:                  if(sum != 0)
1705:                  {
1706:                    distribute = A_offd_data[jj] / sum;
1707:                    for(jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++)
1708:                    {
1709:                      k1 = A_ext_j[jj1];
1710:                      if(k1 >= col_1 && k1 < col_n)
1711:                      { /* diag */
1712:                        loc_col = k1 - col_1;
1713:                        if(P_marker[loc_col] >= jj_begin_row)
1714:                          P_diag_data[P_marker[loc_col]] += distribute*
1715:                           A_ext_data[jj1];
1716:                                if(loc_col == i)
1717:                                  diagonal += distribute*A_ext_data[jj1];
1718:                      }
1719:                      else
1720:                      { 
1721:                        loc_col = -k1 - 1;
1722:                        if(P_marker_offd[loc_col] >= jj_begin_row_offd)
1723:                          P_offd_data[P_marker_offd[loc_col]] += distribute*
[...]
1730:                    diagonal += A_offd_data[jj];
1731:                  }
1732:                }
1733:                else if (CF_marker_offd[i1] != -3)
1734:                {
1735:                  if(num_functions == 1 || dof_func[i] == dof_func_offd[i1])
1736:                    diagonal += A_offd_data[jj];
1737:                }
1738:              }
1739:            }
1740:            if (diagonal)
1741:            {
1742:              for(jj = jj_begin_row; jj < jj_end_row; jj++)
1743:                 P_diag_data[jj] /= -diagonal;
1744:              for(jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++)
1745:                 P_offd_data[jj] /= -diagonal;
1746:            }
1747:          }
1748:          strong_f_marker--;
