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


C++ NODE类代码示例

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


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

示例1: stringcopy

//Final parser, parses node and get data/fields
NODE *
PARSER::parseNode(char *instring, NODE * node)
{
	
	string nextwd;
	NODETYPE ntype;
	NODE tempnode;
	int nodeid, curly = 0;
	char nextstr[MAXSTRSIZE];

	stringcopy( nextwd, instring);
	nodeid = ntype.findNodeType(nextwd);
	node = parseProtoNode(instring, node);//Check first for PROTO  node
	
	if(node != NULL){
		return node; // If node is  PROTO then return pointer to node
	}  
	
	if(!nodeid) return NULL;

	node = tempnode.createNewNode(nodeid, node);
	getNextWord(nextstr);

	
	if(strcmp("{", nextstr) == 0) //Ensure open curly bracket after node name
	{
		curly++;
	}else{
		cout << "Experted open curly bracket at " << nextstr << endl; 
		return NULL;
	}
	
	while(getNextWord(nextstr)){
		NODE *tnodeptr;
		
		if(int n = node->findFieldName(nextstr)){  //Get field for node
			node->getField(n , node);
		}
		
		if((tnodeptr = parseNodeString(nextstr, tnodeptr))){  //Parse children node and store in scenegraph
			if(tnodeptr != NULL){
				node->children.push_back(tnodeptr);
				continue;
			}
		}
		
		if(strcmp("{", nextstr) == 0){
			curly++;
			continue;
		}

		if(strcmp("}", nextstr) == 0){
			curly--;
			if(curly == 0){
				break;
			}
		}
	}
	return node;
}
开发者ID:djkonro,项目名称:vrml-stl,代码行数:61,代码来源:parser.cpp

示例2: operator

  bool operator()(const NODE& node1, const NODE& node2) const {
   double distance1 = norm(node1.position() - p_);
   double distance2 = norm(node2.position() - p_);
   if (distance1 < distance2)
     return true;
   else
     return false;
 }
开发者ID:JMTing,项目名称:CS207,代码行数:8,代码来源:shortest_path.cpp

示例3: checkNumberOfArguments

QScriptValue ScriptableSyntaxDefinition::GLUE_(QScriptContext* context, QScriptEngine* engine)
{
	checkNumberOfArguments(context, 2, intMax);
	NODE node = super(context)->GLUE();
	for (int i = 0, n = context->argumentCount(); i < n; ++i)
		node->appendChild(context->argument(i).toVariant().value<NODE>());
	return nodeToScriptValue(engine, node);
}
开发者ID:corelon,项目名称:paco,代码行数:8,代码来源:ScriptableSyntaxDefinition.cpp

示例4: operator

  Color operator()(const NODE& node) {
    int contribs = node.value().num_contribs;
    double val = node.value().sum;
    double avg = val/((double) contribs);

    //std::cout << "Color: " <<  (avg-min_)/(max_-min_) << std::endl;
    return Color::make_heat((avg-min_)/(max_-min_));
    //return Color::make_heat((avg+20.0)/40.0);
  }
开发者ID:asafira,项目名称:CS207FinalProject,代码行数:9,代码来源:SDLViewer.hpp

示例5: newNODE

void LIST :: newNODE(SPHERE* data){
	NODE* newNode;
	newNode = new NODE(data);
	p = tail->getPre();
	p->setNext(newNode);
	newNode->setNext(tail);
	newNode->setPre(p);
	tail->setPre(newNode);
}
开发者ID:cam-xetal,项目名称:c_zemi,代码行数:9,代码来源:list.cpp

示例6: runShell

void runShell(char* command)
{
  NODE* cmd;
  cmd = findCommand(command);
  if (cmd)
    cmd->cmd();
  tcputs("$>> ", COLOR_GREEN);
  waitCmd();
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例7: deleteNode

bool LIST :: deleteNode(){
	NODE* tmp;
	if(p == head || p == tail)
		return false;
	tmp = p;
	p = p->getPre();
	p->setNext(tmp->getNext());
	p->getNext()->setPre(p);
	delete tmp;

	return true;
}
开发者ID:cam-xetal,项目名称:c_zemi,代码行数:12,代码来源:list.cpp

示例8: operator

  Point operator()(MESH& m, NODE n, double t) {
    (void) t;
    Point pressure_force = Point(0.0, 0.0, 0.0);

    for(auto it=m.adj_triangle_begin(n.uid()); it != m.adj_triangle_end(n.uid()); ++ it) {
      auto tri = (*it);
      Point normal = get_normal_surface(tri);
      double area = tri.area();
      pressure_force += normal * area * pressure;

    }
    return pressure_force; 
  }  
开发者ID:JMTing,项目名称:CS207,代码行数:13,代码来源:final_project.cpp

示例9: result

void
CreateBlueprintVisitorHelper::createWeightedSet(WS *bp, NODE &n) {
    Blueprint::UP result(bp);
    FieldSpecList fields;
    for (size_t i = 0; i < n.getChildren().size(); ++i) {
        fields.clear();
        fields.add(bp->getNextChildField(_field));
        const query::Node &node = *n.getChildren()[i];
        uint32_t weight = getWeightFromNode(node).percent();
        bp->addTerm(_searchable.createBlueprint(_requestContext, fields, node), weight);
    }
    setResult(std::move(result));
}
开发者ID:songhtdo,项目名称:vespa,代码行数:13,代码来源:create_blueprint_visitor_helper.cpp

示例10: operator

 force_type operator() (NODE n, double t){
   Point node_velocity = n.value().velocity;
   Point node_normal(0.0, 0.0, 0.0);
   for (auto it = n.triangle_begin(); it != n.triangle_end(); ++it){
     auto tri = (*it);
     // approximate node normal vector by the sum of normal vectors of its neighboring faces
     node_normal +=  get_normal_surface(tri);
   }
   // calculte wind force
   force_type force = wind_const * dot(wind_velocity_ - node_velocity, node_normal) * node_normal;
   (void) t;
   return force;
 }
开发者ID:JMTing,项目名称:CS207,代码行数:13,代码来源:mass_spring.cpp

示例11: main

int main()
{
	freopen("sequence.in","r",stdin);
	freopen("sequence.out","w",stdout);
	scanf("%d%d%d%d",&N,&Q,&A,&B);
	root=new NODE(1,Q);
	pair<NODE*,long double> MIN;
	NODE *p;
	for (int i=1;i<=N;i++)
	{
		if (i>1)
			if (A<B)
			{
				MIN=findMin(root);
				p=MIN.first;
				long double &mid=MID[i];
				mid=MIN.second;
				Splay(p);
				NODE *q0, *q1(p->l), *q2(p->r);
				if (mid-p->xl>eps)
					q1=new NODE(p->xl,mid,p->a,p->b,p->c,p->l,0);
				if (p->xr-mid>eps)
					q2=new NODE(mid,p->xr,p->a,p->b,p->c,0,p->r);
				if (q1) q1->adjx(A);
				if (q2) q2->adjx(B);
				q0=new NODE(mid+A,mid+B,0,0,p->inter(mid),q1,q2);
				root=q0;
				delete p;
			} else
				root->adjx(A);
		double x;
		scanf("%lf",&x);
		root->adjy(1,-2*x,x*x);
	}
	MIN=findMin(root);
	p=MIN.first;
	long double x=MIN.second, y=p->inter(x);
	for (int i=N;i;i--)
	{
		ans[i]=x;
		if (x>MID[i]+B) x-=B; else
		if (x<MID[i]+A) x-=A; else
			x=MID[i];
	}
	for (int i=1;i<N;i++) printf("%.8f ",(double)ans[i]);
	printf("%.8f\n%.8f\n",(double)ans[N],(double)y);
	return 0;
}
开发者ID:ailyanlu1,项目名称:team_homework,代码行数:48,代码来源:sequence+-+副本.cpp

示例12: prop

	// セグメントツリーをたどる
	T prop(int l, int r, T v, int a, int b, int k=1){
		// 今いるノードの値を確定させる
		propLazy(a, b, k);
		// たどる
		NODE nd;	// 結果保存用(範囲外の場合は初期値が返る)
		if( l <= a && b <= r ){
			// 完全に範囲内の場合
			propLazy(a, b, k, v);
			return data[k].v;
		}else if( l < b && a < r ){
			// 中途半端に含まれる場合
			int m = (a+b) / 2;
			T vl = prop(l,r,v, a, m, k*2);
			T vr = prop(l,r,v, m, b, k*2+1);
			data[k].merge( data[k*2].v, data[k*2+1].v );
			nd.merge( vl, vr );
		}
		return nd.v;
	}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例13: deleteTraces

void TOOL_BASE::deleteTraces( ITEM* aStartItem, bool aWholeTrack )
{
    NODE *node = m_router->GetWorld()->Branch();

    if( !aStartItem )
        return;

    if( !aWholeTrack )
    {
        node->Remove( aStartItem );
    }
    else
    {
        TOPOLOGY topo( node );
        ITEM_SET path = topo.AssembleTrivialPath( aStartItem );

        for( auto ent : path.Items() )
            node->Remove( ent.item );
    }

    m_router->CommitRouting( node );
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:22,代码来源:pns_tool_base.cpp

示例14: operator

 Point operator()(const NODE& node) {
   return node.position();
 }
开发者ID:CME212-Winter2016,项目名称:CME212,代码行数:3,代码来源:SDLViewer.hpp

示例15: if

void MODEL::DoDryRewet( PROJECT* project, int* dried, int* wetted )
{
  DRYREW *dryRew = &region->dryRew;

  region->Connection( 0L );

  int del = 0;
  int wel = 0;

  if( dryRew->method == 1 )
  {
    // mark nodes and elements to be rewetted ------------------------------------------------------
    wel = region->Rewet( dryRew->rewetLimit, dryRew->rewetPasses, project );

    // mark dry nodes and elements -----------------------------------------------------------------
    del = region->Dry( dryRew->dryLimit, dryRew->countDown );
  }
  else if( dryRew->method == 2 )
  {
    region->DryRewet( dryRew->dryLimit, dryRew->rewetLimit, dryRew->countDown, &del, &wel );
  }
  else if( dryRew->method == 3 )
  {
    region->RewetDry( dryRew->dryLimit, dryRew->rewetLimit, dryRew->countDown, &del, &wel );
  }
/*
  // future work ...
  else if( dryRew->method == 4 )
  {
    // determine dynamic boundary ------------------------------------------------------------------
    region.DynamicBound( np, node, *elem, dryRew->dryLimit, project );
  }
*/

  //////////////////////////////////////////////////////////////////////////////////////////////////

# ifdef _MPI_
  del = project->subdom.Mpi_sum( del );
  wel = project->subdom.Mpi_sum( wel );
# endif

  char text [200];

  sprintf( text, "\n (MODEL::DoDryRewet)     %d elements have got dry\n", del );
  REPORT::rpt.Output( text, 3 );

  sprintf( text, "\n (MODEL::DoDryRewet)     %d elements have got wet\n", wel );
  REPORT::rpt.Output( text, 3 );

  int dryRewFlag = del + wel;

  if( dryRewFlag )
  {
    ////////////////////////////////////////////////////////////////////////////////////////////////
    // exchange information on dry nodes on interfaces
#   ifdef _MPI_
    if( project->subdom.npr > 1 )
    {
      MPI_Comm_Dry( project, true );

      //////////////////////////////////////////////////////////////////////////////////////////////
      // reset wetted area, in case of dry nodes that are not dry in adjacent subdomains
      // added on 20.04.2006, sc

      if( dryRew->method == 2  ||  dryRew->method == 3 )
      {
        int wetted = 0;

        for( int n=0; n<region->Getnp(); n++ )
        {
          NODE* nd = region->Getnode(n);

          nd->mark = false;

          double H = nd->v.S - nd->zor;

          if( H < dryRew->dryLimit )
          {
            SF( nd->flag, NODE::kDry );
          }

          else if( isFS(nd->flag, NODE::kDry) )
          {
            nd->mark = true;

            CF( nd->flag, NODE::kDry );
            wetted++;
          }

          CF( nd->flag, NODE::kMarsh );
          nd->z = nd->zor;
        }


        if( dryRew->method == 2 )
        {
          region->DryRewet( dryRew->dryLimit, dryRew->rewetLimit, dryRew->countDown, &del, &wel );
        }
        else if( dryRew->method == 3 )
        {
//.........这里部分代码省略.........
开发者ID:markuszi,项目名称:Rismo2D,代码行数:101,代码来源:DoDryRew.cpp


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