Commit c7b07c41 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Rename nspTarget parameters to originNamespace.

* Because it holds the namespace the unpacked resource comes from.
parent d209e89d
......@@ -747,7 +747,7 @@ streamPack(void * streamptr, void * packBuffer, int packBufferSize,
struct streamAssoc
streamUnpack(char * unpackBuffer, int unpackBufferSize,
int * unpackBufferPos, int nspTarget, void *context)
int * unpackBufferPos, int originNamespace, void *context)
{
int intBuffer[streamNint], streamID;
uint32_t d;
......@@ -768,7 +768,7 @@ streamUnpack(char * unpackBuffer, int unpackBufferSize,
xassert(d == cdiCheckSum(DATATYPE_TXT, intBuffer[2], filename));
streamID = streamOpenWrite ( filename, intBuffer[1] );
xassert ( streamID >= 0 &&
namespaceAdaptKey ( intBuffer[0], nspTarget ) == streamID );
namespaceAdaptKey ( intBuffer[0], originNamespace ) == streamID );
streamDefByteorder(streamID, intBuffer[5]);
streamDefCompType(streamID, intBuffer[6]);
streamDefCompLevel(streamID, intBuffer[7]);
......
......@@ -347,7 +347,7 @@ struct streamAssoc
struct streamAssoc
streamUnpack(char * unpackBuffer, int unpackBufferSize,
int * unpackBufferPos, int nspTarget, void *context);
int * unpackBufferPos, int originNamespace, void *context);
int
cdiStreamOpenDefaultDelegate(const char *filename, const char *filemode,
......
......@@ -4528,7 +4528,7 @@ gridGetPackSize(void * voidP, void *context)
void
gridUnpack(char * unpackBuffer, int unpackBufferSize,
int * unpackBufferPos, int nspTarget, void *context,
int * unpackBufferPos, int originNamespace, void *context,
int force_id)
{
grid_t * gridP;
......@@ -4546,7 +4546,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
&d, 1, DATATYPE_UINT32, context);
xassert(cdiCheckSum(DATATYPE_INT, gridNint, intBuffer) == d);
int targetID = namespaceAdaptKey(intBuffer[0], nspTarget);
int targetID = namespaceAdaptKey(intBuffer[0], originNamespace);
gridP = gridNewEntry(force_id?targetID:CDI_UNDEFID);
xassert(!force_id || targetID == gridP->self);
......
......@@ -89,7 +89,7 @@ void gridGetIndexList( int, int * );
void
gridUnpack(char * unpackBuffer, int unpackBufferSize,
int * unpackBufferPos, int nspTarget, void *context,
int * unpackBufferPos, int originNamespace, void *context,
int force_id);
#endif
......
......@@ -340,7 +340,7 @@ static void institutePackP(void * instituteptr, void *buf, int size, int *positi
serializePack(p->longname, tempbuf[4], DATATYPE_TXT, buf, size, position, context);
}
int instituteUnpack(void *buf, int size, int *position, int nspTarget,
int instituteUnpack(void *buf, int size, int *position, int originNamespace,
void *context, int force_id)
{
int tempbuf[institute_nints];
......@@ -351,7 +351,7 @@ int instituteUnpack(void *buf, int size, int *position, int nspTarget,
longname = name + tempbuf[3];
serializeUnpack(buf, size, position, name, tempbuf[3], DATATYPE_TXT, context);
serializeUnpack(buf, size, position, longname, tempbuf[4], DATATYPE_TXT, context);
int targetID = namespaceAdaptKey(tempbuf[0], nspTarget);
int targetID = namespaceAdaptKey(tempbuf[0], originNamespace);
institute_t *ip = instituteNewEntry(force_id?targetID:CDI_UNDEFID,
tempbuf[1], tempbuf[2], name, longname);
instituteID = ip->self;
......
......@@ -2,7 +2,7 @@
#define INSTITUTION_H
int
instituteUnpack(void *buf, int size, int *position, int nspTarget,
instituteUnpack(void *buf, int size, int *position, int originNamespace,
void *context, int force_id);
void instituteDefaultEntries(void);
......
......@@ -313,7 +313,7 @@ static void modelPackP(void * modelptr, void * buf, int size, int *position, voi
}
int
modelUnpack(void *buf, int size, int *position, int nspTarget, void *context,
modelUnpack(void *buf, int size, int *position, int originNamespace, void *context,
int force_id)
{
int tempbuf[model_nints];
......@@ -328,13 +328,14 @@ modelUnpack(void *buf, int size, int *position, int nspTarget, void *context,
{
name = "";
}
int targetID = namespaceAdaptKey(tempbuf[0], nspTarget);
int targetID = namespaceAdaptKey(tempbuf[0], originNamespace);
model_t *mp = modelNewEntry(force_id?targetID:CDI_UNDEFID,
namespaceAdaptKey(tempbuf[1], nspTarget),
namespaceAdaptKey(tempbuf[1], originNamespace),
tempbuf[2], name);
if (tempbuf[3] != 0)
free(name);
xassert(!force_id || (mp->self == namespaceAdaptKey(tempbuf[0], nspTarget)));
xassert(!force_id
|| (mp->self == namespaceAdaptKey(tempbuf[0], originNamespace)));
return mp->self;
}
......
......@@ -3,7 +3,7 @@
int
modelUnpack(void *buf, int size, int *position,
int nspTarget, void *context, int force_id);
int originNamespace, void *context, int force_id);
void modelDefaultEntries(void);
......
......@@ -267,17 +267,17 @@ int namespaceGetActive ()
return activeNamespace;
}
int namespaceAdaptKey ( int key, int nspTarget )
int namespaceAdaptKey ( int originResH, int originNamespace )
{
namespaceTuple_t tin;
int nsp;
if ( key == CDI_UNDEFID ) return CDI_UNDEFID;
if ( originResH == CDI_UNDEFID ) return CDI_UNDEFID;
tin.idx = key & idxmask;
tin.nsp = (int)(((unsigned)( key & nspmask )) >> idxbits);
tin.idx = originResH & idxmask;
tin.nsp = (int)(((unsigned)( originResH & nspmask )) >> idxbits);
xassert ( tin.nsp == nspTarget );
xassert ( tin.nsp == originNamespace );
nsp = namespaceGetActive ();
......@@ -285,15 +285,15 @@ int namespaceAdaptKey ( int key, int nspTarget )
}
int namespaceAdaptKey2 ( int key )
int namespaceAdaptKey2 ( int originResH )
{
namespaceTuple_t tin;
int nsp;
if ( key == CDI_UNDEFID ) return CDI_UNDEFID;
if ( originResH == CDI_UNDEFID ) return CDI_UNDEFID;
tin.idx = key & idxmask;
tin.nsp = (int)(((unsigned)( key & nspmask )) >> idxbits);
tin.idx = originResH & idxmask;
tin.nsp = (int)(((unsigned)( originResH & nspmask )) >> idxbits);
nsp = namespaceGetActive ();
......
......@@ -65,7 +65,7 @@ int namespaceGetActive ( void );
int namespaceIdxEncode ( namespaceTuple_t );
int namespaceIdxEncode2 ( int, int );
namespaceTuple_t namespaceResHDecode ( int );
int namespaceAdaptKey ( int, int );
int namespaceAdaptKey ( int originResH, int originNamespace);
int namespaceAdaptKey2 ( int );
void namespaceDefResStatus ( statusCode );
statusCode namespaceInqResStatus ( void );
......
......@@ -236,14 +236,14 @@ readFuncCall(struct winHeaderEntry *header)
{
MPI_Comm commCalc = commInqCommCalc ();
int streamID = funcArgs->streamNewTimestep.streamID;
int nspTarget = namespaceResHDecode(streamID).nsp;
int originNamespace = namespaceResHDecode(streamID).nsp;
streamID = namespaceAdaptKey2(streamID);
int oldTaxisID
= vlistInqTaxis(streamInqVlist(streamID));
int position = header->offset;
int changedTaxisID
= taxisUnpack((char *)rxWin[root].buffer, (int)rxWin[root].size,
&position, nspTarget, &commCalc, 0);
&position, originNamespace, &commCalc, 0);
taxis_t *oldTaxisPtr = taxisPtr(oldTaxisID);
taxis_t *changedTaxisPtr = taxisPtr(changedTaxisID);
ptaxisCopy(oldTaxisPtr, changedTaxisPtr);
......
......@@ -20,7 +20,7 @@
void reshUnpackResources(char * unpackBuffer, int unpackBufferSize,
void *context)
{
int token1, token2, nspTarget;
int token1, token2, originNamespace;
int unpackBufferPos = 0;
int numAssociations = 0, sizeAssociations = 16;
struct streamAssoc *associations
......@@ -37,27 +37,27 @@ void reshUnpackResources(char * unpackBuffer, int unpackBufferSize,
{
case START:
serializeUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
&nspTarget, 1, DATATYPE_INT, context);
&originNamespace, 1, DATATYPE_INT, context);
break;
case GRID:
gridUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
nspTarget, context, 1);
originNamespace, context, 1);
break;
case ZAXIS:
zaxisUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
nspTarget, context, 1);
originNamespace, context, 1);
break;
case TAXIS:
taxisUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
nspTarget, context, 1);
originNamespace, context, 1);
break;
case INSTITUTE:
instituteUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
nspTarget, context, 1);
originNamespace, context, 1);
break;
case MODEL:
modelUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
nspTarget, context, 1);
originNamespace, context, 1);
break;
case STREAM:
if (sizeAssociations == numAssociations)
......@@ -66,12 +66,12 @@ void reshUnpackResources(char * unpackBuffer, int unpackBufferSize,
sizeof (associations[0]) * (sizeAssociations *= 2));
associations[numAssociations]
= streamUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
nspTarget, context);
originNamespace, context);
++numAssociations;
break;
case VLIST:
vlistUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
nspTarget, context, 1);
originNamespace, context, 1);
break;
default:
xabort ( "TOKEN MAPS NO VALID DATATYPE" );
......@@ -85,9 +85,9 @@ void reshUnpackResources(char * unpackBuffer, int unpackBufferSize,
{
cdiStreamSetupVlist(stream_to_pointer(associations[i].streamID),
namespaceAdaptKey(associations[i].vlistID,
nspTarget),
originNamespace),
namespaceAdaptKey(associations[i].vlistIDorig,
nspTarget));
originNamespace));
}
free(associations);
}
......
......@@ -1467,7 +1467,7 @@ taxisGetPackSize(void *p, void *context)
int
taxisUnpack(char * unpackBuffer, int unpackBufferSize, int * unpackBufferPos,
int nspTarget, void *context, int force_id)
int originNamespace, void *context, int force_id)
{
taxis_t * taxisP;
int intBuffer[taxisNint];
......@@ -1483,7 +1483,7 @@ taxisUnpack(char * unpackBuffer, int unpackBufferSize, int * unpackBufferPos,
taxisInit();
cdiResH targetID = namespaceAdaptKey(intBuffer[idx++], nspTarget);
cdiResH targetID = namespaceAdaptKey(intBuffer[idx++], originNamespace);
taxisP = taxisNewEntry(force_id?targetID:CDI_UNDEFID);
xassert(!force_id || targetID == taxisP->self);
......
......@@ -44,8 +44,8 @@ extern const resOps taxisOps;
#endif
int
taxisUnpack(char* unpackBuffer, int unpackBufferSize, int* unpackBufferPos,
int nspTarget, void* context, int checkForSameID);
taxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos,
int originNamespace, void *context, int checkForSameID);
#endif /* _TAXIS_H */
/*
......
......@@ -1742,23 +1742,23 @@ void vlistPackP ( void * vlistptr, void * buf, int size, int *position,
}
}
void vlistUnpack(char * buf, int size, int *position, int nspTarget,
void vlistUnpack(char * buf, int size, int *position, int originNamespace,
void *context, int force_id)
{
int tempbuf[vlist_nints];
serializeUnpack(buf, size, position, tempbuf, vlist_nints, DATATYPE_INT, context);
int targetID = namespaceAdaptKey(tempbuf[0], nspTarget);
int targetID = namespaceAdaptKey(tempbuf[0], originNamespace);
vlist_t *p = vlist_new_entry(force_id?targetID:CDI_UNDEFID);
xassert(!force_id || p->self == targetID);
if (!force_id)
targetID = p->self;
p->taxisID = namespaceAdaptKey(tempbuf[3], nspTarget);
p->taxisID = namespaceAdaptKey(tempbuf[3], originNamespace);
p->tableID = tempbuf[4];
p->instID = namespaceAdaptKey(tempbuf[5], nspTarget);
p->modelID = namespaceAdaptKey(tempbuf[6], nspTarget);
p->instID = namespaceAdaptKey(tempbuf[5], originNamespace);
p->modelID = namespaceAdaptKey(tempbuf[6], originNamespace);
vlistAttsUnpack(targetID, CDI_GLOBAL, buf, size, position, context);
for (int varID = 0; varID < tempbuf[1]; varID++ )
vlistVarUnpack(targetID, buf, size, position, nspTarget, context);
vlistVarUnpack(targetID, buf, size, position, originNamespace, context);
}
/*
......
......@@ -155,8 +155,8 @@ int vlistHasTime(int vlistID);
int vlistDelAtts(int vlistID, int varID);
int vlistCopyVarAtts(int vlistID1, int varID_1, int vlistID2, int varID_2);
void vlistUnpack(char * buffer, int bufferSize, int * pos, int nspTarget,
void *context, int force_id);
void vlistUnpack(char * buffer, int bufferSize, int * pos,
int originNamespace, void *context, int force_id);
/* vlistDefVarValidrange: Define the valid range of a Variable */
void vlistDefVarValidrange(int vlistID, int varID, const double *validrange);
......
......@@ -2255,7 +2255,7 @@ imax(int a, int b)
void vlistVarUnpack(int vlistID, char * buf, int size, int *position,
int nspTarget, void *context)
int originNamespace, void *context)
{
double dtempbuf[vlistvar_ndbls];
int tempbuf[vlistvar_nints];
......@@ -2268,8 +2268,8 @@ void vlistVarUnpack(int vlistID, char * buf, int size, int *position,
dtempbuf, vlistvar_ndbls, DATATYPE_FLT64, context);
newvar = vlistDefVar ( vlistID,
namespaceAdaptKey ( tempbuf[1], nspTarget ),
namespaceAdaptKey ( tempbuf[2], nspTarget ),
namespaceAdaptKey ( tempbuf[1], originNamespace ),
namespaceAdaptKey ( tempbuf[2], originNamespace ),
tempbuf[3]);
if (tempbuf[4] || tempbuf[5] || tempbuf[6] || tempbuf[7])
varname = (char*) xmalloc(imax(imax(imax(tempbuf[4],tempbuf[5]),tempbuf[6]),
......@@ -2305,9 +2305,9 @@ void vlistVarUnpack(int vlistID, char * buf, int size, int *position,
if ( varname ) free ( varname );
vlistDefVarDatatype(vlistID, newvar, tempbuf[8]);
vlistDefVarInstitut ( vlistID, newvar,
namespaceAdaptKey ( tempbuf[10], nspTarget ));
namespaceAdaptKey ( tempbuf[10], originNamespace ));
vlistDefVarModel ( vlistID, newvar,
namespaceAdaptKey ( tempbuf[11], nspTarget ));
namespaceAdaptKey ( tempbuf[11], originNamespace ));
vlistDefVarTable(vlistID, newvar, tempbuf[12]);
/* FIXME: changing the table might change the param code */
vlistDefVarParam(vlistID, newvar, tempbuf[9]);
......
......@@ -1694,7 +1694,7 @@ zaxisGetPackSize(void * voidP, void *context)
void
zaxisUnpack(char * unpackBuffer, int unpackBufferSize,
int * unpackBufferPos, int nspTarget, void *context,
int * unpackBufferPos, int originNamespace, void *context,
int force_id)
{
zaxis_t * zaxisP;
......@@ -1712,7 +1712,7 @@ zaxisUnpack(char * unpackBuffer, int unpackBufferSize,
zaxisInit();
zaxisP = zaxisNewEntry(force_id?
namespaceAdaptKey(intBuffer[0], nspTarget)
namespaceAdaptKey(intBuffer[0], originNamespace)
:CDI_UNDEFID);
zaxisP->prec = intBuffer[1];
......
......@@ -5,7 +5,7 @@ int zaxisSize(void);
void
zaxisUnpack(char * unpackBuffer, int unpackBufferSize,
int * unpackBufferPos, int nspTarget, void *context,
int * unpackBufferPos, int originNamespace, void *context,
int force_id);
#endif
Markdown is supported
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