Exodus 7.22

/test/test-empty.c
/*
* Copyright(c) 2005-2017 National Technology &Engineering Solutions
* of Sandia, LLC(NTESS).Under the terms of Contract DE - NA0003525 with
* NTESS, the U.S.Government retains certain rights in this software.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and / or other materials provided
* with the distribution.
*
* * Neither the name of NTESS nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <exodusII.h>
#include <stdio.h>
int main()
{
float version = 0.0;
ex_opts(EX_VERBOSE | EX_ABORT);
int CPU_word_size = 0; /* sizeof(float) */
int IO_word_size = 4; /* (4 bytes) */
/* ======================================== */
/* Create an empty exodus file */
/* ====================================== */
int exoid = ex_create("test.exo", EX_CLOBBER, &CPU_word_size, &IO_word_size);
ex_close(exoid);
/* ======================================== */
/* Now try to open and read the empty file */
/* ====================================== */
exoid = ex_open("test.exo", /* filename path */
EX_READ, /* access mode = READ */
&CPU_word_size, /* CPU word size */
&IO_word_size, /* IO word size */
&version); /* ExodusII library version */
printf("test.exo exoid = %d\n", exoid);
{
char title[MAX_LINE_LENGTH + 1];
int num_dim, num_nodes, num_elem, num_elem_blk, num_node_sets, num_side_sets;
int error = ex_get_init(exoid, title, &num_dim, &num_nodes, &num_elem, &num_elem_blk,
&num_node_sets, &num_side_sets);
printf("after ex_get_init, error = %3d\n", error);
if (error) {
exit(-1);
}
else {
exit(0);
}
}
}
ex_opts
int ex_opts(int options)
Definition: ex_opts.c:83
error
error
Definition: ex_put_elem_var_tab.c:115
ex_open
#define ex_open(path, mode, comp_ws, io_ws, version)
Definition: exodusII.h:474
ex_create
#define ex_create(path, mode, comp_ws, io_ws)
Definition: exodusII.h:444
ex_close
int ex_close(int exoid)
Definition: ex_close.c:73
MAX_LINE_LENGTH
#define MAX_LINE_LENGTH
Definition: exodusII.h:306
EX_ABORT
Definition: exodusII.h:284
EX_CLOBBER
#define EX_CLOBBER
Definition: exodusII.h:114
EX_READ
#define EX_READ
Definition: exodusII.h:111
exodusII.h
ex_get_init
int ex_get_init(int exoid, char *title, void_int *num_dim, void_int *num_nodes, void_int *num_elem, void_int *num_elem_blk, void_int *num_node_sets, void_int *num_side_sets)
Definition: ex_get_init.c:101
EX_VERBOSE
Definition: exodusII.h:282