• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ NN函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _Object_IsA

/*****************************************************************************
 * _Object_IsA
 *****************************************************************************/
bool
_Object_IsA (const void* const objptr, const Object_Class* searched_class)
{
	if (objptr && searched_class) {
		const Object* const obj = (const Object*) objptr;
		const Object_Class* const objclass = OBJECT_GET_CLASS(obj);

		if (objclass == NULL || objclass->magic != CLASS_MAGIC) {
			Log_Printf (LOG_ERROR, 
				    "Object_IsA : not an object ; "
				    "memory might be corrupted !!");
			return false; // ---------->
		}
    
#if 0
		Log_Printf (LOG_DEBUG, "Object_IsA : '%s' isa '%s' ?", 
			    NN(objclass->name), NN(searched_class->name));
#endif

		register const Object_Class* c = objclass;
		while (c) {
			if (c == searched_class)
				return true; // ---------->
			c = c->super;
		}  
		
		Log_Printf (LOG_ERROR, "Object_IsA : '%s' is not a '%s' ", 
			    NN(objclass->name), NN(searched_class->name));
	}
	return false;
}
开发者ID:f1vefour,项目名称:djmount,代码行数:34,代码来源:object.c


示例2: icontainer_real_current

static void 
icontainer_real_current( iContainer *parent, iContainer *child )
{
	iContainer *old_current;

	g_assert( IS_ICONTAINER( parent ) );
	g_assert( !child || IS_ICONTAINER( child ) );
	g_assert( !child || ICONTAINER_IS_CHILD( parent, child ) );

#ifdef DEBUG
	printf( "icontainer_real_current: parent %s \"%s\"; "
		"child %s \"%s\"\n", 
		G_OBJECT_TYPE_NAME( parent ), NN( IOBJECT( parent )->name ),
		child ? G_OBJECT_TYPE_NAME( child ) : "NULL", 
		child ? NN( IOBJECT( child )->name ) : "NULL" );
#endif /*DEBUG*/

	old_current = parent->current;
	parent->current = child;

	if( old_current != child ) {
		if( old_current )
			iobject_changed( IOBJECT( old_current ) );
		if( child )
			iobject_changed( IOBJECT( child ) );
		iobject_changed( IOBJECT( parent ) );
	}

	if( child )
		model_front( MODEL( child ) );
}
开发者ID:jcupitt,项目名称:nip2,代码行数:31,代码来源:icontainer.c


示例3: process_colors

void process_colors()
{
    for (int i = 0; metadata_attr_by_object_type[i] != NULL; ++i)
    {
        sai_object_type_t ot = (sai_object_type_t)i;

        bool is_source = source.find(ot) != source.end();
        bool is_target = target.find(ot) != target.end();


        if (is_source && is_target)
        {
            // node is target and source, so it's in the middle
            std::cout << NN(ot) << " [color=\"0.650 0.500 1.000\"];\n";
        }
        else if (is_target)
        {
            // this node is a leaf
            std::cout << NN(ot) << " [color=\"0.355 0.563 1.000\", shape = rect];\n";

        }
        else if (is_source)
        {
            std::cout << NN(ot) << " [color=\"0.650 0.200 1.000\"];\n";
        }
        else
        {
            if (ot == SAI_OBJECT_TYPE_NULL || ot == SAI_OBJECT_TYPE_MAX)
            {
                continue;
            }
            std::cout << NN(ot) << " [color=plum, shape = rect];\n";
        }
    }
}
开发者ID:zubinshah,项目名称:SAI,代码行数:35,代码来源:saidepgraphgen.cpp


示例4: icontainer_real_child_remove

static void 
icontainer_real_child_remove( iContainer *parent, iContainer *child )
{
	iContainerClass *icontainer_child_class = ICONTAINER_GET_CLASS( child );

	g_assert( IS_ICONTAINER( parent ) && IS_ICONTAINER( child ) );

#ifdef DEBUG
	printf( "icontainer_real_child_remove: parent %s \"%s\"; "
		"child %s \"%s\"\n", 
		G_OBJECT_TYPE_NAME( parent ), NN( IOBJECT( parent )->name ),
		G_OBJECT_TYPE_NAME( child ), NN( IOBJECT( child )->name ) );
#endif /*DEBUG*/

	if( parent->current == child )
		icontainer_current( parent, NULL ); 

	/* We're about to break the link ... trigger the parent_remove() on 
	 * the child.
	 */
	icontainer_child_class->parent_remove( child );

	icontainer_unlink( child ); 

	UNREF( child );

	iobject_changed( IOBJECT( parent ) );
}
开发者ID:jcupitt,项目名称:nip2,代码行数:28,代码来源:icontainer.c


示例5: print_field_fn

static void *
print_field_fn( IMAGE *im, const char *field, GValue *value )
{
	const char *extra;
	char *str_value;

	str_value = g_strdup_value_contents( value );
	printf( "%s: %s", field, str_value );
	g_free( str_value );

	/* Replace NULL static strings with "(null)".
	 */
#define NN( X ) ((X) ? (X) : "(null)")

	/* Look for known enums and decode them.
	 */
	extra = NULL;
	if( strcmp( field, "Coding" ) == 0 )
		extra = NN( im_Coding2char( g_value_get_int( value ) ) );
	else if( strcmp( field, "BandFmt" ) == 0 )
		extra = NN( im_BandFmt2char( g_value_get_int( value ) ) );
	else if( strcmp( field, "Type" ) == 0 )
		extra = NN( im_Type2char( g_value_get_int( value ) ) );
	else if( strcmp( field, "Compression" ) == 0 )
		extra = NN( im_Compression2char( g_value_get_int( value ) ) );

	if( extra )
		printf( " - %s", extra );

	printf( "\n" );

	return( NULL );
}
开发者ID:anasazi,项目名称:POP-REU-Project,代码行数:33,代码来源:im_printdesc.c


示例6: gfire_read_attrib

GList *gfire_read_buddy_status(PurpleConnection *gc, int packet_len)
{
	int index = XFIRE_HEADER_LEN + 1;
	int itmp = 0;
	GList *btmp = NULL;
	gfire_buddy *gf_buddy = NULL;
	GList *ret = NULL;
	GList *sids = NULL;
	GList *msgs = NULL;
	GList *s, *m; 
	gfire_data *gfire = (gfire_data *)gc->proto_data;

	itmp = gfire_read_attrib(&sids, gfire->buff_in + index, packet_len - index, "sid", FALSE, TRUE, 0, 0, 
							XFIRE_SID_LEN);
	if (itmp < 1 ) {
//FIXME add mem cleanup code
FIXME("gfire_read_attrib returned < 1! sids");
		return NULL;
	}	
	index += itmp + 1;
	itmp = gfire_read_attrib(&msgs, gfire->buff_in + index, packet_len - index, "msg", TRUE, FALSE, 0, 0, 0);
	if (itmp < 1 ) {
//FIXME add mem cleanup code
FIXME("gfire_read_attrib returned < 1! msgs");
		return NULL;
	}	

	msgs = g_list_first(msgs); sids = g_list_first(sids);
	m = msgs; s = sids;
	
	while ( NULL != s ){
		btmp = gfire_find_buddy_in_list(gfire->buddies, s->data, GFFB_SIDBIN);
		if (NULL == btmp) {
			purple_debug(PURPLE_DEBUG_MISC, "gfire", "WARN: pkt 154: (away status) could not find sid in buddy list.\n");
		} else {
			gf_buddy = (gfire_buddy *)btmp->data;
			if (NULL != m->data) {
				/* got an away message */
				gf_buddy->away = TRUE;
				gf_buddy->away_msg = m->data;
			} else {
				/* no message, user is back */
				gf_buddy->away = FALSE;
				if (NULL != gf_buddy->away_msg) g_free(gf_buddy->away_msg);
				gf_buddy->away_msg = NULL;
			}
			ret = g_list_append(ret, (gpointer *)gf_buddy);

			purple_debug(PURPLE_DEBUG_MISC, "gfire","(away): %s, is away/back with msg %s\n",
						NN(gf_buddy->name), NN(gf_buddy->away_msg));
		}
		g_free(s->data);
		s->data = NULL;
		s = g_list_next(s); m = g_list_next(m);
	}
	g_list_free(msgs);
	g_list_free(sids);
	return ret;
}
开发者ID:bf4,项目名称:pidgin-mac,代码行数:59,代码来源:gf_packet.c


示例7: gfire_chat_proto_user_join

void gfire_chat_proto_user_join(gfire_data *p_gfire, guint16 p_packet_len)
{
	if(!p_gfire)
		return;

	guint32 offset = XFIRE_HEADER_LEN;

	guint8 *chat_id = NULL;
	gfire_chat *chat = NULL;
	guint32 userid = 0;
	gchar *name = NULL;
	gchar *nick = NULL;
	guint32 perm = 0;
	gfire_buddy *gf_buddy = NULL;

	offset = gfire_proto_read_attr_chatid_bs(p_gfire->buff_in, &chat_id, 0x04, offset);
	if(offset == -1 || !chat_id)
		return;

	chat = gfire_find_chat(p_gfire, chat_id, GFFC_CID);
	if(!chat)
	{
		g_free(chat_id);
		purple_debug_error("gfire", "gfire_chat_proto_user_leave: Unknown chat id!\n");
		return;
	}

	g_free(chat_id);

	offset = gfire_proto_read_attr_int32_bs(p_gfire->buff_in, &userid, 0x01, offset);
	if(offset == -1)
		return;

	offset = gfire_proto_read_attr_string_bs(p_gfire->buff_in, &name, 0x02, offset);
	if(offset == -1 || !name)
	{
		return;
	}

	offset = gfire_proto_read_attr_string_bs(p_gfire->buff_in, &nick, 0x0D, offset);
	if(offset == -1 || !nick)
	{
		g_free(name);
		return;
	}

	offset = gfire_proto_read_attr_int32_bs(p_gfire->buff_in, &perm, 0x12, offset);
	if(offset == -1)
		return;

	gf_buddy = gfire_buddy_create(userid, name, nick, GFBT_GROUPCHAT);
	gfire_chat_add_user(chat, gf_buddy, perm, TRUE);

	purple_debug(PURPLE_DEBUG_MISC, "gfire", "groupchat join, userid: %u, username: %s, alias: %s\n",
				 userid, NN(name), NN(nick));

	g_free(name);
	g_free(nick);
}
开发者ID:wosigh,项目名称:messaging-plugins,代码行数:59,代码来源:gf_chat_proto.c


示例8: ContentDir_Search

/*****************************************************************************
 * ContentDir_Search
 *****************************************************************************/
const ContentDir_BrowseResult*
ContentDir_Search (ContentDir* cds, void* result_context, 
		   const char* objectId, const char* criteria)
{
	Log_Printf (LOG_DEBUG, "ContentDir_Search objectId='%s' criteria='%s'",
		    NN(objectId), NN(criteria));
	return BrowseOrSearchWithCache (cds, result_context, 
					objectId, criteria);
}
开发者ID:Boxee,项目名称:djmount,代码行数:12,代码来源:content_dir.c


示例9: icontainer_real_parent_add

static void
icontainer_real_parent_add( iContainer *child )
{
#ifdef DEBUG
	printf( "icontainer_real_parent_add: child %s \"%s\"; " 
		"parent %s \"%s\"\n", 
		G_OBJECT_TYPE_NAME( child ), 
		NN( IOBJECT( child )->name ),
		G_OBJECT_TYPE_NAME( child->parent ), 
		NN( IOBJECT( child->parent )->name ) );
#endif /*DEBUG*/
}
开发者ID:jcupitt,项目名称:nip2,代码行数:12,代码来源:icontainer.c


示例10: icontainer_real_parent_remove

static void
icontainer_real_parent_remove( iContainer *child )
{
#ifdef DEBUG
{
	iContainer *parent = child->parent;

	printf( "icontainer_real_parent_remove: child %s \"%s\"; "
		"parent %s \"%s\"\n", 
		G_OBJECT_TYPE_NAME( child ), NN( IOBJECT( child )->name ),
		G_OBJECT_TYPE_NAME( parent ), NN( IOBJECT( parent )->name ) );
}
#endif /*DEBUG*/
}
开发者ID:jcupitt,项目名称:nip2,代码行数:14,代码来源:icontainer.c


示例11: ContentDir_GetSearchCapabilities

/*****************************************************************************
 * ContentDir_GetSearchCapabilities
 *****************************************************************************/
const char*
ContentDir_GetSearchCapabilities (ContentDir* self, void* unused)
{
	if (self == NULL)
		return NULL; // ---------->
	
	// Send Action if result not already cached
	if (self->search_caps == NULL) {

		IXML_Document* doc = NULL;
		int rc = Service_SendActionVa
			(OBJECT_SUPER_CAST(self), &doc,
			 "GetSearchCapabilities",
			 NULL, NULL);
		if (rc == UPNP_E_SUCCESS && doc != NULL) {
			self->search_caps = talloc_strdup 
				(self, XMLUtil_FindFirstElementValue
				 (XML_D2N (doc), "SearchCaps", true, true));
			
			Log_Printf (LOG_DEBUG, 
				    "ContentDir_GetSearchCapabilities = '%s'",
				    NN(self->search_caps));
		}
		ixmlDocument_free (doc);
	}
	
	return self->search_caps;
}
开发者ID:Boxee,项目名称:djmount,代码行数:31,代码来源:content_dir.c


示例12: workspace_set_needs_layout

void
workspace_set_needs_layout( Workspace *ws, gboolean needs_layout )
{
#ifdef DEBUG
	printf( "workspace_set_needs_layout: %p %s %d\n", 
		ws, NN( IOBJECT( ws )->name ), needs_layout );
#endif /*DEBUG*/

	if( !ws->needs_layout && 
		needs_layout &&
		!ws->in_dispose ) { 
		g_assert( !g_slist_find( workspace_needs_layout, ws ) ); 

		ws->needs_layout = TRUE;
		workspace_needs_layout = g_slist_prepend( 
			workspace_needs_layout, ws ); 
	}

	if( ws->needs_layout && !needs_layout ) { 
		g_assert( g_slist_find( workspace_needs_layout, ws ) ); 

		ws->needs_layout = FALSE;
		workspace_needs_layout = g_slist_remove( 
			workspace_needs_layout, ws ); 
	}
}
开发者ID:imclab,项目名称:nip2,代码行数:26,代码来源:workspace.c


示例13: icontainer_current

void 
icontainer_current( iContainer *parent, iContainer *child )
{
	g_assert( parent );
	g_assert( !child || ICONTAINER_IS_CHILD( parent, child ) );

	if( parent->current == child )
		return; 

#ifdef DEBUG
	printf( "icontainer_current: (child %p)\n", child );
	printf( "\tchild: %s \"%s\"\n",
		G_OBJECT_TYPE_NAME( child ), 
		NN( IOBJECT( child )->name ) );
#endif /*DEBUG*/

#ifdef DEBUG_SANITY
	icontainer_sanity( parent );
	if( child )
		icontainer_sanity( child );
#endif /*DEBUG_SANITY*/

	g_signal_emit( G_OBJECT( parent ), 
		icontainer_signals[SIG_CURRENT], 0, child );

#ifdef DEBUG_SANITY
	icontainer_sanity( parent );
	if( child )
		icontainer_sanity( child );
#endif /*DEBUG_SANITY*/
}
开发者ID:jcupitt,项目名称:nip2,代码行数:31,代码来源:icontainer.c


示例14: Pipeline1

//TSP -> NN -> Generations( g, ForkJoin ( n, SA -> 2-OPT ) ) -> TSP'
void Pipeline1(tsp_class& tsp_instance, unsigned int number_of_tasks, unsigned int number_of_generations)
{
	#pragma region "PipelineConfiguration"
	auto a = Args<General_args_type>(make_General_args(number_of_generations, number_of_tasks));
	auto sa = Args<SA_args_type>(make_SA_args(1000.0, 0.00001, 0.999, 400));
	auto aco = Args<ACO_args_type>();
	auto ga = Args<GA_args_type>();

	const char* pipeline_description = "TSP -> NN -> Generations( g, ForkJoin ( n, SA -> 2-OPT ) ) -> TSP'";
	display_args(pipeline_description, a, sa, aco, ga);
	
	auto g = a[0].number_of_iterations_or_generations;
	auto n = a[0].number_of_tasks_in_parallel;
	auto _TSP = TSP(just(tsp_instance));
	auto _DisplayInput = Display("TSP INPUT", DisplayFlags::All);
	auto _NN = Measure(NN(), Display("NEAREST NEIGHBOUR", DisplayFlags::EmitMathematicaGraphPlot));	
	auto _SA_2OPT = Chain(SA(sa[0].initial_temperature, sa[0].stopping_criteria_temperature, 
							 sa[0].decreasing_factor, sa[0].monte_carlo_steps), _2OPT());
	auto _ForkJoin = [](unsigned int n, TSP::transformer_type map_fun){ return Measure(ForkJoin(n, map_fun)); };
	auto _DisplayOutput = Display("TSP OUTPUT", DisplayFlags::EmitMathematicaGraphPlot); 
	#pragma endregion

	//TSP -> NN -> Generations( g, ForkJoin ( n, SA -> 2-OPT ) ) -> TSP'
	auto result = _TSP
					.map(_DisplayInput)
					.map(_NN)
					.map(Generations(g, _ForkJoin(n, _SA_2OPT)))
					.map(_DisplayOutput);
}
开发者ID:fabiogaluppo,项目名称:samples,代码行数:30,代码来源:program.cpp


示例15: Pipeline2

//TSP -> NN -> Generations( g, ForkJoin ( n, GA -> 2-OPT ) ) -> TSP'
void Pipeline2(tsp_class& tsp_instance, unsigned int number_of_tasks, 
			                            unsigned int number_of_generations)
{
	#pragma region "PipelineConfiguration"
	auto a = Args<General_args_type>(make_General_args(number_of_generations, number_of_tasks));
	auto sa = Args<SA_args_type>();
	auto aco = Args<ACO_args_type>();
	auto ga = Args<GA_args_type>(make_GA_args(1000, 10, 5, 50000, 10, 0.9));

	const char* pipeline_description = "TSP -> NN -> Generations( g, ForkJoin ( n, GA -> 2-OPT ) ) -> TSP'";
	display_args(pipeline_description, a, sa, aco, ga);
	
	auto g = a[0].number_of_iterations_or_generations;
	auto n = a[0].number_of_tasks_in_parallel;
	auto _TSP = TSP(just(tsp_instance));
	auto _DisplayInput = Display("TSP INPUT", DisplayFlags::All);
	auto _NN = Measure(NN(), Display("NEAREST NEIGHBOUR", DisplayFlags::EmitMathematicaGraphPlot));	
	auto _GA_2OPT = Chain(GA(ga[0].population_size, ga[0].mutation_percentage, ga[0].group_size, 
							 ga[0].number_of_generations, ga[0].nearby_cities, ga[0].nearby_cities_percentage), _2OPT());
	auto _ForkJoin = [](unsigned int n, TSP::transformer_type map_fun){ return Measure(ForkJoin(n, map_fun)); };
	auto _DisplayOutput = Display("TSP OUTPUT", DisplayFlags::EmitMathematicaGraphPlot); 
	#pragma endregion

	//TSP -> NN -> Generations( g, ForkJoin ( n, GA -> 2-OPT ) ) -> TSP'
	auto result = _TSP
					.map(_DisplayInput)
					.map(_NN)
					.map(Generations(g, _ForkJoin(n, _GA_2OPT)))
					.map(_DisplayOutput);
}
开发者ID:fabiogaluppo,项目名称:samples,代码行数:31,代码来源:program.cpp


示例16: icontainer_child_remove

void *
icontainer_child_remove( iContainer *child )
{
	iContainer *parent;

	if( (parent = child->parent) ) {
		g_assert( ICONTAINER_IS_CHILD( parent, child ) );

#ifdef DEBUG
		printf( "icontainer_child_remove: (child %p)\n", child );
		printf( "\tchild: %s \"%s\"\n",
			G_OBJECT_TYPE_NAME( child ), 
			NN( IOBJECT( child )->name ) );
#endif /*DEBUG*/

#ifdef DEBUG_SANITY
		icontainer_sanity( parent );
		icontainer_sanity( child );
#endif /*DEBUG_SANITY*/

		g_signal_emit( G_OBJECT( parent ), 
			icontainer_signals[SIG_CHILD_REMOVE], 0, child );

#ifdef DEBUG_SANITY
		icontainer_sanity( parent );
#endif /*DEBUG_SANITY*/
	}

	return( NULL );
}
开发者ID:jcupitt,项目名称:nip2,代码行数:30,代码来源:icontainer.c


示例17: setfval

Awkfloat setfval(Cell *vp, Awkfloat f)	/* set float val of a Cell */
{
    int fldno;

    f += 0.0;		/* normalise negative zero to positive zero */
    if ((vp->tval & (NUM | STR)) == 0)
        funnyvar(vp, "assign to");
    if (isfld(vp)) {
        donerec = 0;	/* mark $0 invalid */
        fldno = atoi(vp->nval);
        if (fldno > *NF)
            newfld(fldno);
        dprintf( ("setting field %d to %g\n", fldno, f) );
    } else if (&vp->fval == NF) {
        donerec = 0;	/* mark $0 invalid */
        setlastfld(f);
        dprintf( ("setting NF to %g\n", f) );
    } else if (isrec(vp)) {
        donefld = 0;	/* mark $1... invalid */
        donerec = 1;
    }
    if (freeable(vp))
        xfree(vp->sval); /* free any previous string */
    vp->tval &= ~STR;	/* mark string invalid */
    vp->tval |= NUM;	/* mark number ok */
    dprintf( ("setfval %p: %s = %g, t=%o\n", vp, NN(vp->nval), f, vp->tval) );
    return vp->fval = f;
}
开发者ID:mluszczyk,项目名称:so-minix,代码行数:28,代码来源:tran.c


示例18: main

int main()
{
    std::cout << "digraph \"SAI Object Dependency Graph\" {\n";
    std::cout << "size=\"20,10\"; ratio = fill;\n";
    std::cout << "node [style=filled];\n";

    process_object_types();

    process_manual_connections();

    process_colors();

    std::cout << NN(SAI_OBJECT_TYPE_SWITCH) << " [color=orange, shape = parallelogram, peripheries = 2];\n";
    std::cout << NN(SAI_OBJECT_TYPE_PORT) << " [color=gold, shape = diamond, peripheries=2];\n";

    std::cout << "}\n";
    return 0;
}
开发者ID:zubinshah,项目名称:SAI,代码行数:18,代码来源:saidepgraphgen.cpp


示例19: computeLevelset

static void computeLevelset(GModel *gm, cartesianBox<double> &box)
{
  // tolerance for desambiguation
  const double tol = box.getLC() * 1.e-12;
  std::vector<SPoint3> nodes;
  std::vector<int> indices;
  for (cartesianBox<double>::valIter it = box.nodalValuesBegin();
       it != box.nodalValuesEnd(); ++it){
    nodes.push_back(box.getNodeCoordinates(it->first));
    indices.push_back(it->first);
  }
  Msg::Info("  %d nodes in the grid at level %d", (int)nodes.size(), box.getLevel());
  std::vector<double> dist, localdist;
  std::vector<SPoint3> dummy;
  for (GModel::fiter fit = gm->firstFace(); fit != gm->lastFace(); fit++){
    for (int i = 0; i < (*fit)->stl_triangles.size(); i += 3){
      int i1 = (*fit)->stl_triangles[i];
      int i2 = (*fit)->stl_triangles[i + 1];
      int i3 = (*fit)->stl_triangles[i + 2];
      GPoint p1 = (*fit)->point((*fit)->stl_vertices[i1]);
      GPoint p2 = (*fit)->point((*fit)->stl_vertices[i2]);
      GPoint p3 = (*fit)->point((*fit)->stl_vertices[i3]);
      SPoint2 p = ((*fit)->stl_vertices[i1] + (*fit)->stl_vertices[i2] +
                   (*fit)->stl_vertices[i3]) * 0.33333333;
      SVector3 N = (*fit)->normal(p);
      SPoint3 P1(p1.x(), p1.y(), p1.z());
      SPoint3 P2(p2.x(), p2.y(), p2.z());
      SPoint3 P3(p3.x(), p3.y(), p3.z());
      SVector3 NN(crossprod(P2 - P1, P3 - P1));
      if (dot(NN, N) > 0)
	signedDistancesPointsTriangle(localdist, dummy, nodes, P1, P2, P3);
      else
	signedDistancesPointsTriangle(localdist, dummy, nodes, P2, P1, P3);
      if(dist.empty())
        dist = localdist;
      else{
        for (unsigned int j = 0; j < localdist.size(); j++){
          // FIXME: if there is an ambiguity assume we are inside (to
          // avoid holes in the structure). This is definitely just a
          // hack, as it could create pockets of matter outside the
          // structure...
          if(dist[j] * localdist[j] < 0 &&
             fabs(fabs(dist[j]) - fabs(localdist[j])) < tol){
            dist[j] = std::max(dist[j], localdist[j]);
          }
          else{
            dist[j] = (fabs(dist[j]) < fabs(localdist[j])) ? dist[j] : localdist[j];
          }
        }
      }
    }
  }
  for (unsigned int j = 0; j < dist.size(); j++)
    box.setNodalValue(indices[j], dist[j]);

  if(box.getChildBox()) computeLevelset(gm, *box.getChildBox());
}
开发者ID:feelpp,项目名称:debian-gmsh,代码行数:57,代码来源:mainCartesian.cpp


示例20: moveAntTo

void *routeAnt(void *id) {
	int j, i = (int)id;
	for(j=1;j<ins.dimension;j++){
		if(hasCandidatesLeft(i,ant[i].tour[j-1]))
			moveAntTo(i,j,argMax(i,ant[i].tour[j-1]));
		else
			moveAntTo(i,j,NN(i,j-1));
	}
}
开发者ID:piperamirez,项目名称:tsp-acs,代码行数:9,代码来源:tsp-acs.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NN_ASSERT函数代码示例发布时间:2022-05-30
下一篇:
C++ NM_SUPPLICANT_INTERFACE_GET_PRIVATE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap