示例#1
0
文件: fstate.c 项目: antdvid/FronTier
EXPORT	boolean	f_sort_bond_tris(
	INTERFACE	*intfc)
{
	BOND            *b;
	CURVE           **c;
	Locstate        s0, s1;
	int             i, N;
	size_t          sizest;
	static Locstate stemp = NULL;

	if (!i_sort_bond_tris(intfc))
	    return NO;

	sizest = size_of_state(intfc);
	if ((sizest == 0) || !interpolate_intfc_states(intfc))
	    return YES;

	if (stemp == NULL)
	    scalar(&stemp,size_of_state(intfc));

	for (c = intfc->curves; c && *c; ++c)
	{
	    N = (int) size_of_pointers(Btris((*c)->first));
	    for (b = (*c)->first; b != (*c)->last; b = b->next)
	    {
		for (i = 0; i < N; ++i)
		{
		    s0 = left_end_btri_state(Btris(b)[i]);
		    s1 = left_start_btri_state(Btris(b->next)[i]);
		    if (s0 != s1)
		    {
			bi_interpolate_intfc_states(intfc,0.5,0.5,
						    Coords(b->end),s0,
						    Coords(b->end),s1,
						    stemp);
			left_start_btri_state(Btris(b->next)[i]) = s0;
			ft_assign(s0,stemp,sizest);
		    }
		    s0 = right_end_btri_state(Btris(b)[i]);
		    s1 = right_start_btri_state(Btris(b->next)[i]);
		    if (s0 != s1)
		    {
			bi_interpolate_intfc_states(intfc,0.5,0.5,
						    Coords(b->end),s0,
						    Coords(b->end),s1,
						    stemp);
			right_start_btri_state(Btris(b->next)[i]) = s0;
			ft_assign(s0,stemp,sizest);
		    }
		}
	    }
	}
	return YES;
}		/*end f_sort_bond_tris*/
示例#2
0
LOCAL	void add_intfc_blk_pcs3d(
	int     num_tris,
	TRI     **tris,
	SURFACE **surfs,
	BLK_EL0 *blk_el0,
	P_LINK  *hash_table,
	int     h_size)
{
	POINT_COMP_ST *pcs = blk_el0_pcs_els(blk_el0);
	TRI           *t, *tri;
	SURFACE       *s;
	BOND	      *b;
	BOND_TRI      **btris;
	POINT         *p;
	int           i,j,k, npcs;
	TG_PT         *tp;
	Locstate      sl,sr;

	/* reset points in block tris */

	for (i = 0; i < num_tris; ++i)
	{
	    t = tris[i];
	    for (k = 0; k < 3; ++k)
		sorted(Point_of_tri(t)[k]) = NO;
	}

	//see count_num_pcs3d for alloc
	//#bjet2  add points in the boundary of the surfaces 
	
	for (i = 0; i < num_tris; ++i)
	{
	    t = tris[i];
	    for (k = 0; k < 3; ++k)
	    {
	        if(!is_side_bdry(t, k))
	            continue;

		b = Bond_on_side(t, k);
		for(j = 0; j < 2; j++)
		{    
		    p = Point_of_tri(t)[(k+j)%3]; //two points on side k
		    if(sorted(p))
		        continue;
		    sorted(p) = YES;
		    
		    tp = (TG_PT*)find_from_hash_table((POINTER)p,
				    hash_table, h_size);
		    for(btris = Btris(b); btris && *btris; btris++)
		    {
			tri = (*btris)->tri;
			s = (*btris)->surface;
		        slsr(p,Hyper_surf_element(tri),Hyper_surf(s),&sl,&sr);
			
			npcs = num_pcs_els_in_blk(blk_el0);
			pcs[npcs].p = tp;
			pcs[npcs].comp[0] = negative_component(s);
			pcs[npcs].comp[1] = positive_component(s);
			pcs[npcs].s[0] = sl;
			pcs[npcs].s[1] = sr;
			++num_pcs_els_in_blk(blk_el0);
			
			if(debugging("pcs_cell"))
			{
		    	    printf("npcsc %d  comp %d  %d\n", npcs, 
				    pcs[npcs].comp[0], pcs[npcs].comp[1]);
		    	    print_general_vector("p ", Coords(tp), 3, "\n");
			}
		    }  //for btris
		}  // for j, two points for a side
	    }  // for k, sides for t
	}

	// add points in the interior of the surface 

	for (i = 0; i < num_tris; ++i)
	{
	    t = tris[i];	s = surfs[i];
	    for (k = 0; k < 3; ++k)
	    {
		p = Point_of_tri(t)[k];
		if (sorted(p) == YES)
		    continue;
		sorted(p) = YES;

		tp = (TG_PT*)find_from_hash_table((POINTER)p,hash_table,
				                  h_size);
		slsr(p,Hyper_surf_element(t),Hyper_surf(s),&sl,&sr);
		
		npcs = num_pcs_els_in_blk(blk_el0);
		pcs[npcs].p = tp;
		pcs[npcs].comp[0] = negative_component(s);
		pcs[npcs].comp[1] = positive_component(s);
		pcs[npcs].s[0] = sl;
		pcs[npcs].s[1] = sr;
		++num_pcs_els_in_blk(blk_el0);
		
		if(debugging("pcs_cell"))
		{
		    printf("npcs %d  comp %d  %d\n", npcs, 
				    pcs[npcs].comp[0], pcs[npcs].comp[1]);
		    print_general_vector("p ", Coords(tp), 3, "\n");
		}
	    }
	}
}	/* end add_intfc_blk_pcs3d */
示例#3
0
LOCAL	bool	check_curve3d(
	CURVE     *c,
	INTERFACE *intfc)
{
	BOND     *b;
	BOND_TRI **bts, **bts0;
	NODE     *ns, *ne;
	SURFACE  *s, **ss;
	TRI      *tri, **tris;
	bool     status = YES;
	char     warn[1024];
	int      nsides, nbts, i;
	int      ntris;

	(void) sprintf(warn,"WARNING in check_curve3d(), curve %llu inconsistent ",
		       curve_number(c));
	if (c->interface != intfc)
	{
	    (void) printf("%s c->interface (%llu) != intfc (%llu)\n",
			  warn,interface_number(c->interface),
			  interface_number(intfc));
	    status = NO;
	}
	ns = c->start;
	if (!pointer_is_in_array(c,ns->out_curves))
	{
	    (void) printf("%s curve in not in start node (%llu) "
			  "out_curves\n",warn,node_number(ns));
	    status = NO;
	}
	ne = c->end;
	if (!pointer_is_in_array(c,ne->in_curves))
	{
	    (void) printf("%s curve in not in end node (%llu) "
			  "in_curves\n",warn,node_number(ne));
	    status = NO;
	}
	if (ns->posn != c->first->start)
	{
	    (void) printf("%s ns->posn != c->first->start\n"
			  "c->first->start = %llu, "
			  "ns = %llu, ns->posn = %llu\n",
			  warn,point_number(c->first->start),
			  node_number(ns),point_number(ns->posn));
	    status = NO;
	}
	if (ne->posn != c->last->end)
	{
	    (void) printf("%s ne->posn != c->last->end\n"
			  "c->last->end = %llu, "
			  "ne = %llu, ne->posn = %llu\n",
			  warn,point_number(c->last->end),
			  node_number(ne),point_number(ne->posn));

	    print_general_vector("c->last->end", Coords(c->last->end), 3, "\n");
	    print_general_vector("ne->posn", Coords(ne->posn), 3, "\n");
	    print_curve(c);
	    status = NO;
	}
	if (!Boundary_point(ns->posn))
	{
	    (void) printf("%s ns->posn (ns = %llu, ns->posn = %llu) is not a "
			  "boundary point\n",
			  warn,node_number(ns),point_number(ns->posn));
	    status = NO;
	}
	if (!Boundary_point(ne->posn))
	{
	    (void) printf("%s ne->posn (ne = %llu, ne->posn = %llu) is not a "
			  "boundary point\n",
			  warn,node_number(ne),point_number(ne->posn));
	    status = NO;
	}
	if (!Boundary_point(c->first->start))
	{
	    (void) printf("%s c->first->start = %llu is not a "
			  "boundary point\n",
			  warn,point_number(c->first->start));
	    status = NO;
	}
	if (!Boundary_point(c->last->end))
	{
	    (void) printf("%s c->last->end = %llu is not a "
			  "boundary point\n",
			  warn,point_number(c->last->end));
	    status = NO;
	}
	for (ss = c->pos_surfaces; ss && *ss; ++ss)
	{
	    if (!pointer_is_in_array(c,(*ss)->pos_curves))
	    {
	        (void) printf("%s curve in not s->pos_curves "
			      " s = %llu but s is in c->neg_surfaces\n",
			      warn,surface_number(*ss));
		status = NO;
	    }
	}
	for (ss = c->neg_surfaces; ss && *ss; ++ss)
	{
	    if (!pointer_is_in_array(c,(*ss)->neg_curves))
	    {
	        (void) printf("%s curve in not s->neg_curves "
			      " s = %llu but s is in c->neg_surfaces\n",
			      warn,surface_number(*ss));
		status = NO;
	    }
	}
	b = c->first;
	bts0 = Btris(b);
	for (nbts = 0, bts = Btris(b); bts && *bts; ++nbts, ++bts);
	if (nbts == 0)
	{
	    if (c->pos_surfaces || c->neg_surfaces)
	    {
		(void) printf("%s curve has no bond tris but is "
			      "connected to some surface\n",warn);
		status = NO;
	    }
	}
	if (c->first->prev != NULL)
	{
	    (void) printf("%s c->first->prev != NULL\n",warn);
	    print_bond(c->first);
	    print_bond(c->first->prev);
	    status = NO;
	}
	if (c->last->next != NULL)
	{
	    (void) printf("%s c->last->next != NULL\n",warn);
	    print_bond(c->last);
	    print_bond(c->last->next);
	    status = NO;
	}
	for (b = c->first; b != NULL; b = b->next)
	{
	    if (b->next && b->next->start != b->end)
	    {
	        (void) printf("%s bond pair (%llu -> %llu) point pointers "
			      "inconsistent\n",
			      warn,bond_number(b,intfc),
			      bond_number(b->next,intfc));
		print_bond(b);
		print_bond(b->next);
	        status = NO;
	    }
	    if (!Boundary_point(b->start))
	    {
	        (void) printf("%s b->start = %llu is not a "
			      "boundary point\n",
			      warn,point_number(b->start));
		print_bond(b);
	        status = NO;
	    }
	    if (!Boundary_point(b->end))
	    {
	        (void) printf("%s b->end = %llu is not a "
			      "boundary point\n",
			      warn,point_number(b->end));
		print_bond(b);
	        status = NO;
	    }
	    for (i = 0, bts = Btris(b); bts && *bts; ++i, ++bts)
	    {
		if ((i < nbts) &&
		    !(((*bts)->surface == bts0[i]->surface) &&
		          ((*bts)->orient == bts0[i]->orient)))
		{
	            (void) printf("%s inconsistent surface numbers on "
				  "bond tri\n",warn);
		    (void) printf("surface = %llu surface[%d] = %llu\n",
				  surface_number((*bts)->surface),i,
				  surface_number(bts0[i]->surface));
		    (void) printf("orient = %s orient[%d] = %s\n",
				  orientation_name((*bts)->orient),i,
				  orientation_name(bts0[i]->orient));
		    print_bond(b);
	            status = NO;
		}
	    }
	    if (i != nbts)
	    {
	        (void) printf("%s inconsistent %d != %d number of bond tris "
			      "on bond\n",warn,i,nbts);
		print_bond(b);
	        status = NO;
	    }
	    for (bts = Btris(b); bts && *bts; ++bts)
	    {
		if ((*bts)->curve != c)
		{
		    (void) printf("%s bond tri curve field (%llu) != c\n",
				  warn,curve_number((*bts)->curve));
		    print_bond(b);
		    status = NO;
		}
		if ((*bts)->bond != b)
		{
		    (void) printf("%s bond tri bond field (%llu) != b (%llu)\n",
				  warn,bond_number((*bts)->bond,intfc),
				  bond_number(b,intfc));
		    print_bond(b);
		    status = NO;
		}
		tri = (*bts)->tri;
		s = Surface_of_tri(tri);
		if ((*bts)->surface != s)
		{
		    (void) printf("%s bond tri surface field (%llu)"
				  "!= Surface_of_tri(tri) (%llu)\n",
				  warn,surface_number((*bts)->surface),
				  surface_number(s));
		    print_bond(b);
		    status = NO;
		}
		for (nsides = 0, i = 0; i < 3; ++i)
		{
		    if (is_side_bdry(tri,i) && (b==Bond_on_side(tri,i)))
			++nsides;
		}
		if (nsides == 0)
		{
		    (void) printf("%s bond not found on tri side\n",warn);
		    print_bond(b);
		    print_tri(tri,intfc);
		    status = NO;
		}
		else if (nsides > 1)
		{
		    (void) printf("%s bond found on multiple tri sides\n",warn);
		    print_bond(b);
		    print_tri(tri,intfc);
		    status = NO;
		}
		else
		{
		    if (orientation_of_bond_at_tri(b,tri) != (*bts)->orient)
		    {
		        (void) printf("%s inconsistent orientation at "
				      "bond tri\n",warn);
		        print_tri(tri,intfc);
		        print_bond(b);
		        status = NO;
		    }
		    switch ((*bts)->orient)
		    {
		    case POSITIVE_ORIENTATION:
	                if (!pointer_is_in_array(c,s->pos_curves))
	                {
	                    (void) printf("%s curve in not s->pos_curves "
					  " s = %llu\n",
			                  warn,surface_number(s));
		            print_bond(b);
		            print_tri(tri,intfc);
	                    status = NO;
	                }
	                if (!pointer_is_in_array(s,c->pos_surfaces))
	                {
	                    (void) printf("%s surface in not c->pos_surfaces "
					  " s = %llu\n",
			                  warn,surface_number(s));
		            print_bond(b);
		            print_tri(tri,intfc);
	                    status = NO;
	                }
			break;
		    case NEGATIVE_ORIENTATION:
	                if (!pointer_is_in_array(c,s->neg_curves))
	                {
	                    (void) printf("%s curve in not s->neg_curves "
					  " s = %llu\n",
			                  warn,surface_number(s));
		            print_bond(b);
		            print_tri(tri,intfc);
	                    status = NO;
	                }
	                if (!pointer_is_in_array(s,c->neg_surfaces))
	                {
	                    (void) printf("%s surface in not c->neg_surfaces "
					  " s = %llu\n",
			                  warn,surface_number(s));
		            print_bond(b);
		            print_tri(tri,intfc);
	                    status = NO;
	                }
			break;
		    case ORIENTATION_NOT_SET:
			(void) printf("%s inconsistent point and tri "
				      "points\n",warn);
		        print_bond(b);
		        print_tri(tri,intfc);
	                status = NO;
			break;
		    }
		}
		if (b->prev)
		{
		    TRI *t0, *t1;
	            ntris = set_tri_list_around_point(b->start,tri,&tris,intfc);
		    t0 = tris[0]; t1 = tris[ntris-1];
		    if (!(((side_of_tri_with_bond(b,t0) < 3) &&
			      (side_of_tri_with_bond(b->prev,t1) < 3))
		        ||
			     ((side_of_tri_with_bond(b,t1) < 3) &&
			      (side_of_tri_with_bond(b->prev,t0) < 3)))
		       )
		    {
			(void) printf("%s, corrupt tri list at b->start\n",
				      warn);
		        (void) printf("Bond b\n"); print_bond(b);
		        (void) printf("Bond b->prev\n"); print_bond(b->prev);
		        print_tri(tri,intfc);
			(void) printf("number of tris at point = %d\n",ntris);
			for (i = 0; i < ntris; ++i)
			{
			    (void) printf("tris[%d] - ",i);
			    print_tri(tris[i],intfc);
			}
			status = NO;
		    }
		}
	    }
	}
	return status;
}		/*end check_curve3d*/
示例#4
0
LOCAL	bool tri_side_consistent(
	TRI	     *tri,
	TRI_NEIGHBOR *neighbor,
	int	     side,
	INTERFACE    *intfc)
{
	TRI	*side_tri;
	POINT	*ps = Point_of_tri(tri)[side];
	POINT	*pe = Point_of_tri(tri)[Next_m3(side)];
	bool status = YES;
	int	i, bd;

	bd = Boundary_tri(tri);
	if (bd < 0 || bd > 7)
	{
	    (void) printf("WARNING in tri_side_consistent(), "
	        	  "Boundary_tri(tri) = %d is bad\n", bd);
	    print_tri(tri,intfc);
	    status = NO;
	}

	if (neighbor == NULL)
	{
	    if (!allow_null_sides)
	    {
	        (void) printf("WARNING in tri_side_consistent(), "
	        	      "neighbor is null\n");
	        print_tri(tri,intfc);
	        status = NO;
	    }
	}
	else if (is_side_bdry(tri,side))
	{
	    BOND        *b;
	    BOND_TRI	*bt = neighbor->btri;
	    BOND_TRI	**btris;
	    ORIENTATION orient;
	    bool        btri_is_in_list;
	    int         num_tri_in_btri;

	    if (bt == NULL)
	    {
	        (void) printf("WARNING in tri_side_consistent(), "
	        	      "NULL BOND_TRI on tri side %d\n",side);
	        print_tri(tri,intfc);
	        status = NO;
	    }
	    else if ((b = bt->bond) == NULL)
	    {
	        (void) printf("WARNING in tri_side_consistent(), "
	        	      "NULL bond on BOND_TRI on side %d\n",side);
	        print_tri(tri,intfc);
	        status = NO;
	    }
	    else
	    {
		btri_is_in_list = NO;
	        for (num_tri_in_btri = 0, btris = Btris(b); btris && *btris;
		     ++btris)
	        {
	    	    if ((*btris)->tri == tri)
		    {
			++num_tri_in_btri;
			if (bt == *btris)
			    btri_is_in_list = YES;
		    }
	        }
	        if (num_tri_in_btri == 0)
	        {
	            (void) printf("WARNING in tri_side_consistent(), "
	    	                  "Tri is not on bond btris list,\n");
	    	    (void) printf("ps(%llu) - (%g, %g, %g), ",
	    		          point_number(ps),
	    		          Coords(ps)[0],Coords(ps)[1],Coords(ps)[2]);
	    	    (void) printf("\tpe(%llu) - (%g, %g, %g)\n",
	    		          point_number(pe),
	    		          Coords(pe)[0],Coords(pe)[1],Coords(pe)[2]);
	    	    (void) printf("tri - \n");
	            print_tri(tri,intfc);
	    	    (void) printf("bond - \n");
	            print_bond(b);
		    status = NO;
	        }
		else if (num_tri_in_btri != 1)
		{
	            (void) printf("WARNING in tri_side_consistent(), Tri is "
				  "in bond btris list more than once,\n");
	    	    (void) printf("ps(%llu) - (%g, %g, %g), ",
	    		          point_number(ps),
	    		          Coords(ps)[0],Coords(ps)[1],Coords(ps)[2]);
	    	    (void) printf("\tpe(%llu) - (%g, %g, %g)\n",
	    		          point_number(pe),
	    		          Coords(pe)[0],Coords(pe)[1],Coords(pe)[2]);
	    	    (void) printf("tri - \n");
	            print_tri(tri,intfc);
	    	    (void) printf("bond - \n");
	            print_bond(b);
		    status = NO;
		}
		if (!btri_is_in_list)
		{
	            (void) printf("WARNING in tri_side_consistent(), Bond tri "
				  "is not in bond btris list,\n");
	    	    (void) printf("ps(%llu) - (%g, %g, %g), ",
	    		          point_number(ps),
	    		          Coords(ps)[0],Coords(ps)[1],Coords(ps)[2]);
	    	    (void) printf("\tpe(%llu) - (%g, %g, %g)\n",
	    		          point_number(pe),
	    		          Coords(pe)[0],Coords(pe)[1],Coords(pe)[2]);
	    	    (void) printf("tri - \n");
	            print_tri(tri,intfc);
	    	    (void) printf("bond - \n");
	            print_bond(b);
		    status = NO;
		}
		orient = orientation_of_bond_at_tri(b,tri);
	        if (orient == ORIENTATION_NOT_SET)
	        {
	            (void) printf("WARNING in tri_side_consistent(), "
	    	                  "Tri side points not on bond,\n");
	    	    (void) printf("ps(%llu) - (%g, %g, %g), ",
	    		          point_number(ps),
	    		          Coords(ps)[0],Coords(ps)[1],Coords(ps)[2]);
	    	    (void) printf("\tpe(%llu) - (%g, %g, %g)\n",
	    		          point_number(pe),
	    		          Coords(pe)[0],Coords(pe)[1],Coords(pe)[2]);
	    	    (void) printf("tri - \n");	print_tri(tri,intfc);
	    	    (void) printf("bond - \n");	print_bond(b);
		    status = NO;
	        }
		if (orient != bt->orient)
		{
	            (void) printf("WARNING in tri_side_consistent(), "
	    	                  "inconsistent bond tri orientation,\n");
	    	    (void) printf("ps(%llu) - (%g, %g, %g), ",
	    		          point_number(ps),
	    		          Coords(ps)[0],Coords(ps)[1],Coords(ps)[2]);
	    	    (void) printf("\tpe(%llu) - (%g, %g, %g)\n",
	    		          point_number(pe),
	    		          Coords(pe)[0],Coords(pe)[1],Coords(pe)[2]);
	    	    (void) printf("tri - \n");	print_tri(tri,intfc);
	    	    (void) printf("bond - \n");	print_bond(b);
		    status = NO;
		}
	    }
	}
	else
	{
	    if ((side_tri = neighbor->tri) == NULL)
	    {
	        if (!allow_null_sides)
		{
		    status = NO;
	            (void) printf("WARNING in tri_side_consistent(), "
	                          "neighbor->tri == NULL\n");
	            (void) printf("tri - \n");
	            print_tri(tri,intfc);
		}
	    }
	    else
	    {
	      for (i = 0; i < 3; ++i)
	      {
	        if (Tri_on_side(side_tri,i) == tri)
	        {
	          POINT *p0, *p1;
	          p0 = Point_of_tri(side_tri)[i];
	          p1 = Point_of_tri(side_tri)[Next_m3(i)];
	          if (p0 != pe || p1 != ps)   
	          {
	              (void) printf("WARNING in tri_side_consistent(), "
	    	                    "Points on side %d do not match,\n",i);
	    	      (void) printf("ps(%llu) - (%g, %g, %g), ",
	    	                    point_number(ps),
	    		            Coords(ps)[0],
				    Coords(ps)[1],
				    Coords(ps)[2]);
	    	      (void) printf("\tpe(%llu) - (%g, %g, %g)\n",
	    		            point_number(pe),
	    		            Coords(pe)[0],
				    Coords(pe)[1],
				    Coords(pe)[2]);
	    	      (void) printf("p1(%llu) - (%g, %g, %g), ",
	    		            point_number(p1),
	    		            Coords(p1)[0],
				    Coords(p1)[1],
				    Coords(p1)[2]);
	    	      (void) printf("\tp0(%llu) - (%g, %g, %g)\n",
	    		            point_number(p0),
	    		            Coords(p0)[0],
				    Coords(p0)[1],
				    Coords(p0)[2]);
	    	      (void) printf("tri - ");	  print_tri(tri,intfc);
	    	      (void) printf("side_tri - "); print_tri(side_tri,intfc);
		      status = NO;
	          }
		  break;
	        }
	      }
	      if (i == 3)
	      {
	        (void) printf("WARNING in tri_side_consistent(), "
	                      "No side matches tri\n");
	        (void) printf("ps(%llu): (%g, %g, %g), "
			      "\tpe(%llu): (%g, %g, %g)\n",
	    	              point_number(ps),
	    	              Coords(ps)[0],Coords(ps)[1],Coords(ps)[2],
	    	              point_number(pe),
	    	              Coords(pe)[0],Coords(pe)[1],Coords(pe)[2]);
	        (void) printf("tri - \n");
	        print_tri(tri,intfc);
	        (void) printf("side_tri - \n");
	        print_tri(side_tri,intfc);
		status = NO;
	      }
	    }
	}
	return status;
}		/*end tri_side_consistent*/
示例#5
0
LOCAL	bool i_consistent_interface3d(
	INTERFACE	*intfc)
{
	HYPER_SURF_ELEMENT *hse;
	HYPER_SURF         *hs;
	CURVE              **c;
	NODE               **n;
	POINT              *p;
	SURFACE	           **ss, *s;
	TRI	           *tri;
	bool               status = YES;
	const char         *warn = "WARNING in i_consistent_interface(), ";

	/* Check Nodes */
	for (n = intfc->nodes; n && *n; ++n)
	{
	    if ((*n)->interface != intfc)
	    {
		(void) printf("%s n = %llu n->interface (%llu) != intfc (%llu)\n",
			      warn,node_number(*n),
			      interface_number((*n)->interface),
			      interface_number(intfc));
		status = NO;
	    }
	    for (c = (*n)->in_curves; c && *c; ++c)
	    {
		if ((*c)->end != *n)
		{
		    (void) printf("%s inconsistent node (%llu) "
				  "curve (%llu) pair, "
				  "curve->end != n\n",
				  warn,node_number(*n),curve_number(*c));
		    status = NO;
		}
	    }
	    for (c = (*n)->out_curves; c && *c; ++c)
	    {
		if ((*c)->start != *n)
		{
		    (void) printf("%s inconsistent node (%llu) "
				  "curve (%llu) pair, "
				  "curve->start != n\n",
				  warn,node_number(*n),curve_number(*c));
		    status = NO;
		}
	    }
	}

	/* Check Curves */
	for (c = intfc->curves; c && *c; c++)
	{
	    if (!check_curve3d(*c,intfc))
	    {
	        (void) printf("%s inconsistency in curve (%llu) found\n",
			      warn,curve_number(*c));
		status = NO;
	    }
	}

	for (ss = intfc->surfaces; ss && *ss; ++ss)
	{
	    if (!check_consistency_of_tris_on_surface(*ss))
	    {
		(void) printf("%s inconsistency in surface (%llu) found\n",
				  warn,surface_number(*ss));
		status = NO;
	    }
	}

	(void) next_point(intfc,NULL,NULL,NULL);
	while (next_point(intfc,&p,&hse,&hs))
	{
	    BOND        *b = NULL, *bb;
	    BOND_TRI    **bts;
	    CURVE       **c;
	    TRI         **tris;
	    int         i, ntris;
	    int         v, pside, nside;

	    tri = Tri_of_hse(hse);
	    s = Surface_of_hs(hs);
	    if ((v = Vertex_of_point(tri,p)) == ERROR)
	    {
	        (void) printf("%s point not on tri, s = %llu\n",
			      warn,surface_number(s));
	    	(void) printf("p(%llu) - (%g, %g, %g), ",
	    		      point_number(p),
	    		      Coords(p)[0],Coords(p)[1],Coords(p)[2]);
		print_tri(tri,hs->interface);
		status = NO;
	    }
	    if (!Boundary_point(p))
	    {
		ntris = set_tri_list_around_point(p,tri,&tris,intfc);
		if ((tri != tris[0]) ||
		    (tri != Prev_tri_at_vertex(tris[ntris-1],p)))
		{
		    bool consistent_tri_list = NO;
		    if (allow_null_sides)
		    {
			if ((Next_tri_at_vertex(tris[0],p) == NULL) &&
		            (Prev_tri_at_vertex(tris[ntris-1],p) == NULL))
			  consistent_tri_list = YES;  
		    }
		    if (!consistent_tri_list)
		    {
		        (void) printf("\n%s Corrupt tri list s (%llu) "
	    	                      "p(%llu) - (%g, %g, %g)\n",
				      warn,surface_number(s),
	    		              point_number(p),
	    		              Coords(p)[0],Coords(p)[1],Coords(p)[2]);
		        print_tri(tri,hs->interface);
		        (void) printf("%d tris about point\n",ntris);
		        for (i = 0; i < ntris; ++i)
		        {
			    (void) printf("tris[%d] - ",i);
			    print_tri(tris[i],hs->interface);
		        }
		        (void) printf("End printout of "
				      "Corrupt tri list s (%llu) "
	    	                      "p(%llu) - (%g, %g, %g)\n\n",
				      surface_number(s),point_number(p),
	    		              Coords(p)[0],Coords(p)[1],Coords(p)[2]);
		        status = NO;
		    }
		}
		continue;
	    }
	    nside = v;
	    pside = Prev_m3(v);
	    if (is_side_bdry(tri,nside))
		b = Bond_on_side(tri,nside);
	    else if (is_side_bdry(tri,pside))
		b = Bond_on_side(tri,pside);
	    else    //#bjet2
	    {
		ntris = set_tri_list_around_point(p,tri,&tris,intfc);
		v = Vertex_of_point(tris[0],p);
		nside = v;
		pside = Prev_m3(v);
		if (is_side_bdry(tris[0],nside))
		    b = Bond_on_side(tris[0],nside);
		else if (is_side_bdry(tris[0],pside))
		    b = Bond_on_side(tris[0],pside);
		else
		{
		    int i;
	            (void) printf("%s Boundary_point has no adjacent "
				  "tri with a bond\n",warn);
	    	    (void) printf("p(%llu) - (%g, %g, %g), ",
	    		          point_number(p),
	    		          Coords(p)[0],Coords(p)[1],Coords(p)[2]);
		    print_tri(tri,hs->interface);
		    for (i = 0; i < ntris; ++i)
		    {
			(void) printf("tris[%d] - ",i);
			print_tri(tris[i],hs->interface);
		    }
		    status = NO;
		}
		tri = tris[0];
	    }
	    for (bts = Btris(b); bts && *bts; ++bts)
	        if ((*bts)->tri == tri)
	    	    break;
	    if ((bts == NULL) || (*bts == NULL))
	    {
		(void) printf("%s bond tri for tri  not found\n",warn);
	    	(void) printf("p(%llu) - (%g, %g, %g), ",point_number(p),
	    		      Coords(p)[0],Coords(p)[1],Coords(p)[2]);
		print_tri(tri,hs->interface);
		print_bond(b);
		status = NO;
	    }
	    else
	    {
	        if ((*bts)->bond != b)
	        {
		    (void) printf("%s (*bts)->bond != b\n",warn);
	    	    (void) printf("p(%llu) - (%g, %g, %g), ",point_number(p),
	    		          Coords(p)[0],Coords(p)[1],Coords(p)[2]);
		    print_tri(tri,hs->interface);
		    print_bond(b);
		    status = NO;
	        }
	        if ((*bts)->surface != s)
	        {
	            (void) printf("%s inconsistent surfaces at bond tri\n",
				  warn);
	    	    (void) printf("p(%llu) - (%g, %g, %g), ",point_number(p),
	    		          Coords(p)[0],Coords(p)[1],Coords(p)[2]);
		    print_tri(tri,hs->interface);
		    print_bond(b);
		    status = NO;
	        }
		if (orientation_of_bond_at_tri(b,tri) != (*bts)->orient)
		{
		    (void) printf("%s inconsistent orientation at bond tri\n",
				  warn);
	    	    (void) printf("p(%llu) - (%g, %g, %g), ",point_number(p),
	    		          Coords(p)[0],Coords(p)[1],Coords(p)[2]);
		    print_tri(tri,hs->interface);
		    print_bond(b);
		    status = NO;
		}
	        switch ((*bts)->orient)
	        {
	        case POSITIVE_ORIENTATION:
		    for (c = s->pos_curves; c && *c; c++)
		        if ((*c) == (*bts)->curve)
			    break;
	            break;
	        case NEGATIVE_ORIENTATION:
		    for (c = s->neg_curves; c && *c; c++)
		        if ((*c) == (*bts)->curve)
			    break;
	            break;
	        case ORIENTATION_NOT_SET:
		    c = NULL;
	            (void) printf("%s undetermined orientation at "
				  "bond on tri\n",warn);
	    	    (void) printf("p(%llu) - (%g, %g, %g), ",point_number(p),
	    		          Coords(p)[0],Coords(p)[1],Coords(p)[2]);
		    print_tri(tri,hs->interface);
		    print_bond(b);
		    status = NO;
		    break;
	        }
	        if ((c == NULL) || (*c == NULL))
	        {
		    (void) printf("%s curve with bond on tri not found\n",warn);
	    	    (void) printf("p(%llu) - (%g, %g, %g), ",point_number(p),
	    		          Coords(p)[0],Coords(p)[1],Coords(p)[2]);
		    print_tri(tri,hs->interface);
		    print_bond(b);
		    status = NO;
	        }
	        else
	        {
	            for (bb = (*c)->first; bb != NULL; bb = bb->next)
		        if (bb == b)
		            break;
	            if (bb == NULL)
	            {
		        (void) printf("%s bond not on curve\n",warn);
	    	        (void) printf("p(%llu) - (%g, %g, %g), ",point_number(p),
	    		              Coords(p)[0],Coords(p)[1],Coords(p)[2]);
		        print_tri(tri,hs->interface);
		        print_bond(b);
		        print_curve(*c);
		        status = NO;
	            }
	        }
	    }
	}

	if (status == NO)
	{
	    (void) printf("WARNING in i_consistent_interface(), "
	                  "Inconsistent interface found\n");
	    print_interface(intfc);
	}

	allow_null_sides = NO;
	return status;
}		/*end i_consistent_interface*/