OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
psgemr2.c File Reference
#include "redist.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>

Go to the source code of this file.

Data Structures

struct  MDESC
struct  IDESC

Macros

#define static2   static
#define fortran_mr2d   psgemr2do
#define fortran_mr2dnew   psgemr2d
#define scopy_   scopy
#define slacpy_   slacpy
#define Clacpy   Csgelacpy
#define BLOCK_CYCLIC_2D   1
#define SHIFT(row, sprow, nbrow)
#define max(A, B)
#define min(A, B)
#define DIVUP(a, b)
#define ROUNDUP(a, b)
#define scanD0   sgescanD0
#define dispmat   sgedispmat
#define setmemory   sgesetmemory
#define freememory   sgefreememory
#define scan_intervals   sgescan_intervals
#define SENDBUFF   0
#define RECVBUFF   1
#define SIZEBUFF   2
#define NDEBUG

Functions

void Cblacs_pcoord ()
Int Cblacs_pnum ()
void Csetpvmtids ()
void Cblacs_get ()
void Cblacs_pinfo ()
void Cblacs_gridinfo ()
void Cblacs_gridinit ()
void Cblacs_exit ()
void Cblacs_gridexit ()
void Cblacs_setup ()
void Cigebs2d ()
void Cigebr2d ()
void Cigesd2d ()
void Cigerv2d ()
void Cigsum2d ()
void Cigamn2d ()
void Cigamx2d ()
void Csgesd2d ()
void Csgerv2d ()
Int localindice ()
void * mr2d_malloc ()
Int ppcm ()
Int localsize ()
Int memoryblocksize ()
Int changeorigin ()
void paramcheck ()
void Cpsgemr2do ()
void Cpsgemr2d ()
void setmemory (float **adpointer, Int blocksize)
void freememory (float *ptrtobefreed)
Int scan_intervals (char type, Int ja, Int jb, Int n, MDESC *ma, MDESC *mb, Int q0, Int q1, Int col0, Int col1, IDESC *result)

Macro Definition Documentation

◆ BLOCK_CYCLIC_2D

#define BLOCK_CYCLIC_2D   1

Definition at line 36 of file psgemr2.c.

◆ Clacpy

#define Clacpy   Csgelacpy

Definition at line 23 of file psgemr2.c.

◆ dispmat

#define dispmat   sgedispmat

Definition at line 83 of file psgemr2.c.

◆ DIVUP

#define DIVUP ( a,
b )
Value:
( ((a)-1) /(b)+1)

Definition at line 44 of file psgemr2.c.

◆ fortran_mr2d

#define fortran_mr2d   psgemr2do

Definition at line 18 of file psgemr2.c.

◆ fortran_mr2dnew

#define fortran_mr2dnew   psgemr2d

Definition at line 19 of file psgemr2.c.

◆ freememory

#define freememory   sgefreememory

Definition at line 85 of file psgemr2.c.

◆ max

#define max ( A,
B )
Value:
((A)>(B)?(A):(B))

Definition at line 42 of file psgemr2.c.

◆ min

#define min ( A,
B )
Value:
((A)>(B)?(B):(A))

Definition at line 43 of file psgemr2.c.

◆ NDEBUG

#define NDEBUG

Definition at line 102 of file psgemr2.c.

◆ RECVBUFF

#define RECVBUFF   1

Definition at line 96 of file psgemr2.c.

◆ ROUNDUP

#define ROUNDUP ( a,
b )
Value:
(DIVUP(a,b)*(b))
#define DIVUP(a, b)
Definition pcgemr.c:182

Definition at line 45 of file psgemr2.c.

◆ scan_intervals

#define scan_intervals   sgescan_intervals

Definition at line 86 of file psgemr2.c.

◆ scanD0

#define scanD0   sgescanD0

Definition at line 82 of file psgemr2.c.

◆ scopy_

#define scopy_   scopy

Definition at line 20 of file psgemr2.c.

◆ SENDBUFF

#define SENDBUFF   0

Definition at line 95 of file psgemr2.c.

◆ setmemory

#define setmemory   sgesetmemory

Definition at line 84 of file psgemr2.c.

◆ SHIFT

#define SHIFT ( row,
sprow,
nbrow )
Value:
((row)-(sprow)+ ((row) >= (sprow) ? 0 : (nbrow)))

Definition at line 41 of file psgemr2.c.

◆ SIZEBUFF

#define SIZEBUFF   2

Definition at line 97 of file psgemr2.c.

◆ slacpy_

#define slacpy_   slacpy

Definition at line 21 of file psgemr2.c.

◆ static2

#define static2   static

Definition at line 8 of file psgemr2.c.

Function Documentation

◆ Cblacs_exit()

void Cblacs_exit ( )
extern

◆ Cblacs_get()

void Cblacs_get ( )
extern

◆ Cblacs_gridexit()

void Cblacs_gridexit ( )
extern

◆ Cblacs_gridinfo()

void Cblacs_gridinfo ( )
extern

◆ Cblacs_gridinit()

void Cblacs_gridinit ( )
extern

◆ Cblacs_pcoord()

void Cblacs_pcoord ( )
extern

◆ Cblacs_pinfo()

void Cblacs_pinfo ( )
extern

◆ Cblacs_pnum()

Int Cblacs_pnum ( )
extern

◆ Cblacs_setup()

void Cblacs_setup ( )
extern

◆ changeorigin()

Int changeorigin ( )
extern

◆ Cigamn2d()

void Cigamn2d ( )
extern

◆ Cigamx2d()

void Cigamx2d ( )
extern

◆ Cigebr2d()

void Cigebr2d ( )
extern

◆ Cigebs2d()

void Cigebs2d ( )
extern

◆ Cigerv2d()

void Cigerv2d ( )
extern

◆ Cigesd2d()

void Cigesd2d ( )
extern

◆ Cigsum2d()

void Cigsum2d ( )
extern

◆ Cpsgemr2d()

void Cpsgemr2d ( )
extern

◆ Cpsgemr2do()

void Cpsgemr2do ( )
extern

◆ Csetpvmtids()

void Csetpvmtids ( )
extern

◆ Csgerv2d()

void Csgerv2d ( )
extern

◆ Csgesd2d()

void Csgesd2d ( )
extern

◆ freememory()

void freememory ( float * ptrtobefreed)

Definition at line 126 of file psgemr2.c.

127{
128 if (ptrtobefreed == NULL)
129 return;
130 free((char *) ptrtobefreed);
131}

◆ localindice()

Int localindice ( )
extern

◆ localsize()

Int localsize ( )
extern

◆ memoryblocksize()

Int memoryblocksize ( )
extern

◆ mr2d_malloc()

void * mr2d_malloc ( )
extern

◆ paramcheck()

void paramcheck ( )
extern

◆ ppcm()

Int ppcm ( )
extern

◆ scan_intervals()

Int scan_intervals ( char type,
Int ja,
Int jb,
Int n,
MDESC * ma,
MDESC * mb,
Int q0,
Int q1,
Int col0,
Int col1,
IDESC * result )

Definition at line 138 of file psgemr2.c.

144{
145 Int offset, j0, j1, templatewidth0, templatewidth1, nbcol0, nbcol1;
146 Int l; /* local indice on the beginning of the interval */
147 assert(type == 'c' || type == 'r');
148 nbcol0 = (type == 'c' ? ma->nbcol : ma->nbrow);
149 nbcol1 = (type == 'c' ? mb->nbcol : mb->nbrow);
150 templatewidth0 = q0 * nbcol0;
151 templatewidth1 = q1 * nbcol1;
152 {
153 Int sp0 = (type == 'c' ? ma->spcol : ma->sprow);
154 Int sp1 = (type == 'c' ? mb->spcol : mb->sprow);
155 j0 = SHIFT(col0, sp0, q0) * nbcol0 - ja;
156 j1 = SHIFT(col1, sp1, q1) * nbcol1 - jb;
157 }
158 offset = 0;
159 l = 0;
160 /* a small check to verify that the submatrix begin inside the first block
161 * of the original matrix, this done by a sort of coordinate change at the
162 * beginning of the Cpsgemr2d */
163 assert(j0 + nbcol0 > 0);
164 assert(j1 + nbcol1 > 0);
165 while ((j0 < n) && (j1 < n)) {
166 Int end0, end1;
167 Int start, end;
168 end0 = j0 + nbcol0;
169 end1 = j1 + nbcol1;
170 if (end0 <= j1) {
171 j0 += templatewidth0;
172 l += nbcol0;
173 continue;
174 }
175 if (end1 <= j0) {
176 j1 += templatewidth1;
177 continue;
178 }
179 /* compute the raw intersection */
180 start = max(j0, j1);
181 start = max(start, 0);
182 /* the start is correct now, update the corresponding fields */
183 result[offset].lstart = l + start - j0;
184 end = min(end0, end1);
185 if (end0 == end) {
186 j0 += templatewidth0;
187 l += nbcol0;
188 }
189 if (end1 == end)
190 j1 += templatewidth1;
191 /* throw the limit if they go out of the matrix */
192 end = min(end, n);
193 assert(end > start);
194 /* it is a bit tricky to see why the length is always positive after all
195 * this min and max, first we have the property that every interval
196 * considered is at least partly into the submatrix, second we arrive
197 * here only if the raw intersection is non-void, if we remove a limit
198 * that means the corresponding frontier is in both intervals which
199 * proove the final interval is non-void, clear ?? */
200 result[offset].len = end - start;
201 offset += 1;
202 } /* while */
203 return offset;
204}
#define Int
Definition Bconfig.h:22
end[inform, rinform, sol, inst, schur, redrhs, pivnul_list, sym_perm, uns_perm, icntl, cntl, colsca_out, rowsca_out, keep_out, dkeep_out]
Definition dmumps.m:40
integer, dimension(:), allocatable offset
Definition rad2r.F:53
#define SHIFT(row, sprow, nbrow)
Definition psgemr2.c:41
#define max(A, B)
Definition psgemr2.c:42
#define min(A, B)
Definition psgemr2.c:43
n
Int lstart
Definition pcgemr.c:176
Int len
Definition pcgemr.c:177
Int spcol
Definition pcgemr.c:171
Int nbcol
Definition pcgemr.c:169
Int sprow
Definition pcgemr.c:170
Int nbrow
Definition pcgemr.c:168

◆ setmemory()

void setmemory ( float ** adpointer,
Int blocksize )

Definition at line 113 of file psgemr2.c.

114{
115 assert(blocksize >= 0);
116 if (blocksize == 0) {
117 *adpointer = NULL;
118 return;
119 }
120 *adpointer = (float *) mr2d_malloc(
121 blocksize * sizeof(float));
122}
void * mr2d_malloc()