Esempio n. 1
0
void
cmdpkt_beacontimerinterrupt_819xusb(
	struct net_device *dev
)
{
	struct r8192_priv *priv = ieee80211_priv(dev);
	u16 tx_rate;
	{
		//
		// 070117, rcnjko: 87B have to S/W beacon for DTM encryption_cmn.
		//
		if(priv->ieee80211->current_network.mode == IEEE_A  ||
			priv->ieee80211->current_network.mode == IEEE_N_5G ||
			(priv->ieee80211->current_network.mode == IEEE_N_24G  && (!priv->ieee80211->pHTInfo->bCurSuppCCK)))
		{
			tx_rate = 60;
			DMESG("send beacon frame  tx rate is 6Mbpm\n");
		}
		else
		{
			tx_rate =10;
			DMESG("send beacon frame  tx rate is 1Mbpm\n");
		}

		rtl819xusb_beacon_tx(dev,tx_rate); // HW Beacon

	}

}
Esempio n. 2
0
static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg)
{
	struct cmpk_intr_sta rx_intr_status;
	struct r8192_priv *priv = rtllib_priv(dev);

	DMESG("---> cmpk_Handle_Interrupt_Status()\n");

	rx_intr_status.length = pmsg[1];
	if (rx_intr_status.length != (sizeof(struct cmpk_intr_sta) - 2)) {
		DMESG("cmpk_Handle_Interrupt_Status: wrong length!\n");
		return;
	}

	if (priv->rtllib->iw_mode == IW_MODE_ADHOC) {
		rx_intr_status.interrupt_status = *((u32 *)(pmsg + 4));

		DMESG("interrupt status = 0x%x\n",
		      rx_intr_status.interrupt_status);

		if (rx_intr_status.interrupt_status & ISR_TxBcnOk) {
			priv->rtllib->bibsscoordinator = true;
			priv->stats.txbeaconokint++;
		} else if (rx_intr_status.interrupt_status & ISR_TxBcnErr) {
			priv->rtllib->bibsscoordinator = false;
			priv->stats.txbeaconerr++;
		}

		if (rx_intr_status.interrupt_status & ISR_BcnTimerIntr)
			cmdpkt_beacontimerinterrupt_819xusb(dev);
	}

	DMESG("<---- cmpk_handle_interrupt_status()\n");

}
Esempio n. 3
0
/*-----------------------------------------------------------------------------
 * Function:    cmpk_handle_interrupt_status()
 *
 * Overview:    The function is responsible for extract the message from
 *				firmware. It will contain dedicated info in
 *				ws-07-0063-v06-rtl819x-command-packet-specification-070315.doc.
 * 				Please refer to chapter "Interrupt Status Element".
 *
 * Input:       struct net_device *dev,
 *			u8*	pmsg		-	Message Pointer of the command packet.
 *
 * Output:      NONE
 *
 * Return:      NONE
 *
 * Revised History:
 *  When			Who			Remark
 *  05/12/2008	amy		Add this for rtl8192 porting from windows code.
 *
 *---------------------------------------------------------------------------*/
static	void
cmpk_handle_interrupt_status(
	struct net_device *dev,
	u8*	pmsg)
{
	cmpk_intr_sta_t		rx_intr_status;	/* */
	struct r8192_priv *priv = ieee80211_priv(dev);

	DMESG("---> cmpk_Handle_Interrupt_Status()\n");

	/* 0. Display received message. */
	//cmpk_Display_Message(CMPK_RX_BEACON_STATE_SIZE, pMsg);

	/* 1. Extract TX feedback info from RFD to temp structure buffer. */
	/* It seems that FW use big endian(MIPS) and DRV use little endian in
	   windows OS. So we have to read the content byte by byte or transfer
	   endian type before copy the message copy. */
	//rx_bcn_state.Element_ID 	= pMsg[0];
	//rx_bcn_state.Length 		= pMsg[1];
	rx_intr_status.length = pmsg[1];
	if (rx_intr_status.length != (sizeof(cmpk_intr_sta_t) - 2))
	{
		DMESG("cmpk_Handle_Interrupt_Status: wrong length!\n");
		return;
	}


	// Statistics of beacon for ad-hoc mode.
	if(	priv->ieee80211->iw_mode == IW_MODE_ADHOC)
	{
		//2 maybe need endian transform?
		rx_intr_status.interrupt_status = *((u32 *)(pmsg + 4));
		//rx_intr_status.InterruptStatus = N2H4BYTE(*((UINT32 *)(pMsg + 4)));

		DMESG("interrupt status = 0x%x\n", rx_intr_status.interrupt_status);

		if (rx_intr_status.interrupt_status & ISR_TxBcnOk)
		{
			priv->ieee80211->bibsscoordinator = true;
			priv->stats.txbeaconokint++;
		}
		else if (rx_intr_status.interrupt_status & ISR_TxBcnErr)
		{
			priv->ieee80211->bibsscoordinator = false;
			priv->stats.txbeaconerr++;
		}

		if (rx_intr_status.interrupt_status & ISR_BcnTimerIntr)
		{
			cmdpkt_beacontimerinterrupt_819xusb(dev);
		}

	}

	 // Other informations in interrupt status we need?


	DMESG("<---- cmpk_handle_interrupt_status()\n");

}	/* cmpk_handle_interrupt_status */
Esempio n. 4
0
static int r8180_wx_set_retry(struct net_device *dev,
                              struct iw_request_info *info,
                              union iwreq_data *wrqu, char *extra)
{
    struct r8180_priv *priv = ieee80211_priv(dev);
    int err = 0;

    if (priv->ieee80211->bHwRadioOff)
        return 0;

    down(&priv->wx_sem);

    if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
            wrqu->retry.disabled)	{
        err = -EINVAL;
        goto exit;
    }
    if (!(wrqu->retry.flags & IW_RETRY_LIMIT))	{
        err = -EINVAL;
        goto exit;
    }

    if (wrqu->retry.value > R8180_MAX_RETRY)	{
        err = -EINVAL;
        goto exit;
    }
    if (wrqu->retry.flags & IW_RETRY_MAX) {
        priv->retry_rts = wrqu->retry.value;
        DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);

    }	else {
        priv->retry_data = wrqu->retry.value;
        DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
    }

    /* FIXME !
     * We might try to write directly the TX config register
     * or to restart just the (R)TX process.
     * I'm unsure if whole reset is really needed
     */

    rtl8180_commit(dev);
    /*
    if(priv->up){
    	rtl8180_rtx_disable(dev);
    	rtl8180_rx_enable(dev);
    	rtl8180_tx_enable(dev);

    }
    */
exit:
    up(&priv->wx_sem);

    return err;
}
Esempio n. 5
0
static void cmdpkt_beacontimerinterrupt_819xusb(struct net_device *dev)
{
	struct r8192_priv *priv = rtllib_priv(dev);

	if ((priv->rtllib->current_network.mode == IEEE_A)  ||
	    (priv->rtllib->current_network.mode == IEEE_N_5G) ||
	    ((priv->rtllib->current_network.mode == IEEE_N_24G)  &&
	    (!priv->rtllib->pHTInfo->bCurSuppCCK)))
		DMESG("send beacon frame  tx rate is 6Mbpm\n");
	else
		DMESG("send beacon frame  tx rate is 1Mbpm\n");
}
Esempio n. 6
0
static int r8192_wx_set_crcmon(struct net_device *dev,
			       struct iw_request_info *info,
			       union iwreq_data *wrqu, char *extra)
{
	struct r8192_priv *priv = ieee80211_priv(dev);
	int *parms = (int *)extra;
	int enable = (parms[0] > 0);
	short prev = priv->crcmon;

	down(&priv->wx_sem);

	if(enable)
		priv->crcmon=1;
	else
		priv->crcmon=0;

	DMESG("bad CRC in monitor mode are %s",
	      priv->crcmon ? "accepted" : "rejected");

	if(prev != priv->crcmon && priv->up){
		//rtl8180_down(dev);
		//rtl8180_up(dev);
	}

	up(&priv->wx_sem);

	return 0;
}
Esempio n. 7
0
int r8180_wx_set_key(struct net_device *dev, struct iw_request_info *info, 
		     union iwreq_data *wrqu, char *key)
{
	struct r8180_priv *priv = ieee80211_priv(dev);
	struct iw_point *erq = &(wrqu->encoding);	

	if (erq->flags & IW_ENCODE_DISABLED) {
	}
	
	
/*	i = erq->flags & IW_ENCODE_INDEX;
	if (i < 1 || i > 4)
*/	
	
	if (erq->length > 0) {

		//int len = erq->length <= 5 ? 5 : 13;
		
		u32* tkey= (u32*) key;
		priv->key0[0] = tkey[0];
		priv->key0[1] = tkey[1];
		priv->key0[2] = tkey[2];
		priv->key0[3] = tkey[3] &0xff;
		DMESG("Setting wep key to %x %x %x %x", 
		      tkey[0],tkey[1],tkey[2],tkey[3]);
		rtl8180_set_hw_wep(dev);
	}
	return 0;
}
Esempio n. 8
0
void VlasovAux::solve(std::string equation_type, Fields *fields, CComplex *f_in, CComplex *f_out, double dt, int rk_step, const double rk[3]) 
{

  // do I need both, we can stick to e-m ? Speed penality ?
  
  if(equation_type == "ES")

      Vlasov_ES   ((A6zz) f_in, (A6zz) f_out     , (A6zz) f0, (A6zz) f, 
                   (A6zz) ft , (A6zz) Coll, (A6zz) fields->Field, 
                   (A3zz) nonLinearTerm, X, V, M, dt, rk_step, rk);

  else if(equation_type == "EM")

      Vlasov_EM   ((A6zz) f_in, (A6zz) f_out, (A6zz) f0, (A6zz) f,
                   (A6zz) ft, (A6zz) Coll, (A6zz) fields->Field, (A3zz) nonLinearTerm,
                   (A4zz) Xi, (A4zz) G, dt, rk_step, rk);

  else if(equation_type == "Landau_Damping")
    
      Landau_Damping((A6zz) f_in, (A6zz) f_out, (A6zz) f0, (A6zz) f, 
                     (A6zz) ft , (A6zz) fields->Field, 
                      X, V, M, dt, rk_step, rk);
  
  else   check(-1, DMESG("No Such Equation"));

  return;
}
Esempio n. 9
0
int SQLAccessFactory::MakeSQLExecuteFactoryRequest(std::string &dran
                     , std::string &command
                     , SQLExecuteFactoryRequest **req)
{
  SQLExecuteFactoryRequest*  seReq 
     = soap_new__wsdair__SQLExecuteFactoryRequest(&soap,-1);
  *req = seReq;

  seReq->wsdair__SQLExpression = soap_new_wsdair__SQLExpressionType(&soap, -1) ;
  seReq->wsdair__SQLExpression->Expression = command ;
  seReq->wsdai__DataResourceAbstractName = dran;

  DMESG("DRAN : " << seReq->wsdai__DataResourceAbstractName << endl);
  DMESG("EXPR : " << seReq->wsdair__SQLExpression->Expression << endl);

  return SOAP_OK;
}
Esempio n. 10
0
File: FileIO.cpp Progetto: xyuan/gkc
    // Destructor
    FileIO::~FileIO()  {
       // Free all HDF5 resources
       /* End access to the dataset and release resources used by it. */
       // if(asciiOutput == true) asciiOutputFile.close();

     // close some extra stuff
     check( H5Tclose(complex_tid),   DMESG("H5Tclose"));
     check( H5Tclose(timing_tid),   DMESG("H5Tclose"));
     check( H5Tclose(species_tid),  DMESG("H5Tclose"));
     check( H5Tclose(s256_tid),     DMESG("H5Tclose"));
    
     
     // close file
     check( H5Fclose(file) , DMESG("Unable to close file ..."));

     delete cfl_table;

}
Esempio n. 11
0
Array2c Analysis::getSpectrum(unsigned int dir) {
       Array2c spectrum;
       if     (dir == SPEC_XZ)  spectrum.reference(spectrumXZ);
       else if(dir == SPEC_YZ)  spectrum.reference(spectrumXZ);
       else if(dir == SPEC_XY)  spectrum.reference(spectrumXY);
       else   check(-1, DMESG("No such direction for get spectrum"));
    
       return spectrum;
   };
Esempio n. 12
0
static int r8192_wx_set_retry(struct net_device *dev,
				struct iw_request_info *info,
				union iwreq_data *wrqu, char *extra)
{
	struct r8192_priv *priv = rtllib_priv(dev);
	int err = 0;

	if (priv->bHwRadioOff == true)
		return 0;

	down(&priv->wx_sem);

	if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
	    wrqu->retry.disabled) {
		err = -EINVAL;
		goto exit;
	}
	if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) {
		err = -EINVAL;
		goto exit;
	}

	if (wrqu->retry.value > R8192_MAX_RETRY) {
		err = -EINVAL;
		goto exit;
	}
	if (wrqu->retry.flags & IW_RETRY_MAX) {
		priv->retry_rts = wrqu->retry.value;
		DMESG("Setting retry for RTS/CTS data to %d",
		      wrqu->retry.value);

	} else {
		priv->retry_data = wrqu->retry.value;
		DMESG("Setting retry for non RTS/CTS data to %d",
		      wrqu->retry.value);
	}


	rtl8192_commit(dev);
exit:
	up(&priv->wx_sem);

	return err;
}
Esempio n. 13
0
/*-----------------------------------------------------------------------------
 * Function:    cmpk_handle_interrupt_status()
 *
 * Overview:    The function is responsible for extract the message from
 *		firmware. It will contain dedicated info in
 *		ws-07-0063-v06-rtl819x-command-packet-specification-070315.doc.
 *		Please refer to chapter "Interrupt Status Element".
 *
 * Input:       struct net_device *dev
 *              u8 *pmsg		- Message Pointer of the command packet.
 *
 * Output:      NONE
 *
 * Return:      NONE
 *
 * Revised History:
 *  When		Who	Remark
 *  05/12/2008		amy	Add this for rtl8192 porting from windows code.
 *
 *---------------------------------------------------------------------------
 */
static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg)
{
	cmpk_intr_sta_t		rx_intr_status;	/* */
	struct r8192_priv *priv = ieee80211_priv(dev);

	DMESG("---> cmpk_Handle_Interrupt_Status()\n");

	/* 1. Extract TX feedback info from RFD to temp structure buffer. */
	/* It seems that FW use big endian(MIPS) and DRV use little endian in
	 * windows OS. So we have to read the content byte by byte or transfer
	 * endian type before copy the message copy.
	 */
	rx_intr_status.length = pmsg[1];
	if (rx_intr_status.length != (sizeof(cmpk_intr_sta_t) - 2)) {
		DMESG("cmpk_Handle_Interrupt_Status: wrong length!\n");
		return;
	}

	/* Statistics of beacon for ad-hoc mode. */
	if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) {
		/* 2 maybe need endian transform? */
		rx_intr_status.interrupt_status = *((u32 *)(pmsg + 4));

		DMESG("interrupt status = 0x%x\n",
		      rx_intr_status.interrupt_status);

		if (rx_intr_status.interrupt_status & ISR_TxBcnOk) {
			priv->ieee80211->bibsscoordinator = true;
			priv->stats.txbeaconokint++;
		} else if (rx_intr_status.interrupt_status & ISR_TxBcnErr) {
			priv->ieee80211->bibsscoordinator = false;
			priv->stats.txbeaconerr++;
		}

		if (rx_intr_status.interrupt_status & ISR_BcnTimerIntr)
			cmdpkt_beacontimerinterrupt_819xusb(dev);
	}

	/* Other informations in interrupt status we need? */

	DMESG("<---- cmpk_handle_interrupt_status()\n");
}
Esempio n. 14
0
void VlasovCilk::solve(std::string equation_type, Fields *fields, CComplex *f_in, CComplex *f_out, 
                       double dt, int rk_step, const double rk[3]) 
{

  if(0);
  else if(equation_type == "EM") Vlasov_EM((A6zz) f_in, (A6zz) f_out, (A6zz) f0, (A6zz) f, (A6zz) ft, (A6zz) Coll, 
                                           (A6zz) fields->Field, (A4zz) Xi, (A4zz) G, (A3zz) nonLinearTerm,
                                           (A2rr) geo->Kx, (A2rr) geo->Ky, (A2rr) geo->dB_dz,
                                           dt, rk_step, rk);
  else   check(-1, DMESG("No Such Equation"));

}
Esempio n. 15
0
int S_SQLAccessFactory::commitDirectoryToIndex2(EntryProps &prop
                           , const std::string &indexTable
                           , std::string &table
                           , Statement &statement)
{ 
  std::ostringstream query;
  
  query << "UPDATE " << indexTable 
        << " SET \"table_name\" = '" << table  << "', "
        << " \"directory\" = '" << dran << "',"
        << " \"flags\" = '" << prop.flags << "'"
        << " WHERE \"id\"=" << prop.id
        << ";";

  DMESG("SQL: >" << query.str() << "<" << std::endl);
  
  if(statement.exec(query.str())){
    DMESG("16 Directory exists\n");
    return -1;
  } 

  return prop.id;
}
Esempio n. 16
0
static int r8180_wx_set_enc(struct net_device *dev, 
			    struct iw_request_info *info, 
			    union iwreq_data *wrqu, char *key)
{
	struct r8180_priv *priv = ieee80211_priv(dev);
	int ret;
	
	down(&priv->wx_sem);
	
		DMESG("Setting SW wep key");
		ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
			
	up(&priv->wx_sem);
	return ret;
}
Esempio n. 17
0
File: FileIO.cpp Progetto: xyuan/gkc
double FileIO::getOutputMaxTimeStep(Timing timing, double dt) {
       
    check(-1, DMESG("BLA"));        
  /* 
        dt = min(dt, dataOutputPSF        & timing);
        dt = min(dt, dataOutputPhi        & timing);
        dt = min(dt, dataOutputStatistics & timing);
        dt = min(dt, dataOutputXProperty  & timing);
   * */ 
//    	if (timing % dataOutputStatistics) writeScalarValues(vlasov, fields,  analysis, timing);
//    	if (timing % dataOutputXProperty ) writeXProperty(vlasov, fields,  analysis, timing);
//    	if (timing % dataOutputStatistics) writeCFLValues(analysis, fields, timing);

        return dt; 

}
Esempio n. 18
0
static int r8180_wx_set_beaconinterval(struct net_device *dev, struct iw_request_info *aa,
			  union iwreq_data *wrqu, char *b)
{
	int *parms = (int *)b;
	int bi = parms[0];
	
	struct r8180_priv *priv = ieee80211_priv(dev);
	
	down(&priv->wx_sem);
	DMESG("setting beacon interval to %x",bi);
	
	priv->ieee80211->beacon_interval=bi;
	rtl8180_commit(dev);
	up(&priv->wx_sem);
		
	return 0;	
}
Esempio n. 19
0
void SQLAccessFactory::PrintEndpointReference(EndpointReference* er,
    std::string &result)
{
  if ( er == NULL ) return ;
  if (er->Address != NULL )  {
    DMESG("EndPoint : " << er->Address->__item << std::endl);
    std::cout << er->Address->__item << std::endl;
  }

  if (er->wsa__ReferenceParameters != NULL )  {
    std::string rp_dran;
    std::string str = er->wsa__ReferenceParameters->__item;
    dran_deserialize(str, rp_dran);
    std::cout << "DRAN : " << rp_dran << std::endl;
    result = rp_dran;
  }

}
Esempio n. 20
0
static int r8180_wx_set_enc(struct net_device *dev,
			    struct iw_request_info *info,
			    union iwreq_data *wrqu, char *key)
{
	struct r8180_priv *priv = ieee80211_priv(dev);
	int ret;

	if (priv->ieee80211->bHwRadioOff)
		return 0;

	down(&priv->wx_sem);

	if (priv->hw_wep) ret = r8180_wx_set_key(dev, info, wrqu, key);
	else	{
		DMESG("Setting SW wep key");
		ret = ieee80211_wx_set_encode(priv->ieee80211, info, wrqu, key);
	}

	up(&priv->wx_sem);
	return ret;
}
int r8180_wx_set_key(struct net_device *dev, struct iw_request_info *info,
		     union iwreq_data *wrqu, char *key)
{
	struct r8180_priv *priv = ieee80211_priv(dev);
	struct iw_point *erq = &(wrqu->encoding);

	if (priv->ieee80211->bHwRadioOff)
		return 0;

	if (erq->length > 0) {
		u32* tkey = (u32*) key;
		priv->key0[0] = tkey[0];
		priv->key0[1] = tkey[1];
		priv->key0[2] = tkey[2];
		priv->key0[3] = tkey[3] & 0xff;
		DMESG("Setting wep key to %x %x %x %x",
		      tkey[0], tkey[1], tkey[2], tkey[3]);
		rtl8180_set_hw_wep(dev);
	}
	return 0;
}
Esempio n. 22
0
static int r8192_wx_set_crcmon(struct net_device *dev,
			       struct iw_request_info *info,
			       union iwreq_data *wrqu, char *extra)
{
	struct r8192_priv *priv = ieee80211_priv(dev);
	int *parms = (int *)extra;
	int enable = (parms[0] > 0);

	mutex_lock(&priv->wx_mutex);

	if (enable)
		priv->crcmon = 1;
	else
		priv->crcmon = 0;

	DMESG("bad CRC in monitor mode are %s",
	      priv->crcmon ? "accepted" : "rejected");

	mutex_unlock(&priv->wx_mutex);

	return 0;
}
Esempio n. 23
0
void interp(uchar code){
	uchar c = 0;
	uchar d = 0;
	DMESG("{");
		
	if (code == 0xe0){
		e0=1;
		DMESG("SETE0,");
		return;
	}
		
	if (code == 0xf0) {
		DMESG("SETRELEASE,");
		release=1;	
		return;
	}
	
	
	if (e0){
	
		c = xlat(ktab_eo, code);
		DMESGF("xlateo %x->%x", code,c);
	}
	else {
		c = xlat(ktab, code);
		DMESGF("xlat %x->%x", code,c);
	}


	if (c==K_SHIFT) {
		if (release){
			DMESG("UNSHIFT,");
			shift=0;  //handle letting go of shift key
		}
		else {
			DMESG("SHIFT,");
			shift=1;  //handle pressing shift key
		}
	
		release=0;
		e0=0;
		DMESG("unRELEASE0,unE0");
		return;
	}

	DMESG("nE0");
	e0=0;

	if (release) {
		DMESG("ISREL,unREL");
		release=0;
		return;  //release codes don't generate characters
	}
	release=0;
	

	if (c==0)
		return;



	//generate capitals
	if (shift) {
		DMESG("isshift,");
		if ((c>='a') && (c<='z'))	{
			DMESGF("alpha %c,", c);
			c=c-'a'+'A';
		} else {
			d = xlat(ktab_shift, c); //shift the key
			DMESGF("shifted %c->%c", c, d);
			if(d)
				c=d;
		}
	}
		
	DMESGF("out %c}", c);
	nextchar=c;
		
}
Esempio n. 24
0
File: FileIO.cpp Progetto: xyuan/gkc
    int FileIO::create(Setup *setup) {
     
        hid_t file_plist = H5Pcreate(H5P_FILE_ACCESS);
#ifdef GKC_PARALLEL_MPI
   //       pass some information onto the underlying MPI_File_open call 
          MPI_Info file_info;
          check(MPI_Info_create(&file_info), DMESG("File info"));
          /* 
          H5Pset_sieve_buf_size(file_plist, 262144); 
          H5Pset_alignment(file_plist, 524288, 262144);
                
          MPI_Info_set(file_info, (char *) "access_style"        , (char *) "write_once");
          MPI_Info_set(file_info, (char *) "collective_buffering", (char *) "true");
          MPI_Info_set(file_info, (char *) "cb_block_size"       , (char *) "1048576");
          MPI_Info_set(file_info, (char *) "cb_buffer_size"      , (char *) "4194304");
           * */

          check( H5Pset_fapl_mpio(file_plist, parallel->Comm[DIR_ALL], file_info), DMESG("Set MPI Property"));
#endif
        file = check(H5Fcreate(outputFileName.c_str(), (overwriteFile ? H5F_ACC_TRUNC : H5F_ACC_EXCL),
                        H5P_DEFAULT, file_plist ), DMESG("H5FCreate : HDF5 File (File already exists ? use -f to overwrite) : " + outputFileName));
        check( H5Pclose(file_plist),   DMESG("H5Pclose"));

#ifdef GKC_PARALLEL_MPI
        MPI_Info_free(&file_info);
#endif
        
         //////////////////////////////////////////////////////////////// Info Group ////////////////////////////////////////////////////////

          hid_t infoGroup = check(H5Gcreate(file, "/Info",H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT), DMESG("Error creating group file for Phasespace : H5Gcreate"));

         check(H5LTset_attribute_string(infoGroup, ".", "Output", outputFileName.c_str()), DMESG("H5LTset_attribute"));
         check(H5LTset_attribute_string(infoGroup, ".", "Input",  inputFileName.c_str()), DMESG("H5LTset_attribute"));
         
         
         check(H5LTset_attribute_string(infoGroup, ".", "Version", PACKAGE_VERSION), DMESG("H5LTset_attribute"));
         // Some Simulation specific stuff
         //check(H5LTset_attribute_string(infoGroup, ".", "Solver", ((setup->Solver & VL_LIN) ? "Linear" : "Non-Linear")), DMESG("H5LTset_attribute"));
         //heck(H5LTset_attribute_string(infoGroup, ".", "Type",   ((setup->VlasovType   & VLASOV_LOCAL ) ? "Local"  : "Global"    )), DMESG("H5LTset_attribute"));
         //heck(H5LTset_attribute_string(infoGroup, ".", "FFTSolverS",   ((setup->VlasovType   & VLASOV_LOCAL ) ? "Local"  : "Global"    )), DMESG("H5LTset_attribute"));
         //check(H5LTset_attribute_string(infoGroup, ".", "Initial Condition", setup->PerturbationMethod.c_str()), DMESG("H5LTset_attribute"));
         check(H5LTset_attribute_string(infoGroup, ".", "Info", info.c_str()), DMESG("H5LTset_attribute"));
         
         check(H5LTset_attribute_string(infoGroup, ".", "Config", setup->configFileString.c_str()), DMESG("H5LTset_attribute"));

         H5Gclose(infoGroup);
         
         
         /// Wrote setup constants, ugly here ////
         hid_t constantsGroup = check(H5Gcreate(file, "/Constants",H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT), DMESG("Error creating group file for Phasespace : H5Gcreate"));
         //
         if (!setup->parser_constants.empty()) { 
            
           std::vector<std::string> const_vec = Setup::split(setup->parser_constants, ",");

            for(int s = 0; s < const_vec.size(); s++) { 
                std::vector<std::string> key_value = Setup::split(const_vec[s],"=");
                double value = Setup::string_to_double(key_value[1]);
                int dim[] = { 1 };
   //           check(H5LTmake_dataset_double(constantsGroup, Setup::trimLower(key_value[0], false).c_str(), 1, dim, &value ), DMESG("Write Constants Attributes"));
                check(H5LTset_attribute_double(constantsGroup, ".", Setup::trimLower(key_value[0], false).c_str(), &value, 1), DMESG("H5LTset_attribute"));
                //check(H5LTset_attribute_double(constantsGroup, ".", Setup::trimLower(key_value[0], false).c_str(), &(Setup::string_to_double(key_value[1])), 1), DMESG("H5LTset_attribute"));
            };
         
         }
         
          H5Gclose(constantsGroup);

         
         // ********************* setup Table for CFL   *****************88
         cfl_table = new CFLTable();
         
         cfl_offset[0] =  HOFFSET( CFLTable, timeStep );
         cfl_offset[1] =  HOFFSET( CFLTable, time );
         cfl_offset[2] =  HOFFSET( CFLTable, Fx );
         cfl_offset[3] =  HOFFSET( CFLTable, Fy );
         cfl_offset[4] =  HOFFSET( CFLTable, Fz  );
         cfl_offset[5] =  HOFFSET( CFLTable, Fv );
         cfl_offset[6] =  HOFFSET( CFLTable, total );
          

         for(int i = 1; i < 7; i++)  cfl_sizes[i] = sizeof(double); cfl_sizes[0] = sizeof(int);
         hid_t   cfl_type[7]; for(int i = 1; i < 7; i++)  cfl_type [i] = H5T_NATIVE_DOUBLE; cfl_type[0] = H5T_NATIVE_INT;

         const char *cfl_names[7];
         cfl_names[0] = "timeStep";
         cfl_names[1] = "time";
         cfl_names[2] = "Fx"; cfl_names[3] = "Fy"; cfl_names[4] = "Fz"; cfl_names[5] = "Fv"; cfl_names[6] = "Total";

          check(H5TBmake_table("cflTable", file, "cfl", (hsize_t) 7, (hsize_t) 0, sizeof(CFLTable), (const char**) cfl_names,
                               cfl_offset, cfl_type, 32, NULL, 0, cfl_table ), DMESG("H5Tmake_table : cfl"));
         

         return HELIOS_SUCCESS;
    }
Esempio n. 25
0
void Grid::initData(FileIO *fileIO) 
{

  hid_t gridGroup = fileIO->newGroup("/Grid");
  
  // set lengths
  check(H5LTset_attribute_double(gridGroup, ".", "Lx", &Lx, 1), DMESG("HDF-5 Error"));
  check(H5LTset_attribute_double(gridGroup, ".", "Ly", &Ly, 1), DMESG("HDF-5 Error"));
  check(H5LTset_attribute_double(gridGroup, ".", "Lz", &Lz, 1), DMESG("HDF-5 Error"));
  check(H5LTset_attribute_double(gridGroup, ".", "Lv", &Lv, 1), DMESG("HDF-5 Error"));
  check(H5LTset_attribute_double(gridGroup, ".", "Lm", &Lm, 1), DMESG("HDF-5 Error"));
         
  // set grid point number
  check(H5LTset_attribute_int(gridGroup, ".", "Nx", &Nx , 1), DMESG("HDF-5 Error"));
  check(H5LTset_attribute_int(gridGroup, ".", "Nky",&Nky, 1), DMESG("HDF-5 Error"));
  check(H5LTset_attribute_int(gridGroup, ".", "Nz", &Nz , 1), DMESG("HDF-5 Error"));
  check(H5LTset_attribute_int(gridGroup, ".", "Nv", &Nv , 1), DMESG("HDF-5 Error"));
  check(H5LTset_attribute_int(gridGroup, ".", "Nm", &Nm , 1), DMESG("HDF-5 Error"));
  check(H5LTset_attribute_int(gridGroup, ".", "Ns", &Ns , 1), DMESG("HDF-5 Error"));
         
  // set grids 
  check(H5LTset_attribute_double(gridGroup, ".", "X", &X[NxGlD], Nx), DMESG("HDF-5 Error"));
  check(H5LTset_attribute_double(gridGroup, ".", "Z", &Z[NzGlD], Nz), DMESG("HDF-5 Error"));
  check(H5LTset_attribute_double(gridGroup, ".", "V", &V[NvGlD], Nv), DMESG("HDF-5 Error"));
  check(H5LTset_attribute_double(gridGroup, ".", "M", &M[NmGlD], Nm), DMESG("HDF-5 Error"));
  
  check(H5LTset_attribute_string(gridGroup, ".", "MuIntegrationType", muIntegrationType.c_str()), DMESG("HDF-5 Error")); 
  
  H5Gclose(gridGroup);
}
Esempio n. 26
0
int S_SQLAccessFactory::handleQuery()
{
  // get what command is requested
  MDInterpreter interpreter;
  MDInterpreter::CommandToken cmdToken = interpreter.parseCommand (query);

  // check whether the command is supported
  int ret = checkInvalidCommand(soap ,cmdToken, _ACCESS_FACTORY);
  if ( ret != SOAP_OK ) return ret;

  ret = checkDBConnection(soap, helper);
  if (ret != SOAP_OK ) return ret;

  ret = checkTooManyIndirectServiceForUser();
  if ( ret != SOAP_OK ) return ret;
  
  Statement statement(*(helper->dbConn->dbServer->dbConn), debug);

  // initialze prop
  EntryProps prop;
  prop.directoryTable = "SQLRespone";
  prop.indexTable = "masterindex";
  prop.flags = 0;

  std::string table;

  int error = 0 ;
  do {
    if( statement.beginTransaction()) { error = 1; break; }

    // parse requested query
    std::string translatedQuery;
    helper->dbConn->dbServer->sqlParse(query, cmdToken, translatedQuery);

    int isPlain = helper->dbConn->dbServer->asp->isPlain ;

    DBResult dbResult;
    std::vector<std::string> results;
    helper->dbConn->getResult(dbResult,results);
    if (dbResult.errorCode != 0) {   // error
      return returnErrorDBResult(soap, dbResult);
    }

    std::stringstream query_s ;

    // add an directory entry into masterindex
    prop.id = helper->dbConn->dbServer->addDirectoryToIndex("SQLResponse"
                , prop, statement);
    if ( prop.id < 0 ) { error = 1; break; }

    switch(cmdToken) {
      case MDInterpreter::cSELECT:
      {
        table = "responses" + StringOf(prop.id) + "_"
                 + StringOf(helper->dbConn->dbServer->asp->numColumn) ;
        query_s << "CREATE VIEW " << table << " AS " << translatedQuery << ";";
        break;
      }
      case MDInterpreter::cUPDATE:
      case MDInterpreter::cDELETE:
      case MDInterpreter::cINSERT:
      {
        query_s <<  translatedQuery << ";";
        table = "responseu" + StringOf(prop.id) + "_"  ;
        break;
      }
      default:
        ERRLOG("Unsupported command token: " << cmdToken);  
    }
    DMESG("Translated query : " <<  query_s.str() << std::endl);

    if( statement.exec(query_s.str())) { error = 1; break; }

    switch(cmdToken) {
      case MDInterpreter::cUPDATE:
      case MDInterpreter::cDELETE:
      case MDInterpreter::cINSERT:
      {
        table += StringOf(statement.numRows() ) ;
        break;
      }
      default:
        ERRLOG("Unsupported command token: " << cmdToken);      
    }

    dran = "/SQLResponse/" + table ;
    prop.flags = EPT_DIR ;
    if( isPlain ) prop.flags += EP_PLAIN;
    prop.id = commitDirectoryToIndex2(prop, "masterindex", table, statement);
  } while ( false ) ;


  if (error)  {
    return generateSoapError(soap, "Invalid Expression Fault" , NULL
            , SOAP_TYPE_wsdai__InvalidExpressionFaultType );
  }

  if ( helper->dbConn->dbServer->finalizeDirectoryToIndex(prop.id, statement) < 0) {
    return generateSoapError(soap, "Invalid Expression Fault" , NULL
                , SOAP_TYPE_wsdai__InvalidExpressionFaultType );
  }

  statement.commitTransaction();

  return SOAP_OK;
}
Esempio n. 27
0
Grid:: Grid (Setup *setup, Parallel *parallel, FileIO *fileIO) 
{
  
  muIntegrationType = setup->get("Grid.MuIntegrationType", "Gauss-Legendre");
    
  // Set Initial conditions
 
  // Global Domain Grid Number
  Nx  = setup->get("Grid.Nx", 32);
  Nky = setup->get("Grid.Nky", 9);
  Nz  = setup->get("Grid.Nz", 8 );
  Nv  = setup->get("Grid.Nv", 16);
  Nm  = setup->get("Grid.Nm", 1 );
  Ns  = setup->get("Grid.Ns", 1 );
  
  // Global Domain Grid Lengths
  Lx  = setup->get("Grid.Lx", 16.   );
  Ly  = setup->get("Grid.Ly", 32.   );
  Lz  = setup->get("Grid.Lz", 2. * M_PI);
  Lv  = setup->get("Grid.Lv", 4.  );
  Lm  = setup->get("Grid.Lm", 7.  );
  
  int NmBoundary  = setup->get("Grid.NmBoundary", 0 );
  
  const double x0  = setup->get("Grid.x0", Lx/2.);
  //const double z0  = setup->get("Grid.z0", 0.   );
    
  int Ny = 2 * Nky - 2;
      
  check(((Nm == 1) && (Lm != 1.)) ? -1 : 0, DMESG("For Nm=1, set Lm = 1 !"));
  
  // Calculate grid distances values (equidistant for X, Y, Z, V)
  dx = (Nx > 1) ? Lx/((double) (Nx-1)) : Lx;
  dy = (Ny > 1) ? Ly/((double) (Ny-1)) : Ly;
  dz = (Nz > 1) ? Lz/((double) (Nz  )) : Lz;
  dv = (Nv > 1) ? 2.* Lv/ ( (double) (Nv-1)) : Lv;
      
  // Set Global Global lower/upper Domain/Boundary index
  NxGlD = 3; NxGuD=Nx+2; NxGlB=1; NxGuB=Nx+4; 
  NyGlD = 3; NyGuD=Ny+2; NyGlB=1; NyGuB=Ny+4; 
  NzGlD = 3; NzGuD=Nz+2; NzGlB=1; NzGuB=Nz+4; 
  NvGlD = 3; NvGuD=Nv+2; NvGlB=1; NvGuB=Nv+4; 
  NmGlD = 1; NmGuD=Nm;   NmGlB=1; NmGuB=Nm; 
  NsGlD = 1; NsGuD=Ns;   NsGlB=1; NsGuB=Ns; 
       
  NkyGlD = 0  ; NkyGuD=Nky-1; NkyGlB=0; NkyGuB=Nky-1; 
  NkyLlD = 0  ; NkyLuD=Nky-1; NkyLlB=0; NkyLuB=Nky-1;
  NkyLD  = Nky; NkyGD = Nky; 
  
  // Number of Ghost/Halo cells
  NxGC = 2; NyGC = 2; NzGC = 2; NvGC = 2; NmGC = NmBoundary == 1 ? 2 : 0; 

  //////////////////   Grid decomposition  ////////////////////////
  // Set local (L) lower (l) and upper (u) bounds
  // Currently we only have equal partition decomposition

  // Set local decomposition indices for X
  NxLlD = (NxGuD - NxGlD + 1)/parallel->decomposition[DIR_X] * parallel->Coord[DIR_X] + NxGC + 1;
  NxLuD = (NxGuD - NxGlD + 1)/parallel->decomposition[DIR_X] * (parallel->Coord[DIR_X]+1) + NxGC;
  NxLlB = NxLlD - NxGC; NxLuB = NxLuD + NxGC;

  // Set local decomposition indices for Y (wtf?)
  NyLlD = (NyGuD - NyGlD + 1)/parallel->decomposition[DIR_Y] *  parallel->Coord[DIR_Y] + NyGC + 1;
  NyLuD = (NyGuD - NyGlD + 1)/parallel->decomposition[DIR_Y] * (parallel->Coord[DIR_Y]+ 1) + NyGC;
  NyLlB = NyLlD - NyGC; NyLuB = NyLuD + NyGC;

  // Set local decomposition indices for Z
  NzLlD = (NzGuD - NzGlD + 1)/parallel->decomposition[DIR_Z] *  parallel->Coord[DIR_Z] + NzGC + 1;
  NzLuD = (NzGuD - NzGlD + 1)/parallel->decomposition[DIR_Z] * (parallel->Coord[DIR_Z]+1) + NzGC;
  NzLlB =  NzLlD - NzGC; NzLuB = NzLuD + NzGC;
    
  // Set local decomposition indices for V
  NvLlD = (NvGuD - NvGlD + 1)/parallel->decomposition[DIR_V] *  parallel->Coord[DIR_V] + NvGC + 1;
  NvLuD = (NvGuD - NvGlD + 1)/parallel->decomposition[DIR_V] * (parallel->Coord[DIR_V] + 1) + NvGC;
  NvLlB = NvLlD - NvGC; NvLuB = NvLuD + NvGC;
    
  // Set local decomposition indices for M (no boundary)
  NmLlD = (NmGuD - NmGlD + 1)/parallel->decomposition[DIR_M] *  parallel->Coord[DIR_M] + 1;
  NmLuD = (NmGuD - NmGlD + 1)/parallel->decomposition[DIR_M] * (parallel->Coord[DIR_M] + 1) ;
  NmLlB = NmLlD - NmGC; NmLuB = NmLuD + NmGC; 

  // Set local decomposition indices for S (no boundary)
  NsLlD = (NsGuD - NsGlD + 1)/parallel->decomposition[DIR_S] *  parallel->Coord[DIR_S] + 1;
  NsLuD = (NsGuD - NsGlD + 1)/parallel->decomposition[DIR_S] * (parallel->Coord[DIR_S] + 1) ;
  NsLlB = NsLlD; NsLuB = NsLuD; 

  // Set number of local domain points
  NxLD = NxLuD - NxLlD + 1; NyLD = NyLuD - NyLlD + 1;
  NzLD = NzLuD - NzLlD + 1; NvLD = NvLuD - NvLlD + 1;
  NmLD = NmLuD - NmLlD + 1; NsLD = NsLuD - NsLlD + 1;

  // Set number of local boundary points 
  NxLB = NxLuB - NxLlB + 1; NyLB = NyLuB - NyLlB + 1;
  NzLB = NzLuB - NzLlB + 1; NvLB = NvLuB - NvLlB + 1;
  NmLB = NmLuB - NmLlB + 1; NsLB = NsLuB - NsLlB + 1;
    
  // Set number of local/global Domain points 
  NxGB = Nx + 2*NxGC  ; NyGB = Ny + 2*NyGC;
  NzGB = Nz + 2*NxGC  ; NvGB = Nv + 2*NxGC;
  NmGB = Nm           ; NsGB = Ns;

  // Set Ranges of Local Domain (LD)
  RxLD.setRange(NxLlD,NxLD);
  RzLD.setRange(NzLlD,NzLD);
  RvLD.setRange(NvLlD,NvLD);
  RmLD.setRange(NmLlD,NmLD);
  RsLD.setRange(NsLlD,NsLD);
  RkyLD.setRange(NkyLlD,NkyLD);
    
  // Set Ranges of Local Boundary (LB)
  RxLB.setRange(NxLlB,NxLB);
  RzLB.setRange(NzLlB,NzLB);
  RvLB.setRange(NvLlB,NvLB);
  RmLB.setRange(NmLlB,NmLB);
  RsLB.setRange(NsLlB,NsLB);
    
  RxLB4.setRange(NxLlB-2,NxLB+4);
  
  // Set Ranges of Global Boundary (LB)
  RxGB.setRange(NxGlB, NxGB);
  RzGB.setRange(NzGlB, NzGB);
  RvGB.setRange(NvGlB, NvGB);
  RmGB.setRange(NmGlB, NmGB);
  RsGB.setRange(NsGlB, NsGB);
  
  // Set Ranges of Global Domain (LD)
  RxGD.setRange(NxGlD, Nx);
  RzGD.setRange(NzGlD, Nz);
  RvGD.setRange(NvGlD, Nv);
  RmGD.setRange(NmGlD, Nm);
  RsGD.setRange(NsGlD, Ns);
 
  ///////////////  Set Grid  Domain ////////////

  // X (Note : For gyro-averaged fields we have extended boundaries
  ArrayX = nct::allocate(nct::Range(NxGlB-2, NxGB+4))(&X);
  ArrayZ = nct::allocate(RzGB)(&Z);
  ArrayV = nct::allocate(RvGB)(&V);
  ArrayM = nct::allocate(RmGB)(&M, &dm);

  // Use  equidistant grid for X, Z and V
  bool includeX0Point = setup->get("Grid.IncludeX0Point", 0);
  for(int x = NxGlB-2; x <= NxGuB+2; x++) X[x] = -Lx/2. + dx * (x - NxGC - 1) + ((includeX0Point) ? dx/2. : 0.);
  //for(int z = NzGlB; z <= NzGuB; z++) Z[z] = -Lz/2. + dz * (z - NzGC - 1) ;
  for(int z = NzGlB; z <= NzGuB; z++) Z[z] =  dz * (z - NzGC - 1) ;
  for(int v = NvGlB; v <= NvGuB; v++) V[v] = -Lv + dv * (v - NvGlD);
    
  // M For mu we can choose between various integration type e.g. rectangle or Gaussian
  // @todo use setup to define integration method
  Integrate integrate(muIntegrationType, Nm, 0., Lm);

  for(int m = NmGlD, n = 0; m <= NmGuD; m++, n++) {

    M [m] = (Nm == 1) ? 0. : integrate.x(n) ; 
    dm[m] = (Nm == 1) ? 1. : integrate.w(n); 
  }

  // Set local Jacobian (better use geometry module ?)
  dXYZ  = dx * dy * dz;
  dXYZV = dx * dy * dz * dv;

  initData(fileIO);
}
Esempio n. 28
0
void Analysis::initDataOutput(Setup *setup, FileIO *fileIO) {
        
     analysisGroup = fileIO->newGroup(fileIO->getFileID(), "/Analysis");
        
     hsize_t offset0[] = { 0, 0, 0, 0, 0, 0, 0 };
    
     //###################################### Analysis - Heat fluxes ################################
     
     // Heat Flux ky and Particle FluxKy ( per species) 
     hid_t fluxGroup = fileIO->newGroup(analysisGroup, "Flux");
     
     hsize_t FSky_dim[]       = { plasma->nfields, Nky, Ns  , 1 }; 
     hsize_t FSky_maxdim[]    = { plasma->nfields, Nky, Ns  , H5S_UNLIMITED} ;
     hsize_t FSky_chunkdim[]  = { plasma->nfields, Nky, NsLD, 1 };
     hsize_t FSky_chunkBdim[] = { plasma->nfields, Nky, NsLD, 1 };
     hsize_t FSky_offset[]    = { 0, 0  , NsLlD-1, 0  };
//     std::cout << "NsLD : " << NsLD << std::endl;
//     std::cout << parallel->Coord(DIR_XYZVM) << std::endl << std::flush;
//     parallel->barrier();
     
//check(-1, DMESG("STOP"));

     FA_heatKy      = new FileAttr("Heat"   , fluxGroup, 4, FSky_dim, FSky_maxdim, FSky_chunkdim, offset0,  FSky_chunkBdim, FSky_offset, parallel->Coord(DIR_XYZVM == 0));
     FA_particleKy  = new FileAttr("Density", fluxGroup, 4, FSky_dim, FSky_maxdim, FSky_chunkdim, offset0,  FSky_chunkBdim, FSky_offset, parallel->Coord(DIR_XYZVM == 0));
    
     H5Gclose(fluxGroup);
     
     //###################################### Moments - Heat fluxes ################################
     hid_t momentGroup = check(H5Gcreate(fileIO->getFileID(), "/Moments",H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT), DMESG("Error creating group file for Phi : H5Gcreate"));

     hsize_t moment_dim[]       =  { grid->NzGD , NkyLD      , grid->NxGD , NsLD , 1};
     hsize_t moment_maxdim[]    =  { grid->NzGD , NkyLD      , grid->NxGD , Ns   , H5S_UNLIMITED};
     hsize_t moment_chunkBdim[] =  { NzLD       , NkyLD      , NxLD       , NsLD , 1          };
     hsize_t moment_chunkdim[]  =  { NzLD       , NkyLD      , NxLD       , NsLD , 1};
     hsize_t moment_moffset[]   =  { 0, 0, 0, 0, 0 };
     hsize_t moment_offset[]    =  { NzLlD-3, 0     , NxLlD-3, 0     ,  0  };
     
     bool momWrite = (parallel->Coord(DIR_VM) == 0);
     
     
     FA_Mom_Tp        = new FileAttr("Temperature_v", momentGroup, 5, moment_dim , moment_maxdim   , moment_chunkdim   , moment_moffset    ,  moment_chunkBdim  , moment_offset, momWrite, fileIO->complex_tid);
     FA_Mom_HeatFlux  = new FileAttr("HeatFlux"     , momentGroup, 5, moment_dim , moment_maxdim   , moment_chunkdim   , moment_moffset    ,  moment_chunkBdim  , moment_offset, momWrite, fileIO->complex_tid);
     FA_Mom_Density   = new FileAttr("Density"      , momentGroup, 5, moment_dim , moment_maxdim   , moment_chunkdim   , moment_moffset    ,  moment_chunkBdim  , moment_offset, momWrite, fileIO->complex_tid);
     FA_Mom_Time  = fileIO->newTiming(momentGroup);
        
     H5Gclose(momentGroup);
      
     dataOutputMoments   = Timing(setup->get("DataOutput.Moments.Step", -1)       , setup->get("DataOutput.Moments.Time", -1.));


     //###################################### Power Spectrum  ################################################
     // X-scalarValue
      hid_t growGroup = fileIO->newGroup(analysisGroup, "PowerSpectrum");

     hsize_t grow_x_dim[]       = { plasma->nfields, Nx/2+1, 1 }; 
     hsize_t grow_x_maxdim[]    = { plasma->nfields, Nx/2+1, H5S_UNLIMITED} ;
     hsize_t grow_x_chunkdim[]  = { plasma->nfields, Nx/2+1, 1 };
     hsize_t grow_x_chunkBdim[] = { plasma->nfields, Nx/2+1, 1 };
     FA_grow_x  = new FileAttr("X", growGroup, 3, grow_x_dim, grow_x_maxdim, grow_x_chunkdim, offset0,  grow_x_chunkBdim, offset0, parallel->myRank == 0);

     // Y-scalarValue
     hsize_t grow_y_dim[]       = { plasma->nfields, Nky, 1 };
     hsize_t grow_y_maxdim[]    = { plasma->nfields, Nky, H5S_UNLIMITED };
     hsize_t grow_y_chunkdim[]  = { plasma->nfields, Nky, 1 };
     hsize_t grow_y_chunkBdim[] = { plasma->nfields, Nky, 1 };
   
     FA_grow_y  = new FileAttr("Y", growGroup, 3, grow_y_dim, grow_y_maxdim, grow_y_chunkdim, offset0,  grow_y_chunkBdim, offset0, parallel->myRank == 0);

     FA_grow_t  = fileIO->newTiming(growGroup);

     H5Gclose(growGroup);
     
     
     hid_t freqGroup = fileIO->newGroup(analysisGroup, "PhaseShift");
     FA_freq_x  = new FileAttr("X", freqGroup, 3, grow_x_dim, grow_x_maxdim, grow_x_chunkdim, offset0,  grow_x_chunkBdim, offset0, parallel->myRank == 0);
     FA_freq_y  = new FileAttr("Y", growGroup, 3, grow_y_dim, grow_y_maxdim, grow_y_chunkdim, offset0,  grow_y_chunkBdim, offset0, parallel->myRank == 0);
     FA_freq_t  = fileIO->newTiming(freqGroup);
     H5Gclose(freqGroup);

      //////////////////////////////////////////////////////////////// Setup Table for scalar data ////////////////////////////////////////////////////////
              
      ScalarValues scalarValues;
     
      size_t SV_offset[] = { HOFFSET( ScalarValues, timestep ) , HOFFSET( ScalarValues, time     ), HOFFSET( ScalarValues, phiEnergy ),
                            HOFFSET( ScalarValues, ApEnergy ),  HOFFSET( ScalarValues, BpEnergy ), HOFFSET( ScalarValues, particle_number    ),
                            HOFFSET( ScalarValues, kinetic_energy ), HOFFSET( ScalarValues, entropy ), HOFFSET( ScalarValues, heat_flux ),
                            HOFFSET( ScalarValues, particle_flux ) };

      size_t SV_sizes[] = { sizeof(scalarValues.timestep), sizeof(scalarValues.time    ), sizeof(scalarValues.phiEnergy), 
                           sizeof(scalarValues.ApEnergy), sizeof(scalarValues.BpEnergy), Ns * sizeof(scalarValues.particle_number[0]), Ns * sizeof(scalarValues.kinetic_energy[0]), 
                           Ns * sizeof(scalarValues.entropy[0]), Ns * sizeof(scalarValues.heat_flux[0]), Ns * sizeof(scalarValues.particle_flux[0])};

      hid_t SV_types[] = { H5T_NATIVE_INT, H5T_NATIVE_DOUBLE, H5T_NATIVE_DOUBLE, H5T_NATIVE_DOUBLE, H5T_NATIVE_DOUBLE, 
                           fileIO->species_tid, fileIO->species_tid, fileIO->species_tid, fileIO->species_tid, fileIO->species_tid } ;
  
      const char *SV_names[] = { "Timestep", "Time", "phiEnergy", "ApEnergy", "BpEnergy", "ParticleNumber", "KineticEnergy", "Entropy", "HeatFlux", "ParticleFlux" };

      SVTable = new TableAttr(analysisGroup, "scalarValues", 10, SV_names, SV_offset, SV_types, SV_sizes, &scalarValues); 

      dataOutputStatistics  = Timing(setup->get("DataOutput.Statistics.Step", -1), setup->get("DataOutput.Statistics.Time", -1.));

}
Esempio n. 29
0
File: FileIO.cpp Progetto: xyuan/gkc
hid_t  FileIO::newGroup(hid_t parentNode, std::string name)
{
      
      hid_t newGroup = check(H5Gcreate(parentNode, name.c_str(),H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT), DMESG("Error creating group file for Spectrum : H5Gcreate"));
      return newGroup;

};