Ejemplo n.º 1
0
/// @par
///
/// May be called more than once to purge and re-initialize the crowd.
bool dtCrowd::init(const int maxAgents, const float maxAgentRadius, dtNavMesh* nav)
{
	purge();
	
	m_maxAgents = maxAgents;
	m_maxAgentRadius = maxAgentRadius;

	dtVset(m_ext, m_maxAgentRadius*2.0f,m_maxAgentRadius*1.5f,m_maxAgentRadius*2.0f);
	
	m_grid = dtAllocProximityGrid();
	if (!m_grid)
		return false;
	if (!m_grid->init(m_maxAgents*4, maxAgentRadius*3))
		return false;
	
	m_obstacleQuery = dtAllocObstacleAvoidanceQuery();
	if (!m_obstacleQuery)
		return false;
	if (!m_obstacleQuery->init(6, 8))
		return false;

	// Init obstacle query params.
	memset(m_obstacleQueryParams, 0, sizeof(m_obstacleQueryParams));
	for (int i = 0; i < DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS; ++i)
	{
		dtObstacleAvoidanceParams* params = &m_obstacleQueryParams[i];
		params->velBias = 0.4f;
		params->weightDesVel = 2.0f;
		params->weightCurVel = 0.75f;
		params->weightSide = 0.75f;
		params->weightToi = 2.5f;
		params->horizTime = 2.5f;
		params->gridSize = 33;
		params->adaptiveDivs = 7;
		params->adaptiveRings = 2;
		params->adaptiveDepth = 5;
	}
	
	// Allocate temp buffer for merging paths.
	m_maxPathResult = 256;
	m_pathResult = (dtPolyRef*)dtAlloc(sizeof(dtPolyRef)*m_maxPathResult, DT_ALLOC_PERM);
	if (!m_pathResult)
		return false;
	
	if (!m_pathq.init(m_maxPathResult, MAX_PATHQUEUE_NODES, nav))
		return false;
	
	m_agents = (dtCrowdAgent*)dtAlloc(sizeof(dtCrowdAgent)*m_maxAgents, DT_ALLOC_PERM);
	if (!m_agents)
		return false;
	
	m_activeAgents = (dtCrowdAgent**)dtAlloc(sizeof(dtCrowdAgent*)*m_maxAgents, DT_ALLOC_PERM);
	if (!m_activeAgents)
		return false;

	m_agentAnims = (dtCrowdAgentAnimation*)dtAlloc(sizeof(dtCrowdAgentAnimation)*m_maxAgents, DT_ALLOC_PERM);
	if (!m_agentAnims)
		return false;
	
	for (int i = 0; i < m_maxAgents; ++i)
	{
		new(&m_agents[i]) dtCrowdAgent();
		m_agents[i].active = false;
		if (!m_agents[i].corridor.init(m_maxPathResult))
			return false;
	}

	for (int i = 0; i < m_maxAgents; ++i)
	{
		m_agentAnims[i].active = false;
	}

	// The navquery is mostly used for local searches, no need for large node pool.
	m_navquery = dtAllocNavMeshQuery();
	if (!m_navquery)
		return false;
	if (dtStatusFailed(m_navquery->init(nav, MAX_COMMON_NODES)))
		return false;
	
	return true;
}
Ejemplo n.º 2
0
dtCrowd::~dtCrowd()
{
	purge();
}
Ejemplo n.º 3
0
pulsesequence()
{
    /* DECLARE VARIABLES */
    char     satmode[MAXSTR],f1180[MAXSTR],sspul[MAXSTR],comm[MAXSTR],
             pwx180ad[MAXSTR],pwx180adR[MAXSTR],pwx180ref[MAXSTR];
    int	  phase,satmove,maxni,t1_counter,icosel=1,
                                         prgcycle = (int)(getval("prgcycle")+0.5);
    double   tau1,tauxh, tauxh1, taucc,av180,
             hsgt   = getval("hsgt"),
             gt1    = getval("gt1"),
             gt2    = getval("gt2"),
             gt3    = getval("gt3"),
             hsglvl = getval("hsglvl"),
             gzlvl1 = getval("gzlvl1"),
             gzlvl2 = getval("gzlvl2"),
             gzlvl3 = getval("gzlvl3"),
             pwx    = getval("pwx"),
             pwxlvl = getval("pwxlvl"),
             j1xh   = getval("j1xh"),
             jcc    = getval("jcc"),
             satdly = getval("satdly"),
             satpwr = getval("satpwr"),
             satfrq = getval("satfrq"),
             sw1    = getval("sw1"),
             gstab  = getval("gstab"),
             kappa  = getval("kappa"),
             dofdec = getval("dofdec"),
             pwx180 = getval("pwx180"),
             pwxlvl180  = getval("pwxlvl180");

    getstr("f1180",f1180);
    getstr("satmode",satmode);
    getstr("sspul",sspul);
    getstr("pwx180ad", pwx180ad);
    ni = getval("ni");
    av180 = (double)((int)(1e6*(9.45*4*pwx/1.54+0.5e-6))/1e6); /* round it to 1usec */
    phase = (int) (getval("phase") + 0.5);
    satmove = ( fabs(tof - satfrq) >= 0.1 );

    /* construct a command line for Pbox */

    if((getval("arraydim") < 1.5) || (ix==1))        /* execute only once */
    {   sprintf(comm, "Pbox ad180 -u %s -w \"cawurst-10 %.1f/%.6f\" -s 1.0 -0\n",
                userdir, 1.0/pwx, 30*pwx);
        system(comm);                         /* create adiabatic 180 pulse */
        sprintf(comm, "Pbox av180 -u %s -w \"av180b %.6f\" -s 1.0 -0\n", userdir, av180);
        system(comm);                        /* create refocusing 180 pulse */
    }

    /* LOAD VARIABLES */

    settable(t1, 1, phi1);
    settable(t2, 1, phi2);
    settable(t4, 2, phi4);
    settable(t5, 4, phi5);
    settable(t6, 4, phi6);
    settable(t8, 1, phi8);
    settable(t9, 8, phi9);
    settable(t10, 16, phi10);
    settable(t11, 1, phi11);
    settable(t31, 16, phi31);

    /* INITIALIZE VARIABLES */
    if (j1xh != 0.0)
    {
        tauxh = 1/(4*j1xh);
        tauxh1 = 1/(6*j1xh);
    }
    else
    {
        tauxh = 1.80e-3;
        tauxh1 = 1.80e-3;
    }

    if ( jcc != 0.0 ) taucc = 1/(4*jcc);
    else  taucc = 1/(4*40);

    /*  Phase incrementation for hypercomplex echo-antiecho 2D data */

    if (phase == 2)
    {
        tsadd(t6,2,4);
        icosel=-1;
    }
    else icosel=1;

    /* Calculate modifications to phases for States-TPPI acquisition          */

    if( ix == 1) d2_init = d2 ;
    t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 );
    if(t1_counter % 2)
    {
        tsadd(t9,2,4);
        tsadd(t31,2,4);
    }

    /* Check constant-time conditions */
    if (kappa == 1.0)
    {
        maxni = (int) (taucc*sw1*2.0);
        if (maxni < ni)
        {
            abort_message("too many increments! maxni = %d   ",maxni);
        }
    }

    /* SET UP FOR (-90,180) PHASE CORRECTIONS IF f1180='y' */
    tau1 = d2;
    if(f1180[A] == 'y')  tau1 += ( 1.0/(2.0*sw1) ); /* Wait half a dwell time */
    tau1 = tau1/2.0;

    /* BEGIN ACTUAL PULSE SEQUENCE */

    status(A);
    decpower(pwxlvl);
    decoffset(dof);     /* Set decoupler power to pwxlvl */

    delay(5.0e-5);
    if (getflag("sspul"))
        steadystate();

    if (satmode[0] == 'y')
    {
        if ((d1-satdly) > 0.02)
            delay(d1-satdly);
        else
            delay(0.02);
        if (getflag("slpsat"))
        {
            shaped_satpulse("relaxD",satdly,v4);
            if (getflag("prgflg"))
                shaped_purge(v1,v4,v18,v19);
        }
        else
        {
            satpulse(satdly,v4,rof1,rof1);
            if (getflag("prgflg"))
                purge(v1,v4,v18,v19);
        }

    }
    else
        delay(d1);

    if (getflag("wet"))
        wet4(zero,one);

    status(B);
    rcvroff();
    rgpulse(pw,t1,1.0e-6,0.0);
    txphase(t1);
    decphase(t1);
    delay(tauxh-15.0*pwx);                        /* delay=1/4J(XH) */
    simshaped_pulse("","ad180",2*pw,30*pwx,t1,t1,0.0,0.0);
    txphase(t2);
    decphase(t4);
    delay(tauxh-15.0*pwx);
    simpulse(pw,pwx,t2,t4,0.0,0.0);
    decphase(t8);
    delay(taucc);
    decshaped_pulse("av180",av180,t8,0.0,0.0);
    decphase(t9);
    delay(taucc);
    decrgpulse(pwx,t9,0.0,0.0);
    delay(tau1);
    rgpulse(2*pw,t1,1.0e-6,0.0);
    delay(tau1);
    delay(gt1 + gstab + 2*GRADIENT_DELAY - 2*pw -1.0e-6);
    decshaped_pulse("av180",av180,t11,1.0e-6,0.0);
    zgradpulse(gzlvl1, gt1);
    delay(gstab);
    decrgpulse(pwx*1.3333,t10,1.0e-6,0.0);   /* 120 Grad pulse */
    decphase(t11);
    delay(taucc - kappa*tau1);
    decshaped_pulse("av180",av180,t11,0.0,0.0);
    delay(10.0e-6);
    zgradpulse(gzlvl2,gt2);
    delay(gstab);
    delay(taucc - 10.0e-6 - gstab - gt2 - 2*GRADIENT_DELAY - 1.0e-6);
    rgpulse(kappa*2*pw,t1,1.0e-6,0.0);
    delay(kappa*tau1);
    simpulse(pw,pwx,t1,t5,1.0e-6,0.0);
    txphase(t1);
    decphase(t1);
    delay(tauxh1);                        /* delay=1/4J (XH);1/6J XH,XH2, XH3) */
    simshaped_pulse("","av180",2*pw,av180,t1,t1,0.0,0.0);
    txphase(t2);
    decphase(t6);
    delay(tauxh1);
    simpulse(pw,pwx,t2,t6,0.0,0.0);
    txphase(t1);
    decphase(t1);
    delay(tauxh-15.0*pwx);
    simshaped_pulse("","ad180",2*pw,30*pwx,t1,t1,0.0,0.0);
    txphase(t1);
    delay(tauxh-15.0*pwx-0.5e-6);
    rgpulse(pw,t1,0.0,0.0);
    decpower(dpwr);
    decoffset(dofdec);  /* lower decoupler power for decoupling */
    delay(gt3 + gstab + 2*GRADIENT_DELAY-POWER_DELAY-1.0e-6);
    rgpulse(2*pw,t1,1.0e-6,0.0);
    zgradpulse(icosel*gzlvl3, gt3);
    delay(gstab);
    rcvron();
    status(C);
    setreceiver(t31);
}
Ejemplo n.º 4
0
dtPathQueue::~dtPathQueue()
{
	purge();
}
Ejemplo n.º 5
0
SoundManager::~SoundManager() {
    purge();
}
Ejemplo n.º 6
0
void pulsesequence()
{
   double  hsglvl = getval("hsglvl"),
             hsgt = getval("hsgt"),
           satpwr = getval("satpwr"),
           satdly = getval("satdly");
   int     prgcycle = (int)(getval("prgcycle")+0.5);
   char    sspul[MAXSTR],satmode[MAXSTR],wet[MAXSTR];

   getstr("satmode",satmode);
   getstr("sspul", sspul);
   getstr("wet",wet);

  assign(ct,v17);
  assign(zero,v18);
  assign(zero,v19);

  if (getflag("prgflg") && (satmode[0] == 'y') && (prgcycle > 1.5))
    {
        hlv(ct,v17);
        mod2(ct,v18); dbl(v18,v18);
        if (prgcycle > 2.5)
           {
                hlv(v17,v17);
                hlv(ct,v19); mod2(v19,v19); dbl(v19,v19);
           }
     }

   settable(t1,4,ph1);     getelem(t1,v17,v1);
   settable(t2,8,ph2);     getelem(t2,v17,v2);
   assign(v1,oph);
   add(oph,v18,oph);
   add(oph,v19,oph);

/* BEGIN ACTUAL SEQUENCE */
   status(A);
      obspower(tpwr);
 
   delay(5.0e-5);
   if (getflag("sspul"))
	steadystate();

   if (satmode[0] == 'y')
     {
        if ((d1-satdly) > 0.02)
                delay(d1-satdly);
        else
                delay(0.02);
        if (getflag("slpsat"))
           {
                shaped_satpulse("relaxD",satdly,v4);
                if (getflag("prgflg"))
                   shaped_purge(v1,v4,v18,v19);
           }
        else
           {
                satpulse(satdly,v4,rof1,rof1);
                if (getflag("prgflg"))
                   purge(v1,v4,v18,v19);
           }

     }
   else
	delay(d1);

   if (getflag("wet"))
     wet4(zero,one);

   status(B);
      if (getflag("cpmgflg"))
      {
         rgpulse(pw, v1, rof1, 0.0);
         cpmg(v1, v15);
      }
      else
         rgpulse(pw, v1, rof1, rof1);
      delay(d2/2);
      rgpulse(2.0*pw, v2, rof1, 2*rof1);
      delay(d2/2 + 2*pw/PI);
   status(C);
}
Ejemplo n.º 7
0
pulsesequence()

{
   double   gzlvlE = getval("gzlvlE"),
	    gtE = getval("gtE"),
	    EDratio = getval("EDratio"),
	    gstab = getval("gstab"),
	    mult = getval("mult"),
            hsglvl = getval("hsglvl"),
            hsgt = getval("hsgt"),
            tau,
	    evolcorr,
            taug;
   int	    icosel,
            prgcycle = (int)(getval("prgcycle")+0.5),
	    phase1 = (int)(getval("phase")+0.5),
	    ZZgsign;

//synchronize gradients to srate for probetype='nano'
//   Preserve gradient "area"
        gtE = syncGradTime("gtE","gzlvlE",0.5);
        gzlvlE = syncGradLvl("gtE","gzlvlE",0.5);

   tau  = 1/(4*(getval("j1xh")));
   evolcorr = 2*pw+4.0e-6;

   if (mult > 0.5)
    taug = 2*tau;
   else
    taug = gtE + gstab + 2*GRADIENT_DELAY;
   ZZgsign=-1;
   if (mult == 2) ZZgsign=1;
   icosel = 1;

  assign(ct,v17);
  assign(zero,v18);
  assign(zero,v19);

  if (getflag("prgflg") && (satmode[0] == 'y') && (prgcycle > 1.5))
    {
        hlv(ct,v17);
        mod2(ct,v18); dbl(v18,v18);
        if (prgcycle > 2.5)
           {
                hlv(v17,v17);
                hlv(ct,v19); mod2(v19,v19); dbl(v19,v19);
           }
     }

   settable(t1,4,ph1);
   settable(t2,2,ph2);
   settable(t3,8,ph3);
   settable(t4,16,ph4);
   settable(t5,16,ph5);

  getelem(t1, v17, v1);
  getelem(t3, v17, v3);
  getelem(t4, v17, v4);
  getelem(t2, v17, v2);
  getelem(t5, v17, oph);

  assign(zero,v6);
  add(oph,v18,oph);
  add(oph,v19,oph);

/*
   mod2(id2,v14);
   dbl(v14,v14);
*/
   initval(2.0*(double)(((int)(d2*getval("sw1")+0.5)%2)),v14);

   if ((phase1 == 2) || (phase1 == 5))
     icosel = -1;

   add(v2,v14,v2);
   add(oph,v14,oph);

status(A);
   obspower(tpwr);

   delay(5.0e-5);
   if (getflag("sspul"))
        steadystate();

   if (satmode[0] == 'y')
     {
        if ((d1-satdly) > 0.02)
                delay(d1-satdly);
        else
                delay(0.02);
        if (getflag("slpsat"))
           {
                shaped_satpulse("relaxD",satdly,zero);
                if (getflag("prgflg"))
                   shaped_purge(v6,zero,v18,v19);
           }
        else
           {
                satpulse(satdly,zero,rof1,rof1);
                if (getflag("prgflg"))
                   purge(v6,zero,v18,v19);
           }
     }
   else
	delay(d1);

   if (getflag("wet"))
     wet4(zero,one);

   decpower(pwxlvl);

status(B);

      if (getflag("nullflg"))
      {
        rgpulse(0.5*pw,zero,rof1,rof1);
        delay(2*tau);
        simpulse(2.0*pw,2.0*pwx,zero,zero,rof1,rof1);
        delay(2*tau);
        rgpulse(1.5*pw,two,rof1,rof1);
        zgradpulse(hsglvl,hsgt);
        delay(1e-3);
      }

     rgpulse(pw,v6,rof1,rof1);
     delay(tau);
     simpulse(2*pw,2*pwx,zero,zero,rof1,rof1);
     delay(tau);
     rgpulse(pw,v1,rof1,rof1);
	zgradpulse(hsglvl,2*hsgt);
	delay(1e-3);
     decrgpulse(pwx,v2,rof1,2.0e-6);
     
      delay(d2/2);
     rgpulse(2*pw,zero,2.0e-6,2.0e-6);
      delay(d2/2);
     zgradpulse(gzlvlE,gtE);
     delay(taug - gtE - 2*GRADIENT_DELAY);
     simpulse(mult*pw,2*pwx,zero,zero,rof1,rof1);
     delay(taug + evolcorr); 
     
     decrgpulse(pwx,v4,2.0e-6,rof1);
	zgradpulse(ZZgsign*0.6*hsglvl,1.2*hsgt);
	delay(1e-3);
     rgpulse(pw,v3,rof1,rof1);
     delay(tau - (2*pw/PI) - 2*rof1);
     simpulse(2*pw,2*pwx,zero,zero,rof1, rof2);
     decpower(dpwr);
     zgradpulse(icosel*2.0*gzlvlE/EDratio,gtE/2.0);
     delay(tau - gtE/2.0 - 2*GRADIENT_DELAY - POWER_DELAY);
   status(C);
}
Ejemplo n.º 8
0
static void process_command(int *quit)
{
	char inbuf[132];
	int x = 0, y = 0;

	if (!opt_cmd) {
		fgets(inbuf, sizeof(inbuf), stdin);
		sscanf(inbuf, "%s %d %d", cmd, &x, &y);
	}

	if (!strncmp(cmd, "EXIT", 4)) {
		*quit = 1;
		unlock_all();
		return;
	}

	if (!strncmp(cmd, "CLOSE", 5)) {
		*quit = 1;
		openclose_ls = 1;
		unlock_all();
		return;
	}

	if (!strncmp(cmd, "kill", 4)) {
		printf("process exiting\n");
		exit(0);
	}

	if (!strncmp(cmd, "lock", 4) && strlen(cmd) == 4) {
		lock(x, y);
		return;
	}

	if (!strncmp(cmd, "unlock", 6) && strlen(cmd) == 6) {
		unlock(x);
		return;
	}

	if (!strncmp(cmd, "unlockf", 7) && strlen(cmd) == 7) {
		unlockf(x);
		return;
	}

	if (!strncmp(cmd, "cancel", 6) && strlen(cmd) == 6) {
		cancel(x);
		return;
	}

	if (!strncmp(cmd, "canceld", 7) && strlen(cmd) == 7) {
		canceld(x, y);
		return;
	}

	if (!strncmp(cmd, "lock_sync", 9) && strlen(cmd) == 9) {
		lock_sync(x, y);
		return;
	}

	if (!strncmp(cmd, "unlock_sync", 11) && strlen(cmd) == 11) {
		unlock_sync(x);
		return;
	}

	if (!strncmp(cmd, "lock-kill", 9) && strlen(cmd) == 9) {
		lock(x, y);
		printf("process exiting\n");
		exit(0);
	}

	if (!strncmp(cmd, "unlock-kill", 11) && strlen(cmd) == 11) {
		unlock(x);
		printf("process exiting\n");
		exit(0);
	}

	if (!strncmp(cmd, "lock-cancel", 11) && strlen(cmd) == 11) {
		lock(x, y);
		/* usleep(1000 * z); */
		cancel(x);
		return;
	}

	if (!strncmp(cmd, "lock-unlockf", 12) && strlen(cmd) == 12) {
		lock(x, y);
		/* usleep(1000 * z); */
		unlockf(x);
		return;
	}

	if (!strncmp(cmd, "ex", 2)) {
		lock(x, LKM_EXMODE);
		return;
	}

	if (!strncmp(cmd, "pr", 2)) {
		lock(x, LKM_PRMODE);
		return;
	}

	if (!strncmp(cmd, "hold", 4) && strlen(cmd) == 4) {
		lock_all(LKM_PRMODE);
		return;
	}

	if (!strncmp(cmd, "hold-kill", 9) && strlen(cmd) == 9) {
		lock_all(LKM_PRMODE);
		exit(0);
	}

	if (!strncmp(cmd, "release", 7) && strlen(cmd) == 7) {
		unlock_all();
		return;
	}

	if (!strncmp(cmd, "release-kill", 12) && strlen(cmd) == 12) {
		unlock_all();
		exit(0);
	}

	if (!strncmp(cmd, "dump", 4) && strlen(cmd) == 4) {
		dump();
		return;
	}

	if (!strncmp(cmd, "stress", 6) && strlen(cmd) == 6) {
		if (iterations && !x)
			x = iterations;
		stress(x);
		return;
	}

	if (!strncmp(cmd, "tstress", 7) && strlen(cmd) == 7) {
		tstress(x);
		return;
	}

	if (!strncmp(cmd, "dstress", 7) && strlen(cmd) == 7) {
		dstress(x);
		return;
	}

	if (!strncmp(cmd, "stress_delay", 12) && strlen(cmd) == 12) {
		stress_delay = x;
		return;
	}

	if (!strncmp(cmd, "stress_lock_only", 16) && strlen(cmd) == 16) {
		stress_lock_only = !stress_lock_only;
		printf("stress_lock_only is %s\n", stress_lock_only ? "on" : "off");
		return;
	}

	if (!strncmp(cmd, "stress_stop", 11) && strlen(cmd) == 11) {
		stress_stop = !stress_stop;
		printf("stress_stop is %d\n", stress_stop);
		return;
	}

	if (!strncmp(cmd, "ignore_bast", 11) && strlen(cmd) == 11) {
		ignore_bast = !ignore_bast;
		printf("ignore_bast is %s\n", ignore_bast ? "on" : "off");
		return;
	}

	if (!strncmp(cmd, "our_xid", 7) && strlen(cmd) == 7) {
		our_xid = x;
		printf("our_xid is %llx\n", (unsigned long long)our_xid);
		return;
	}


	if (!strncmp(cmd, "purge", 5) && strlen(cmd) == 5) {
		purge(x, y);
		return;
	}

	if (!strncmp(cmd, "purgetest", 9) && strlen(cmd) == 9) {
		purgetest(x, y);
		return;
	}

	if (!strncmp(cmd, "noqueue", 7)) {
		noqueue = !noqueue;
		printf("noqueue is %s\n", noqueue ? "on" : "off");
		return;
	}

	if (!strncmp(cmd, "persistent", 10)) {
		persistent = !persistent;
		printf("persistent is %s\n", persistent ? "on" : "off");
		return;
	}

	if (!strncmp(cmd, "minhold", 7)) {
		minhold = x;
		return;
	}

	if (!strncmp(cmd, "timeout", 7)) {
		timeout = (uint64_t) 100 * x; /* dlm takes it in centiseconds */
		printf("timeout is %d\n", x);
		return;
	}

	if (!strncmp(cmd, "quiet", 5)) {
		quiet = !quiet;
		printf("quiet is %d\n", quiet);
		return;
	}

	if (!strncmp(cmd, "verbose", 7)) {
		verbose = !verbose;
		printf("verbose is %d\n", verbose);
		return;
	}

	if (!strncmp(cmd, "help", 4)) {
		print_commands();
		return;
	}

	if (!strncmp(cmd, "settings", 8)) {
		print_settings();
		return;
	}

	printf("unknown command %s\n", cmd);
}
Ejemplo n.º 9
0
pulsesequence()
{

  double j1min = getval("j1min"),
         j1max = getval("j1max"),
         pwx180 = getval("pwx180"),
         pwxlvl180 = getval("pwxlvl180"),
         pwx180r = getval("pwx180r"),
         pwxlvl180r = getval("pwxlvl180r"),
         mult = getval("mult"),
         gzlvl0 = getval("gzlvl0"),
         gt0 = getval("gt0"),
         gzlvlE = getval("gzlvlE"),
         gtE = getval("gtE"),
         EDratio = getval("EDratio"),
         gstab = getval("gstab"),
	 tauA,
         tauB,
         tau,
         taumb,
         taug,
         grad1,
         grad2,
         grad3,
         grad4;

  char   pwx180ad[MAXSTR], 
         pwx180ref[MAXSTR];

  int 	 icosel,
         prgcycle = (int)(getval("prgcycle")+0.5),
	 phase1 = (int)(getval("phase")+0.5);

//synchronize gradients to srate for probetype='nano'
//   Preserve gradient "area"
        gtE = syncGradTime("gtE","gzlvlE",1.0);
        gzlvlE = syncGradLvl("gtE","gzlvlE",1.0);

  getstr("pwx180ad", pwx180ad);
  getstr("pwx180ref", pwx180ref);

  tauA = 1/(2*(j1min + 0.146*(j1max - j1min)));
  tauB = 1/(2*(j1max - 0.146*(j1max - j1min)));
  tau = 1/(j1max + j1min);
  taumb = 1 / (2 * (getval("jnxh")));

  taug = tau + getval("tauC");

  icosel = 1;

  assign(ct,v17);
  assign(zero,v18);
  assign(zero,v19);

  if (getflag("prgflg") && (satmode[0] == 'y') && (prgcycle > 1.5))
    {
        hlv(ct,v17);
        mod2(ct,v18); dbl(v18,v18);
        if (prgcycle > 2.5)
           {
                hlv(v17,v17);
                hlv(ct,v19); mod2(v19,v19); dbl(v19,v19);
           }
     }

  settable(t1, 4, ph1);
  settable(t2, 8, ph2);
  settable(t3, 16, ph3);
  settable(t4, 2, ph4);

  getelem(t1, v17, v1);
  getelem(t2, v17, v2);
  getelem(t3, v17, v3);
  getelem(t4, v17, oph);

  add(oph,v18,oph);
  add(oph,v19,oph);
  assign(zero,v6);

/*
  mod2(id2, v14);
  dbl(v14,v14);
*/
  initval(2.0*(double)(((int)(d2*getval("sw1")+0.5)%2)),v14);

  add(v2, v14, v2);
  add(oph, v14, oph);

  if ((phase1 == 2) || (phase1 == 5))
  {
    icosel = -1;
  }

  grad2 = gzlvlE;
  grad3 = -1.5*gzlvlE;
  grad1 = -1.0*grad2*(EDratio + icosel)/EDratio;
  grad4 = -1.0*grad3*(EDratio - icosel)/EDratio;

  if (mult > 0.5)
  {
    grad4 = -1.0*grad3*(EDratio + icosel)/EDratio;
  }

  status(A);

   delay(5.0e-5);
   if (getflag("sspul"))
        steadystate();

   if (satmode[0] == 'y')
     {
        if ((d1-satdly) > 0.02)
                delay(d1-satdly);
        else
                delay(0.02);
        if (getflag("slpsat"))
           {
                shaped_satpulse("relaxD",satdly,zero);
                if (getflag("prgflg"))
                   shaped_purge(v6,zero,v18,v19);
           }
        else
           {
                satpulse(satdly,zero,rof1,rof1);
                if (getflag("prgflg"))
                   purge(v6,zero,v18,v19);
           }
     }
   else
        delay(d1);

   if (getflag("wet"))
     wet4(zero,one);

   obspower(tpwr);
   decpower(pwxlvl);

  status(B);

    rgpulse(pw, v6, rof1, rof2);

/* Start of J filter  */

   if (getflag("jfilter"))
   {
     zgradpulse(gzlvl0,gt0);
     delay(tauA - gt0);
     decrgpulse(pwx, zero, rof1, rof1);
     zgradpulse(-gzlvl0*2/3,gt0);
     delay(tauB - gt0);
     decrgpulse(pwx, zero, rof1, rof1);
     zgradpulse(-gzlvl0/3,gt0);
    }

/* End of J filter */

    delay(taumb);

    zgradpulse(grad1,gtE);
    delay(gstab);

    decrgpulse(pwx, v2, rof1, rof1);

    if (mult > 0.5)
    {
    decpower(pwxlvl180r);
    zgradpulse(grad2,gtE);
    delay(taug-gtE-2*GRADIENT_DELAY);
    decshaped_pulse(pwx180ref, pwx180r, zero, rof1, rof1);

    delay(d2/2);
    rgpulse(2*pw,v3,rof1,rof1);
    delay(d2/2);

    delay(taug-(gtE+gstab+2*GRADIENT_DELAY)+(4*pwx/PI+2*rof1+2*POWER_DELAY-2*pw-2*rof1));
    zgradpulse(grad3,gtE);
    delay(gstab);
    decshaped_pulse(pwx180ref, pwx180r, zero, rof1, rof1);
    }

    else
    {
    decpower(pwxlvl180);
    zgradpulse(grad2,gtE);
    delay(taug/2+(pwx180r-pwx180)/2- gtE - 2*GRADIENT_DELAY);
    decshaped_pulse(pwx180ad, pwx180, zero, rof1, rof1);
    delay(taug/2+(pwx180r-pwx180)/2.0);

    delay(d2/2);
    rgpulse(2*pw,v3,rof1,rof1);
    delay(d2/2);

    delay(taug/2+(pwx180r-pwx180)/2.0+(4*pwx/PI+2*rof1+2*POWER_DELAY-2*pw-2*rof1));
    decshaped_pulse(pwx180ad, pwx180, zero, rof1, rof1);
    delay(taug/2+(pwx180r-pwx180)/2-gtE-gstab-2*GRADIENT_DELAY);
    zgradpulse(grad3,gtE);
    delay(gstab);
    }

    decpower(pwxlvl);

    decrgpulse(pwx, v1, rof1, rof2);
    decpower(dpwr);
    zgradpulse(grad4,gtE);
    delay(gstab);

  status(C);
}
Ejemplo n.º 10
0
CLinkedQueue::~CLinkedQueue()
{
	purge();
}
Ejemplo n.º 11
0
pulsesequence()
{
   double          selpwrA = getval("selpwrA"),
                   selpwA = getval("selpwA"),
                   gzlvlA = getval("gzlvlA"),
                   gtA = getval("gtA"),
                   selpwrB = getval("selpwrB"),
                   selpwB = getval("selpwB"),
                   gzlvlB = getval("gzlvlB"),
                   gtB = getval("gtB"),
                   gstab = getval("gstab"),
                   slpwrR = getval("slpwrR"),
                   slpwR = getval("slpwR"),
                   mixR = getval("mixR"),
                   gzlvlz = getval("gzlvlz"),
                   gtz = getval("gtz"),
		   alfa1,
		   t1dly,
		   zfphinc = getval("zfphinc");
   char		   slpatR[MAXSTR],
                   selshapeA[MAXSTR],
                   selshapeB[MAXSTR];
   int             phase1 = (int)(getval("phase")+0.5),
                   prgcycle = (int)(getval("prgcycle")+0.5);

//synchronize gradients to srate for probetype='nano'
//   Preserve gradient "area"
        gtA = syncGradTime("gtA","gzlvlA",1.0);
        gzlvlA = syncGradLvl("gtA","gzlvlA",1.0);
        gtB = syncGradTime("gtB","gzlvlB",1.0);
        gzlvlB = syncGradLvl("gtB","gzlvlB",1.0);

/* LOAD AND INITIALIZE PARAMETERS */
   getstr("selshapeA",selshapeA);
   getstr("selshapeB",selshapeB);
   getstr("slpatR",slpatR);

   alfa1 = POWER_DELAY + (2*pw/PI) + rof1;
   if (getflag("homodec"))
        alfa1 = alfa1 + 2.0e-6 + 2*pw;
   t1dly = d2-alfa1;
   if (t1dly > 0.0)
        t1dly = t1dly;
   else
        t1dly = 0.0;

   if (strcmp(slpatR,"cw") &&
        strcmp(slpatR,"troesy") &&
        strcmp(slpatR,"dante"))
        abort_message("SpinLock pattern %s not supported!.\n", slpatR);

  assign(ct,v17);
  assign(zero,v18);
  assign(zero,v19);

  if (getflag("prgflg") && (satmode[0] == 'y') && (prgcycle > 1.5))
    {
        hlv(ct,v17);
        mod2(ct,v18); dbl(v18,v18);
        if (prgcycle > 2.5)
           {
                hlv(v17,v17);
                hlv(ct,v19); mod2(v19,v19); dbl(v19,v19);
           }
     }

   settable(t1,4,ph1);	getelem(t1,v17,v1);
   settable(t2,8,ph2);	getelem(t2,v17,v20);
   settable(t3,8,ph3);	
   settable(t8,4,ph8);	getelem(t8,v17,v8);
   settable(t6,8,ph6);	getelem(t6,v17,v6);
  
   assign(v1,oph); 
   if (getflag("zfilt"))
	getelem(t3,v17,oph);

   assign(v20,v9);
   if (!strcmp(slpatR,"troesy"))
	assign(v20,v21);
   else
	add(v20,one,v21);

   add(oph,v18,oph);
   add(oph,v19,oph);

  if (getflag("prgflg") && (satmode[0] == 'y'))
	assign(v1,v6);
   if (phase1 == 2)
      {incr(v1); incr(v6);}			/* hypercomplex method */

  assign(v1,v11);
  add(v11,two,v12);
  assign(oph,v14);

/*
   mod2(id2,v13);
   dbl(v13,v13);
*/
  initval(2.0*(double)(((int)(d2*getval("sw1")+0.5)%2)),v13);

  if (getflag("fadflg"))
  {
       add(v1,v13,v1);
       add(v6,v13,v6);
       add(oph,v13,oph);
  }

  if (getflag("homodec"))
	add(oph,two,oph);

/* The following is for flipback pulse */
   zfphinc=zfphinc+180;
   if (zfphinc < 0) zfphinc=zfphinc+360;
   initval(zfphinc,v10);

/* BEGIN ACTUAL PULSE SEQUENCE */
   status(A);
      obspower(tpwr);

   delay(5.0e-5);
   if (getflag("sspul"))
        steadystate();

   if (satmode[0] == 'y')
     {
        if ((d1-satdly) > 0.02)
                delay(d1-satdly);
        else
                delay(0.02);
        if (getflag("slpsat"))
           {
                shaped_satpulse("relaxD",satdly,v6);
                if (getflag("prgflg"))
                   shaped_purge(v1,v6,v18,v19);
           }
        else
           {
                satpulse(satdly,v6,rof1,rof1);
                if (getflag("prgflg"))
                   purge(v1,v6,v18,v19);
           }
     }
   else
        delay(d1);

   if (getflag("wet"))
     wet4(zero,one);
   decpower(dpwr);

   status(B);
      rgpulse(pw, v1, rof1, rof1);
      if (getflag("homodec"))
       {
                delay(t1dly/2);
                rgpulse(2*pw,v14,1.0e-6,1.0e-6);
       }
      else
                delay(t1dly);

        zgradpulse(gzlvlA,gtA);
        delay(gstab);
        obspower(selpwrA);
        shaped_pulse(selshapeA,selpwA,v11,rof1,rof1);
        obspower(tpwr);
        zgradpulse(gzlvlA,gtA);
        delay(gstab);

      if (getflag("homodec"))
                delay(t1dly/2);

        zgradpulse(gzlvlB,gtB);
        delay(gstab);
        obspower(selpwrB);
        shaped_pulse(selshapeB,selpwB,v12,rof1,rof1);
        obspower(tpwr);
        zgradpulse(gzlvlB,gtB);
        delay(gstab);
      
      obspower(slpwrR);

      if (mixR > 0.0)
      {
        if (dps_flag)
          	rgpulse(mixR,v21,0.0,0.0);
        else
          SpinLock(slpatR,mixR,slpwR,v21);
      }

       if ((getflag("zfilt")) && (getflag("PFGflg")))
        {
           obspower(tpwr);
           rgpulse(pw,v9,1.0e-6,rof1);
           zgradpulse(gzlvlz,gtz);
           delay(gtz/3);
           if (getflag("flipback"))
                FBpulse(v8,v10);
           rgpulse(pw,v8,rof1,rof2);
        }
       else
           delay(rof2);

   status(C);
}
Ejemplo n.º 12
0
pulsesequence()
{
  double satdly = getval("satdly");
  int prgcycle=(int)(getval("prgcycle")+0.5);
  char	satmode[MAXSTR],
	sspul[MAXSTR];

  getstr("satmode",satmode);
  getstr("sspul",sspul);

  assign(ct,v17);
  assign(zero,v18);
  assign(zero,v19);

  if (getflag("prgflg") && (satmode[0] == 'y') && (prgcycle > 1.5))
    {
        hlv(ct,v17);
        mod2(ct,v18); dbl(v18,v18);
  	if (prgcycle > 2.5)
	   {
        	hlv(v17,v17);
		hlv(ct,v19); mod2(v19,v19); dbl(v19,v19);
	   }
     }

  settable(t1,4,phs1);
  settable(t2,8,phs2);
  settable(t3,4,phs3);
  getelem(t1,v17,v1);
  getelem(t2,v17,v2);
  getelem(t3,v17,v3);
  assign(v1,oph);
  add(oph,v18,oph);
  add(oph,v19,oph);

  if (getflag("prgflg") && (satmode[0] == 'y'))
	assign(v3,v2);

   /* equilibrium period */
   status(A);

   delay(5.0e-5);
   if (sspul[0] == 'y')
        steadystate();

   if (satmode[0] == 'y')
     {
        if ((d1-satdly) > 0.02)
                delay(d1-satdly);
        else
                delay(0.02);
	if (getflag("slpsat"))
	   {
		shaped_satpulse("relaxD",satdly,v2);
                if (getflag("prgflg"))
                   shaped_purge(v1,v2,v18,v19);
	   }
	else
	   {
        	satpulse(satdly,v2,rof1,rof1);
		if (getflag("prgflg"))
		   purge(v1,v2,v18,v19);
	   }
     }
   else
	delay(d1);

   status(B);

   pulse(p1,zero); 
   hsdelay(d2); 
   rgpulse(pw,v1,rof1,rof2);

   status(C);
}
Ejemplo n.º 13
0
void dbRtree::drop(dbDatabase* db, oid_t treeId)
{
    purge(db, treeId);
    db->freeObject(treeId);
}