FORTRAN_API int FORT_CALL nfmpi_put_vars_real_all_ ( int *v1, int *v2, MPI_Offset v3[], MPI_Offset v4[], MPI_Offset v5[], float*v6 ){
    int ierr;
    int l2 = *v2 - 1;
    MPI_Offset *l3 = 0;
    MPI_Offset *l4 = 0;
    MPI_Offset *l5 = 0;

    { int ln = ncmpixVardim(*v1,*v2-1);
    if (ln > 0) {
        int li;
        l3 = (MPI_Offset *)malloc( ln * sizeof(MPI_Offset) );
        for (li=0; li<ln; li++) 
            l3[li] = v3[ln-1-li] - 1;
    }
    else if (ln < 0) {
        /* Error return */
        ierr = ln; 
	return ierr;
    }
    }

    { int ln = ncmpixVardim(*v1,*v2-1);
    if (ln > 0) {
        int li;
        l4 = (MPI_Offset *)malloc( ln * sizeof(MPI_Offset) );
        for (li=0; li<ln; li++) 
            l4[li] = v4[ln-1-li];
    }
    else if (ln < 0) {
        /* Error return */
        ierr = ln; 
	return ierr;
    }
    }

    { int ln = ncmpixVardim(*v1,*v2-1);
    if (ln > 0) {
        int li;
        l5 = (MPI_Offset *)malloc( ln * sizeof(MPI_Offset) );
        for (li=0; li<ln; li++) 
            l5[li] = v5[ln-1-li];
    }
    else if (ln < 0) {
        /* Error return */
        ierr = ln; 
	return ierr;
    }
    }
    ierr = ncmpi_put_vars_float_all( *v1, l2, l3, l4, l5, v6 );

    if (l3) { free(l3); }

    if (l4) { free(l4); }

    if (l5) { free(l5); }
    return ierr;
}
Exemple #2
0
void
ITLRandomField::_DumpRandomSamples2NetCdf
(
 const int iRandomVariable
		)
{
  for(int b = 0; b < IGetNrOfBlocks(); b++)
    {
      const CBlock& cBlock = this->CGetBlock(b);
      int iNrOfCells = 1;
      for(int d = 0; d < CBlock::MAX_DIM; d++)
	iNrOfCells *= cBlock.piDimLengths[d];

      TBuffer<float> pfTemp;
      pfTemp.alloc(iNrOfCells);

	  #ifndef WITH_PNETCDF	// ADD-BY-LEETEN 09/01/2011
      size_t puStart[6];
      size_t puCount[6];

      // ADD-BY-LEETEN 09/01/2011-BEGIN
      #else	// #ifndef WITH_PNETCDF
      MPI_Offset puStart[6];
      MPI_Offset puCount[6];
      MPI_Offset puStride[6];
      for(int d = 0; d < sizeof(puStride)/sizeof(puStride[0]); d ++)
    	  puStride[d] = 1;
	  #endif	// #ifndef WITH_PNETCDF
      // ADD-BY-LEETEN 09/01/2011-END

      // time
      puStart[0] = this->IGetNrOfTimeStamps() - 1;
      puCount[0] = 1;

      // block
	  #ifndef WITH_PNETCDF	// ADD-BY-LEETEN 09/01/2011
      puStart[1] = (size_t)b;
      // ADD-BY-LEETEN 09/01/2011-BEGIN
      #else	// #ifndef WITH_PNETCDF
      puStart[1] = (size_t)CGetBlock(b).iGlobalId;
	  #endif	// #ifndef WITH_PNETCDF
      // ADD-BY-LEETEN 09/01/2011-END
      puCount[1] = 1;

      for(int d = 0; d < CBlock::MAX_DIM; d++)
	{
	  puStart[2+d] = 0;
	  puCount[2+d] = (size_t)cBlock.piDimLengths[CBlock::MAX_DIM - 1 - d];
	}

      _CollectRandomSamplesInBlock(b, iRandomVariable, &pfTemp[0], true);


		#ifndef	WITH_PNETCDF	// ADD-BY-LEETEN 08/12/2011
      ASSERT_NETCDF(nc_put_vara_float(
				      iNcId,
				      CGetRandomVariable(iRandomVariable).iVarId,
				      puStart,
				      puCount,
				      &pfTemp[0]));
		// ADD-BY-LEETEN 08/12/2011-BEGIN
		#else	// #ifndef	WITH_PNETCDF
      	// MOD-BY-LEETEN 09/01/2011-FROM:
			// LOG_ERROR(fprintf(stderr, "PNetCDF is not fully supported yet."))
		// TO:
		ASSERT_NETCDF(ncmpi_put_vars_float_all(
					  iNcId,
					  CGetRandomVariable(iRandomVariable).iVarId,
					  puStart,
					  puCount,
					  puStride,
					  &pfTemp[0]));
		// MOD-BY-LEETEN 09/01/2011-END
		#endif	// #ifndef	WITH_PNETCDF
		// ADD-BY-LEETEN 08/12/2011-END
    }
}