Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / applications / utilities / postProcessing / graphics / ensightFoamReader / README_USERD_IN_BUFFERS
blob8b80e6a645dbc3ec0d14e7c2bcf5da86881f0827
1 README_USERD_IN_BUFFERS
2 ========================
3 Five optional routines for normal elements,
5   USERD_get_part_coords_in_buffers               |
6   USERD_get_part_node_ids_in_buffers             |
7   USERD_get_part_elements_by_type_in_buffers     |If any of these are implemented,
8   USERD_get_part_element_ids_by_type_in_buffers  |all 5 of them must be implemented
9   USERD_get_var_by_component_in_buffers          |
13 one optional routine for nsided elements,
15   USERD_get_nsided_conn_in_buffers
19 and one optional routine for nfaced elements,
21   USERD_get_nfaced_conn_in_buffers
24 can be added into any API 2.* reader to be used by the 
25 Unstructured Auto Distribute capability in EnSight 8.2 and later.
27 Unstructured Auto Distribute is a capability requiring Server of Servers (SOS)
28 that will partition an unstructured model for you automatically across a set of
29 servers.
31 If you do not implement the routines listed above (and described below) in your
32 reader, EnSight can still perform this operation but will require much more memory on
33 each server to read in the data (somewhat like each server having to read the
34 whole model). You will however, get the execution advantage of having your model
35 partitioned across multiple servers.
37 If you do implement these routines in your reader (in a proper manner), you
38 should be able to not only get the execution advantages, but also memory usage
39 on each server which is proportional to the subset that it is assigned to deal with. 
42 Note that the optional routines are functionally quite similar
43 to the following functions. And thus their implementation should
44 not be too difficult to add to any existing reader that has already
45 implemented these:
46 ------------------------------------------
47 USERD_get_part_coords
48 USERD_get_part_node_ids
49 USERD_get_part_elements_by_type
50 USERD_get_part_element_ids_by_type
51 USERD_get_var_by_component
53 USERD_get_nsided_conn
55 USERD_get_nfaced_conn
59 Routine Details:
60 ================
62 /*--------------------------------------------------------------------
63  * USERD_get_part_coords_in_buffers -
64  *--------------------------------------------------------------------
65  *
66  *   Get the coordinates for an unstructured part in buffers.
67  *
68  *  (IN)  part_number             = The part number
69  *
70  *                                  (1-based index of part table, namely:
71  *
72  *                                     1 ... Numparts_available.
73  *
74  *                                   It is NOT the part_id that
75  *                                   is loaded in USERD_get_gold_part_build_info)
76  *
77  *  (IN)  first                   = TRUE if first invocation of a buffered set.
78  *                                  Will be FALSE for all subsequent invocations
79  *                                  of the set.  This is so you can open files, get to
80  *                                  the correct starting spot, initialize, etc.
81  *
82  *  (IN) n_beg                    = Zero based, first node index
83  *                                  of the buffered set
84  *
85  *  (IN) n_end                    = Zero based, last node index
86  *                                  of the buffered set
87  *                                      
88  *                     Thus, for first five nodes:
89  *                       n_beg = 0
90  *                       n_end = 4
91  *                       total_number = (n_end - n_beg) + 1 = (4 - 0) + 1 = 5
92  *
93  *                     for second five nodes, would be:      
94  *                       n_beg = 5
95  *                       n_end = 9
96  *                       total_number = (n_end - n_beg) + 1 = (9 - 5) + 1 = 5
97  *
98  *                     for all nodes of a part, would be:
99  *                       n_beg = 0
100  *                       n_end = num_nodes - 1
102  *  (IN)  buffer_size             = The size of the buffer.
103  *                                  Namely:   coord_array[3][buffer_size]
105  *  (OUT) coord_array             = 2D float buffer array which is set up to hold
106  *                                  x,y,z coordinates of nodes.
108  *       (IMPORTANT: the second dimension of of this array is 0-based!!!)
110  *       (IMPORTANT: in the sister routine (USERD_get_part_coords) - which
111  *                   does not use buffers. This array is 1-based.  So pay attention.)
113  *                                  (Array will have been allocated
114  *                                   3 by buffer_size long
116  * Example, if we had a part with 645 nodes and the buffer size was set to 200
118  *          first invocation:
119  *            first = TRUE            Will be TRUE the first time! 
120  *            n_beg = 0
121  *            n_end = 644
122  *            buffer_size = 200
123  *            coord_array[3][200]     fill with values for nodes 1 - 200   (zero-based)
124  *            *num_returned = 200     set this
125  *            return(0)               return this (indicates more to do)
127  *          second invocation:        which occurs because we returned a 0 last time
128  *            first = FALSE           will now be FALSE
129  *            n_beg = 0
130  *            n_end = 644
131  *            buffer_size = 200
132  *            coord_array[3][200]     fill with values for nodes 201 - 400 (zero-based)
133  *            *num_returned = 200     set this
134  *            return(0)               return this (indicates more to do)
136  *          third invocation:         which occurs because we returned a 0 last time
137  *            first = FALSE           will still be FALSE
138  *            n_beg = 0
139  *            n_end = 644
140  *            buffer_size = 200
141  *            coord_array[3][200]     fill with values for nodes 401 - 600 (zero-based)
142  *            *num_returned = 200     set this
143  *            return(0)               return this (indicates more to do)
145  *          fourth invocation:        which occurs because we returned a 0 last time
146  *            first = FALSE           will still be FALSE
147  *            n_beg = 0
148  *            n_end = 644
149  *            buffer_size = 200
150  *            coord_array[3][200]     fill with values for nodes 601 - 645 (zero-based)
151  *            *num_returned = 45      set this
152  *            return(1)               return this (indicates done!)
154  *  (OUT)  *num_returned          = The number of nodes whose coordinates are returned
155  *                                  in the buffer. This will normally be equal to
156  *                                  buffer_size except for that last buffer -
157  *                                  which could be less than a full buffer. 
159  * returns  0  if got some, more to do
160  *          1  if got some, done
161  *         -1  if an error
163  *  Notes:
164  *  * This will be based on Current_time_step
166  *  * Not called unless number_of_nodes for the part > 0
168  *  * Again, make sure each buffer is zero based. For our example above:
170  *                                                 Invocation:
171  *                                     1          2          3           4
172  *                                  -------    -------    --------    -------
173  *      coord_array[0][0]    x  for node 1     node 201   node 401    node 601   
174  *      coord_array[1][0]    y  for    "          "          "           " 
175  *      coord_array[2][0]    z  for    "          "          "           " 
177  *      coord_array[0][1]    x  for node 2     node 202   node 402    node 602
178  *      coord_array[1][1]    y  for    "          "          "           "
179  *      coord_array[2][1]    z  for    "          "          "           "
180  * 
181  *      ...
183  *      coord_array[0][199]  x  for node 200   node 400   node 600    node 645
184  *      coord_array[1][199]  y  for    "          "          "           "
185  *      coord_array[2][199]  z  for    "          "          "           "
186  *--------------------------------------------------------------------*/
188 USERD_get_part_coords_in_buffers(int part_number,
189                                  float **coord_array,
190                                  int first,
191                                  int n_beg,
192                                  int n_end,
193                                  int buffer_size,
194                                  int *num_returned)
200 /*--------------------------------------------------------------------
201  * USERD_get_part_node_ids_in_buffers -
202  *--------------------------------------------------------------------
204  *   Get the node ids for an unstructured part in buffers.
206  *  (IN)  part_number             = The part number
208  *                                  (1-based index of part table, namely:
210  *                                     1 ... Numparts_available.
212  *                                   It is NOT the part_id that
213  *                                   is loaded in USERD_get_gold_part_build_info)
215  *  (IN)  first                   = TRUE if first invocation of a buffered set.
216  *                                  Will be FALSE for all subsequent invocations
217  *                                  of the set.  This is so you can open files, get to
218  *                                  the correct starting spot, initialize, etc.
220  *  (IN) n_beg                    = Zero based, first node index
221  *                                  of the buffered set
223  *  (IN) n_end                    = Zero based, last node index
224  *                                  of the buffered set
225  *                                      
226  *                     Thus, for first five nodes:
227  *                       n_beg = 0
228  *                       n_end = 4
229  *                       total_number = (n_end - n_beg) + 1 = (4 - 0) + 1 = 5
231  *                     for second five nodes, would be:      
232  *                       n_beg = 5
233  *                       n_end = 9
234  *                       total_number = (n_end - n_beg) + 1 = (9 - 5) + 1 = 5
236  *                     for all nodes of a part, would be:
237  *                       n_beg = 0
238  *                       n_end = num_nodes - 1
240  *  (IN)  buffer_size             = The size of the buffer.
241  *                                  Namely:   nodeid_array[buffer_size]
243  *  (OUT) nodeid_array            = 1D buffer array which is set up to hold
244  *                                  node ids of nodes
246  *       (IMPORTANT: this array is 0-based!!!)
248  *       (IMPORTANT: in the sister routine (USERD_get_part_node_ids) - which
249  *                   does not use buffers. This array is 1-based.  So pay attention.)
251  *                                  (Array will have been allocated
252  *                                   buffer_size long)
254  * Example, if we had a part with 645 nodes and the buffer size was set to 200
256  *          first invocation:
257  *            first = TRUE            Will be TRUE the first time! 
258  *            n_beg = 0
259  *            n_end = 644
260  *            buffer_size = 200
261  *            nodeid_array[200]       fill with values for nodes 1 - 200   (zero-based)
262  *            *num_returned = 200     set this
263  *            return(0)               return this (indicates more to do)
265  *          second invocation:        which occurs because we returned a 0 last time
266  *            first = FALSE           will now be FALSE
267  *            n_beg = 0
268  *            n_end = 644
269  *            buffer_size = 200
270  *            nodeid_array[200]       fill with values for nodes 201 - 400 (zero-based)
271  *            *num_returned = 200     set this
272  *            return(0)               return this (indicates more to do)
274  *          third invocation:         which occurs because we returned a 0 last time
275  *            first = FALSE           will still be FALSE
276  *            n_beg = 0
277  *            n_end = 644
278  *            buffer_size = 200
279  *            nodeid_array[200]       fill with values for nodes 401 - 600 (zero-based)
280  *            *num_returned = 200     set this
281  *            return(0)               return this (indicates more to do)
283  *          fourth invocation:        which occurs because we returned a 0 last time
284  *            first = FALSE           will still be FALSE
285  *            n_beg = 0
286  *            n_end = 644
287  *            buffer_size = 200
288  *            nodeid_array[200]       fill with values for nodes 601 - 645 (zero-based)
289  *            *num_returned = 45      set this
290  *            return(1)               return this (indicates done!)
293  *  (OUT)  *num_returned          = The number of nodes whose ids are returned
294  *                                  in the buffer. This will normally be equal
295  *                                  to buffer_size except for that last buffer
296  *                                  - which could be less than a full buffer. 
298  * returns  0  if got some, more to do
299  *          1  if got some, done
300  *         -1  if an error
302  *  Notes:
303  *  * This will be based on Current_time_step
305  *  * Not called unless number_of_nodes for the part > 0
307  *  * Again, make sure each buffer is zero based. For our example above:
309  *                                                 Invocation:
310  *                                     1          2          3           4
311  *                                  -------    -------    --------    -------
312  *      nodeid_array[0]    id   for node 1     node 201   node 401    node 601   
314  *      nodeid_array[1]    id   for node 2     node 202   node 402    node 602
316  *      ...
318  *      nodeid_array[199]  id   for node 200   node 400   node 600    node 645
319  *--------------------------------------------------------------------*/
321 USERD_get_part_node_ids_in_buffers(int part_number,
322                                    int *nodeid_array,
323                                    int first,
324                                    int n_beg,
325                                    int n_end,
326                                    int buffer_size,
327                                    int *num_returned)
332 /*--------------------------------------------------------------------
333  * USERD_get_part_elements_by_type_in_buffers -
334  *--------------------------------------------------------------------
336  *   Gets the connectivities for the elements of a particular type
337  *   in an unstructured part in buffers
339  *  (IN)  part_number             = The part number
341  *                                  (1-based index of part table, namely:
343  *                                     1 ... Numparts_available.
345  *                                   It is NOT the part_id that
346  *                                   is loaded in USERD_get_gold_part_build_info)
348  *  (IN)  element_type            = One of the following (See global_extern.h)
349  *                                  Z_POINT    node point element
350  *                                  Z_BAR02    2 node bar
351  *                                  Z_BAR03    3 node bar
352  *                                  Z_TRI03    3 node triangle
353  *                                  Z_TRI06    6 node triangle
354  *                                  Z_QUA04    4 node quad
355  *                                  Z_QUA08    8 node quad
356  *                                  Z_TET04    4 node tetrahedron
357  *                                  Z_TET10   10 node tetrahedron
358  *                                  Z_PYR05    5 node pyramid
359  *                                  Z_PYR13   13 node pyramid
360  *                                  Z_PEN06    6 node pentahedron
361  *                                  Z_PEN15   15 node pentahedron
362  *                                  Z_HEX08    8 node hexahedron
363  *                                  Z_HEX20   20 node hexahedron
365  *   Starting at API 2.01:
366  *   ====================
367  *                                  Z_G_POINT    ghost node point element
368  *                                  Z_G_BAR02    2 node ghost bar
369  *                                  Z_G_BAR03    3 node ghost bar
370  *                                  Z_G_TRI03    3 node ghost triangle
371  *                                  Z_G_TRI06    6 node ghost triangle
372  *                                  Z_G_QUA04    4 node ghost quad
373  *                                  Z_G_QUA08    8 node ghost quad
374  *                                  Z_G_TET04    4 node ghost tetrahedron
375  *                                  Z_G_TET10   10 node ghost tetrahedron
376  *                                  Z_G_PYR05    5 node ghost pyramid
377  *                                  Z_G_PYR13   13 node ghost pyramid
378  *                                  Z_G_PEN06    6 node ghost pentahedron
379  *                                  Z_G_PEN15   15 node ghost pentahedron
380  *                                  Z_G_HEX08    8 node ghost hexahedron
381  *                                  Z_G_HEX20   20 node ghost hexahedron
382  *                                  Z_NSIDED     n node ghost nsided polygon
383  *                                  Z_NFACED     n face ghost nfaced polyhedron
385  *   Starting at API 2.02:
386  *   ====================
387  *                                  Z_NSIDED     n node nsided polygon
388  *                                  Z_NFACED     n face nfaced polyhedron
389  *                                  Z_G_NSIDED   n node ghost nsided polygon
390  *                                  Z_G_NFACED   n face ghost nfaced polyhedron
392  *  (IN)  first                   = TRUE if first invocation of a buffered set.
393  *                                  Will be FALSE for all subsequent invocations
394  *                                  of the set.  This is so you can open files, get to
395  *                                  the correct starting spot, initialize, etc.
397  *  (IN) e_beg                    = Zero based, first element number
398  *                                  of the buffered set
400  *  (IN) e_end                    = Zero based, last element number
401  *                                  of the buffered set
403  *                     Thus, for first five elements of a type:
404  *                       e_beg = 0
405  *                       e_end = 4
406  *                       total_number = (e_end - e_beg) + 1 = (4 - 0) + 1 = 5
408  *                     for second five elements of a type, would be:
409  *                       e_beg = 5
410  *                       e_end = 9
411  *                       total_number = (e_end - e_beg) + 1 = (9 - 5) + 1 = 5
413  *                     for all elements of the type of a part, would be:
414  *                       n_beg = 0
415  *                       n_end = num_elements_of_type - 1
417  *  (IN) buffer_size              = The size of the buffer.
418  *                                  Namely:  conn_array[buffer_size][element_size]
420  *  (OUT) conn_array              = 2D buffer array which is set up to hold
421  *                                  connectivity of elements of the type.
423  *                                  (Array will have been allocated
424  *                                   buffer_size of
425  *                                   the type by connectivity length
426  *                                   of the type)
428  *                       ex) The allocated dimensions available
429  *                           for this routine will be:
430  *                              conn_array[buffer_size][3]   when called with Z_TRI03
432  *                              conn_array[buffer_size][4]   when called with Z_QUA04
434  *                              conn_array[buffer_size][8]   when called with Z_HEX08
436  *                              etc.
438  *   * Example, (if 158 quad elements, and buffer size is 200)
440  *       (get all 158 quad4s in one invocation)
441  *          element_type = Z_QUA04
442  *          first = TRUE               Will be TRUE the first time!
443  *          e_beg  = 0                 (zero based, first element index)
444  *          e_end  = 157               (zero based, last element index)
445  *          buffer_size = 200
446  *          conn_array[200][4]         Use first 158 locations of the array
447  *          *num_returned = 158        set this
448  *          return(1)                  return this (indicates no more to do)
450  *   * Example, (if 158 quad elements, and buffer size is 75)
452  *        first invocation:
453  *          element_type = Z_QUA04
454  *          first = TRUE               Will be TRUE the first time!
455  *          e_beg  = 0
456  *          e_end  = 157
457  *          buffer_size = 75
458  *          conn_array[75][4]          load in conn for elements 1 - 75
459  *          *num_returned = 75         set this
460  *          return(0)                  return this (indicates more to do)
462  *        second invocation:
463  *          element_type = Z_QUA04
464  *          first = TRUE               Will be TRUE the first time!
465  *          e_beg  = 0
466  *          e_end  = 157
467  *          buffer_size = 75
468  *          conn_array[75][4]          load in conn for elements 76 - 150
469  *          *num_returned = 75         set this
470  *          return(0)                  return this (indicates more to do)
472  *        third invocation:
473  *          element_type = Z_QUA04
474  *          first = TRUE               Will be TRUE the first time!
475  *          e_beg  = 0
476  *          e_end  = 157
477  *          buffer_size = 75
478  *          conn_array[75][4]          load in conn for elements 151 - 158
479  *          *num_returned = 8          set this
480  *          return(1)                  return this (indicates no more to do)
483  *  (OUT)  *num_returned          = The number of elements whose connectivities
484  *                                  are returned in the buffer. This will
485  *                                  normally be equal to buffer_size except for
486  *                                  that last buffer - which could be less than
487  *                                  a full buffer.
489  * returns  0  if got some, more to do
490  *          1  if got some, done
491  *         -1  if an error
493  *  Notes:
494  *  * This will be based on Current_time_step
496  *  * Again, make sure each buffer is zero based. For our example using buffers above:
498  *                                                        Invocation:
499  *                                                  1          2          3    
500  *                                               -------    -------    --------
501  *      conn_array[0][0]       node 1 in conn for quad 1    quad 76     quad 151
502  *      conn_array[0][1]       node 2 in conn for quad 1    quad 76     quad 151
503  *      conn_array[0][2]       node 3 in conn for quad 1    quad 76     quad 151
504  *      conn_array[0][3]       node 4 in conn for quad 1    quad 76     quad 151
506  *      conn_array[1][0]       node 1 in conn for quad 2    quad 77     quad 152
507  *      conn_array[1][1]       node 2 in conn for quad 2    quad 77     quad 152
508  *      conn_array[1][2]       node 3 in conn for quad 2    quad 77     quad 152
509  *      conn_array[1][3]       node 4 in conn for quad 2    quad 77     quad 152
511  *      ...
513  *      conn_array[74][0]      node 1 in conn for quad 75    quad 150   quad 158
514  *      conn_array[74][1]      node 2 in conn for quad 75    quad 150   quad 158
515  *      conn_array[74][2]      node 3 in conn for quad 75    quad 150   quad 158
516  *      conn_array[74][3]      node 4 in conn for quad 75    quad 150   quad 158
517  *--------------------------------------------------------------------*/
519 USERD_get_part_elements_by_type_in_buffers(int part_number,
520                                            int element_type,
521                                            int **conn_array,
522                                            int first,
523                                            int e_beg,
524                                            int e_end,
525                                            int buffer_size,
526                                            int *num_returned)
532 /*--------------------------------------------------------------------
533  * USERD_get_part_element_ids_by_type_in_buffers -
534  *--------------------------------------------------------------------
536  *   Gets the ids for the elements of a particular type
537  *   in an unstructured part in buffers
539  *  (IN)  part_number             = The part number
541  *                                  (1-based index of part table, namely:
543  *                                     1 ... Numparts_available.
545  *                                   It is NOT the part_id that
546  *                                   is loaded in USERD_get_gold_part_build_info)
548  *  (IN)  element_type            = One of the following (See global_extern.h)
549  *                                  Z_POINT    node point element
550  *                                  Z_BAR02    2 node bar
551  *                                  Z_BAR03    3 node bar
552  *                                  Z_TRI03    3 node triangle
553  *                                  Z_TRI06    6 node triangle
554  *                                  Z_QUA04    4 node quad
555  *                                  Z_QUA08    8 node quad
556  *                                  Z_TET04    4 node tetrahedron
557  *                                  Z_TET10   10 node tetrahedron
558  *                                  Z_PYR05    5 node pyramid
559  *                                  Z_PYR13   13 node pyramid
560  *                                  Z_PEN06    6 node pentahedron
561  *                                  Z_PEN15   15 node pentahedron
562  *                                  Z_HEX08    8 node hexahedron
563  *                                  Z_HEX20   20 node hexahedron
565  *   Starting at API 2.01:
566  *   ====================
567  *                                  Z_G_POINT    ghost node point element
568  *                                  Z_G_BAR02    2 node ghost bar
569  *                                  Z_G_BAR03    3 node ghost bar
570  *                                  Z_G_TRI03    3 node ghost triangle
571  *                                  Z_G_TRI06    6 node ghost triangle
572  *                                  Z_G_QUA04    4 node ghost quad
573  *                                  Z_G_QUA08    8 node ghost quad
574  *                                  Z_G_TET04    4 node ghost tetrahedron
575  *                                  Z_G_TET10   10 node ghost tetrahedron
576  *                                  Z_G_PYR05    5 node ghost pyramid
577  *                                  Z_G_PYR13   13 node ghost pyramid
578  *                                  Z_G_PEN06    6 node ghost pentahedron
579  *                                  Z_G_PEN15   15 node ghost pentahedron
580  *                                  Z_G_HEX08    8 node ghost hexahedron
581  *                                  Z_G_HEX20   20 node ghost hexahedron
582  *                                  Z_NSIDED     n node ghost nsided polygon
583  *                                  Z_NFACED     n face ghost nfaced polyhedron
585  *   Starting at API 2.02:
586  *   ====================
587  *                                  Z_NSIDED     n node nsided polygon
588  *                                  Z_NFACED     n face nfaced polyhedron
589  *                                  Z_G_NSIDED   n node ghost nsided polygon
590  *                                  Z_G_NFACED   n face ghost nfaced polyhedron
592  *  (IN)  first                   = TRUE if first invocation of a buffered set.
593  *                                  Will be FALSE for all subsequent invocations
594  *                                  of the set.  This is so you can open files, get to
595  *                                  the correct starting spot, initialize, etc.
597  *  (IN) e_beg                    = Zero based, first element number
598  *                                  of the buffered set
600  *  (IN) e_end                    = Zero based, last element number
601  *                                  of the buffered set
603  *                     Thus, for first five elements of a type:
604  *                       e_beg = 0
605  *                       e_end = 4
606  *                       total_number = (e_end - e_beg) + 1 = (4 - 0) + 1 = 5
608  *                     for second five elements of a type, would be:
609  *                       e_beg = 5
610  *                       e_end = 9
611  *                       total_number = (e_end - e_beg) + 1 = (9 - 5) + 1 = 5
613  *                     for all elements of the type of a part, would be:
614  *                       n_beg = 0
615  *                       n_end = num_elements_of_type - 1
617  *  (IN) buffer_size              = The size of the buffer.
618  *                                  Namely:  elemid_array[buffer_size]
620  *  (OUT) elemid_array            = 1D buffer array which is set up to hold ids
621  *                                  of elements of the type.
623  *                                  (Array will have been allocated
624  *                                   buffer_size long)
626  *   * Example, (if 158 quad elements, and buffer size is 200)
628  *       (get all 158 quad4 ids in one invocation)
629  *          element_type = Z_QUA04
630  *          first = TRUE               Will be TRUE the first time!
631  *          e_beg  = 0                 (zero based, first element index)
632  *          e_end  = 157               (zero based, last element index)
633  *          buffer_size = 200
634  *          elemeid_array[200]         Use first 158 locations of the array
635  *          *num_returned = 158        set this
636  *          return(1)                  return this (indicates no more to do)
638  *   * Example, (if 158 quad elements, and buffer size is 75)
640  *        first invocation:
641  *          element_type = Z_QUA04
642  *          first = TRUE               Will be TRUE the first time!
643  *          e_beg  = 0
644  *          e_end  = 157
645  *          buffer_size = 75
646  *          elemid_array[75]           load in ids for elements 1 - 75
647  *          *num_returned = 75         set this
648  *          return(0)                  return this (indicates more to do)
650  *        second invocation:
651  *          element_type = Z_QUA04
652  *          first = TRUE               Will be TRUE the first time!
653  *          e_beg  = 0
654  *          e_end  = 157
655  *          buffer_size = 75
656  *          elemid_array[75]           load in ids for elements 76 - 150
657  *          *num_returned = 75         set this
658  *          return(0)                  return this (indicates more to do)
660  *        third invocation:
661  *          element_type = Z_QUA04
662  *          first = TRUE               Will be TRUE the first time!
663  *          e_beg  = 0
664  *          e_end  = 157
665  *          buffer_size = 75
666  *          elemid_array[75]           load in ids for elements 151 - 158
667  *          *num_returned = 8          set this
668  *          return(1)                  return this (indicates no more to do)
671  *  (OUT)  *num_returned          = The number of elements whose ids are returned
672  *                                  in the buffer. This will normally be equal
673  *                                  to buffer_size except for that last buffer
674  *                                  - which could be less than a full buffer.
676  * returns  0  if got some, more to do
677  *          1  if got some, done
678  *         -1  if an error
680  *  Notes:
681  *  * This will be based on Current_time_step
683  *  * Again, make sure each buffer is zero based. For our example using buffers above:
685  *                                                  Invocation:
686  *                                           1          2          3    
687  *                                        -------    -------    --------
688  *      elemid_array[0]       elem id  for quad 1    quad 76     quad 151
690  *      elemid_array[1]       elem id  for quad 2    quad 77     quad 152
692  *      ...
694  *      elemid_array[74]      elem id  for quad 75   quad 150    quad 158
695  *--------------------------------------------------------------------*/
697 USERD_get_part_element_ids_by_type_in_buffers(int part_number,
698                                               int element_type,
699                                               int *elemid_array,
700                                               int first,
701                                               int e_beg,
702                                               int e_end,
703                                               int buffer_size,
704                                               int *num_returned)
711 /*--------------------------------------------------------------------
712  * USERD_get_var_by_component_in_buffers -  used by unstructured parts
713  *--------------------------------------------------------------------
715  *  if Z_PER_NODE:
716  *    Get the component value at each node for a given variable in the part
717  *    in buffers.
719  *  or if Z_PER_ELEM:
720  *    Get the component value at each element of a specific part and type for
721  *    a given variable in buffers.
723  *  (IN)  which_variable          = The variable number
725  *  (IN)  which_part                Since EnSight Version 7.4
726  *                                  -------------------------
727  *                                = The part number
729  *                                  (1-based index of part table, namely:
731  *                                     1 ... Numparts_available.
733  *                                   It is NOT the part_id that
734  *                                   is loaded in USERD_get_gold_part_build_info)
736  *                                  Prior to EnSight Version 7.4
737  *                                  ----------------------------
738  *                                = The part id   This is the part_id label loaded
739  *                                                in USERD_get_gold_part_build_inf\o.
740  *                                                It is NOT the part table index.
742  *  (IN)  var_type                = Z_SCALAR
743  *                                  Z_VECTOR
744  *                                  Z_TENSOR     ( symmetric tensor)
745  *                                  Z_TENSOR9    (asymmetric tensor)
747  *  (IN)  which_type
749  *           if Z_PER_NODE:         Not used
751  *           if Z_PER_ELEM:       = The element type
752  *                                  Z_POINT    node point element
753  *                                  Z_BAR02    2 node bar
754  *                                  Z_BAR03    3 node bar
755  *                                  Z_TRI03    3 node triangle
756  *                                  Z_TRI06    6 node triangle
757  *                                  Z_QUA04    4 node quad
758  *                                  Z_QUA08    8 node quad
759  *                                  Z_TET04    4 node tetrahedron
760  *                                  Z_TET10   10 node tetrahedron
761  *                                  Z_PYR05    5 node pyramid
762  *                                  Z_PYR13   13 node pyramid
763  *                                  Z_PEN06    6 node pentahedron
764  *                                  Z_PEN15   15 node pentahedron
765  *                                  Z_HEX08    8 node hexahedron
766  *                                  Z_HEX20   20 node hexahedron
768  *   Starting at API 2.01:
769  *   ====================
770  *                                  Z_G_POINT    ghost node point element
771  *                                  Z_G_BAR02    2 node ghost bar
772  *                                  Z_G_BAR03    3 node ghost bar
773  *                                  Z_G_TRI03    3 node ghost triangle
774  *                                  Z_G_TRI06    6 node ghost triangle
775  *                                  Z_G_QUA04    4 node ghost quad
776  *                                  Z_G_QUA08    8 node ghost quad
777  *                                  Z_G_TET04    4 node ghost tetrahedron
778  *                                  Z_G_TET10   10 node ghost tetrahedron
779  *                                  Z_G_PYR05    5 node ghost pyramid
780  *                                  Z_G_PYR13   13 node ghost pyramid
781  *                                  Z_G_PEN06    6 node ghost pentahedron
782  *                                  Z_G_PEN15   15 node ghost pentahedron
783  *                                  Z_G_HEX08    8 node ghost hexahedron
784  *                                  Z_G_HEX20   20 node ghost hexahedron
785  *   Starting at API 2.02:
786  *   ====================
787  *                                  Z_NSIDED     n node nsided polygon
788  *                                  Z_NFACED     n face nfaced polyhedron
789  *                                  Z_G_NSIDED   n node ghost nsided polygon
790  *                                  Z_G_NFACED   n face ghost nfaced polyhedron
794  *  (IN)  imag_data               = TRUE if imag component
795  *                                  FALSE if real component
797  *  (IN)  component               = The component: (0       if Z_SCALAR)
798  *                                                 (0 - 2   if Z_VECTOR)
799  *                                                 (0 - 5   if Z_TENSOR)
800  *                                                 (0 - 8   if Z_TENSOR9)
802  *                                * 6 Symmetric Indicies, 0:5    *
803  *                                * ---------------------------- *
804  *                                *     | 11 12 13 |   | 0 3 4 | *
805  *                                *     |          |   |       | *
806  *                                * T = |    22 23 | = |   1 5 | *
807  *                                *     |          |   |       | *
808  *                                *     |       33 |   |     2 | *
810  *                                * 9 General   Indicies, 0:8    *
811  *                                * ---------------------------- *
812  *                                *     | 11 12 13 |   | 0 1 2 | *
813  *                                *     |          |   |       | *
814  *                                * T = | 21 22 23 | = | 3 4 5 | *
815  *                                *     |          |   |       | *
816  *                                *     | 31 32 33 |   | 6 7 8 | *
818  *  (IN) ne_beg
819  *          if Z_PER_NODE:   = Zero based, first node index of the buffered set
820  *          if Z_PER_ELEM:   = Zero based, first element index of the buffered set
822  *  (IN) ne_end
823  *          if Z_PER_NODE:   = Zero based, last node index of the buffered set
824  *          if Z_PER_ELEM:   = Zero based, last element index of the buffered set
826  *                     Thus, for first five elements or nodes:
827  *                       e_beg = 0
828  *                       e_end = 4
829  *                       total_number = (e_end - e_beg) + 1 = (4 - 0) + 1 = 5
831  *                     for second five elements or nodes, would be:
832  *                       e_beg = 5
833  *                       e_end = 9
834  *                       total_number = (e_end - e_beg) + 1 = (9 - 5) + 1 = 5
836  *                     for all elements or nodes of a part, would be:
837  *                       n_beg = 0
838  *                       n_end = num_elements_or_nodes - 1
840  * (IN) first                    = TRUE if first invocation of a buffered set.
841  *                                  Will be FALSE for all subsequent invocations
842  *                                  of the set.  This is so you can open files, get to
843  *                                  the correct starting spot, initialize, etc.
845  * (IN) buffer_size              = The size of the buffer.
846  *                                  Namely:  var_array[buffer_size]
848  * (IN) leftside                 = TRUE if current time is at a timestep or
849  *                                      when getting the left side of a time
850  *                                      span that encloses the current time.
851  *                               = FALSE when getting the right side of a time
852  *                                       span that encloses the current time.
854  *  Timeline:
855  *   step1         step2          step3
856  *     |-------------|--------------|-------...  requires no interpolation
857  *                   ^                           get values at step2 (leftside = TRUE)
858  *                   current time                   (leftside = TRUE)
861  *  Timeline:
862  *   step1         step2          step3
863  *     |-------------|--------------|-------...  requires interpolation
864  *              ^                                get values at step2 (leftside = TRUE)
865  *              current time                 and get values at step3 (leftside = FALSE)
867  *    Note that it would generally be easier for this routine if EnSight got all
868  *         of the left side, then all of the right side, and then did its
869  *         interpolation. But, in the spirit of doing things in buffers (to save
870  *         memory) it gets a left side buffer (and the corresponding right side
871  *         buffer and interpolates these), if needed, before going to the next
872  *         buffer of the set.  Thus, you need to be able to handle that situation.
874  *    Note also that EnSight will have called the routine to change the current
875  *         time step between the two invocations when interpolation is required.
876  *         And Ensight does the interpolating.  This variable is provided so
877  *         that you can deal with two different files or pointers between the
878  *         corresponding invocations for the two times
880  * (OUT) var_array
882  *     -----------------------------------------------------------------------
883  *     (IMPORTANT: this array is 0-based for both Z_PER_NODE and Z_PER_ELEM!!!
884  *     -----------------------------------------------------------------------
886  *          if Z_PER_NODE:       = 1D buffer array set up to hold a variable
887  *                                 component value for nodes.
889  *          if Z_PER_ELEM:       = 1D buffer array set up to hold a variable
890  *                                 component value for elements.
892  *                                 (Array will have been allocated
893  *                                  buffer_size long)
895  *              Info stored in this fashion:
896  *                   var_array[0] = var component for node or element 1 of part
897  *                   var_array[1] = var component for node or element 2 of part
898  *                   var_array[2] = var component for node or element 3 of part
899  *                   etc.
901  *   * Example, (if 158 quad elements with a real Z_PER_ELEM scalar,
902  *               current time is between steps, and buffer size is 75)
904  *        first invocation:            (for left side of time span)
905  *          var_type = Z_SCALAR
906  *          which_type = Z_PER_ELEM
907  *          imag_data = FALSE
908  *          component = 0
909  *          ne_beg = 0
910  *          ne_end = 157
911  *          first = TRUE               Will be TRUE the first time!
912  *          buffer_size = 75
913  *          leftside = TRUE            <==
914  *          var_array[75]              load in scalar value for elements 1 - 75
915  *          *num_returned = 75         set this
916  *          return(0)                  return this (indicates more to do)
918  *        second invocation:           (for right side of time span)
919  *          var_type = Z_SCALAR
920  *          which_type = Z_PER_ELEM
921  *          imag_data = FALSE
922  *          component = 0
923  *          ne_beg = 0
924  *          ne_end = 157
925  *          first = TRUE               Note: Will still be TRUE (because is right side)
926  *          buffer_size = 75
927  *          leftside = FALSE           <==
928  *          var_array[75]              load in scalar value for elements 1 - 75
929  *          *num_returned = 75         set this
930  *          return(0)                  return this (indicates more to do)
932  * -------------------------------
933  *        third invocation:            (for left side of time span)
934  *          var_type = Z_SCALAR
935  *          which_type = Z_PER_ELEM
936  *          imag_data = FALSE
937  *          component = 0
938  *          ne_beg = 0
939  *          ne_end = 157
940  *          first = FALSE              Will be FALSE now
941  *          buffer_size = 75
942  *          leftside = TRUE            <==
943  *          var_array[75]              load in scalar value for elements 76 - 150
944  *          *num_returned = 75         set this
945  *          return(0)                  return this (indicates more to do)
947  *        fourth invocation:           (for right side of time span)
948  *          var_type = Z_SCALAR
949  *          which_type = Z_PER_ELEM
950  *          imag_data = FALSE
951  *          component = 0
952  *          ne_beg = 0
953  *          ne_end = 157
954  *          first = FALSE             
955  *          buffer_size = 75
956  *          leftside = FALSE           <==
957  *          var_array[75]              load in scalar value for elements 76 - 150
958  *          *num_returned = 75         set this
959  *          return(0)                  return this (indicates more to do)
961  *------------------------------------
962  *        fifth invocation:            (for left side of time span)
963  *          var_type = Z_SCALAR
964  *          which_type = Z_PER_ELEM
965  *          imag_data = FALSE
966  *          component = 0
967  *          ne_beg = 0
968  *          ne_end = 157
969  *          first = FALSE              Will still be FALSE
970  *          buffer_size = 75
971  *          leftside = TRUE            <==
972  *          var_array[75]              load in scalar value for elements 151 - 158
973  *          *num_returned = 8          set this
974  *          return(1)                  return this (indicates no more to do)
976  *        sixth invocation:           (for right side of time span)
977  *          var_type = Z_SCALAR
978  *          which_type = Z_PER_ELEM
979  *          imag_data = FALSE
980  *          component = 0
981  *          ne_beg = 0
982  *          ne_end = 157
983  *          first = FALSE            
984  *          buffer_size = 75
985  *          leftside = FALSE           <==
986  *          var_array[75]              load in scalar value for elements 151 - 158
987  *          *num_returned = 8          set this
988  *          return(1)                  return this (indicates no more to do)
991  *  (OUT)  *num_returned          = The number of nodes or elements whose variable
992  *                                  values are returned in the buffer. This will
993  *                                  normally be equal to buffer_size except for
994  *                                  that last buffer - which could be less than
995  *                                  a full buffer.
997  * returns  0  if got some, more to do
998  *          1  if got some, done
999  *         -1  if an error
1001  *  Notes:
1002  *  * This will be based on Current_time_step
1004  *  * Again, make sure each buffer is zero based. For our example using buffers above:
1006  *                                                  Invocation:
1007  *                         ----------------   ------------------   ------------------- 
1008  *                            1        2         3          4          5          6
1009  *                         -------  -------   --------  --------   ---------  ---------
1010  * var_array[0]  scalar of quad 1L  quad 1R   quad 76L  quad 76R   quad 151L  quad 151R
1012  * var_array[1]  scalar of quad 2L  quad 2R   quad 77L  quad 77R   quad 152L  quad 152R
1014  * ...
1016  * var_array[74] scalar of quad 75L quad 75R  quad 150L quad 150R  quad 158L  quad 158R
1018  *   Where:   L indicates left time step
1019  *            R indicates right time step
1020  *--------------------------------------------------------------------*/
1022 USERD_get_var_by_component_in_buffers(int which_variable,
1023                                       int which_part,
1024                                       int var_type,
1025                                       int which_type,
1026                                       int imag_data,
1027                                       int component,
1028                                       float *var_array,
1029                                       int first,
1030                                       int ne_beg,
1031                                       int ne_end,
1032                                       int buffer_size,
1033                                       int leftside,
1034                                       int *num_returned)
1039 /*--------------------------------------------------------------------
1040  * USERD_get_nsided_conn_in_buffers -
1041  *--------------------------------------------------------------------
1043  *   Gets the two arrays containing the connectivity information
1044  *   of nsided elements in buffers
1046  *  (IN)  part_number      = The part number
1048  *                           (1-based index of part table, namely:
1050  *                              1 ... Numparts_available.
1052  *                            It is NOT the part_id that
1053  *                            is loaded in USERD_get_gold_part_build_info)
1055  *  (IN)  first            = TRUE if first invocation of a buffered set.
1056  *                           Will be FALSE for all subsequent invocations
1057  *                           of the set.  This is so you can open files,
1058  *                           get to the correct starting spot,
1059  *                           initialize, etc.
1061  *  (IN) e_beg             = Zero based, first element number
1062  *                           of the buffered set
1064  *  (IN) e_end             = Zero based, last element number
1065  *                           of the buffered set
1067  *                     Thus, for first five elements of a type:
1068  *                       e_beg = 0
1069  *                       e_end = 4
1070  *                       total_number = (e_end - e_beg) + 1 = (4 - 0) + 1 = 5
1072  *                     for second five elements of a type, would be:
1073  *                       e_beg = 5
1074  *                       e_end = 9
1075  *                       total_number = (e_end - e_beg) + 1 = (9 - 5) + 1 = 5
1077  *                     for all elements of the type of a part, would be:
1078  *                       n_beg = 0
1079  *                       n_end = num_elements_of_type - 1
1081  *  (IN) buffer_size         = The size of the num_nodes_per_elem_array buffer.
1082  *                             Namely: num_nodes_per_elem_array[buffer_size]
1084  *  (OUT) num_nodes_per_elem_array = 1D buffer array of the number of nodes
1085  *                                   per nsided element.
1087  *  (OUT) nsided_conn_array  = 1D buffer array of nsided connectivies
1089  *                             (int array will have been allocated
1090  *                              long enough to hold all the nsided
1091  *                              connectivities in the buffered chunk)
1093  *  (OUT) *num_returned      = The number of elements whose connectivities
1094  *                             are returned in the buffer. This will
1095  *                             normally be equal to buffer_size except for
1096  *                             that last buffer - which could be less than
1097  *                             a full buffer.
1099  *   Providing nsided information to Ensight:
1101  *   NOTE: for other nsided operations you need these first two, but we
1102  *         don't actually use them in this routine.
1104  *   1. In USERD_get_gold_part_build_info, provide the number of nsided
1105  *      elements in the part.
1107  *   2. In USERD_get_part_elements_by_type, provide (in the conn_array),
1108  *      the number of nodes per nsided element. (as if connectivity
1109  *      length of an nsided element is one)
1111  *   We do use the following:
1112  *   3. In this routine, provide the corresponding num_nodes_per_element and
1113  *      streamed connectivities for each of the nsided elements in this
1114  *      buffered portion.
1117  *   Simple example:         5        6
1118  *                          +--------+
1119  *   3 nsided elements:    /|         \
1120  *   (1 4-sided           / |          \
1121  *    1 3-sided          /  |           \
1122  *    1 7-sided)        /   |            \ 7
1123  *                     /3   |4            +
1124  *                    +-----+             |
1125  *                    |     |             |
1126  *                    |     |             |8
1127  *                    |     |             +
1128  *                    |     |            /
1129  *                    |     |           /
1130  *                    |     |          /
1131  *                    |1    |2        /9
1132  *                    +-----+--------+
1134  *    NOTE, don't really use these first two here  (See USERD_get_nsided_conn)
1136  *    1. In USERD_get_gold_part_build_info:
1137  *            number_of_elements[Z_NSIDED] = 3
1138  *                                           .
1139  *                                          /|\
1140  *                                           |
1141  *    2. In USERD_get_part_elements_by_type:
1142  *        length of conn_array will be:      3 x 1
1144  *        for element_type of Z_NSIDED:
1145  *            conn_array[0][0] = 4           (for the 4-sided element)
1146  *            conn_array[1][0] = 3           (for the 3-sided element)
1147  *            conn_array[2][0] = 7           (for the 7-sided element)
1149  *                         Sum  ===
1150  *                               14
1152  *    But for our example, lets assume that that our buffer is just 2
1153  *                                                   ================
1154  *    3. In this routine:
1156  *       first invocation:
1157  *         first = TRUE
1158  *         e_beg = 0
1159  *         e_end = 2
1160  *         buffer_size = 2
1161  *         num_nodes_per_elem_array[2]    load it: num_nodes_per_elem_array[0] = 4
1162  *                                                 num_nodes_per_elem_array[1] = 3
1164  *         nsided_conn_array[at least 7]  load it:   nsided_conn_array[0] = 1
1165  *                                                   nsided_conn_array[1] = 2
1166  *                                                   nsided_conn_array[2] = 4
1167  *                                                   nsided_conn_array[3] = 3
1169  *                                                   nsided_conn_array[4] = 3
1170  *                                                   nsided_conn_array[5] = 4
1171  *                                                   nsided_conn_array[6] = 5
1172  *         *num_returned = 2
1173  *         return(0)                       return this (indicates more to do)
1175  *       second invocation:
1176  *         first = FALSE
1177  *         e_beg = 0
1178  *         e_end = 2
1179  *         buffer_size = 2
1180  *         num_nodes_per_elem_array[2]    load it: num_nodes_per_elem_array[0] = 7
1182  *         nsided_conn_array[at least 7]  load it:   nsided_conn_array[0] = 2
1183  *                                                   nsided_conn_array[1] = 9
1184  *                                                   nsided_conn_array[2] = 8
1185  *                                                   nsided_conn_array[3] = 7
1186  *                                                   nsided_conn_array[4] = 6
1187  *                                                   nsided_conn_array[5] = 5
1188  *                                                   nsided_conn_array[6] = 4
1189  *         *num_returned = 1
1190  *         return(1)                       return this (indicates no more to do)
1192  * returns  0  if got some, more to do
1193  *          1  if got some, done
1194  *         -1  if an error
1196  *  Notes:
1197  *  * This will be based on Current_time_step
1199  *  * Will not be called unless there are some nsided elements in the
1200  *    the part
1201  *--------------------------------------------------------------------*/
1203 USERD_get_nsided_conn_in_buffers(int part_number,
1204                                  int *num_nodes_per_elem_array,
1205                                  int *nsided_conn_array,
1206                                  int first,
1207                                  int e_beg,
1208                                  int e_end,
1209                                  int buffer_size,
1210                                  int *num_returned)
1215 /*--------------------------------------------------------------------
1216  * USERD_get_nfaced_conn_in_buffers -
1217  *--------------------------------------------------------------------
1219  *   Gets three arrays containing the number of faces per element,
1220  *   number of nodes per face, and connectivity per face of nfaced
1221  *   elements in buffers
1223  *  (IN)  part_number      = The part number
1225  *                           (1-based index of part table, namely:
1227  *                              1 ... Numparts_available.
1229  *                            It is NOT the part_id that
1230  *                            is loaded in USERD_get_gold_part_build_info)
1232  *  (IN)  first            = TRUE if first invocation of a buffered set.
1233  *                           Will be FALSE for all subsequent invocations
1234  *                           of the set.  This is so you can open files,
1235  *                           get to the correct starting spot,
1236  *                           initialize, etc.
1238  *  (IN) e_beg             = Zero based, first element number
1239  *                           of the buffered set
1241  *  (IN) e_end             = Zero based, last element number
1242  *                           of the buffered set
1244  *                     Thus, for first five elements of a type:
1245  *                       e_beg = 0
1246  *                       e_end = 4
1247  *                       total_number = (e_end - e_beg) + 1 = (4 - 0) + 1 = 5
1249  *                     for second five elements of a type, would be:
1250  *                       e_beg = 5
1251  *                       e_end = 9
1252  *                       total_number = (e_end - e_beg) + 1 = (9 - 5) + 1 = 5
1254  *                     for all elements of the type of a part, would be:
1255  *                       n_beg = 0
1256  *                       n_end = num_elements_of_type - 1
1258  *  (IN) buffer_size         = The size of the num_nodes_per_elem_array buffer.
1259  *                             Namely: num_nodes_per_elem_array[buffer_size]
1261  *  (OUT) nfaced_fpe_array   = 1D buffer array of the number of faces per nfaced
1262  *                             element.
1264  *                                (int array will have been allocated
1265  *                                 buffer_size long)
1267  *  (OUT) nfaced_npf_array   = 1D buffer array of the number of nodes per face
1268  *                             for nfaced elements.
1270  *                                (int array will have been allocated long
1271  *                                 enough to hold a buffer's size of values)
1273  *  (OUT) nfaced_conn_array  = 1D array of nsided face connectivies of
1274  *                             nfaced elements
1276  *                             (int array will have been allocated
1277  *                              long enough to hold a buffer's worth of values)
1279  *   Providing nfaced information to Ensight:
1281  *   NOTE: for other nfaced operations you need these first two, but we
1282  *         don't actually use them in this routine.
1284  *   1. In USERD_get_gold_part_build_info, provide the number of nfaced
1285  *      polyhedral elements in the part.
1287  *   2. In USERD_get_part_elements_by_type, provide (in the conn_array),
1288  *      the number of faces per nfaced element. (as if connectivity
1289  *      length of an nfaced element is one)
1291  *   We do use the following:
1292  *   3. In this routine, provide the corresponding number of faces per nfaced
1293  *      element, streamed number of nodes per face, and streamed face
1294  *      connectivities for each of the faces of the nfaced elements in the
1295  *      bufferred portion.
1298  *   Simple example:         11        10   12
1299  *                          +--------+-----+
1300  *   2 nfaced elements:    /|        |\   /|
1301  *   (1 7-faced           / |        | \ / |
1302  *    1 5-sided)         /  |        |  +9 |
1303  *                      /   |        | /|  |
1304  *                     /7   |      8 /  |  |
1305  *                    +-----------+/ |  |  |
1306  *                    |     |5    |  |4 |  |6
1307  *                    |     +-----|--+--|--+
1308  *                    |    /      |   \ | /
1309  *                    |   /       |    \|/3
1310  *                    |  /        |     +
1311  *                    | /         |    /
1312  *                    |/1         |2 /
1313  *                    +-----------+/
1315  *    Note, don't really use these first two here (See USERD_get_nfaced_conn)
1317  *    1. In USERD_get_gold_part_build_info:
1318  *            number_of_elements[Z_NFACED] = 2
1319  *                                           .
1320  *                                          /|\
1321  *                                           |
1322  *    2. In USERD_get_part_elements_by_type:
1323  *        length of conn_array will be:      2 x 1
1324  *        for element_type of Z_NFACED:
1325  *            conn_array[0][0] = 7           (for the 7-faced element)
1326  *            conn_array[1][0] = 5           (for the 5-faced element)
1327  *                              ==
1328  *                         Sum  12
1331  *    But for our simple example, lets assume that that our buffer is just 1
1332  *      so that we have multiple invocations.               ================
1334  *    3. In this routine:
1336  *       first invocation:
1337  *         first = TRUE
1338  *         e_beg = 0
1339  *         e_end = 1
1340  *         buffer_size = 1
1341  *         nfaced_fpe_array[1]            load it: nfaced_fpe_array[0] = 7
1343  *         nfaced_npf_array[at least 7]   load it: nfaced_npf_array[0] = 5
1344  *                                                 nfaced_npf_array[1] = 5
1345  *                                                 nfaced_npf_array[2] = 4
1346  *                                                 nfaced_npf_array[3] = 4
1347  *                                                 nfaced_npf_array[4] = 4
1348  *                                                 nfaced_npf_array[5] = 4
1349  *                                                 nfaced_npf_array[6] = 4
1351  *         nsided_conn_array[at least 30] load it: nsided_conn_array[0] = 7
1352  *                                                 nsided_conn_array[1] = 8
1353  *                                                 nsided_conn_array[2] = 9
1354  *                                                 nsided_conn_array[3] = 10
1355  *                                                 nsided_conn_array[4] = 11
1357  *                                                 nsided_conn_array[5] = 1
1358  *                                                 nsided_conn_array[6] = 5
1359  *                                                 nsided_conn_array[7] = 4
1360  *                                                 nsided_conn_array[8] = 3
1361  *                                                 nsided_conn_array[9] = 2
1363  *                                                 nsided_conn_array[10] = 1
1364  *                                                 nsided_conn_array[11] = 2
1365  *                                                 nsided_conn_array[12] = 8
1366  *                                                 nsided_conn_array[13] = 7
1368  *                                                 nsided_conn_array[14] = 5
1369  *                                                 nsided_conn_array[15] = 1
1370  *                                                 nsided_conn_array[16] = 7
1371  *                                                 nsided_conn_array[17] = 11
1373  *                                                 nsided_conn_array[18] = 4
1374  *                                                 nsided_conn_array[19] = 5
1375  *                                                 nsided_conn_array[20] = 11
1376  *                                                 nsided_conn_array[21] = 10
1378  *                                                 nsided_conn_array[22] = 2
1379  *                                                 nsided_conn_array[23] = 3
1380  *                                                 nsided_conn_array[24] = 9
1381  *                                                 nsided_conn_array[25] = 8
1383  *                                                 nsided_conn_array[26] = 3
1384  *                                                 nsided_conn_array[27] = 4
1385  *                                                 nsided_conn_array[28] = 10
1386  *                                                 nsided_conn_array[29] = 9
1387  *         *num_returned = 1;
1388  *         return(0)
1390  *       second invocation:
1391  *         first = FALSE
1392  *         e_beg = 0
1393  *         e_end = 1
1394  *         buffer_size = 1
1395  *         nfaced_fpe_array[1]            load it: nfaced_fpe_array[0] = 5
1397  *         nfaced_npf_array[at least 7]   load it: nfaced_npf_array[0] = 3
1398  *                                                 nfaced_npf_array[1] = 3
1399  *                                                 nfaced_npf_array[2] = 4
1400  *                                                 nfaced_npf_array[3] = 4
1401  *                                                 nfaced_npf_array[4] = 4
1403  *         nsided_conn_array[at least 18] load it: nsided_conn_array[0] = 9
1404  *                                                 nsided_conn_array[1] = 12
1405  *                                                 nsided_conn_array[2] = 10
1407  *                                                 nsided_conn_array[3] = 3
1408  *                                                 nsided_conn_array[4] = 4
1409  *                                                 nsided_conn_array[5] = 6
1411  *                                                 nsided_conn_array[6] = 6
1412  *                                                 nsided_conn_array[7] = 4
1413  *                                                 nsided_conn_array[8] = 10
1414  *                                                 nsided_conn_array[9] = 12
1416  *                                                 nsided_conn_array[10] = 3
1417  *                                                 nsided_conn_array[11] = 6
1418  *                                                 nsided_conn_array[12] = 12
1419  *                                                 nsided_conn_array[13] = 9
1421  *                                                 nsided_conn_array[14] = 4
1422  *                                                 nsided_conn_array[15] = 3
1423  *                                                 nsided_conn_array[16] = 9
1424  *                                                 nsided_conn_array[17] = 10
1425  *         *num_returned = 1;
1426  *         return(1)
1428  * returns  0  if got some, more to do
1429  *          1  if got some, done
1430  *         -1  if an error
1432  *  Notes:
1433  *  * This will be based on Current_time_step
1435  *  * Will not be called unless there are some nfaced elements in the
1436  *    the part
1437  *--------------------------------------------------------------------*/
1439 USERD_get_nfaced_conn_in_buffers(int part_number,
1440                                  int *nfaced_fpe_array,
1441                                  int *nfaced_npf_array,
1442                                  int *nfaced_conn_array,
1443                                  int first,
1444                                  int e_beg,
1445                                  int e_end,
1446                                  int buffer_size,
1447                                  int *num_returned)