SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
PB_Ctop.c
Go to the documentation of this file.
1/* ---------------------------------------------------------------------
2*
3* -- PBLAS auxiliary routine (version 2.0) --
4* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
5* and University of California, Berkeley.
6* April 1, 1998
7*
8* ---------------------------------------------------------------------
9*/
10/*
11* Include files
12*/
13#include "../pblas.h"
14#include "../PBpblas.h"
15#include "../PBtools.h"
16#include "../PBblacs.h"
17#include "../PBblas.h"
18
19#ifdef __STDC__
20char * PB_Ctop( Int * ICTXT, char * OP, char * SCOPE, char * TOP )
21#else
22char * PB_Ctop( ICTXT, OP, SCOPE, TOP )
23/*
24* .. Scalar Arguments ..
25*/
26 Int * ICTXT;
27/*
28* .. Array Arguments ..
29*/
30 char * OP, * SCOPE, * TOP;
31#endif
32{
33/*
34* Purpose
35* =======
36*
37* PB_Ctop returns or initializes the row-, column- or all- broadcast
38* or combine topologies.
39*
40* Arguments
41* =========
42*
43* ICTXT (local input) INTEGER
44* On entry, ICTXT specifies the BLACS context handle, indica-
45* ting the global context of the operation. The context itself
46* is global, but the value of ICTXT is local.
47*
48* OP (global input) pointer to CHAR
49* On input, OP specifies the BLACS operation defined as fol-
50* lows:
51* OP = 'B' or 'b', BLACS broadcast operation,
52* OP = 'C' or 'c', BLACS combine operation.
53*
54* SCOPE (global input) pointer to CHAR
55* On entry, SCOPE specifies the scope of the BLACS operation as
56* follows:
57* SCOPE = 'R' or 'r', rowwise broadcast or combine,
58* SCOPE = 'C' or 'c', column broadcast or combine,
59* SCOPE = 'A' or 'a', all broadcast or combine.
60*
61* TOP (global input) pointer to CHAR
62* On entry, TOP is a character string specifying the BLACS to-
63* pology to be used i.e. to be set for the given operation spe-
64* cified by OP and SCOPE. If TOP = TOP_GET, the routine instead
65* returns the current topology in use for the given operation
66* specified by OP and SCOPE.
67*
68* -- Written on April 1, 1998 by
69* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
70*
71* ---------------------------------------------------------------------
72*/
73/*
74* .. Local Scalars ..
75*/
76 static char rbtop = CTOP_DEFAULT;
77 static char cbtop = CTOP_DEFAULT;
78 static char abtop = CTOP_DEFAULT;
79 static char rctop = CTOP_DEFAULT;
80 static char cctop = CTOP_DEFAULT;
81 static char actop = CTOP_DEFAULT;
82/* ..
83* .. Executable Statements ..
84*
85*/
86/*
87* This BLACS topology information should be cached within a BLACS context.
88* This will be corrected in the near future. Sorry.
89*/
90 if( *OP == CBCAST )
91 {
92/*
93* BLACS broadcast operations
94*/
95 if( *TOP == CTOP_GET )
96 {
97/*
98* retrieve the current topology in SCOPE
99*/
100 if( *SCOPE == CROW ) { return( &rbtop ); }
101 else if( *SCOPE == CCOLUMN ) { return( &cbtop ); }
102 else { return( &abtop ); }
103 }
104 else
105 {
106/*
107* set the topology to be used from now on in SCOPE
108*/
109 if( *SCOPE == CROW ) { rbtop = *TOP; return( &rbtop ); }
110 else if( *SCOPE == CCOLUMN ) { cbtop = *TOP; return( &cbtop ); }
111 else { abtop = *TOP; return( &abtop ); }
112 }
113 }
114 else
115 {
116/*
117* BLACS combine operations
118*/
119 if( *TOP == CTOP_GET )
120 {
121/*
122* retrieve the current topology in SCOPE
123*/
124 if( *SCOPE == CROW ) { return( &rctop ); }
125 else if( *SCOPE == CCOLUMN ) { return( &cctop ); }
126 else { return( &actop ); }
127 }
128 else
129 {
130/*
131* set the topology to be used from now on in SCOPE
132*/
133 if( *SCOPE == CROW ) { rctop = *TOP; return( &rctop ); }
134 else if( *SCOPE == CCOLUMN ) { cctop = *TOP; return( &cctop ); }
135 else { actop = *TOP; return( &actop ); }
136 }
137 }
138/*
139* End of PB_Ctop
140*/
141}
#define Int
Definition Bconfig.h:22
#define CCOLUMN
Definition PBblacs.h:20
#define CROW
Definition PBblacs.h:21
#define CTOP_DEFAULT
Definition PBblacs.h:26
#define CTOP_GET
Definition PBblacs.h:25
#define CBCAST
Definition PBblacs.h:23
char * PB_Ctop()