File: ptop.c

package info (click to toggle)
scalapack 1.6-13
  • links: PTS
  • area: main
  • in suites: potato
  • size: 30,476 kB
  • ctags: 25,789
  • sloc: fortran: 296,718; ansic: 51,265; makefile: 1,541; sh: 4
file content (110 lines) | stat: -rw-r--r-- 2,200 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#include "tools.h"

/* ---------------------------------------------------------------------
*
*  -- PBLAS routine (version 1.5) --
*     University of Tennessee, Knoxville, Oak Ridge National Laboratory,
*     and University of California, Berkeley.
*     March 17, 1995
*
*  ---------------------------------------------------------------------
*/

char * ptop( op, scope, top )
/*
*  .. Scalar Arguments ..
*/
   char        * op, * scope, * top;
{
/*
*  Purpose
*  =======
*
*  ptop get or set the row, column or all broadcast or combine
*  topologies.
*
*  =====================================================================
*
*  .. Local Scalars ..
*/
   static char rowbtop = ' ';         /* Default broadcast topologies */
   static char colbtop = ' ';
   static char allbtop = ' ';

   static char rowctop = ' ';           /* Default combine topologies */
   static char colctop = ' ';
   static char allctop = ' ';

   if( *op == 'B' )
   {
      if( *top == '!' )
      {
         if( *scope == 'R' )
         {
            return &rowbtop;
         }
         else if( *scope == 'C' )
         {
            return &colbtop;
         }
         else
         {
            return &allbtop;
         }
      }
      else
      {
         if( *scope == 'R' )
         {
            rowbtop = *top;
            return &rowbtop;
         }
         else if( *scope == 'C' )
         {
            colbtop = *top;
            return &colbtop;
         }
         else
         {
            allbtop = *top;
            return &allbtop;
         }
      }
   }
   else
   {
      if( *top == '!' )
      {
         if( *scope == 'R' )
         {
            return &rowctop;
         }
         else if( *scope == 'C' )
         {
            return &colctop;
         }
         else
         {
            return &allctop;
         }
      }
      else
      {
         if( *scope == 'R' )
         {
            rowctop = *top;
            return &rowctop;
         }
         else if( *scope == 'C' )
         {
            colctop = *top;
            return &colctop;
         }
         else
         {
            allctop = *top;
            return &allctop;
         }
      }
   }
}