/* This file is part of the Neper software package. */
/* Copyright (C) 2003-2014, Romain Quey. */
/* See the COPYING file in the top-level directory. */

#ifndef NEUT_TESS_TOPO_H
#define NEUT_TESS_TOPO_H

/// \brief Get the faces of a vertex
///
///
///
extern void neut_tess_ver_faces (struct TESS Tess, int ver, int **pface,
				 int *pfaceqty);

/// \brief Get the faces of a vertex, among the faces of a poly
///
///
///
extern void neut_tess_ver_poly_faces (struct TESS Tess, int ver, int
				      poly, int **pface, int *pfaceqty);

/// \brief Get the polyhedra of a vertex
///
///
///
extern void neut_tess_ver_polys (struct TESS Tess, int ver, int **ppoly,
				 int *ppolyqty);

/// \brief Get the domain edges of a vertex
///
///
///
extern void neut_tess_ver_domedges (struct TESS Tess, int ver, int **pdedge,
				    int *pdedgeqty);

extern void neut_tess_vers_alldomedges (struct TESS Tess, int* vers, int
    verqty, int **pdedges, int *pdedgeqty);

/// \brief Get the domain faces of a vertex
///
///
///
extern void neut_tess_ver_domfaces (struct TESS Tess, int ver, int **pdface,
				    int *pdfaceqty);

/// \brief Get the domain faces of an edge
///
///
///
extern void neut_tess_edge_domfaces (struct TESS Tess, int edge, int **pdface,
				     int *pdfaceqty);

extern void neut_tess_edge_cells (struct TESS Tess, int edge,
				  int **pcell, int *pcellqty);

/// \brief Get the polyhedra of an edge
///
///
///
extern void neut_tess_edge_polys (struct TESS Tess, int edge, int **ppoly,
				  int *ppolyqty);

/// \brief Get the polyhedra of a face
///
///
///
extern void neut_tess_face_polys (struct TESS Tess, int face, int **ppoly,
				  int *ppolyqty);

/// \brief Get the vertices of a set of edges
///
///
///
extern void neut_tess_edges_vers (struct TESS Tess, int *edge, int edgeqty,
				  int **pver, int *pverqty);

/// \brief Get the faces of a set of edges
///
///
///
extern void neut_tess_edges_faces (struct TESS Tess, int *edge, int edgeqty,
				  int **pface, int *pfaceqty);

/// \brief Get the edges of a ver, with the edges belonging to a given domface
///
///
///
extern int neut_tess_ver_domface_edges (struct TESS Tess, int ver, int dface,
					int **pedge, int *pedgeqty);

/// \brief Get the faces of an edge, with the faces belonging to a given domface
///
///
///
extern int neut_tess_edge_domface_faces (struct TESS Tess, int edge,
					 int dface, int **pface,
					 int *pfaceqty);

/// \brief Tell if an edge is a fake edge (not a triple line + on the circular part of a cylinder)
///
///
///
extern int neut_tess_edge_fake (struct TESS Tess, int edge);

/// \brief Get the edges of a set of faces
///
///
///
extern void neut_tess_faces_vers (struct TESS Tess, int *face, int faceqty,
				  int **pver, int *pverqty);

/// \brief Get the edges of a set of faces
///
///
///
extern void neut_tess_faces_edges (struct TESS Tess, int *face, int faceqty,
				   int **pedge, int *pedgeqty);

/// \brief Get the com edge of a set of faces of a TESS
///
///
///
extern int neut_tess_faces_comedges (struct TESS Tess, int *face, int faceqty,
				    int **pedges, int* pedgeqty);

/// \brief Get the vertices of a polyhedron
///
///
///
extern void neut_tess_poly_vers (struct TESS Tess, int poly, int **pver,
				 int *pverqty);

/// \brief Get the edges of a polyhedron
///
///
///
extern void neut_tess_poly_edges (struct TESS Tess, int poly, int **pedge,
				  int *pedgeqty);

/// \brief Get the skin faces of a set of polyhedra
///
///
///
extern void neut_tess_polys_skinfaces (struct TESS Tess, int *poly,
				       int polyqty, int **pface,
				       int **pfacepoly, int *pfaceqty);

/// \brief Get the neighbouring polyhedra of a polyhedron
///
///
///
extern void neut_tess_poly_neighpoly (struct TESS Tess, int poly,
				      int **pnpoly, int *pnpolyqty);

/// \brief Get the neighbouring faces of a face
///
///
///
extern void neut_tess_face_neighface (struct TESS Tess, int face,
				      int **pnface, int *pnfaceqty);

/// \brief Get the neighbouring edges of a edge
///
///
///
extern void neut_tess_edge_neighedge (struct TESS Tess, int edge,
				      int **pnedge, int *pnedgeqty);

/// \brief Get the neighbouring cells of a cell
///
///
///
extern void neut_tess_cell_neighcell (struct TESS Tess, int cell,
				      int **pncell, int *pncellqty);

/// \brief Get the two faces of an edge of a polyhedron
///
///
///
extern void neut_tess_poly_edge_faces (struct TESS Tess, int poly, int edge,
				       int **pface);

/// \brief Get the orientation of a face of a polyhedron
///
///
///
extern void neut_tess_poly_face_ori (struct TESS Tess, int poly, int face,
				     int *pfaceori);

/// \brief Get the orientation of an edge of a face
///
///
///
extern void neut_tess_face_edge_ori (struct TESS Tess, int face, int edge,
				     int *pedgeori);

/// \brief Get the vertices of a set of domain vertices
///
///
///
extern void neut_tess_domvers_ver (struct TESS Tess, int *dver, int dverqty,
				   int **pver, int *pverqty);

/// \brief Get the com domain edge of a set of domain vertices
///
///
///
extern int neut_tess_domvers_comdomedge (struct TESS Tess, int *dver,
					 int dverqty, int *pdedge);

/// \brief Get the domain faces of a domain vertex
///
///
///
extern void neut_tess_domver_domface (struct TESS Tess, int dver,
				      int **pdface, int *pdfaceqty);

/// \brief Get the edges of a domain edge, in sorted order, i.e. going
/// from one vertex of the domain edge to the next.
///
///
extern void neut_tess_domedge_edges_sorted (struct TESS Tess, int dedge,
					    int **pedge, int **pedgeori,
					    int *pedgeqty);

/// \brief Get the com domain face of a set of domain edges
///
///
///
extern int neut_tess_domedges_comdomface (struct TESS Tess, int *dedge,
					  int dedgeqty, int *pdface);

/// \brief Get the domain vertices of a set of domain edges
///
///
///
extern int neut_tess_domedges_domvers (struct TESS Tess, int *dedge,
				       int dedgeqty, int **pdver,
				       int *pdverqty);

/// \brief Get the com domain vertex of a set of domain edges
///
///
///
extern int neut_tess_domedges_comdomver (struct TESS Tess, int *dedge,
					 int dedgeqty, int *pdver);

/// \brief Get the vertices of a domain edge
///
///
///
extern void neut_tess_domedge_ver (struct TESS Tess, int dedge, int **pver,
				   int *pverqty);

/// \brief Get the vertices of the body of a domain edge
///
///
///
extern void neut_tess_domedge_body_ver (struct TESS Tess, int dedge,
					int **pver, int *pverqty);

/// \brief Get the vertices of a domain edge
///
///
///
extern void neut_tess_domedges_ver (struct TESS Tess, int *dedge,
				    int dedgeqty, int **pver, int *pverqty);

/// \brief Get the vertices of the bodies of domain edges
///
/// dfaceqty = -1 means take all dom edges
///
extern void neut_tess_domedges_body_ver (struct TESS Tess, int *dedge,
					 int dedgeqty, int **pver,
					 int *pverqty);

/// \brief Get the com domain edge of a set of domain faces
///
///
///
extern int neut_tess_domfaces_comdomedge (struct TESS Tess, int *dface,
					  int dfaceqty, int *pdedge);

/// \brief Get the com domain ver of a set of domain faces
///
///
///
extern int neut_tess_domfaces_comdomver (struct TESS Tess, int *face,
					 int faceqty, int *pver);

/// \brief Get the vertices of a domain face
///
///
///
extern void neut_tess_domface_ver (struct TESS Tess, int dface, int **pver,
				   int *pverqty);

/// \brief Get the vertices of the body of a domain face
///
///
///
extern void neut_tess_domface_body_ver (struct TESS Tess, int dface,
					int **pver, int *pverqty);

/// \brief Get the vertices of the bodies of domain faces
///
/// dfaceqty = -1 means take all dom faces
///
extern void neut_tess_domfaces_body_ver (struct TESS Tess, int *dface,
					 int dfaceqty, int **pver,
					 int *pverqty);

/// \brief Get the vers of a domain edge
///
///
///
extern void neut_tess_domedge_vers (struct TESS Tess, int dedge, int **pver,
				    int *pverqty);

/// \brief Get the edges of a domain face
///
///
///
extern void neut_tess_domface_edges (struct TESS Tess, int dface, int **pedge,
				     int *pedgeqty);

/// \brief Get the edges of the body of a domain face
///
///
///
extern void neut_tess_domface_body_edges (struct TESS Tess, int dface,
					  int **pedge, int *pedgeqty);

/// \brief Get the true level of a polyhedron
///
///
///
extern int neut_tess_cell_true (struct TESS Tess, int);

/// \brief Get the body level of a polyhedron
///
///
///
extern int neut_tess_cell_body (struct TESS Tess, int);

/// \brief Get the true level of a poly
///
///
///
extern int neut_tess_poly_true (struct TESS Tess, int);

/// \brief Get the body level of a poly
///
///
///
extern int neut_tess_poly_body (struct TESS Tess, int);

/// \brief Get the true level of a face
///
///
///
extern int neut_tess_face_true (struct TESS Tess, int);

/// \brief Get the body level of a face
///
///
///
extern int neut_tess_face_body (struct TESS Tess, int);

/// \brief Get the true level of a edge
///
///
///
extern int neut_tess_edge_true (struct TESS Tess, int);

/// \brief Get the body level of a edge
///
///
///
extern int neut_tess_edge_body (struct TESS Tess, int);

/// \brief Get the true level of a ver
///
///
///
extern int neut_tess_ver_true (struct TESS Tess, int);

/// \brief Get the body level of a ver
///
///
///
extern int neut_tess_ver_body (struct TESS Tess, int);

/// \brief Determine if a polyhedron is standard
///
///
///
extern int neut_tess_poly_std (struct TESS Tess, int);

/// \brief Determine if a polyhedron has been regularized
///
///
///
extern int neut_tess_poly_reg (struct TESS Tess, int);

/// \brief Get a mesh from a poly of a TESS
///
///
///
extern int
neut_tess_poly_mesh (struct TESS Tess, int nb,
		     struct NODES *pNodes, struct MESH *pMesh);

extern int neut_tess_face_interpolmesh (struct TESS Tess, int, struct NODES *,
					struct MESH *);

extern int neut_tess_domface_label_id (struct TESS Tess, char *label,
				       int *pid);

extern void neut_tess_cell_vers (struct TESS Tess, int cell, int **pvers,
				 int *pverqty);

extern int neut_tess_entity_true (struct TESS, char*, int);
extern int neut_tess_entity_body (struct TESS, char*, int);

#endif /* NEUT_TESS_TOPO_H */
