Example #1
0
void new_hash_table()
{
    init_zobrist();
    
    hash_mask = HASH_TABLE_SIZE - 1;
    hash_table = (hash_node *)malloc(HASH_TABLE_SIZE * sizeof(hash_node));
    reset_hash_table();
}
Example #2
0
LIB_LOCAL 	void copy_tg_pts_from_intfc(
	TRI_GRID *ntg,
	P_LINK   *hash_table,
	int      h_size)
{
#if defined(TWOD) || defined(THREED)
	TG_PT     *fr_pt;
	INTERFACE *intfc = ntg->grid_intfc;
	POINT     *point;
#endif /* defined(TWOD) || defined(THREED) */

	reset_hash_table(hash_table,h_size);

#if defined(TWOD)
	if (intfc->dim == 2)
	{
	    BOND  *b;
	    CURVE **c;
	    NODE  **n;

	    fr_pt = ntg->front_points;
	    for (n = intfc->nodes; n && *n; ++n)
	    {
		point = (*n)->posn;
		Coords(fr_pt)[0] = Coords(point)[0];
		Coords(fr_pt)[1] = Coords(point)[1];
		(void) add_to_hash_table((POINTER)point,(POINTER)fr_pt,
			                 hash_table,h_size);
		++fr_pt;
	    }
	    for (c = intfc->curves; c && *c; ++c)
	    {
		for (b = (*c)->first; b != (*c)->last; b = b->next)
		{
		   point = b->end;
		   Coords(fr_pt)[0] = Coords(point)[0];
		   Coords(fr_pt)[1] = Coords(point)[1];
		   (void) add_to_hash_table((POINTER)point,(POINTER)fr_pt,
				            hash_table,h_size);
		   ++fr_pt;
		}
	    }
	}
#endif /* defined(TWOD) */
#if defined(THREED)
	if (intfc->dim == 3)
	{
	    HYPER_SURF         *hs;
	    HYPER_SURF_ELEMENT *hse;

	    fr_pt = ntg->front_points;
	    (void) next_point(intfc,NULL,NULL,NULL);
	    while (next_point(intfc,&point,&hse,&hs))
	    {
	          Coords(fr_pt)[0] = Coords(point)[0];
	          Coords(fr_pt)[1] = Coords(point)[1];
	          Coords(fr_pt)[2] = Coords(point)[2];
	          (void) add_to_hash_table((POINTER)point,(POINTER)fr_pt,
				           hash_table,h_size);
	          ++fr_pt;
	    }
	}
#endif /* defined(THREED) */
}		/*end copy_tg_pts_from_intfc*/