Ejemplo n.º 1
0
void PrintStlPAVFFocusPorts(PrintDest_t *dest, int indent, const char *vfName, const int numRecords, const uint32 select, const uint32 start, const uint32 range,
	const STL_PA_VF_FOCUS_PORTS_RSP *pVFFocusPorts)
{
	int i;

	PrintFunc(dest, "%*sVF name: %s\n", indent, "", vfName);
	PrintFunc(dest, "%*sNumber links: %u\n", indent, "", numRecords);
	PrintFunc(dest, "%*sFocus select: 0x%x\n", indent, "", select);
	PrintFunc(dest, "%*sFocus start:  %u\n", indent, "", start);
	PrintFunc(dest, "%*sFocus range:  %u\n", indent, "", range);
	for (i = 0; i < numRecords; i++) {
		PrintFunc(dest, "%*s%u:LID:0x%04x  Port:%u  Rate: %4s MTU: %5s nbrLID:0x%04x  nbrPort:%u\n",
				indent, "", i+1, pVFFocusPorts[i].nodeLid, pVFFocusPorts[i].portNumber,
				StlStaticRateToText(pVFFocusPorts[i].rate), IbMTUToText(pVFFocusPorts[i].mtu),
				pVFFocusPorts[i].neighborLid, pVFFocusPorts[i].neighborPortNumber);
		PrintFunc(dest, "%*s   Value:   %16"PRIu64"   nbrValue:  %16"PRIu64"\n",
				indent, "", pVFFocusPorts[i].value, pVFFocusPorts[i].neighborValue);
		PrintFunc(dest, "%*s   GUID:  0x%016"PRIx64"   nbrGuid: 0x%016"PRIx64"\n",
				indent, "", pVFFocusPorts[i].nodeGUID, pVFFocusPorts[i].neighborGuid);
		PrintFunc(dest, "%*s   Status: %s Name: %.*s\n",
				indent, "",
				StlFocusFlagToText(pVFFocusPorts[i].localFlags),
				(int)sizeof(pVFFocusPorts[i].nodeDesc),
				pVFFocusPorts[i].nodeDesc);
		PrintFunc(dest, "%*s   Status: %s Neighbor Name: %.*s\n",
				indent, "",
				StlFocusFlagToText(pVFFocusPorts[i].neighborFlags),
				(int)sizeof(pVFFocusPorts[i].neighborNodeDesc),
				pVFFocusPorts[i].neighborNodeDesc);
	}
	PrintStlPAImageId(dest, indent, &pVFFocusPorts[0].imageId);

	return;
}
/*******************************************************************************
* Function Name  : addFunc
* Description    : Add the function code 
* Input          : iFunc - the code to this function
				   regions - the regions to this function
				   kitchens - the kitchens to this function
				   depts - the departments to this function
				   iRepeat - the repeat times to this function
* Output         : None
* Return         : None
*******************************************************************************/
void PrinterInstance::addFunc(int iFunc, const vector<int>& regions, const vector<int>& kitchens, const vector<int>& depts, int iRepeat){
	vector<PrintFunc>::iterator iter_func = find(funcs.begin(), funcs.end(), PrintFunc(iFunc));
	if(iter_func == funcs.end()){
		//if the function doesn't exist, means the new function
		//put it to the function list 
		funcs.push_back(PrintFunc(iFunc, regions, kitchens, depts, iRepeat));
	}
}
Ejemplo n.º 3
0
int main(int argc, char* argv[])
{
  if (argc!=3) exit(0);
  double U = atof(argv[1]);
  double T = atof(argv[2]);

   int N = 8192;
   double t = 0.5;
   int metal = 1;
   double min_accr = 1e-9;
   int MAX_ITS = 400;
   int UseBethe = 1;
   int print_final = 1;
   int print_intermediate = 0;
   int print_initial = 0;
   int print_lambda = 0;
   int show_status = 1;

   //===================== Run IACHM dor all possible T and U =======================//
 
   IAHFCHM iahfchm;
   iahfchm.UseBethe = (UseBethe==1);
   iahfchm.SetOptions(print_final, print_intermediate, print_initial, print_lambda, show_status);

   iahfchm.Initialize(N, T, U, metal, t, min_accr);
   iahfchm.U=U;  
 
   iahfchm.Run(MAX_ITS, true);
 
   double numax = 50.0;
   int Nn = (int) numax/(2.0*pi*T);
   complex<double>* sigma = new complex<double>[Nn];
   complex<double>* Lambda = new complex<double>[Nn];
   double* nu = new double[Nn];

   for(int n=0; n<Nn; n++)
   { printf("calculating Lambda, n=%d\n",n);
     Lambda[n] = iahfchm.Lambda(n, &v1);
 
     if (n>0) sigma[n] = (Lambda[n]-Lambda[0])/ (2.0 * pi * n);
     else sigma[n] =  std::numeric_limits<double>::quiet_NaN();
 
     nu[n] = 2.0 * pi * T * n;  

     char sigmaFN[300];
     sprintf(sigmaFN,"sigma.U%.3f.T%.3f",U,T);
     PrintFunc(sigmaFN,n+1,sigma,nu);

     char LambdaFN[300];
     sprintf(LambdaFN,"Lambda.U%.3f.T%.3f",U,T);
     PrintFunc(LambdaFN,n+1,Lambda,nu);
   }

   delete [] sigma;
   delete [] Lambda;
   delete [] nu;
  
}
Ejemplo n.º 4
0
void PrintStlPAMoveFreeze(PrintDest_t *dest, int indent, const STL_MOVE_FREEZE_DATA *pMoveFreeze)
{
	PrintFunc(dest, "%*sOld Freeze Image\n", indent, "");
	PrintStlPAImageId(dest, indent, &pMoveFreeze->oldFreezeImage);
	PrintFunc(dest, "%*sNew Freeze Image\n", indent, "");
	PrintStlPAImageId(dest, indent, &pMoveFreeze->newFreezeImage);

	return;
}
Ejemplo n.º 5
0
void PrintStlPAGroupList(PrintDest_t *dest, int indent, const int numRecords, const STL_PA_GROUP_LIST *pGroupList)
{
	int i;

	PrintFunc(dest, "%*sNumber of Groups: %u\n", indent, "", numRecords);
	for (i = 0; i < numRecords; i++)
		PrintFunc(dest, "%*sGroup %u: %s\n", indent, "", i+1, pGroupList[i].groupName);
	return;
}
Ejemplo n.º 6
0
void PrintStlPAVFList(PrintDest_t *dest, int indent, const int numRecords, const STL_PA_VF_LIST *pVFList)
{
	int i;

	PrintFunc(dest, "%*sNumber of VFs: %u\n", indent, "", numRecords);
	for (i = 0; i < numRecords; i++) {
		PrintFunc(dest, "%*sVF %u: %s\n", indent, "", i+1, pVFList[i].vfName);
	}
	return;
}
Ejemplo n.º 7
0
static void
spawn_print(Operand *op)
{
  spawn_proc *proc = op->value;
  ForceNewline();
  PrintFunc("spawned process: ");
  if (!proc) PrintFunc("<no longer exists>");
  else if (proc->argv0) PrintFunc(proc->argv0);
  else PrintFunc("<name lost>");
  ForceNewline();
}
Ejemplo n.º 8
0
STDMETHODIMP OutputPin::EndFlush()
{
	PrintFunc(L"OutputPin::EndFlush");

	flushing = false;
	return S_OK;
}
Ejemplo n.º 9
0
STDMETHODIMP OutputPin::BeginFlush()
{
	PrintFunc(L"OutputPin::BeginFlush");

	flushing = true;
	return S_OK;
}
Ejemplo n.º 10
0
STDMETHODIMP OutputPin::QueryAccept(const AM_MEDIA_TYPE *pmt)
{
	PrintFunc(L"OutputPin::QueryAccept");

	DSHOW_UNUSED(pmt);
	return S_OK;
}
Ejemplo n.º 11
0
STDMETHODIMP CapturePin::EndFlush()
{
	PrintFunc(L"CapturePin::EndFlush");

	flushing = false;
	return S_OK;
}
Ejemplo n.º 12
0
void PrintStlPAImageId(PrintDest_t *dest, int indent, const STL_PA_IMAGE_ID_DATA *pImageId)
{
	time_t absTime = (time_t)pImageId->imageTime.absoluteTime;

	PrintFunc(dest, "%*sImageNumber: 0x%"PRIx64" Offset: %d\n",
			indent, "", pImageId->imageNumber, pImageId->imageOffset);
	if (absTime) {
		char buf[80];
		snprintf(buf, sizeof(buf), "%s", ctime((const time_t *)&absTime));
		if ((strlen(buf)>0) && (buf[strlen(buf)-1] == '\n'))
			buf[strlen(buf)-1] = '\0';

		PrintFunc(dest, "%*sImageTime: %s\n", indent, "", buf);
	}
	return;
}
Ejemplo n.º 13
0
// IMemInputPin methods
STDMETHODIMP CapturePin::GetAllocator(IMemAllocator **ppAllocator)
{
	PrintFunc(L"CapturePin::GetAllocator");

	DSHOW_UNUSED(ppAllocator);
	return VFW_E_NO_ALLOCATOR;
}
Ejemplo n.º 14
0
STDMETHODIMP CapturePin::BeginFlush()
{
	PrintFunc(L"CapturePin::BeginFlush");

	flushing = true;
	return S_OK;
}
Ejemplo n.º 15
0
STDMETHODIMP CapturePin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES *pProps)
{
	PrintFunc(L"CapturePin::GetAllocatorRequirements");

	DSHOW_UNUSED(pProps);
	return E_NOTIMPL;
}
Ejemplo n.º 16
0
int main()
{

  int N=1000;
  GRID grid(N, 1.5, false);
  
  //GRID grid("params");
  //int N=grid.get_N();

  double* omega = new double[N];
  double* dos = new double[N];

  grid.assign_omega(omega);
  printf("-----grid ready\n");

  int Nx = 4000;
  int Ny = 4000;
  IBZ ibz(IBZtypes::TriangularLattice, Nx, Ny);
  printf("-----ibz ready\n");
  for(int n=0; n<N; n++)
  { for(int i=0; i<Nx; i++)
    for(int j=0; j<Ny; j++)
      ibz.summand[i][j] = 1.0/(omega[n]-ibz.epsilon[i][j]+ii*1e-3);
    printf("-----summand ready, n=%d \n",n);
    dos[n] = -(1.0/pi)*imag(ibz.sum());    
  }
  PrintFunc("triangular_dos",N,dos,omega);
  printf("Spectral weight: %.6f\n",TrapezIntegral(N, dos, omega));
  delete [] dos;  
  delete [] omega;
  return 0;
}
Ejemplo n.º 17
0
/* ARGSUSED */
static void
ympg_print(Operand *op)
{
  /* ympg_stream *yzs = op->value; */
  ForceNewline();
  PrintFunc("mpeg encoder object");
  ForceNewline();
}
Ejemplo n.º 18
0
STDMETHODIMP CapturePin::QueryInternalConnections(IPin **apPin, ULONG *nPin)
{
	PrintFunc(L"CapturePin::QueryInternalConnections");

	DSHOW_UNUSED(apPin);
	DSHOW_UNUSED(nPin);
	return E_NOTIMPL;
}
Ejemplo n.º 19
0
STDMETHODIMP CapturePin::NotifyAllocator(IMemAllocator *pAllocator,
		BOOL bReadOnly)
{
	PrintFunc(L"CapturePin::NotifyAllocator");

	DSHOW_UNUSED(pAllocator);
	DSHOW_UNUSED(bReadOnly);
	return S_OK;
}
Ejemplo n.º 20
0
STDMETHODIMP CapturePin::ConnectionMediaType(AM_MEDIA_TYPE *pmt)
{
	PrintFunc(L"CapturePin::ConnectionMediaType");

	if (!connectedPin)
		return VFW_E_NOT_CONNECTED;

	return CopyMediaType(pmt, connectedMediaType);
}
Ejemplo n.º 21
0
STDMETHODIMP OutputPin::ConnectionMediaType(AM_MEDIA_TYPE *pmt)
{
	PrintFunc(L"OutputPin::ConnectionMediaType");

	if (!connectedPin)
		return VFW_E_NOT_CONNECTED;

	return CopyMediaType(pmt, outputInfo.mt);
}
Ejemplo n.º 22
0
STDMETHODIMP OutputPin::ReceiveConnection(IPin *pConnector,
		const AM_MEDIA_TYPE *pmt)
{
	PrintFunc(L"OutputPin::ReceiveConnection");

	DSHOW_UNUSED(pConnector);
	DSHOW_UNUSED(pmt);
	return S_OK;
}
Ejemplo n.º 23
0
void PrintStlPAImageInfo(PrintDest_t *dest, int indent, const STL_PA_IMAGE_INFO_DATA *pImageInfo)
{
	int i;
	time_t sweepStart = (time_t)pImageInfo->sweepStart;
	char buf[80];

	ctime_r((const time_t *)&sweepStart, buf);
	if ((strlen(buf)>0) && (buf[strlen(buf)-1] == '\n'))
		buf[strlen(buf)-1] = '\0';
	PrintStlPAImageId(dest, indent, &pImageInfo->imageId);
	PrintFunc(dest, "%*sImageSweepStart: %s  Duration: %u.%03u Seconds\n",
				indent, "", buf,
				pImageInfo->sweepDuration/1000000,
				(pImageInfo->sweepDuration%1000000)/1000);
	if (pImageInfo->imageInterval) {
		PrintFunc(dest, "%*sImage Interval: %u Seconds\n",
					indent, "", pImageInfo->imageInterval);
	}
	PrintFunc(dest, "%*sNum SW Ports: %u  HFI Ports: %u\n",
				indent, "", pImageInfo->numSwitchPorts,
			   	pImageInfo->numHFIPorts);
	PrintFunc(dest, "%*sNum SWs: %u  Links: %u  SMs: %u\n",
				indent, "", pImageInfo->numSwitchNodes,
				pImageInfo->numLinks, pImageInfo->numSMs);
	PrintFunc(dest, "%*sNum Failed Nodes: %u  Failed Ports: %u  Unexpected Clear Ports: %u\n",
				indent, "", pImageInfo->numFailedNodes,
				pImageInfo->numFailedPorts,
			   	pImageInfo->numUnexpectedClearPorts);
	PrintFunc(dest, "%*sNum Skipped Nodes: %u  Skipped Ports: %u\n",
				indent, "", pImageInfo->numSkippedNodes,
				pImageInfo->numSkippedPorts);
	for (i = 0; i < 2; i++) {
		if (i != 0 && ! pImageInfo->SMInfo[i].lid)
			continue;
		PrintFunc(dest, "%*s%s: LID: 0x%04x  Port: %3u  Priority: %2u  State: %s\n",
				indent, "", (i==0)?"   Master SM":"Secondary SM",
				pImageInfo->SMInfo[i].lid,
				pImageInfo->SMInfo[i].portNumber,
				pImageInfo->SMInfo[i].priority,
				IbSMStateToText(pImageInfo->SMInfo[i].state));
		PrintFunc(dest, "%*s              PortGuid: %016"PRIx64"\n",
				indent, "", pImageInfo->SMInfo[i].smPortGuid);
		PrintFunc(dest, "%*s              Name: %.*s\n",
				indent, "", (int)sizeof(pImageInfo->SMInfo[i].smNodeDesc),
				pImageInfo->SMInfo[i].smNodeDesc);
	}

	return;
}
Ejemplo n.º 24
0
STDMETHODIMP CapturePin::Disconnect()
{
	PrintFunc(L"CapturePin::Disconnect");

	if (!connectedPin)
		return S_FALSE;

	connectedPin = nullptr;
	return S_OK;
}
Ejemplo n.º 25
0
void PrintStlPAVFConfig(PrintDest_t *dest, int indent, const char *vfName, const int numRecords, const STL_PA_VF_CFG_RSP *pVFConfig)
{
	int i;

	PrintFunc(dest, "%*sVF name: %s\n",
				indent, "", vfName);
	PrintFunc(dest, "%*sNumber ports: %u\n",
				indent, "", numRecords);
	for (i = 0; i < numRecords; i++) {
		PrintFunc(dest, "%*s%u:LID:0x%04x Port:%u  GUID:0x%016"PRIx64"  NodeDesc: %.*s\n",
				indent, "", i+1, pVFConfig[i].nodeLid, pVFConfig[i].portNumber,
				pVFConfig[i].nodeGUID,
			   	(int)sizeof(pVFConfig[i].nodeDesc),
			   	pVFConfig[i].nodeDesc);
	}
	PrintStlPAImageId(dest, indent, &pVFConfig->imageId);

	return;
}
Ejemplo n.º 26
0
STDMETHODIMP CapturePin::NewSegment(REFERENCE_TIME tStart,
		REFERENCE_TIME tStop, double dRate)
{
	PrintFunc(L"CapturePin::NewSegment");

	DSHOW_UNUSED(tStart);
	DSHOW_UNUSED(tStop);
	DSHOW_UNUSED(dRate);
	return S_OK;
}
Ejemplo n.º 27
0
STDMETHODIMP OutputPin::EnumMediaTypes(IEnumMediaTypes **ppEnum)
{
	PrintFunc(L"OutputPin::EnumMediaTypes");

	*ppEnum = new OutputEnumMediaTypes(this);
	if (!*ppEnum)
		return E_OUTOFMEMORY;

	return NOERROR;
}
Ejemplo n.º 28
0
STDMETHODIMP CapturePin::EnumMediaTypes(IEnumMediaTypes **ppEnum)
{
	PrintFunc(L"CapturePin::EnumMediaTypes");

	*ppEnum = new CaptureEnumMediaTypes(this);
	if (!*ppEnum)
		return E_OUTOFMEMORY;

	return NOERROR;
}
Ejemplo n.º 29
0
Archivo: pma.c Proyecto: nirmoy/opa-ff
static FSTATUS perform_stl_pma_query(uint8 method, uint16 attrid, uint32 attrmod, argrec *args, STL_PERF_MAD *mad, size_t send_size)
{
	FSTATUS status;
	uint32_t dlid;
    uint8_t sl;

    sl   = args->sl==0xff?DEFAULT_PMA_SL:args->sl;  // check if sl has been set, if not use default sl

	mad->common.BaseVersion = STL_BASE_VERSION;
	mad->common.ClassVersion = STL_PM_CLASS_VERSION;
	mad->common.MgmtClass = MCLASS_PERF;
	mad->common.u.NS.Status.AsReg16 = 0; 
	mad->common.mr.AsReg8 = 0;
	mad->common.mr.s.Method = method;
	mad->common.AttributeID = attrid;
	mad->common.TransactionID = (++g_transactID);
	mad->common.AttributeModifier = attrmod;

	if (oib_get_port_state(args->oib_port) != IB_PORT_ACTIVE) {
		fprintf(stderr, "WARNING port (%s:%d) is not ACTIVE!\n",
			oib_get_hfi_name(args->oib_port),
			oib_get_hfi_port_num(args->oib_port));
    	dlid = args->dlid?args->dlid:STL_LID_PERMISSIVE;// perm lid for local query
	} else {
	    dlid = args->dlid?args->dlid:args->slid;	// use slid for local query
	}

    // Determine which pkey to use (full or limited)
    // Attempt to use full at all times, otherwise, can
    // use the limited for queries of the local port.
    uint16_t pkey = oib_get_mgmt_pkey(args->oib_port, args->dlid, args->drpaths);
    if (pkey==0) {
        fprintf(stderr, "ERROR: Local port does not have management privileges\n");
        return (FPROTECTION);
    }

	if (g_verbose) {
		PrintFunc(&g_dest, "Sending MAD to 0x%08x:\n", dlid);
		PrintMadHeader(&g_dest, 2, &mad->common);
		PrintSeparator(&g_dest);
	}

	BSWAP_MAD_HEADER((MAD*)mad);
	{
		struct oib_mad_addr addr = {
			lid  : dlid,
			qpn  : 1,
			qkey : QP1_WELL_KNOWN_Q_KEY,
			pkey : pkey,
            sl   : sl
		};
        size_t recv_size = sizeof(*mad);
		status = oib_send_recv_mad_no_alloc(args->oib_port, (uint8_t *)mad, send_size+sizeof(MAD_COMMON), &addr,
											(uint8_t *)mad, &recv_size, RESP_WAIT_TIME, 0);
	}
Ejemplo n.º 30
0
void fprint_path_record(FILE *f, char *str, op_path_rec_t *p_path)
{
	IB_PATH_RECORD path;

	network_to_host_path_record((IB_PATH_RECORD_NO*)p_path, &path);

	PrintDestInitFile(&printdest,f);

	PrintFunc(&printdest, "%s:\n",str);
	PrintExtendedPathRecord(&printdest,8, &path);
}