Beispiel #1
0
void parser_t::netdev_hint()
{
	pstring dev(get_identifier());
	require_token(m_tok_comma);
	pstring hint(get_identifier());
	m_setup.register_param(dev + ".HINT_" + hint, 1);
	require_token(m_tok_param_right);
}
void dynamicLagrangian<BasicTurbulenceModel>::correctNut
(
    const tmp<volTensorField>& gradU
)
{
    this->nut_ = (flm_/fmm_)*sqr(this->delta())*mag(dev(symm(gradU)));
    this->nut_.correctBoundaryConditions();
}
Beispiel #3
0
tmp<fvVectorMatrix> realizableKE_Veh::divDevReff(volVectorField& U) const
{
    return
    (
      - fvm::laplacian(nuEff(), U)
      - fvc::div(nuEff()*dev(T(fvc::grad(U))))
    );
}
Beispiel #4
0
 void close(BOOST_IOS::openmode which)
 {
     if (which == BOOST_IOS::in && (flags_ & f_input_closed) == 0) {
         flags_ |= f_input_closed;
         iostreams::close(dev(), BOOST_IOS::in);
     }
     if (which == BOOST_IOS::out && (flags_ & f_output_closed) == 0) {
         flags_ |= f_output_closed;
         detail::execute_all(
             detail::flush_buffer(buf_.second(), dev(), can_write::value),
             detail::call_close(dev(), BOOST_IOS::out),
             detail::call_reset(dev_),
             detail::call_reset(buf_.first()),
             detail::call_reset(buf_.second())
         );
     }
 }
tmp<fvVectorMatrix> SpalartAllmaras::divDevReff(volVectorField& U) const
{
    return
    (
      - fvm::laplacian(nuEff(), U)
      - fvc::div(nuEff()*dev(T(fvc::grad(U))))
    );
}
Beispiel #6
0
void AudioDevice::printAll(){
	for(int i=0; i<numDevices(); i++){
		printf("[%2d] ", i);
		AudioDevice dev(i);
		dev.print();
		//print(i);
	}
}
Beispiel #7
0
tmp<fvVectorMatrix> kOmega::divDevReff(volVectorField& U) const
{
    return
    (
      - fvm::laplacian(nuEff(), U)
      - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
    );
}
tmp<fvVectorMatrix> LienCubicKE::divDevReff(volVectorField& U) const
{
    return
        (
            fvc::div(nonlinearStress_)
            - fvm::laplacian(nuEff(), U)
            - fvc::div(nuEff()*dev(T(fvc::grad(U))))
        );
}
Beispiel #9
0
Datei: adc.c Projekt: adjih/RIOT
static inline void prep(adc_t line)
{
    if (dev(line) == ADC0) {
        bit_set32(&SIM->SCGC6, SIM_SCGC6_ADC0_SHIFT);
    }
#ifdef ADC1
    else if (dev(line) == ADC1) {
#if defined(SIM_SCGC3_ADC1_SHIFT)
        bit_set32(&SIM->SCGC3, SIM_SCGC3_ADC1_SHIFT);
#elif defined(SIM_SCGC6_ADC1_SHIFT)
        bit_set32(&SIM->SCGC6, SIM_SCGC6_ADC1_SHIFT);
#else
#error ADC1 clock gate is not known!
#endif
    }
#endif /* ADC1 */
    mutex_lock(&locks[dev_num(line)]);
}
Beispiel #10
0
int main(int argc, char **argv) {

  Palette palette;
  palette.Shade16();
  Device dev(WinX, WinY, &palette);
  MainApp app(dev);

  return dev.MainLoop();
}
Beispiel #11
0
IPHeader::PrintOptType::PrintOptType(const char *ptr,const char *lim)
 {
  StrParse dev(ptr,lim);
  
  ParseInbound(dev,inbound);
  ParseExtra(dev,extra);
  
  if( !dev.finish() ) setDefault(); 
 }
ofPolyline returnNormalizedLine (ofPolyline & input){
    ofPolyline output = input;
    vector< float > x;
    vector< float > y;
    for (int i = 0; i < output.getVertices().size(); i++){
        x.push_back(output[i].x);
        y.push_back(output[i].y);
    }
    float sumx, meanx, varx, devx, skewx, kurtx;
    float sumy, meany, vary, devy, skewy, kurty;
    computeStats(x.begin( ), x.end( ), sumx, meanx, varx, devx, skewx, kurtx);
    computeStats(y.begin( ), y.end( ), sumy, meany, vary, devy, skewy, kurty);
    float stdDev = sqrt(devx*devx + devy*devy);
    ofPoint midPt (meanx, meany);
    ofPoint dev (stdDev, stdDev);
    
    
    ofMatrix4x4 mat;
    mat.makeTranslationMatrix(-midPt.x, -midPt.y, 0);
    
    ofMatrix4x4 mat2;
    mat2.makeScaleMatrix(100.0/dev.x, 100.0/dev.y, 1.0);
    // mat.scale(100,100,1.0);
    
    //mat *= mat2;
    
    
    for (int i = 0; i < output.getVertices().size(); i++){
        
        ofPoint input = output[i];
        
        output[i] -= midPt;
        output[i] /= dev;
        output[i]*= 100.0;
        
        //        cout << output[i] << endl;
        //        cout << "--> " << input << endl;
        //        cout << input * mat * mat2 << endl;
        //        cout << "--> " << (input * mat * mat2) * mat2.getInverse() * mat.getInverse() << endl;
        
    }
    //    ofRectangle boxOrig = input.getBoundingBox();
    //    ofRectangle box = boxOrig;
    //    ofRectangle outputBox(-100,-100,200,200);
    //    box.scaleTo(outputBox);
    //
    //    for (int i = 0; i < output.getVertices().size(); i++){
    //        output.getVertices()[i].x = ofMap( output.getVertices()[i].x, boxOrig.position.x, boxOrig.position.x + boxOrig.width,
    //                                           box.position.x, box.x + box.width);
    //        output.getVertices()[i].y = ofMap( output.getVertices()[i].y, boxOrig.position.y, boxOrig.position.y + boxOrig.height,
    //                                          box.position.x, box.y + box.height);
    //
    //    }
    
    return output;
    
}
Beispiel #13
0
istream* Hdfs::open(std::string path)
{
  if (exists(path) == false)
  {
    throw ios_base::failure("File not found.");
  }
  HdfsDevice dev(_host, _port, path);
  return new boost::iostreams::stream<HdfsDevice>(dev);
}
tmp<volScalarField> realizableKE::rCmu
(
    const volTensorField& gradU
)
{
    volScalarField S2 = 2*magSqr(dev(symm(gradU)));
    volScalarField magS = sqrt(S2);
    return rCmu(gradU, S2, magS);
}
dimensionedTensor dev(const dimensionedTensor& dt)
{
    return dimensionedTensor
    (
        "dev("+dt.name()+')',
        dt.dimensions(),
        dev(dt.value())
    );
}
/* static */
int getDriveInfoFromSysfs(DriveInfoList *pList, bool isDVD, bool *pfSuccess)
{
    AssertPtrReturn(pList, VERR_INVALID_POINTER);
    AssertPtrNullReturn(pfSuccess, VERR_INVALID_POINTER); /* Valid or Null */
    LogFlowFunc (("pList=%p, isDVD=%u, pfSuccess=%p\n",
                  pList, (unsigned) isDVD, pfSuccess));
    RTDIR hDir;
    int rc;
    bool fSuccess = false;
    unsigned cFound = 0;

    if (!RTPathExists("/sys"))
        return VINF_SUCCESS;
    rc = RTDirOpen(&hDir, "/sys/block");
    /* This might mean that sysfs semantics have changed */
    AssertReturn(rc != VERR_FILE_NOT_FOUND, VINF_SUCCESS);
    fSuccess = true;
    if (RT_SUCCESS(rc))
    {
        for (;;)
        {
            RTDIRENTRY entry;
            rc = RTDirRead(hDir, &entry, NULL);
            Assert(rc != VERR_BUFFER_OVERFLOW);  /* Should never happen... */
            if (RT_FAILURE(rc))  /* Including overflow and no more files */
                break;
            if (entry.szName[0] == '.')
                continue;
            sysfsBlockDev dev(entry.szName, isDVD);
            /* This might mean that sysfs semantics have changed */
            AssertBreakStmt(dev.isConsistent(), fSuccess = false);
            if (!dev.isValid())
                continue;
            try
            {
                pList->push_back(DriveInfo(dev.getNode(), dev.getUdi(), dev.getDesc()));
            }
            catch(std::bad_alloc &e)
            {
                rc = VERR_NO_MEMORY;
                break;
            }
            ++cFound;
        }
        RTDirClose(hDir);
    }
    if (rc == VERR_NO_MORE_FILES)
        rc = VINF_SUCCESS;
    if (RT_FAILURE(rc))
        /* Clean up again */
        for (unsigned i = 0; i < cFound; ++i)
            pList->pop_back();
    if (pfSuccess)
        *pfSuccess = fSuccess;
    LogFlow (("rc=%Rrc, fSuccess=%u\n", rc, (unsigned) fSuccess));
    return rc;
}
Beispiel #17
0
//This function determines the Mises equivalent of a strain tensor, according to the Voigt convention for strains 
double Mises_strain(const vec &v) {
	assert(v.size()==6);

	vec vdev = dev(v);
	vec vdev2 = vdev;
	for (int i=3; i<6; i++)
		vdev2(i) = 0.5*vdev2(i);	

	return sqrt(2./3.*sum(vdev%vdev2));
}
Beispiel #18
0
//This function determines the Mises equivalent of a stress tensor, according to the Voigt convention for stress 
double Mises_stress(const vec &v) {
	assert(v.size()==6);

	vec vdev = dev(v);
	vec vdev2 = vdev;
	for (int i=3; i<6; i++)
		vdev2(i) = 2.*vdev2(i);	

	return sqrt(3./2.*sum(vdev%vdev2));
}
Beispiel #19
0
//Returns the second invariant of the deviatoric part of a second order strain tensor written as a Voigt vector
double J2_strain(const vec &v) {
	assert(v.size()==6);

	vec vdev = dev(v);
	vec vdev2 = vdev;
	for (int i=3; i<6; i++)
		vdev2(i) = 0.5*vdev2(i);	

	return 0.5*sum(vdev%vdev2);
}
Beispiel #20
0
int i2c_acquire(i2c_t bus)
{
    assert(bus < I2C_NUMOF);

    mutex_lock(&locks[bus]);
    dev(bus)->ENABLE = TWIM_ENABLE_ENABLE_Enabled;

    DEBUG("[i2c] acquired bus %i\n", (int)bus);
    return 0;
}
Beispiel #21
0
int timer_clear(tim_t tim, int channel)
{
    if (channel != 0) {
        return -1;
    }

    dev(tim)->IMR &= ~(GPT_IMR_TAMIM);

    return 0;
}
Beispiel #22
0
int i2c_release(i2c_t bus)
{
    assert(bus < I2C_NUMOF);

    dev(bus)->ENABLE = TWIM_ENABLE_ENABLE_Disabled;
    mutex_unlock(&locks[bus]);

    DEBUG("[i2c] released bus %i\n", (int)bus);
    return 0;
}
Beispiel #23
0
int timer_clear(tim_t tim, int channel)
{
    if (channel >= TIMER_CHANNELS) {
        return -1;
    }

    dev(tim)->TC_CHANNEL[0].TC_IDR = (TC_IDR_CPAS << channel);

    return 1;
}
Beispiel #24
0
PrintTaskPriority::PrintOptType::PrintOptType(const char *ptr,const char *lim)
 {
  StrParse dev(ptr,lim);
  
  ParseUInt_empty(dev,width,0);
  
  Parse_empty(dev,align);
  
  if( !dev.finish() ) setDefault();
 }
Beispiel #25
0
IntegerPrintOpt::IntegerPrintOpt(const char *ptr,const char *lim)
 {
  StrParse dev(ptr,lim);
  
  Parse_empty(dev,show_sign);
    
  ParseUInt_empty(dev,width,0);

  if( !dev.finish() ) setDefault();
 }
Beispiel #26
0
tmp<volSymmTensorField> NonLinEddyViscABL::devBeff() const
{
    return -nuEff()*dev(twoSymm(fvc::grad(U())));

    tmp<volSymmTensorField> tdevBeff
    (
        GenEddyViscModel::devBeff()
    );
    tdevBeff() += nonlinearStress_;
    return tdevBeff;
}
Beispiel #27
0
int main(void)
{
	int a,b;
	printf("enter the number(3,5):\n");
	scanf("%d,%d",&a,&b);
	printf("add=%d\n",add(a,b));
	printf("sub=%d\n",sub(a,b));
	printf("mul=%d\n",mul(a,b));
	printf("dev=%d\n",dev(a,b));
	return 0;
}
Beispiel #28
0
IOStream& operator<<(IOStream& outs, OWI& owi)
{
  OWI::Driver dev(&owi);
  int8_t last = OWI::Driver::FIRST;
  do {
    last = dev.search_rom(last);
    if (last == OWI::Driver::ERROR) return (outs);
    outs << dev << endl;
  } while (last != OWI::Driver::LAST);
  return (outs);
}
Beispiel #29
0
        /**
        * Retrieve the device used by the pipeline.
        * The device class provides the application access to control camera additional settings -
        * get device information, sensor options information, options value query and set, sensor specific extensions.
        * Since the pipeline controls the device streams configuration, activation state and frames reading, calling
        * the device API functions, which execute those operations, results in unexpected behavior.
        * The pipeline streaming device is selected during pipeline \c start(). Devices of profiles, which are not returned by
        * pipeline \c start() or \c get_active_profile(), are not guaranteed to be used by the pipeline.
        *
        * \return rs2::device The pipeline selected device
        */
        device get_device() const
        {
            rs2_error* e = nullptr;
            std::shared_ptr<rs2_device> dev(
                rs2_pipeline_profile_get_device(_pipeline_profile.get(), &e),
                rs2_delete_device);

            error::handle(e);

            return device(dev);
        }
Beispiel #30
0
int timer_set_absolute(tim_t tim, int channel, unsigned int value)
{
    DEBUG("%s(%u, %u, %u)\n", __FUNCTION__, tim, channel, value);

    if ((tim >= TIMER_NUMOF) || (channel >= (int)timer_config[tim].chn) ) {
        return -1;
    }
    /* clear any pending match interrupts */
    dev(tim)->ICR = chn_isr_cfg[channel].flag;
    if (channel == 0) {
        dev(tim)->TAMATCHR = (timer_config[tim].cfg == GPTMCFG_32_BIT_TIMER) ?
                             value : (LOAD_VALUE - value);
    }
    else {
        dev(tim)->TBMATCHR = (LOAD_VALUE - value);
    }
    dev(tim)->IMR |= chn_isr_cfg[channel].flag;

    return 1;
}