#ifndef	SYSPROTO_H
#define	SYSPROTO_H

#include <v_lib.h>
#include "rgcache.h"
#include "genparse.h"
#include "seqparse.h"

/*
 * Filler particle: fiber.
 */
typedef struct fp_s
{
	vec3_t	p1, p2;
	vec_t	length, radius;
	vec_t	volume;
}	fp_t, *fp_p;

/*
 * Contact point
 */
typedef struct fc_s
{
	/*
	 * Pointers to contacting fibers. Assume that no more fibers
	 * will be added: doing so can lead to memRealloc() and invalidation
	 * of pointers.
	 */
	fp_p f1, f2;
	int nf1, nf2;	/* indiced of fibers. redundant */
	vec_t dist;		/* minimal distance between axes of fibers */
	vec3_t cp;		/* contact point */
}	fc_t, *fc_p;

/*
 * System to be modeled.
 */
typedef struct tsys_s
{
	char		parent_name[MAX_ID_LEN];
	char		name[MAX_ID_LEN + 256];
	vec3_t		bbox[2];
	vec_t		volume;
	vec_t		volumetric_content;
	vec_t		extrapolated_vc;
	vec_t		average_length;
	vec_t		average_diameter;
	vec_t		time_estimation; /* estimation of computation time */
	bstack_t	fs; /* of fp_t */
	bstack_t	cs; /* of fc_t */
}	tsys_t, *tsys_p;

vboolean V_GLOBAL	sysCreateSystems(vp_stack_p seqs, vp_stack_p syss_dest);
void	V_GLOBAL	sysDestroy(vp_stack_p syss);
void	V_GLOBAL	sysPrint(vp_stack_p syss);
vboolean V_GLOBAL	sysSequentialScheduler(vp_stack_p syss);
vboolean V_GLOBAL	sysPostprocess(vp_stack_p syss, FILE *out);

#endif /* SYSPROTO_H */
