OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
getpbbuf.c File Reference
#include "tools.h"

Go to the source code of this file.

Functions

char * getpbbuf (char *mess, Int length)

Function Documentation

◆ getpbbuf()

char * getpbbuf ( char * mess,
Int length )

Definition at line 3 of file getpbbuf.c.

4{
5/*
6* Purpose
7* =======
8*
9* getpbbuf returns a pointer to a working buffer of size length alloca-
10* ted for the PBLAS routines.
11*
12* ======================================================================
13*
14* .. Local Scalars ..
15*/
16 static char * pblasbuf = NULL;
17 static Int pbbuflen = 0, mone = -1;
18/* ..
19* .. External Functions ..
20*/
21 void blacs_abort_();
22/* ..
23* .. Executable Statements ..
24*/
25 if( length >= 0 )
26 {
27 if( length > pbbuflen )
28 {
29 if( pblasbuf )
30 free( pblasbuf );
31 pblasbuf = (char *) malloc((unsigned)length);
32 if( !pblasbuf )
33 {
34 fprintf( stderr,
35 "PBLAS %s ERROR: Memory allocation failed\n",
36 mess );
37 blacs_abort_( &mone, &mone );
38 }
39 pbbuflen = length;
40 }
41 }
42 else if( pblasbuf )
43 {
44 free( pblasbuf );
45 pblasbuf = NULL;
46 pbbuflen = 0;
47 }
48 return( pblasbuf );
49}
#define Int
Definition Bconfig.h:22
F_VOID_FUNC blacs_abort_(Int *ConTxt, Int *ErrNo)
Definition blacs_abort_.c:6