~ubuntu-branches/ubuntu/trusty/silo-llnl/trusty

« back to all changes in this revision

Viewing changes to tests/quad.c

  • Committer: Bazaar Package Importer
  • Author(s): Alastair McKinstry
  • Date: 2011-01-02 00:03:01 UTC
  • Revision ID: james.westby@ubuntu.com-20110102000301-9s2hfsjrkguz6h4r
Tags: upstream-4.8
ImportĀ upstreamĀ versionĀ 4.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (c) 1994 - 2010, Lawrence Livermore National Security, LLC.
 
3
LLNL-CODE-425250.
 
4
All rights reserved.
 
5
 
 
6
This file is part of Silo. For details, see silo.llnl.gov.
 
7
 
 
8
Redistribution and use in source and binary forms, with or without
 
9
modification, are permitted provided that the following conditions
 
10
are met:
 
11
 
 
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
 
17
     the distribution.
 
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.
 
21
 
 
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.
 
34
 
 
35
This work was produced at Lawrence Livermore National Laboratory under
 
36
Contract No.  DE-AC52-07NA27344 with the DOE.
 
37
 
 
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.
 
44
 
 
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.
 
53
*/
 
54
 
 
55
#include <stdlib.h>
 
56
#include <string.h>
 
57
#include "silo.h"
 
58
#include <std.c>
 
59
 
 
60
extern int build_quad(DBfile *dbfile, char *name);
 
61
 
 
62
int
 
63
main (int argc, char *argv[])
 
64
{
 
65
    DBfile        *dbfile;
 
66
    int           i, driver=DB_PDB;
 
67
    static char   *filename="quad.pdb";
 
68
    int            show_all_errors = FALSE;
 
69
 
 
70
    for (i=1; i<argc; i++) {
 
71
        if (!strncmp(argv[i], "DB_PDB", 6)) {
 
72
            driver = StringToDriver(argv[i]);
 
73
            filename = "quad.pdb";
 
74
        } else if (!strncmp(argv[i], "DB_HDF5", 7)) {
 
75
            driver = StringToDriver(argv[i]);
 
76
            filename = "quad.h5";
 
77
        } else if (!strcmp(argv[i], "show-all-errors")) {
 
78
            show_all_errors = 1;
 
79
        } else if (argv[i][0] != '\0') {
 
80
            fprintf(stderr, "%s: ignored argument `%s'\n", argv[0], argv[i]);
 
81
        }
 
82
    }
 
83
 
 
84
    DBShowErrors(show_all_errors?DB_ALL_AND_DRVR:DB_ALL, NULL);
 
85
 
 
86
 
 
87
#if 1
 
88
    dbfile = DBCreate(filename, 0, DB_LOCAL,
 
89
                      "quad test file", driver);
 
90
    printf("Creating file: '%s'...\n", filename);
 
91
#endif
 
92
 
 
93
    DBMkDir (dbfile, "/dir1");
 
94
    DBSetDir (dbfile, "/dir1");
 
95
    (void)build_quad (dbfile, "quadmesh");
 
96
 
 
97
    DBMkDir (dbfile, "/dir2");
 
98
    DBSetDir (dbfile, "/dir2");
 
99
    (void)build_quad (dbfile, "quadmesh");
 
100
 
 
101
    
 
102
#if 0
 
103
    meshtypes[0] = DB_QUAD_RECT;
 
104
    meshnames[0] = "quadmesh";
 
105
    nmesh = 1;
 
106
 
 
107
    mmid = DBPutMultimesh(dbfile, "mmesh", nmesh, meshnames,
 
108
                          meshtypes, NULL);
 
109
#endif
 
110
 
 
111
    DBClose(dbfile);
 
112
    CleanupDriverStuff();
 
113
    exit(0);
 
114
}