ScaLAPACK  2.0.2
ScaLAPACK: Scalable Linear Algebra PACKage
blacs_grid_.c
Go to the documentation of this file.
00001 #include "Bdef.h"
00002 
00003 #if (INTFACE == C_CALL)
00004 void Cblacs_gridexit(int ConTxt)
00005 #else
00006 F_VOID_FUNC blacs_gridexit_(int *ConTxt)
00007 #endif
00008 {
00009    int i;
00010    BLACSCONTEXT *ctxt;
00011    extern int BI_MaxNCtxt;
00012    extern BLACSCONTEXT **BI_MyContxts;
00013 
00014    if ( (Mpval(ConTxt) < 0) || (Mpval(ConTxt) >= BI_MaxNCtxt) )
00015       BI_BlacsErr(Mpval(ConTxt), __LINE__, __FILE__,
00016                   "Trying to exit non-existent context");
00017 
00018    if (BI_MyContxts[Mpval(ConTxt)] == NULL)
00019       BI_BlacsErr(Mpval(ConTxt), __LINE__, __FILE__,
00020                   "Trying to exit an already freed context");
00021 
00022    MGetConTxt(Mpval(ConTxt), ctxt);
00023 /*
00024  * Destroy context
00025  */
00026    MPI_Comm_free(&ctxt->pscp.comm);
00027    MPI_Comm_free(&ctxt->ascp.comm);
00028    MPI_Comm_free(&ctxt->rscp.comm);
00029    MPI_Comm_free(&ctxt->cscp.comm);
00030    free(ctxt);
00031    BI_MyContxts[Mpval(ConTxt)] = NULL;
00032 }