2
Copyright (c) 1994 - 2010, Lawrence Livermore National Security, LLC.
6
This file is part of Silo. For details, see silo.llnl.gov.
8
Redistribution and use in source and binary forms, with or without
9
modification, are permitted provided that the following conditions
12
* Redistributions of source code must retain the above copyright
13
notice, this list of conditions and the disclaimer below.
14
* Redistributions in binary form must reproduce the above copyright
15
notice, this list of conditions and the disclaimer (as noted
16
below) in the documentation and/or other materials provided with
18
* Neither the name of the LLNS/LLNL nor the names of its
19
contributors may be used to endorse or promote products derived
20
from this software without specific prior written permission.
22
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE
26
LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR
27
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
This work was produced at Lawrence Livermore National Laboratory under
36
Contract No. DE-AC52-07NA27344 with the DOE.
38
Neither the United States Government nor Lawrence Livermore National
39
Security, LLC nor any of their employees, makes any warranty, express
40
or implied, or assumes any liability or responsibility for the
41
accuracy, completeness, or usefulness of any information, apparatus,
42
product, or process disclosed, or represents that its use would not
43
infringe privately-owned rights.
45
Any reference herein to any specific commercial products, process, or
46
services by trade name, trademark, manufacturer or otherwise does not
47
necessarily constitute or imply its endorsement, recommendation, or
48
favoring by the United States Government or Lawrence Livermore
49
National Security, LLC. The views and opinions of authors expressed
50
herein do not necessarily state or reflect those of the United States
51
Government or Lawrence Livermore National Security, LLC, and shall not
52
be used for advertising or product endorsement purposes.
55
#include "silo.h" /*include public silo */
66
/*-------------------------------------------------------------------------
69
* Purpose: Test writing a polyhedral zonelist
71
* Writes two hexes sharing a common face using a
76
* Programmer: Mark C. Miller, July 27, 2004
78
*-------------------------------------------------------------------------
81
main(int argc, char *argv[])
85
char *filename="polyzl.pdb";
90
char *xname = "xcoords";
91
char *yname = "ycoords";
92
char *zname = "zcoords";
94
float x[NNODES] = {0.0, 1.0, 2.0, 0.0, 1.0, 2.0, 0.0, 1.0, 2.0, 0.0, 1.0, 2.0};
95
float y[NNODES] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
96
float z[NNODES] = {0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
98
int nodecnt[NFACES] = {4,4,4,4,4,4,4,4,4,4,4};
99
int lnodelist = 4 * NFACES;
100
int nodelist[4*NFACES] = {0,1,7,6, 1,2,8,7, 1,0,3,4,
101
2,1,4,5, 4,3,9,10, 5,4,10,11,
102
6,7,10,9, 7,8,11,10, 0,6,9,3,
105
int facecnt[NZONES] = {6,6};
106
int lfacelist = 6 * NZONES;
107
int facelist[6*NZONES] = {0,2,4,6,8,-9, 1,3,5,7,9,10};
111
int show_all_errors = FALSE;
117
coordnames[0] = xname;
118
coordnames[1] = yname;
119
coordnames[2] = zname;
121
/* Parse command-line */
122
for (i=1; i<argc; i++) {
123
if (!strncmp(argv[i], "DB_PDB", 6)) {
124
driver = StringToDriver(argv[i]);
125
filename = "polyzl.pdb";
126
} else if (!strncmp(argv[i], "DB_HDF5", 7)) {
127
driver = StringToDriver(argv[i]);
128
filename = "polyzl.h5";
129
} else if (!strcmp(argv[i], "show-all-errors")) {
131
} else if (argv[i][0] != '\0') {
132
fprintf(stderr, "%s: ignored argument `%s'\n", argv[0], argv[i]);
136
DBShowErrors(show_all_errors?DB_ALL_AND_DRVR:DB_TOP, NULL);
140
* Create a file that contains a simple mesh of 2 hexes
142
printf("Creating file: `%s'\n", filename);
143
dbfile = DBCreate(filename,0,DB_LOCAL,"Polyhedral Zonelist Test",driver);
145
optlist = DBMakeOptlist(3);
146
DBAddOption(optlist, DBOPT_PHZONELIST, "polyzl");
148
DBPutUcdmesh(dbfile, "ucdmesh", 3, coordnames, coords, NNODES, NZONES,
149
NULL, NULL, DB_FLOAT, optlist);
151
DBPutPHZonelist(dbfile, "polyzl",
152
NFACES, nodecnt, lnodelist, nodelist, NULL,
153
NZONES, facecnt, lfacelist, facelist,
154
0, 0, NZONES-1, NULL);
158
CleanupDriverStuff();