当前位置: 首页>>代码示例>>C++>>正文


C++ dr函数代码示例

本文整理汇总了C++中dr函数的典型用法代码示例。如果您正苦于以下问题:C++ dr函数的具体用法?C++ dr怎么用?C++ dr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pde

void pde(double t, double ****f, double ****df)
{
   int i,j,k,l,m;
   double dv1[3][3],dv2[3][3],dp1[3],dp2[3],dn1[3];

   boundary_conditions(f);

   for(i=ghost;i<mm1;i++)
   for(j=ghost;j<mm2;j++)
   for(k=ghost;k<mm3;k++) {
      for(l=0;l<3;l++)
      for(m=0;m<3;m++) {
         dv1[l][m]=dr(f[l],i,j,k,m+1,0,dx[m],ghost, approx);
         dv2[l][m]=dr(f[l],i,j,k,m+1,1,dx[m]*dx[m],ghost, approx);
      }
      for(m=0;m<3;m++) {
         dp1[m]=dr(f[3],i,j,k,m+1,0,dx[m],ghost, approx);
         dn1[m]=dr(nut,i,j,k,m+1,0,dx[m],ghost, approx);
      }

      for(l=0;l<3;l++)
       df[l][i][j][k]= (dv2[l][0] + dv2[l][1] + dv2[l][2])*nut[i][j][k]
                     - dp1[l] + (dn1[0]-f[0][i][j][k])*dv1[l][0]
                              + (dn1[1]-f[1][i][j][k])*dv1[l][1]
                              + (dn1[2]-f[2][i][j][k])*dv1[l][2];
      df[3][i][j][k]= (-(dv1[0][0] + dv1[1][1] + dv1[2][2]))/Gamma;
   }

   return;
}
开发者ID:Infovarius,项目名称:findif,代码行数:30,代码来源:pde.cpp

示例2: DCHECK

    IServerSPtr ServersManager::createServer(IConnectionSettingsBaseSPtr settings)
    {
        DCHECK(settings);

        IServerSPtr result;
        connectionTypes conT = settings->connectionType();
        IServerSPtr ser = findServerBySetting(settings);
        if(conT == REDIS){
            RedisServer *newRed = NULL;
            if(!ser){
                IDriverSPtr dr(new RedisDriver(settings));
                dr->start();
                newRed = new RedisServer(dr, true);
            }
            else{
                newRed = new RedisServer(ser->driver(), false);
            }
            result.reset(newRed);
            servers_.push_back(result);
        }
        else if(conT == MEMCACHED){
            MemcachedServer *newMem = NULL;
            if(!ser){
                IDriverSPtr dr(new MemcachedDriver(settings));
                dr->start();
                newMem = new MemcachedServer(dr, true);
            }
            else{
                newMem = new MemcachedServer(ser->driver(), false);
            }
            result.reset(newMem);
            servers_.push_back(result);
        }
        else if(conT == SSDB){
            SsdbServer *newSsdb = NULL;
            if(!ser){
                IDriverSPtr dr(new SsdbDriver(settings));
                dr->start();
                newSsdb = new SsdbServer(dr, true);
            }
            else{
                newSsdb = new SsdbServer(ser->driver(), false);
            }
            result.reset(newSsdb);
            servers_.push_back(result);
        }

        DCHECK(result);
        if(ser && syncServers_){
            result->syncWithServer(ser.get());
        }

        return result;
    }
开发者ID:TakedWind,项目名称:fastoredis,代码行数:54,代码来源:servers_manager.cpp

示例3: equal_partial_tuplefn

int equal_partial_tuplefn(oidtype x, oidtype y) 
{ // Standard comparison function
  struct ptcell *dx = dr(x, ptcell),
		            *dy = dr(y, ptcell);
	int k;

	if (dx->size != dy->size) return FALSE; 
	for (k = 0; k < dx->size; k++) 
		if (!equal(a_getelem(dx->tuple, k, FALSE), a_getelem(dy->tuple, k, FALSE))) return FALSE;

	return TRUE;	
}
开发者ID:andan342,项目名称:SciSPARQL,代码行数:12,代码来源:partial_tuple.c

示例4: dr

void PZStability::set(const rscf_t & sol, const arma::uvec & drop, bool cplx_, bool can, bool oo) {
  cplx=cplx_;
  cancheck=can;
  oocheck=oo;

  Checkpoint *chkptp=solverp->get_checkpoint();
  arma::cx_mat CW;
  chkptp->cread("CW",CW);

  chkptp->read(basis);
  grid=DFTGrid(&basis,true,method.lobatto);
  nlgrid=DFTGrid(&basis,true,method.lobatto);

  // Update solution
  rsol=sol;
  rsol.cC.cols(0,CW.n_cols-1)=CW;

  // Drop orbitals
  if(!cancheck) {
    arma::uvec dr(arma::sort(drop,"descend"));
    for(size_t i=0;i<dr.n_elem;i++) {
      rsol.cC.shed_col(dr(i));
      CW.shed_col(0);
    }
  }

  // Update size parameters
  restr=true;
  oa=ob=CW.n_cols;
  va=vb=rsol.cC.n_cols-oa;

  fprintf(stderr,"\noa = %i, ob = %i, va = %i, vb = %i\n",(int) oa, (int) ob, (int) va, (int) vb);
  fprintf(stderr,"There are %i parameters.\n",(int) count_params());
  fflush(stdout);

  // Reconstruct DFT grid
  if(method.adaptive)
    grid.construct(CW,method.gridtol,method.x_func,method.c_func);
  else {
    bool strict(false);
    grid.construct(method.nrad,method.lmax,method.x_func,method.c_func,strict);
    if(method.nl)
      nlgrid.construct(method.nlnrad,method.nllmax,true,false,strict,true);
  }

  // Update reference
  arma::vec x(count_params());
  x.zeros();
  eval(x,-1);
}
开发者ID:Monkey---Brainz,项目名称:erkale,代码行数:50,代码来源:pzstability.cpp

示例5: query

  void query(const scalar_type* q, int k0, int emax, double* dist, int* results) {
    cv::AutoBuffer<int> tmp(emax);
    typedef std::pair<int, accum_type> dr_type; // * swap int and accum_type here, for naming consistency
    cv::AutoBuffer<dr_type> dr(k0);
    int k1 = 0;

    // * handle k0 >= emax, in which case don't track max distance

    for (int l = 0; l < L && emax > 0; ++l) {
      lsh_hash h = (*g[l])(q);
      int m = ops->hash_lookup(h, l, tmp, emax);
      for (int j = 0; j < m && emax > 0; ++j, --emax) {
	int i = tmp[j];
	const scalar_type* p = (const scalar_type*)ops->vector_lookup(i);
	accum_type pd = (*g[l]).distance(p, q);
	if (k1 < k0) {
	  dr[k1++] = std::make_pair(i, pd);
	  std::push_heap(&dr[0], &dr[k1], comp_dist);
	} else if (pd < dr[0].second) {
	  std::pop_heap(&dr[0], &dr[k0], comp_dist);
	  dr[k0 - 1] = std::make_pair(i, pd);
	  std::push_heap(&dr[0], &dr[k0], comp_dist);
	}
      }
    }

    for (int j = 0; j < k1; ++j)
      dist[j] = dr[j].second, results[j] = dr[j].first;
    std::fill(dist + k1, dist + k0, 0);
    std::fill(results + k1, results + k0, -1);
  }
开发者ID:09beezahmad,项目名称:opencv,代码行数:31,代码来源:lsh.cpp

示例6: _rundocker

   void _rundocker(std::string src, std::string dst, std::string passwd, std::string ctrcmd, const params &p)
   {
      std::string cmd("docker");
      std::vector<std::string> args;

      args.push_back(cmd);
      args.push_back("run");
      args.push_back("-i");
      args.push_back("--name=\"dr_compress\"");
      if (passwd.length() > 0)
      {
         logmsg(kLDEBUG, "Using password supplied.", p);
         args.push_back("-e");
         args.push_back("PASS=\"" + passwd + "\"");
      }
      args.push_back("-v");
      args.push_back(src + ":/src");
      args.push_back("-v");
      args.push_back(dst + ":/dst");
      args.push_back("drunner/rootutils");
      args.push_back("bash");
      args.push_back("-c");
      args.push_back(ctrcmd);
      
      utils::dockerrun dr(cmd, args, "dr_compress", p);
   }
开发者ID:p-jackson,项目名称:drunner,代码行数:26,代码来源:compress.cpp

示例7: createRVE

// Uses an input file for now, should eventually create the RVE itself.
bool FE2FluidMaterialStatus :: createRVE(int n, GaussPoint *gp, const std::string &inputfile)
{
    OOFEMTXTDataReader dr(inputfile.c_str());
    EngngModel *em = InstanciateProblem(&dr, _processor, 0); // Everything but nrsolver is updated.
    dr.finish();
    em->setProblemScale(microScale);
    em->checkProblemConsistency();
    em->initMetaStepAttributes( em->giveMetaStep( 1 ) );
    em->giveNextStep(); // Makes sure there is a timestep (which we will modify before solving a step)
    em->init();

    this->rve = dynamic_cast<StokesFlow*> (em);
    if (!this->rve) {
        return false;
    }
    std::ostringstream name;
    name << this->rve->giveOutputBaseFileName() << "-gp" << n;
#ifdef __PARALLEL_MODE
    if (this->domain->giveEngngModel()->isParallel() && this->domain->giveEngngModel()->giveNumberOfProcesses() > 1) {
        name << "." << this->domain->giveEngngModel()->giveRank();
    }
#endif
    this->rve->letOutputBaseFileNameBe(name.str());

    this->bc = dynamic_cast< MixedGradientPressureBC* >(this->rve->giveDomain(1)->giveBc(1));
    if (!this->bc) {
        OOFEM_ERROR("FE2FluidMaterialStatus :: createRVE - RVE doesn't have necessary boundary condition; should have MixedGradientPressure as first b.c. (in first domain)");
    }

    return true;
}
开发者ID:Benjamin-git,项目名称:OOFEM_LargeDef,代码行数:32,代码来源:fe2fluidmaterial.C

示例8: main

int main(int argc, char **argv)
{
    ros::init(argc, argv, "deadreckoning");
    ros::NodeHandle node("~");
    ROS_INFO("Initialized ROS.");

    bool simulation = true;
    std::string mode;
    if (node.getParam("mode", mode))
        simulation = mode != "realworld";
    ROS_INFO("Mode: %s", simulation ? "Simulation" : "Real world");

    srand(time(0));
    
    double minX=-5, maxX=5, minY=-5, maxY=5;
    if (simulation)
    {
        minX = 0; maxX = 10;
        minY = 0; maxY = 10;
    }
    DeadReckoning dr(node, simulation, minX, maxX, minY, maxY);
    if (dr.ready())
        dr.reckon();
    
    ROS_INFO("Bye!");
    return 0;
};
开发者ID:CokieForever,项目名称:LCCP-Turtlebot,代码行数:27,代码来源:deadreckoning_main.cpp

示例9: dr

std::set<DetectionReport> ReportManager::getDRs()
{
  std::set<DetectionReport> result;
  for (std::size_t i = 0; i<packetSize_; ++i)
  {
    try
    {
      DB::DynDBDriver::DR_row row = drCursor_.fetchRow();
      // TODO get features for DR
      DetectionReport dr(row);
      lastDR_ = dr;
      result.insert(dr);
    }
    catch (const DB::exceptions::NoResultAvailable& /*ex*/)
    { // if no more results available, prepare new Cursor and end loop
      Common::GlobalLogger
          ::getInstance().log("ReportManager","No result available from DB");

      setupNextCursor();
      break;
    }
  }

  return result;
}
开发者ID:bandarichen,项目名称:track0matic,代码行数:25,代码来源:reportmanager.cpp

示例10: run

		// Inherited via Task
		virtual void run() override
		{
			LOG_SCOPE_TIME(BitEngine::EngineLog, "Texture load");

			ResourceLoader::DataRequest dr(nullptr); 
			if (textureData)
			{
				dr = std::move(textureData->getData());
			} else {
				dr = std::move(useData);
			}

			if (dr.isLoaded())
			{
				texture->imgData.fileData.swap(dr.data);
				texture->imgData.pixelData = stbi_load_from_memory((unsigned char*)texture->imgData.fileData.data(), texture->imgData.fileData.size(), &texture->imgData.width, &texture->imgData.height, &texture->imgData.color, 0);
				if (texture->imgData.pixelData != nullptr) {
					LOG(BitEngine::EngineLog, BE_LOG_VERBOSE) << "stbi loaded texture: " << dr.meta->getNameId() << " w: " << texture->imgData.width << " h: " << texture->imgData.height;
					manager->uploadToGPU(texture);
				}
				else
				{
					LOG(BitEngine::EngineLog, BE_LOG_ERROR) << "stbi failed to load texture: " << dr.meta->getNameId() << " reason: " << stbi_failure_reason();
				}
			}
			else
			{
				LOG(BitEngine::EngineLog, BE_LOG_ERROR) << "Resource meta " << dr.meta->getNameId() << " on state: " << dr.loadState;
			}
		}
开发者ID:MateusMP,项目名称:BitEngine,代码行数:31,代码来源:GL2TextureManager.cpp

示例11: sc_main

int sc_main(int argc, char* argv[]) {
	sc_signal<char> i1, i2, i3;
	sc_signal<char>d1, o1, o2, o3, o4;
	sc_signal<bool>sr;
	sc_signal<bool>clk;
	change_case cc("cc");
	filter ft("ft");
	m_bus mb("mb");
	driver dr("dr");
	monitor mon("mon");
	UART ur("ur");
	arbiter ar("ar");
	dr.d_char(d1);
	cc.char_in(d1);
	cc.char_out(o1);
	ft.char_in(d1);
	ft.char_out(o2);
	ar.selector(sr);
	ar.clk(clk);
	mb.char_in1(o1);
	mb.char_in2(o2);
	mb.char_out(o3);
	mb.selector(sr);
	ur.char_in(o3);
	ur.char_out(o4);
	mon.clk(clk);
	mon.m_char(o4);
	sc_start();
	return 0;
}
开发者ID:caizezhi,项目名称:SystemC_bus_based,代码行数:30,代码来源:main.cpp

示例12: printf

 bool Query::Execute( RowReaderType rr )
 {
     if( !stmt )
     {
         printf( "Query::execute failed. _stmt = nullptr" );
         return false;
     }
     if( vc != vi )
     {
         printf( "Query::execute failed. parameter count is not valid. _vc = %d, _vi = %d", vc, vi );
         return false;
     }
     vi = 0;
     int ok = sqlite3_step( stmt );
     if( !( ok == SQLITE_OK || ok == SQLITE_DONE || ok == SQLITE_ROW ) )
     {
         printf( "Query::execute sqlite3_step failed. code = %d, errmsg = %s", ok, sqlite3_errmsg( conn->db ) );
         return false;
     }
     if( rr )
     {
         DataReader dr( stmt );
         while( ok == SQLITE_ROW )
         {
             dr.Reset();
             rr( dr );
             ok = sqlite3_step( stmt );
         }
     }
     ok = sqlite3_reset( stmt );
     if( ok == SQLITE_OK || ok == SQLITE_DONE ) return true;
     printf( "Query::execute sqlite3_reset failed. code = %d", ok );
     return false;
 }
开发者ID:denghe,项目名称:69net,代码行数:34,代码来源:Sqlite.cpp

示例13: createRVE

bool
StructuralFE2MaterialStatus :: createRVE(int n, GaussPoint *gp, const std :: string &inputfile)
{
    OOFEMTXTDataReader dr( inputfile.c_str() );
    EngngModel *em = InstanciateProblem(dr, _processor, 0); // Everything but nrsolver is updated.
    dr.finish();
    em->setProblemScale(microScale);
    em->checkProblemConsistency();
    em->initMetaStepAttributes( em->giveMetaStep(1) );
    em->giveNextStep(); // Makes sure there is a timestep (which we will modify before solving a step)
    em->init();

    this->rve.reset( em );

    std :: ostringstream name;
    name << this->rve->giveOutputBaseFileName() << "-gp" << n;
    if ( this->domain->giveEngngModel()->isParallel() && this->domain->giveEngngModel()->giveNumberOfProcesses() > 1 ) {
        name << "." << this->domain->giveEngngModel()->giveRank();
    }

    this->rve->letOutputBaseFileNameBe( name.str() );

    this->bc = dynamic_cast< PrescribedGradientHomogenization * >( this->rve->giveDomain(1)->giveBc(1) );
    if ( !this->bc ) {
        OOFEM_ERROR("RVE doesn't have necessary boundary condition; should have a type of PrescribedGradientHomogenization as first b.c.");
    }

    return true;
}
开发者ID:aishugang,项目名称:oofem,代码行数:29,代码来源:structuralfe2material.C

示例14: dr

bool AtlasTexture::get_rect_region(const Rect2& p_rect, const Rect2& p_src_rect,Rect2& r_rect,Rect2& r_src_rect) const {

	Rect2 rc=region;

	if (!atlas.is_valid())
		return false;

	Rect2 src=p_src_rect;
	src.pos+=(rc.pos-margin.pos);
	Rect2 src_c = rc.clip(src);
	if (src_c.size==Size2())
		return false;
	Vector2 ofs = (src_c.pos-src.pos);

	Vector2 scale = p_rect.size / p_src_rect.size;
    if(scale.x < 0)
    {
	float mx = (margin.size.width - margin.pos.x);
	mx -= margin.pos.x;
	ofs.x = -(ofs.x + mx);
    }
    if(scale.y < 0)
    {
	float my = margin.size.height - margin.pos.y;
	my -= margin.pos.y;
	ofs.y = -(ofs.y + my);
    }
	Rect2 dr( p_rect.pos+ofs*scale,src_c.size*scale );



	r_rect=dr;
	r_src_rect=src_c;
	return true;
}
开发者ID:AutonomicStudios,项目名称:godot,代码行数:35,代码来源:texture.cpp

示例15: dr

void ContentContainer::DrawContentsInRegions(const Regions& rgns, const Point& offset) const
{
	// layout shouldn't be empty unless there is no content anyway...
	if (layout.empty()) return;

	// should only have 1 region
	const Region& rgn = rgns.front();

	// TODO: intersect with the screen clip so we can bail out even earlier

	const Point& drawOrigin = rgn.Origin();
	Point drawPoint = drawOrigin;
	ContentLayout::const_iterator it = layout.begin();

#if (DEBUG_TEXT)
	Region dr(parentOffset + offset, contentBounds);
	core->GetVideoDriver()->DrawRect(dr, ColorRed, true);
	core->GetVideoDriver()->DrawRect(dr, ColorWhite, false);
	dr = Region(parentOffset + offset, ContentFrame());
	core->GetVideoDriver()->DrawRect(dr, ColorGreen, true);
	core->GetVideoDriver()->DrawRect(dr, ColorWhite, false);
#endif

	for (; it != layout.end(); ++it) {
		const Layout& l = *it;
		assert(drawPoint.x <= drawOrigin.x + frame.w);
		l.content->DrawContentsInRegions(l.regions, offset + parentOffset);
	}
}
开发者ID:ChunHungLiu,项目名称:gemrb,代码行数:29,代码来源:TextContainer.cpp


注:本文中的dr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。