Commit 6822922f authored by Deike Kleberg's avatar Deike Kleberg
Browse files

pioNamepaceInit/pioNamespaceCleanup

parent 489cefc4
......@@ -71,7 +71,7 @@ void modelRun ()
double levs[nlev] = {101300, 92500, 85000, 50000, 20000};
double var[nlon*nlat*nlev];
namespaceInit ( 1, hasLocalFile );
pioNamespaceInit ( 1, hasLocalFile );
gridID = gridCreate(GRID_LONLAT, nlon*nlat);
gridDefXsize(gridID, nlon);
......@@ -129,7 +129,9 @@ void modelRun ()
vlistDestroy(vlistID);
taxisDestroy(taxisID);
zaxisDestroy(zaxisID);
gridDestroy(gridID);
gridDestroy(gridID);
pioNamespaceCleanup ();
}
......
......@@ -187,9 +187,9 @@ void modelRun ()
int bufferSize, differ;
MPI_Status status;
namespaceInit ( 2, hasLocalFile );
pioNamespaceInit ( 2, hasLocalFile );
namespaceSetActive ( 0 );
pioNamespaceSetActive ( 0 );
gridID = defineGrid ();
zaxisID = defineZaxis ();
......@@ -207,7 +207,7 @@ void modelRun ()
xmpi ( MPI_Recv ( recvBuffer, bufferSize, MPI_PACKED, 0,
0, MPI_COMM_WORLD, &status ));
namespaceSetActive ( 1 );
pioNamespaceSetActive ( 1 );
rpcUnpackResources ( recvBuffer, bufferSize, MPI_COMM_WORLD );
free ( recvBuffer );
reshPackBufferDestroy ( &sendBuffer );
......@@ -216,8 +216,9 @@ void modelRun ()
printf ( "The resource arrays %s.\n", differ ? "differ" : "are equal" );
reshArrayPrint ( "reshArrayModel" );
namespaceSetActive ( 0 );
pioNamespaceSetActive ( 0 );
streamClose(streamID);
pioNamespaceCleanup ();
return;
}
......
......@@ -211,8 +211,12 @@ int pioInit ( int, int, int );
void pioFinalize ( void );
void pioMetadata ( int, int * );
void namespaceInit ( int, int * );
void namespaceSetActive ( int );
void namespaceInit ( int, int * );//to delete
void namespaceSetActive ( int );//to delete
void pioNamespaceInit ( int, int * );
void pioNamespaceCleanup ( void );
void pioNamespaceSetActive ( int );
void gridGetIndexArray ( int, int * );
void streamGetIndexArray ( int, int * );
......
......@@ -66,7 +66,7 @@ namespaceTuple_t namespaceResHDecode ( int resH )
return tin;
}
// to delete
void namespaceInit ( int nspn, int * argHasLocalFile )
{
int i;
......@@ -82,7 +82,22 @@ void namespaceInit ( int nspn, int * argHasLocalFile )
}
void namespaceCleanup ( void )
void pioNamespaceInit ( int nspn, int * argHasLocalFile )
{
int i;
assert(nspn <= NUM_NAMESPACES && nspn >= 1 );
nNamespaces = nspn;
if ( nspn >= 1 )
{
hasLocalFile = xmalloc ( nspn * sizeof ( int ));
for ( i = 0; i < nspn; i++ )
hasLocalFile[i] = argHasLocalFile[i];
}
}
void pioNamespaceCleanup ( void )
{
if ( nNamespaces > 1 ) free ( hasLocalFile );
}
......@@ -103,6 +118,12 @@ void namespaceSetActive ( int nId )
}
void pioNamespaceSetActive ( int nId )
{
namespaceSetActive ( nId );
}
int namespaceGetActive ()
{
return activeNamespace;
......
......@@ -14,7 +14,6 @@ int namespaceIdxEncode ( namespaceTuple_t );
int namespaceIdxEncode2 ( int, int );
namespaceTuple_t namespaceResHDecode ( int );
int namespaceHasLocalFile ( int );
void namespaceCleanup ( void );
int namespaceAdaptKey ( int, int );
int namespaceAdaptKey2 ( int );
......
......@@ -87,7 +87,6 @@ MPI_Comm pioInit_c ( MPI_Comm comm, int nIOP, int mode )
{
IOServer ( commModel, mode );
commsIOCleanup ();
namespaceCleanup ();
MPI_Finalize ();
exit ( 0 );
}
......@@ -437,8 +436,6 @@ void pioFinalize ()
MPI_Send ( &ibuffer, 1, MPI_INT, nProcsCalc, FINALIZE, *( commsIO + i ));
commsIOCleanup ();
namespaceCleanup ();
#endif
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment