1 /* Copyright 2004,2007,2010 ENSEIRB, INRIA & CNRS
2 **
3 ** This file is part of the Scotch software package for static mapping,
4 ** graph partitioning and sparse matrix ordering.
5 **
6 ** This software is governed by the CeCILL-C license under French law
7 ** and abiding by the rules of distribution of free software. You can
8 ** use, modify and/or redistribute the software under the terms of the
9 ** CeCILL-C license as circulated by CEA, CNRS and INRIA at the following
10 ** URL: "http://www.cecill.info".
11 **
12 ** As a counterpart to the access to the source code and rights to copy,
13 ** modify and redistribute granted by the license, users are provided
14 ** only with a limited warranty and the software's author, the holder of
15 ** the economic rights, and the successive licensors have only limited
16 ** liability.
17 **
18 ** In this respect, the user's attention is drawn to the risks associated
19 ** with loading, using, modifying and/or developing or reproducing the
20 ** software by the user in light of its specific status of free software,
21 ** that may mean that it is complicated to manipulate, and that also
22 ** therefore means that it is reserved for developers and experienced
23 ** professionals having in-depth computer knowledge. Users are therefore
24 ** encouraged to load and test the software's suitability as regards
25 ** their requirements in conditions enabling the security of their
26 ** systems and/or data to be ensured and, more generally, to use and
27 ** operate it in the same conditions as regards security.
28 **
29 ** The fact that you are presently reading this means that you have had
30 ** knowledge of the CeCILL-C license and that you accept its terms.
31 */
32 /************************************************************/
33 /**                                                        **/
34 /**   NAME       : mesh.h                                  **/
35 /**                                                        **/
36 /**   AUTHOR     : Francois PELLEGRINI                     **/
37 /**                                                        **/
38 /**   FUNCTION   : These lines are the data declarations   **/
39 /**                for the source mesh functions.          **/
40 /**                                                        **/
41 /**   DATES      : # Version 4.0  : from : 29 dec 2001     **/
42 /**                                 to     11 may 2004     **/
43 /**                # Version 5.1  : from : 04 nov 2010     **/
44 /**                                 to     04 nov 2010     **/
45 /**                                                        **/
46 /************************************************************/
47 
48 /*
49 **  The defines.
50 */
51 
52 /*+ Mesh option flags. +*/
53 
54 #define MESHNONE                    0x0000        /* No options set */
55 
56 #define MESHFREEEDGE                0x0001        /* Free edgetab array        */
57 #define MESHFREEVERT                0x0002        /* Free verttab array        */
58 #define MESHFREEVEND                0x0004        /* Free verttab array        */
59 #define MESHFREEVNUM                0x0008        /* Free vnumtab array        */
60 #define MESHFREEOTHR                0x0010        /* Free all other arrays     */
61 #define MESHFREETABS                0x001F        /* Free all mesh arrays      */
62 #define MESHVERTGROUP               0x0010        /* All vertex arrays grouped */
63 
64 /*+ The Mesh flag type. +*/
65 
66 typedef int MeshFlag;                             /*+ Mesh property flags +*/
67 
68 /*+ Mesh structure. It is basically a graph
69     structure. It is a bipartite graph in the
70     sense that node vertices are adjacent
71     to element vertices only, and that element
72     vertices are adjacent to node vertices only.
73     Node vertices can all be put before or after
74     element vertices, but node and element
75     vertices cannot be mixed. In most algorithms,
76     elements are put at the beginning because
77     critical algorithms, such as the mesh
78     induction and mesh coarsening routines,
79     start by scanning element edges, such that
80     elements can then be built on the fly before
81     nodes are processed. Furthermore, as halo
82     meshes comprise halo nodes but not halo
83     elements, all halo nodes will be put at the
84     end of the node array, making un-haloing much
85     easier and inexpensive.
86     Vertex global indices are also different,
87     as vnumtab is only valid for (non-halo)
88     node vertices. The base of the vnumtax array
89     is thus vnodbas, and not s.baseval . Moreover,
90     the contents of vnumtab is based with respect
91     to baseval, and not to vnodbas, so that
92     building the inverse permutation does not
93     require to know vnodbas to trim node indices.
94     When vertex loads are available, node loads
95     represent the number of degrees of freedom
96     per node, and element loads should be set as
97     the sum of the vertex loads of all of their
98     adjacent nodes (used by routines such as
99     vmeshSeparateGg).                              +*/
100 
101 typedef struct Mesh_ {
102   MeshFlag                  flagval;              /*+ Graph properties                         +*/
103   Gnum                      baseval;              /*+ Base index for edge/vertex arrays        +*/
104   Gnum                      velmnbr;              /*+ Number of element vertices               +*/
105   Gnum                      velmbas;              /*+ Based number of first element            +*/
106   Gnum                      velmnnd;              /*+ Based number of first non-element vertex +*/
107   Gnum                      veisnbr;              /*+ Number of isolated element vertices      +*/
108   Gnum                      vnodnbr;              /*+ Number of node vertices in mesh          +*/
109   Gnum                      vnodbas;              /*+ Based number of first node               +*/
110   Gnum                      vnodnnd;              /*+ Based number of first non-node vertex    +*/
111   Gnum *                    verttax;              /*+ Vertex array [based]                     +*/
112   Gnum *                    vendtax;              /*+ End vertex array [based]                 +*/
113   Gnum *                    velotax;              /*+ Element vertex load array (if present)   +*/
114   Gnum *                    vnlotax;              /*+ Node vertex load array (if present)      +*/
115   Gnum                      velosum;              /*+ Sum of element vertex weights            +*/
116   Gnum                      vnlosum;              /*+ Sum of node vertex weights               +*/
117   Gnum *                    vnumtax;              /*+ Vertex number in ancestor graph          +*/
118   Gnum *                    vlbltax;              /*+ Vertex label (from file)                 +*/
119   Gnum                      edgenbr;              /*+ Number of edges (arcs) in graph          +*/
120   Gnum *                    edgetax;              /*+ Edge array [based]                       +*/
121   Gnum                      degrmax;              /*+ Maximum degree                           +*/
122 } Mesh;
123 
124 /*
125 **  The function prototypes.
126 */
127 
128 #ifndef MESH
129 #define static
130 #endif
131 
132 int                         meshInit            (Mesh * const);
133 void                        meshExit            (Mesh * const);
134 void                        meshFree            (Mesh * const);
135 int                         meshLoad            (Mesh * restrict const, FILE * restrict const, const Gnum);
136 int                         meshSave            (const Mesh * restrict const, FILE * restrict const);
137 Gnum                        meshBase            (Mesh * const, const Gnum);
138 int                         meshGraph           (const Mesh * restrict const, Graph * restrict const);
139 int                         meshInduceList      (const Mesh *, Mesh *, const VertList *);
140 int                         meshInducePart      (const Mesh *, Mesh *, const Gnum, const GraphPart *, const GraphPart);
141 int                         meshInduceSepa      (const Mesh * restrict const, const GraphPart * restrict const, const Gnum, const Gnum * restrict const, Mesh * restrict const);
142 int                         meshCheck           (const Mesh * const);
143 int                         meshReorder         (const Mesh * restrict const, Mesh * restrict const);
144 
145 #ifdef GEOM_H
146 int                         meshGeomLoadHabo    (Mesh * restrict const, Geom * restrict const, FILE * const, FILE * const, const char * const);
147 int                         meshGeomLoadScot    (Mesh * restrict const, Geom * restrict const, FILE * const, FILE * const, const char * const);
148 int                         meshGeomSaveScot    (const Mesh * restrict const, const Geom * restrict const, FILE * const, FILE * const, const char * const);
149 #endif /* GEOM_H */
150 
151 #undef static
152