File: find_cusp.c

package info (click to toggle)
snappea 3.0d3-20.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 5,896 kB
  • ctags: 3,582
  • sloc: ansic: 33,469; sh: 8,293; python: 7,623; makefile: 240
file content (41 lines) | stat: -rw-r--r-- 1,018 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 *	find_cusp.c
 *
 *	This function provides the following utility for use within the kernel.
 *
 *		Cusp *find_cusp(Triangulation *manifold, int cusp_index);
 *
 *	The UI refers to cusps by their indices, because it doesn't know about
 *	the Cusp data structure.  When a kernel function receives a cusp_index,
 *	it may call the function find_cusp() to convert the index to an actual
 *	pointer to the corresponding Cusp data structure.  If find_cusp() cannot
 *	find a Cusp with the given cusp_index, it calls uFatalError().
 */

#include "kernel.h"

Cusp *find_cusp(
	Triangulation	*manifold,
	int				cusp_index)
{
	Cusp	*cusp;

	for (cusp = manifold->cusp_list_begin.next;
		 cusp != &manifold->cusp_list_end;
		 cusp = cusp->next)

		if (cusp->index == cusp_index)

			return cusp;

	/*
	 *	No Cusp with the given index was found.
	 */
	uFatalError("find_cusp", "find_cusp");

	/*
	 *	The C++ compiler would like a return value, even though
	 *	we never return from the uFatalError() call.
	 */
	return NULL;
}