1 /* dskz02.f -- translated by f2c (version 19980913).
2    You must link the resulting object file with the libraries:
3 	-lf2c -lm   (in that order)
4 */
5 
6 #include "f2c.h"
7 
8 /* Table of constant values */
9 
10 static integer c__1 = 1;
11 static integer c__2 = 2;
12 
13 /* $Procedure DSKZ02 ( DSK, fetch type 2 model size parameters ) */
dskz02_(integer * handle,integer * dladsc,integer * nv,integer * np)14 /* Subroutine */ int dskz02_(integer *handle, integer *dladsc, integer *nv,
15 	integer *np)
16 {
17     integer n;
18     extern /* Subroutine */ int chkin_(char *, ftnlen), dski02_(integer *,
19 	    integer *, integer *, integer *, integer *, integer *, integer *);
20     extern logical return_(void);
21     extern /* Subroutine */ int chkout_(char *, ftnlen);
22 
23 /* $ Abstract */
24 
25 /*     Return plate model size parameters---plate count and */
26 /*     vertex count---for a type 2 DSK segment. */
27 
28 /* $ Disclaimer */
29 
30 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
31 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
32 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
33 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
34 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
35 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
36 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
37 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
38 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
39 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
40 
41 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
42 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
43 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
44 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
45 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
46 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
47 
48 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
49 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
50 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
51 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
52 
53 /* $ Required_Reading */
54 
55 /*     DAS */
56 /*     DSK */
57 
58 /* $ Keywords */
59 
60 /*     DAS */
61 /*     DSK */
62 /*     FILES */
63 
64 /* $ Declarations */
65 
66 /*     Include file dla.inc */
67 
68 /*     This include file declares parameters for DLA format */
69 /*     version zero. */
70 
71 /*        Version 3.0.1 17-OCT-2016 (NJB) */
72 
73 /*           Corrected comment: VERIDX is now described as a DAS */
74 /*           integer address rather than a d.p. address. */
75 
76 /*        Version 3.0.0 20-JUN-2006 (NJB) */
77 
78 /*           Changed name of parameter DSCSIZ to DLADSZ. */
79 
80 /*        Version 2.0.0 09-FEB-2005 (NJB) */
81 
82 /*           Changed descriptor layout to make backward pointer */
83 /*           first element.  Updated DLA format version code to 1. */
84 
85 /*           Added parameters for format version and number of bytes per */
86 /*           DAS comment record. */
87 
88 /*        Version 1.0.0 28-JAN-2004 (NJB) */
89 
90 
91 /*     DAS integer address of DLA version code. */
92 
93 
94 /*     Linked list parameters */
95 
96 /*     Logical arrays (aka "segments") in a DAS linked array (DLA) file */
97 /*     are organized as a doubly linked list.  Each logical array may */
98 /*     actually consist of character, double precision, and integer */
99 /*     components.  A component of a given data type occupies a */
100 /*     contiguous range of DAS addresses of that type.  Any or all */
101 /*     array components may be empty. */
102 
103 /*     The segment descriptors in a SPICE DLA (DAS linked array) file */
104 /*     are connected by a doubly linked list.  Each node of the list is */
105 /*     represented by a pair of integers acting as forward and backward */
106 /*     pointers.  Each pointer pair occupies the first two integers of a */
107 /*     segment descriptor in DAS integer address space.  The DLA file */
108 /*     contains pointers to the first integers of both the first and */
109 /*     last segment descriptors. */
110 
111 /*     At the DLA level of a file format implementation, there is */
112 /*     no knowledge of the data contents.  Hence segment descriptors */
113 /*     provide information only about file layout (in contrast with */
114 /*     the DAF system).  Metadata giving specifics of segment contents */
115 /*     are stored within the segments themselves in DLA-based file */
116 /*     formats. */
117 
118 
119 /*     Parameter declarations follow. */
120 
121 /*     DAS integer addresses of first and last segment linked list */
122 /*     pointer pairs.  The contents of these pointers */
123 /*     are the DAS addresses of the first integers belonging */
124 /*     to the first and last link pairs, respectively. */
125 
126 /*     The acronyms "LLB" and "LLE" denote "linked list begin" */
127 /*     and "linked list end" respectively. */
128 
129 
130 /*     Null pointer parameter. */
131 
132 
133 /*     Segment descriptor parameters */
134 
135 /*     Each segment descriptor occupies a contiguous */
136 /*     range of DAS integer addresses. */
137 
138 /*        The segment descriptor layout is: */
139 
140 /*           +---------------+ */
141 /*           | BACKWARD PTR  | Linked list backward pointer */
142 /*           +---------------+ */
143 /*           | FORWARD PTR   | Linked list forward pointer */
144 /*           +---------------+ */
145 /*           | BASE INT ADDR | Base DAS integer address */
146 /*           +---------------+ */
147 /*           | INT COMP SIZE | Size of integer segment component */
148 /*           +---------------+ */
149 /*           | BASE DP ADDR  | Base DAS d.p. address */
150 /*           +---------------+ */
151 /*           | DP COMP SIZE  | Size of d.p. segment component */
152 /*           +---------------+ */
153 /*           | BASE CHR ADDR | Base DAS character address */
154 /*           +---------------+ */
155 /*           | CHR COMP SIZE | Size of character segment component */
156 /*           +---------------+ */
157 
158 /*     Parameters defining offsets for segment descriptor elements */
159 /*     follow. */
160 
161 
162 /*     Descriptor size: */
163 
164 
165 /*     Other DLA parameters: */
166 
167 
168 /*     DLA format version.  (This number is expected to occur very */
169 /*     rarely at integer address VERIDX in uninitialized DLA files.) */
170 
171 
172 /*     Characters per DAS comment record. */
173 
174 
175 /*     End of include file dla.inc */
176 
177 
178 /*     Include file dskdsc.inc */
179 
180 /*     This include file declares parameters for DSK segment descriptors. */
181 
182 /* -       SPICELIB Version 1.0.0 08-FEB-2017 (NJB) */
183 
184 /*           Updated version info. */
185 
186 /*           22-JAN-2016 (NJB) */
187 
188 /*              Added parameter for data class 2. Changed name of data */
189 /*              class 1 parameter. Corrected data class descriptions. */
190 
191 /*           13-MAY-2010 (NJB) */
192 
193 /*              Descriptor now contains two ID codes, one for the */
194 /*              surface, one for the associated ephemeris object. This */
195 /*              supports association of multiple surfaces with one */
196 /*              ephemeris object without creating file management */
197 /*              issues. */
198 
199 /*              Room was added for coordinate system definition */
200 /*              parameters. */
201 
202 /*               Flag arrays and model ID/component entries were deleted. */
203 
204 /*            11-SEP-2008 (NJB) */
205 
206 
207 /*     DSK segment descriptors are implemented as an array of d.p. */
208 /*     numbers.  Note that each integer descriptor datum occupies one */
209 /*     d.p. value. */
210 
211 
212 
213 
214 /*     Segment descriptor parameters */
215 
216 /*     Each segment descriptor occupies a contiguous */
217 /*     range of DAS d.p. addresses. */
218 
219 /*        The DSK segment descriptor layout is: */
220 
221 /*           +---------------------+ */
222 /*           | Surface ID code     | */
223 /*           +---------------------+ */
224 /*           | Center ID code      | */
225 /*           +---------------------+ */
226 /*           | Data class code     | */
227 /*           +---------------------+ */
228 /*           | Data type           | */
229 /*           +---------------------+ */
230 /*           | Ref frame code      | */
231 /*           +---------------------+ */
232 /*           | Coord sys code      | */
233 /*           +---------------------+ */
234 /*           | Coord sys parameters|  {10 elements} */
235 /*           +---------------------+ */
236 /*           | Min coord 1         | */
237 /*           +---------------------+ */
238 /*           | Max coord 1         | */
239 /*           +---------------------+ */
240 /*           | Min coord 2         | */
241 /*           +---------------------+ */
242 /*           | Max coord 2         | */
243 /*           +---------------------+ */
244 /*           | Min coord 3         | */
245 /*           +---------------------+ */
246 /*           | Max coord 3         | */
247 /*           +---------------------+ */
248 /*           | Start time          | */
249 /*           +---------------------+ */
250 /*           | Stop time           | */
251 /*           +---------------------+ */
252 
253 /*     Parameters defining offsets for segment descriptor elements */
254 /*     follow. */
255 
256 
257 /*     Surface ID code: */
258 
259 
260 /*     Central ephemeris object NAIF ID: */
261 
262 
263 /*     Data class: */
264 
265 /*     The "data class" is a code indicating the category of */
266 /*     data contained in the segment. */
267 
268 
269 /*     Data type: */
270 
271 
272 /*     Frame ID: */
273 
274 
275 /*     Coordinate system code: */
276 
277 
278 /*     Coordinate system parameter start index: */
279 
280 
281 /*     Number of coordinate system parameters: */
282 
283 
284 /*     Ranges for coordinate bounds: */
285 
286 
287 /*     Coverage time bounds: */
288 
289 
290 /*     Descriptor size (24): */
291 
292 
293 /*     Data class values: */
294 
295 /*        Class 1 indicates a surface that can be represented as a */
296 /*                single-valued function of its domain coordinates. */
297 
298 /*                An example is a surface defined by a function that */
299 /*                maps each planetodetic longitude and latitude pair to */
300 /*                a unique altitude. */
301 
302 
303 /*        Class 2 indicates a general surface. Surfaces that */
304 /*                have multiple points for a given pair of domain */
305 /*                coordinates---for example, multiple radii for a given */
306 /*                latitude and longitude---belong to class 2. */
307 
308 
309 
310 /*     Coordinate system values: */
311 
312 /*        The coordinate system code indicates the system to which the */
313 /*        tangential coordinate bounds belong. */
314 
315 /*        Code 1 refers to the planetocentric latitudinal system. */
316 
317 /*        In this system, the first tangential coordinate is longitude */
318 /*        and the second tangential coordinate is latitude. The third */
319 /*        coordinate is radius. */
320 
321 
322 
323 /*        Code 2 refers to the cylindrical system. */
324 
325 /*        In this system, the first tangential coordinate is radius and */
326 /*        the second tangential coordinate is longitude. The third, */
327 /*        orthogonal coordinate is Z. */
328 
329 
330 
331 /*        Code 3 refers to the rectangular system. */
332 
333 /*        In this system, the first tangential coordinate is X and */
334 /*        the second tangential coordinate is Y. The third, */
335 /*        orthogonal coordinate is Z. */
336 
337 
338 
339 /*        Code 4 refers to the planetodetic/geodetic system. */
340 
341 /*        In this system, the first tangential coordinate is longitude */
342 /*        and the second tangential coordinate is planetodetic */
343 /*        latitude. The third, orthogonal coordinate is altitude. */
344 
345 
346 
347 /*     End of include file dskdsc.inc */
348 
349 
350 /*     Include file dsk02.inc */
351 
352 /*     This include file declares parameters for DSK data type 2 */
353 /*     (plate model). */
354 
355 /* -       SPICELIB Version 1.0.0 08-FEB-2017 (NJB) */
356 
357 /*          Updated version info. */
358 
359 /*           22-JAN-2016 (NJB) */
360 
361 /*              Now includes spatial index parameters. */
362 
363 /*           26-MAR-2015 (NJB) */
364 
365 /*              Updated to increase MAXVRT to 16000002. MAXNPV */
366 /*              has been changed to (3/2)*MAXPLT. Set MAXVOX */
367 /*              to 100000000. */
368 
369 /*           13-MAY-2010 (NJB) */
370 
371 /*              Updated to reflect new no-record design. */
372 
373 /*           04-MAY-2010 (NJB) */
374 
375 /*              Updated for new type 2 segment design. Now uses */
376 /*              a local parameter to represent DSK descriptor */
377 /*              size (NB). */
378 
379 /*           13-SEP-2008 (NJB) */
380 
381 /*              Updated to remove albedo information. */
382 /*              Updated to use parameter for DSK descriptor size. */
383 
384 /*           27-DEC-2006 (NJB) */
385 
386 /*              Updated to remove minimum and maximum radius information */
387 /*              from segment layout.  These bounds are now included */
388 /*              in the segment descriptor. */
389 
390 /*           26-OCT-2006 (NJB) */
391 
392 /*              Updated to remove normal, center, longest side, albedo, */
393 /*              and area keyword parameters. */
394 
395 /*           04-AUG-2006 (NJB) */
396 
397 /*              Updated to support coarse voxel grid.  Area data */
398 /*              have now been removed. */
399 
400 /*           10-JUL-2006 (NJB) */
401 
402 
403 /*     Each type 2 DSK segment has integer, d.p., and character */
404 /*     components.  The segment layout in DAS address space is as */
405 /*     follows: */
406 
407 
408 /*        Integer layout: */
409 
410 /*           +-----------------+ */
411 /*           | NV              |  (# of vertices) */
412 /*           +-----------------+ */
413 /*           | NP              |  (# of plates ) */
414 /*           +-----------------+ */
415 /*           | NVXTOT          |  (total number of voxels) */
416 /*           +-----------------+ */
417 /*           | VGREXT          |  (voxel grid extents, 3 integers) */
418 /*           +-----------------+ */
419 /*           | CGRSCL          |  (coarse voxel grid scale, 1 integer) */
420 /*           +-----------------+ */
421 /*           | VOXNPT          |  (size of voxel-plate pointer list) */
422 /*           +-----------------+ */
423 /*           | VOXNPL          |  (size of voxel-plate list) */
424 /*           +-----------------+ */
425 /*           | VTXNPL          |  (size of vertex-plate list) */
426 /*           +-----------------+ */
427 /*           | PLATES          |  (NP 3-tuples of vertex IDs) */
428 /*           +-----------------+ */
429 /*           | VOXPTR          |  (voxel-plate pointer array) */
430 /*           +-----------------+ */
431 /*           | VOXPLT          |  (voxel-plate list) */
432 /*           +-----------------+ */
433 /*           | VTXPTR          |  (vertex-plate pointer array) */
434 /*           +-----------------+ */
435 /*           | VTXPLT          |  (vertex-plate list) */
436 /*           +-----------------+ */
437 /*           | CGRPTR          |  (coarse grid occupancy pointers) */
438 /*           +-----------------+ */
439 
440 
441 
442 /*        D.p. layout: */
443 
444 /*           +-----------------+ */
445 /*           | DSK descriptor  |  DSKDSZ elements */
446 /*           +-----------------+ */
447 /*           | Vertex bounds   |  6 values (min/max for each component) */
448 /*           +-----------------+ */
449 /*           | Voxel origin    |  3 elements */
450 /*           +-----------------+ */
451 /*           | Voxel size      |  1 element */
452 /*           +-----------------+ */
453 /*           | Vertices        |  3*NV elements */
454 /*           +-----------------+ */
455 
456 
457 /*     This local parameter MUST be kept consistent with */
458 /*     the parameter DSKDSZ which is declared in dskdsc.inc. */
459 
460 
461 /*     Integer item keyword parameters used by fetch routines: */
462 
463 
464 /*     Double precision item keyword parameters used by fetch routines: */
465 
466 
467 /*     The parameters below formerly were declared in pltmax.inc. */
468 
469 /*     Limits on plate model capacity: */
470 
471 /*     The maximum number of bodies, vertices and */
472 /*     plates in a plate model or collective thereof are */
473 /*     provided here. */
474 
475 /*     These values can be used to dimension arrays, or to */
476 /*     use as limit checks. */
477 
478 /*     The value of MAXPLT is determined from MAXVRT via */
479 /*     Euler's Formula for simple polyhedra having triangular */
480 /*     faces. */
481 
482 /*     MAXVRT is the maximum number of vertices the triangular */
483 /*            plate model software will support. */
484 
485 
486 /*     MAXPLT is the maximum number of plates that the triangular */
487 /*            plate model software will support. */
488 
489 
490 /*     MAXNPV is the maximum allowed number of vertices, not taking into */
491 /*     account shared vertices. */
492 
493 /*     Note that this value is not sufficient to create a vertex-plate */
494 /*     mapping for a model of maximum plate count. */
495 
496 
497 /*     MAXVOX is the maximum number of voxels. */
498 
499 
500 /*     MAXCGR is the maximum size of the coarse voxel grid. */
501 
502 
503 /*     MAXEDG is the maximum allowed number of vertex or plate */
504 /*     neighbors a vertex may have. */
505 
506 /*     DSK type 2 spatial index parameters */
507 /*     =================================== */
508 
509 /*        DSK type 2 spatial index integer component */
510 /*        ------------------------------------------ */
511 
512 /*           +-----------------+ */
513 /*           | VGREXT          |  (voxel grid extents, 3 integers) */
514 /*           +-----------------+ */
515 /*           | CGRSCL          |  (coarse voxel grid scale, 1 integer) */
516 /*           +-----------------+ */
517 /*           | VOXNPT          |  (size of voxel-plate pointer list) */
518 /*           +-----------------+ */
519 /*           | VOXNPL          |  (size of voxel-plate list) */
520 /*           +-----------------+ */
521 /*           | VTXNPL          |  (size of vertex-plate list) */
522 /*           +-----------------+ */
523 /*           | CGRPTR          |  (coarse grid occupancy pointers) */
524 /*           +-----------------+ */
525 /*           | VOXPTR          |  (voxel-plate pointer array) */
526 /*           +-----------------+ */
527 /*           | VOXPLT          |  (voxel-plate list) */
528 /*           +-----------------+ */
529 /*           | VTXPTR          |  (vertex-plate pointer array) */
530 /*           +-----------------+ */
531 /*           | VTXPLT          |  (vertex-plate list) */
532 /*           +-----------------+ */
533 
534 
535 /*        Index parameters */
536 
537 
538 /*     Grid extent: */
539 
540 
541 /*     Coarse grid scale: */
542 
543 
544 /*     Voxel pointer count: */
545 
546 
547 /*     Voxel-plate list count: */
548 
549 
550 /*     Vertex-plate list count: */
551 
552 
553 /*     Coarse grid pointers: */
554 
555 
556 /*     Size of fixed-size portion of integer component: */
557 
558 
559 /*        DSK type 2 spatial index double precision component */
560 /*        --------------------------------------------------- */
561 
562 /*           +-----------------+ */
563 /*           | Vertex bounds   |  6 values (min/max for each component) */
564 /*           +-----------------+ */
565 /*           | Voxel origin    |  3 elements */
566 /*           +-----------------+ */
567 /*           | Voxel size      |  1 element */
568 /*           +-----------------+ */
569 
570 
571 
572 /*        Index parameters */
573 
574 /*     Vertex bounds: */
575 
576 
577 /*     Voxel grid origin: */
578 
579 
580 /*     Voxel size: */
581 
582 
583 /*     Size of fixed-size portion of double precision component: */
584 
585 
586 /*     The limits below are used to define a suggested maximum */
587 /*     size for the integer component of the spatial index. */
588 
589 
590 /*     Maximum number of entries in voxel-plate pointer array: */
591 
592 
593 /*     Maximum cell size: */
594 
595 
596 /*     Maximum number of entries in voxel-plate list: */
597 
598 
599 /*     Spatial index integer component size: */
600 
601 
602 /*     End of include file dsk02.inc */
603 
604 /* $ Brief_I/O */
605 
606 /*     Variable  I/O  Description */
607 /*     --------  ---  -------------------------------------------------- */
608 /*     HANDLE     I   DSK file handle. */
609 /*     DLADSC     I   DLA descriptor. */
610 /*     NV         O   Number of vertices. */
611 /*     NP         O   Number of plates. */
612 
613 /* $ Detailed_Input */
614 
615 /*     HANDLE         is the handle of a DSK file containing a type 2 */
616 /*                    segment from which data are to be fetched. */
617 
618 /*     DLADSC         is the DLA descriptor associated with the segment */
619 /*                    from which data are to be fetched. */
620 
621 /* $ Detailed_Output */
622 
623 /*     NV             is the number of vertices belonging to */
624 /*                    the specified plate model. */
625 
626 /*     NP             is the number of plates belonging to the */
627 /*                    specified plate model. */
628 
629 /* $ Parameters */
630 
631 /*     See the INCLUDE files */
632 
633 /*         dla.inc */
634 /*         dsk02.inc */
635 /*         dskdsc.inc */
636 
637 /* $ Exceptions */
638 
639 /*     1) If the input handle is invalid, the error will be diagnosed by */
640 /*        routines in the call tree of this routine. */
641 
642 /*     2) If a file read error occurs, the error will be diagnosed by */
643 /*        routines in the call tree of this routine. */
644 
645 /*     3) If the input DLA descriptor is invalid, the effect of this */
646 /*        routine is undefined. The error *may* be diagnosed by routines */
647 /*        in the call tree of this routine, but there are no guarantees. */
648 
649 /* $ Files */
650 
651 /*     See input argument HANDLE. */
652 
653 /* $ Particulars */
654 
655 /*     This routine enables SPICE-based user applications to */
656 /*     conveniently fetch the plate and vertex counts of a type 2 DSK */
657 /*     segment. */
658 
659 /*     See the routine DSKB02 (DSK, fetch type 2 bookkeeping data) */
660 /*     for an interface that returns all type 2 DSK segment */
661 /*     bookkeeping data in a single call. */
662 
663 /* $ Examples */
664 
665 /*     1) Look up all the vertices associated with each plate */
666 /*        of the model contained in a specified type 2 segment. For each */
667 /*        plate, display the plate's vertices and normal vector. */
668 
669 /*        For this example, we'll show the context of this look-up: */
670 /*        opening the DSK file for read access, traversing a trivial, */
671 /*        one-segment list to obtain the segment of interest. */
672 
673 
674 /*        Example code begins here. */
675 
676 
677 /*           PROGRAM DSKBULK */
678 /*           IMPLICIT NONE */
679 
680 /*           INCLUDE 'dla.inc' */
681 /*           INCLUDE 'dsk02.inc' */
682 
683 
684 /*           CHARACTER*(*)         FMT */
685 /*           PARAMETER           ( FMT    = '(1X,A,3(1XE16.9))' ) */
686 
687 
688 /*           INTEGER               BUFSIZ */
689 /*           PARAMETER           ( BUFSIZ = 10000 ) */
690 
691 /*           INTEGER               FILSIZ */
692 /*           PARAMETER           ( FILSIZ = 255 ) */
693 
694 
695 /*           CHARACTER*(FILSIZ)    DSK */
696 
697 /*           DOUBLE PRECISION      NORMAL ( 3 ) */
698 /*           DOUBLE PRECISION      VERTS  ( 3, BUFSIZ ) */
699 
700 /*           INTEGER               DLADSC ( DLADSZ ) */
701 /*           INTEGER               HANDLE */
702 /*           INTEGER               I */
703 /*           INTEGER               J */
704 /*           INTEGER               N */
705 /*           INTEGER               NNORM */
706 /*           INTEGER               NP */
707 /*           INTEGER               NREAD */
708 /*           INTEGER               NV */
709 /*           INTEGER               NVTX */
710 /*           INTEGER               PLATES  ( 3, BUFSIZ ) */
711 /*           INTEGER               PLIX */
712 /*           INTEGER               REMAIN */
713 /*           INTEGER               START */
714 
715 /*           LOGICAL               FOUND */
716 
717 /*     C */
718 /*     C     Prompt for name of DSK and open file for reading. */
719 /*     C */
720 /*           CALL PROMPT ( 'Enter DSK name > ', DSK ) */
721 
722 /*           CALL DASOPR ( DSK, HANDLE ) */
723 
724 /*           CALL DLABFS ( HANDLE, DLADSC, FOUND ) */
725 
726 /*           IF ( .NOT. FOUND ) THEN */
727 
728 /*              CALL SETMSG ( 'No segment found in file #.' ) */
729 /*              CALL ERRCH  ( '#',  DSK                     ) */
730 /*              CALL SIGERR ( 'SPICE(NOSEGMENT)'            ) */
731 
732 /*           END IF */
733 
734 /*     C */
735 /*     C     Get segment vertex and plate counts. */
736 /*     C */
737 /*           CALL DSKZ02 ( HANDLE, DLADSC, NV, NP ) */
738 
739 /*           WRITE (*,*) ' ' */
740 /*           WRITE (*,*) 'Number of vertices: ', NV */
741 /*           WRITE (*,*) 'Number of plates:   ', NP */
742 /*     C */
743 /*     C     Display the vertices of each plate. */
744 /*     C */
745 /*           REMAIN = NP */
746 /*           START  = 1 */
747 
748 /*           DO WHILE ( REMAIN .GT. 0 ) */
749 /*     C */
750 /*     C        NREAD is the number of plates we'll read on this */
751 /*     C        loop pass. */
752 /*     C */
753 /*              NREAD  = MIN ( BUFSIZ, REMAIN ) */
754 
755 /*              CALL DSKP02 ( HANDLE, DLADSC, START, NREAD, N, PLATES ) */
756 
757 /*              DO I = 1, N */
758 
759 /*                 PLIX = START + I - 1 */
760 /*     C */
761 /*     C           Read the vertices of the current plate. */
762 /*     C */
763 /*                 DO J = 1, 3 */
764 /*                    CALL DSKV02 ( HANDLE, DLADSC, PLATES(J,I), */
765 /*          .                       1,      NVTX,   VERTS (1,J)  ) */
766 /*                 END DO */
767 /*     C */
768 /*     C           Display the vertices of the current plate: */
769 /*     C */
770 /*                 WRITE (*,*  ) ' ' */
771 /*                 WRITE (*,*  ) 'Plate number: ', PLIX */
772 /*                 WRITE (*,FMT) '   Vertex 1: ', (VERTS(J,1), J = 1,3) */
773 /*                 WRITE (*,FMT) '   Vertex 2: ', (VERTS(J,2), J = 1,3) */
774 /*                 WRITE (*,FMT) '   Vertex 3: ', (VERTS(J,3), J = 1,3) */
775 
776 /*     C */
777 /*     C           Display the normal vector of the current plate: */
778 /*     C */
779 /*                 CALL DSKN02 ( HANDLE, DLADSC, PLIX, NORMAL ) */
780 
781 /*                 WRITE (*,FMT) '   Normal:   ', (NORMAL(J), J = 1,3) */
782 
783 /*              END DO */
784 
785 /*              START  = START  + NREAD */
786 /*              REMAIN = REMAIN - NREAD */
787 
788 /*           END DO */
789 
790 /*     C */
791 /*     C     Close the kernel.  This isn't necessary in a stand- */
792 /*     C     alone program, but it's good practice in subroutines */
793 /*     C     because it frees program and system resources. */
794 /*     C */
795 /*           CALL DASCLS ( HANDLE ) */
796 
797 /*           END */
798 
799 
800 /*     When this program was executed on a PC/Linux/gfortran/64bit */
801 /*     platform, using a DSK file representing a regular icosahedron, */
802 /*     the output was: */
803 
804 
805 /*     Enter DSK name > solid.bds */
806 
807 /*      Number of vertices:           12 */
808 /*      Number of plates:             20 */
809 
810 /*      Plate number:            1 */
811 /*         Vertex 1:   0.000000000E+00  0.000000000E+00  0.117557000E+01 */
812 /*         Vertex 2:   0.105146000E+01  0.000000000E+00  0.525731000E+00 */
813 /*         Vertex 3:   0.324920000E+00  0.100000000E+01  0.525731000E+00 */
814 /*         Normal:     0.491124160E+00  0.356821347E+00  0.794654382E+00 */
815 
816 /*      Plate number:            2 */
817 /*         Vertex 1:   0.000000000E+00  0.000000000E+00  0.117557000E+01 */
818 /*         Vertex 2:   0.324920000E+00  0.100000000E+01  0.525731000E+00 */
819 /*         Vertex 3:  -0.850651000E+00  0.618034000E+00  0.525731000E+00 */
820 /*         Normal:    -0.187592328E+00  0.577350079E+00  0.794654645E+00 */
821 
822 /*           ... */
823 
824 /*      Plate number:           20 */
825 /*         Vertex 1:   0.850651000E+00 -0.618034000E+00 -0.525731000E+00 */
826 /*         Vertex 2:   0.000000000E+00  0.000000000E+00 -0.117557000E+01 */
827 /*         Vertex 3:   0.850651000E+00  0.618034000E+00 -0.525731000E+00 */
828 /*         Normal:     0.607061680E+00  0.000000000E+00 -0.794654715E+00 */
829 
830 
831 /* $ Restrictions */
832 
833 /*     None. */
834 
835 /* $ Literature_References */
836 
837 /*     None. */
838 
839 /* $ Author_and_Institution */
840 
841 /*     N.J. Bachman    (JPL) */
842 
843 /* $ Version */
844 
845 /* -    SPICELIB Version 1.0.0, 02-JUN-2010 (NJB) */
846 
847 /* -& */
848 /* $ Index_Entries */
849 
850 /*     fetch model size parameters from a type 2 dsk segment */
851 
852 /* -& */
853 
854 /*     SPICELIB functions */
855 
856 
857 /*     Local variables */
858 
859     if (return_()) {
860 	return 0;
861     }
862     chkin_("DSKZ02", (ftnlen)6);
863     dski02_(handle, dladsc, &c__1, &c__1, &c__1, &n, nv);
864     dski02_(handle, dladsc, &c__2, &c__1, &c__1, &n, np);
865     chkout_("DSKZ02", (ftnlen)6);
866     return 0;
867 } /* dskz02_ */
868 
869