Commit 532ea713 authored by Ben Boeckel's avatar Ben Boeckel

Merge branch 'upstream-exodusII' into HEAD

* upstream-exodusII:
  exodusII 2020-05-19 (82aaa66b)
parents b3e7b0c2 f18bf32d
......@@ -117,6 +117,7 @@ set(sources
src/deprecated/ex_put_var_param.c
src/deprecated/ex_put_var_tab.c
src/ex__put_homogenous_block_params.c
src/ex_add_attr.c
src/ex_close.c
src/ex_conv.c
......@@ -127,9 +128,14 @@ set(sources
src/ex_cvt_nodes_to_sides.c
src/ex_err.c
src/ex_get_all_times.c
src/ex_get_assemblies.c
src/ex_get_assembly.c
src/ex_get_attr.c
src/ex_get_attr_names.c
src/ex_get_attr_param.c
src/ex_get_attribute.c
src/ex_get_blob.c
src/ex_get_blobs.c
src/ex_get_block.c
src/ex_get_block_param.c
src/ex_get_block_params.c
......@@ -184,6 +190,9 @@ set(sources
src/ex_get_prop_array.c
src/ex_get_prop_names.c
src/ex_get_qa.c
src/ex_get_reduction_variable_names.c
src/ex_get_reduction_variable_param.c
src/ex_get_reduction_vars.c
src/ex_get_set.c
src/ex_get_set_dist_fact.c
src/ex_get_set_param.c
......@@ -207,9 +216,12 @@ set(sources
src/ex_opts.c
src/ex_put_all_var_param.c
src/ex_put_all_var_param_ext.c
src/ex_put_assemblies.c
src/ex_put_attr.c
src/ex_put_attr_names.c
src/ex_put_attr_param.c
src/ex_put_attribute.c
src/ex_put_blobs.c
src/ex_put_block.c
src/ex_put_block_param.c
src/ex_put_block_params.c
......@@ -260,6 +272,9 @@ set(sources
src/ex_put_prop_array.c
src/ex_put_prop_names.c
src/ex_put_qa.c
src/ex_put_reduction_variable_names.c
src/ex_put_reduction_variable_param.c
src/ex_put_reduction_vars.c
src/ex_put_set.c
src/ex_put_set_dist_fact.c
src/ex_put_set_param.c
......
......@@ -8,5 +8,5 @@ process.
* Add attributes to pass commit checks within VTK.
* CMake code to integrate with VTK's module system.
* Mangle all exported symbols to have a `vtkexodusII_` prefix.
* Use VTK's netcdf library
* Mangle all exported symbols to have a `vtkexodusII_` prefix.
......@@ -29,39 +29,6 @@
// 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.
//
//|||||| parent of b406f69b6... cmake: use exodusII_cfg.h
// 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.
#ifndef __exodusII_cfg_h
#define __exodusII_cfg_h
......
#ifndef vtk_exodusII_mangle_h
#define vtk_exodusII_mangle_h
#define EX_errval_key_g vtkexodusII_EX_errval_key_g
#define EX_first_init_g vtkexodusII_EX_first_init_g
#define EX_g vtkexodusII_EX_g
#define ex__catstr vtkexodusII_ex__catstr
#define ex__catstr2 vtkexodusII_ex__catstr2
#define ex__check_file_type vtkexodusII_ex__check_file_type
......@@ -10,6 +13,7 @@
#define ex__compress_variable vtkexodusII_ex__compress_variable
#define ex__conv_exit vtkexodusII_ex__conv_exit
#define ex__conv_init vtkexodusII_ex__conv_init
#define ex__default_max_name_length vtkexodusII_ex__default_max_name_length
#define ex__dim_num_entries_in_object vtkexodusII_ex__dim_num_entries_in_object
#define ex__dim_num_objects vtkexodusII_ex__dim_num_objects
#define ex__find_file_item vtkexodusII_ex__find_file_item
......@@ -37,9 +41,11 @@
#define ex__mutex_lock vtkexodusII_ex__mutex_lock
#define ex__mutex_unlock vtkexodusII_ex__mutex_unlock
#define ex__name_of_map vtkexodusII_ex__name_of_map
#define ex__name_red_var_of_object vtkexodusII_ex__name_red_var_of_object
#define ex__name_var_of_object vtkexodusII_ex__name_var_of_object
#define ex__populate_header vtkexodusII_ex__populate_header
#define ex__pthread_first_thread_init vtkexodusII_ex__pthread_first_thread_init
#define ex__put_homogenous_block_params vtkexodusII_ex__put_homogenous_block_params
#define ex__put_name vtkexodusII_ex__put_name
#define ex__put_names vtkexodusII_ex__put_names
#define ex__put_nemesis_version vtkexodusII_ex__put_nemesis_version
......@@ -48,6 +54,7 @@
#define ex__reset_error_status vtkexodusII_ex__reset_error_status
#define ex__rm_file_item vtkexodusII_ex__rm_file_item
#define ex__rm_stat_ptr vtkexodusII_ex__rm_stat_ptr
#define ex__set_compact_storage vtkexodusII_ex__set_compact_storage
#define ex__trim vtkexodusII_ex__trim
#define ex__update_max_name_length vtkexodusII_ex__update_max_name_length
#define ex_add_attr vtkexodusII_ex_add_attr
......@@ -71,11 +78,20 @@
#define ex_dim_num_objects vtkexodusII_ex_dim_num_objects
#define ex_err vtkexodusII_ex_err
#define ex_err_fn vtkexodusII_ex_err_fn
#define ex_errval vtkexodusII_ex_errval
#define ex_find_file_item vtkexodusII_ex_find_file_item
#define ex_get_all_times vtkexodusII_ex_get_all_times
#define ex_get_assemblies vtkexodusII_ex_get_assemblies
#define ex_get_assembly vtkexodusII_ex_get_assembly
#define ex_get_attr vtkexodusII_ex_get_attr
#define ex_get_attr_names vtkexodusII_ex_get_attr_names
#define ex_get_attr_param vtkexodusII_ex_get_attr_param
#define ex_get_attribute vtkexodusII_ex_get_attribute
#define ex_get_attribute_count vtkexodusII_ex_get_attribute_count
#define ex_get_attribute_param vtkexodusII_ex_get_attribute_param
#define ex_get_attributes vtkexodusII_ex_get_attributes
#define ex_get_blob vtkexodusII_ex_get_blob
#define ex_get_blobs vtkexodusII_ex_get_blobs
#define ex_get_block vtkexodusII_ex_get_block
#define ex_get_block_param vtkexodusII_ex_get_block_param
#define ex_get_block_params vtkexodusII_ex_get_block_params
......@@ -191,6 +207,9 @@
#define ex_get_prop_array vtkexodusII_ex_get_prop_array
#define ex_get_prop_names vtkexodusII_ex_get_prop_names
#define ex_get_qa vtkexodusII_ex_get_qa
#define ex_get_reduction_variable_names vtkexodusII_ex_get_reduction_variable_names
#define ex_get_reduction_variable_param vtkexodusII_ex_get_reduction_variable_param
#define ex_get_reduction_vars vtkexodusII_ex_get_reduction_vars
#define ex_get_set vtkexodusII_ex_get_set
#define ex_get_set_dist_fact vtkexodusII_ex_get_set_dist_fact
#define ex_get_set_param vtkexodusII_ex_get_set_param
......@@ -241,9 +260,13 @@
#define ex_pthread_first_thread_init vtkexodusII_ex_pthread_first_thread_init
#define ex_put_all_var_param vtkexodusII_ex_put_all_var_param
#define ex_put_all_var_param_ext vtkexodusII_ex_put_all_var_param_ext
#define ex_put_assemblies vtkexodusII_ex_put_assemblies
#define ex_put_attr vtkexodusII_ex_put_attr
#define ex_put_attr_names vtkexodusII_ex_put_attr_names
#define ex_put_attr_param vtkexodusII_ex_put_attr_param
#define ex_put_attribute vtkexodusII_ex_put_attribute
#define ex_put_attributes vtkexodusII_ex_put_attributes
#define ex_put_blobs vtkexodusII_ex_put_blobs
#define ex_put_block vtkexodusII_ex_put_block
#define ex_put_block_param vtkexodusII_ex_put_block_param
#define ex_put_block_params vtkexodusII_ex_put_block_params
......@@ -259,6 +282,7 @@
#define ex_put_coord vtkexodusII_ex_put_coord
#define ex_put_coord_names vtkexodusII_ex_put_coord_names
#define ex_put_coordinate_frames vtkexodusII_ex_put_coordinate_frames
#define ex_put_double_attribute vtkexodusII_ex_put_double_attribute
#define ex_put_eb_info_global vtkexodusII_ex_put_eb_info_global
#define ex_put_elem_attr vtkexodusII_ex_put_elem_attr
#define ex_put_elem_attr_names vtkexodusII_ex_put_elem_attr_names
......@@ -278,6 +302,7 @@
#define ex_put_init_ext vtkexodusII_ex_put_init_ext
#define ex_put_init_global vtkexodusII_ex_put_init_global
#define ex_put_init_info vtkexodusII_ex_put_init_info
#define ex_put_integer_attribute vtkexodusII_ex_put_integer_attribute
#define ex_put_loadbal_param vtkexodusII_ex_put_loadbal_param
#define ex_put_loadbal_param_cc vtkexodusII_ex_put_loadbal_param_cc
#define ex_put_map vtkexodusII_ex_put_map
......@@ -342,6 +367,9 @@
#define ex_put_prop_array vtkexodusII_ex_put_prop_array
#define ex_put_prop_names vtkexodusII_ex_put_prop_names
#define ex_put_qa vtkexodusII_ex_put_qa
#define ex_put_reduction_variable_names vtkexodusII_ex_put_reduction_variable_names
#define ex_put_reduction_variable_param vtkexodusII_ex_put_reduction_variable_param
#define ex_put_reduction_vars vtkexodusII_ex_put_reduction_vars
#define ex_put_set vtkexodusII_ex_put_set
#define ex_put_set_dist_fact vtkexodusII_ex_put_set_dist_fact
#define ex_put_set_param vtkexodusII_ex_put_set_param
......@@ -352,6 +380,7 @@
#define ex_put_ss_param_global vtkexodusII_ex_put_ss_param_global
#define ex_put_sset_var vtkexodusII_ex_put_sset_var
#define ex_put_sset_var_tab vtkexodusII_ex_put_sset_var_tab
#define ex_put_text_attribute vtkexodusII_ex_put_text_attribute
#define ex_put_time vtkexodusII_ex_put_time
#define ex_put_truth_table vtkexodusII_ex_put_truth_table
#define ex_put_var vtkexodusII_ex_put_var
......@@ -376,26 +405,27 @@
#define ex_update_max_name_length vtkexodusII_ex_update_max_name_length
#define ex_var_type_to_ex_entity_type vtkexodusII_ex_var_type_to_ex_entity_type
#define exerrval_get vtkexodusII_exerrval_get
#define nc_flt_code vtkexodusII_nc_flt_code
#define ne__check_file_version vtkexodusII_ne__check_file_version
#define ne__id_lkup vtkexodusII_ne__id_lkup
#define ne_check_file_version vtkexodusII_ne_check_file_version
#define ne_id_lkup vtkexodusII_ne_id_lkup
// global variables
#define exoptval vtkexodusII_exoptval
#define ex__default_max_name_length vtkexodusII_ex__default_max_name_length
#define exoII_fam vtkexodusII_exoII_fam
#define exoII_ass vtkexodusII_exoII_ass
#define exoII_eb vtkexodusII_exoII_eb
#define exoII_ed vtkexodusII_exoII_ed
#define exoII_edm vtkexodusII_exoII_edm
#define exoII_els vtkexodusII_exoII_els
#define exoII_fs vtkexodusII_exoII_fs
#define exoII_fa vtkexodusII_exoII_fa
#define exoII_em vtkexodusII_exoII_em
#define exoII_es vtkexodusII_exoII_es
#define exoII_ed vtkexodusII_exoII_ed
#define exoII_fa vtkexodusII_exoII_fa
#define exoII_fam vtkexodusII_exoII_fam
#define exoII_fs vtkexodusII_exoII_fs
#define exoII_nm vtkexodusII_exoII_nm
#define exoII_em vtkexodusII_exoII_em
#define exoII_ss vtkexodusII_exoII_ss
#define exoII_ns vtkexodusII_exoII_ns
#define exoII_eb vtkexodusII_exoII_eb
#define exoII_ss vtkexodusII_exoII_ss
#define exodus_unused_symbol_dummy_ex_create_par vtkexodusII_exodus_unused_symbol_dummy_ex_create_par
#define exodus_unused_symbol_dummy_ex_open_par vtkexodusII_exodus_unused_symbol_dummy_ex_open_par
#define exoptval vtkexodusII_exoptval
#define nc_flt_code vtkexodusII_nc_flt_code
#define ne__check_file_version vtkexodusII_ne__check_file_version
#define ne__id_lkup vtkexodusII_ne__id_lkup
#define ne_check_file_version vtkexodusII_ne_check_file_version
#define ne_id_lkup vtkexodusII_ne_id_lkup
#define ne_ret_string vtkexodusII_ne_ret_string
#endif
......@@ -34,7 +34,7 @@
*/
#include "exodusII.h" // for ex_get_partial_var, etc
#include "exodusII_int.h"
/*!
\ingroup ResultsData
......@@ -46,6 +46,7 @@ int ex_get_n_elem_var(int exoid, int time_step, int elem_var_index, ex_entity_id
int64_t num_elem_this_blk, int64_t start_elem_num, int64_t num_elem,
void *elem_var_vals)
{
EX_UNUSED(num_elem_this_blk);
return ex_get_partial_var(exoid, time_step, EX_ELEM_BLOCK, elem_var_index, elem_blk_id,
start_elem_num, num_elem, elem_var_vals);
}
......@@ -57,6 +57,7 @@
/*****************************************************************************/
#include "exodusII.h" // for ex_get_partial_var, etc
#include "exodusII_int.h"
/*!
\ingroup ResultsData
......@@ -75,6 +76,7 @@ int ex_get_partial_elem_var(int exoid, int time_step, int elem_var_index, ex_ent
int64_t num_elem_this_blk, int64_t start_elem_num, int64_t num_elem,
void *elem_var_vals)
{
EX_UNUSED(num_elem_this_blk);
return ex_get_partial_var(exoid, time_step, EX_ELEM_BLOCK, elem_var_index, elem_blk_id,
start_elem_num, num_elem, elem_var_vals);
}
......@@ -52,6 +52,7 @@
*****************************************************************************/
#include "exodusII.h" // for ex_put_all_var_param
#include "exodusII_int.h"
/*!
* writes the number of global, nodal, and element variables
......@@ -71,5 +72,6 @@ int ex_put_concat_var_param(int exoid, int num_g, int num_n, int num_e,
int num_elem_blk, /* unused */
int *elem_var_tab)
{
EX_UNUSED(num_elem_blk);
return ex_put_all_var_param(exoid, num_g, num_n, num_e, elem_var_tab, 0, 0, 0, 0);
}
/*
* Copyright (c) 2005-2017 National Technology & Engineering Solutions
* Copyright (c) 2005-2017, 2020 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.
*
......@@ -32,31 +32,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/*****************************************************************************
*
* expvtt - ex_put_elem_var_tab
*
* environment - UNIX
*
* entry conditions -
* input parameters:
* int exoid exodus file id
* int num_elem_blk number of element blocks
* int num_elem_var number of element variables
* int* elem_var_tab element variable truth table array
*
* exit conditions -
*
* revision history -
*
*
*****************************************************************************/
#include "exodusII.h"
/*!
* \deprecated Use ex_put_truth_table()(exoid, EX_ELEM_BLOCK, num_elem_blk,
* num_elem_var, elem_var_tab)
\deprecated Use ex_put_truth_table()(exoid, EX_ELEM_BLOCK, num_elem_blk,
num_elem_var, elem_var_tab)
The function ex_put_elem_var_tab() writes the exodus element variable
truth table to the database. The element variable truth table
......
......@@ -128,6 +128,8 @@ int ex_close(int exoid)
ex__rm_file_item(exoid, ex__get_counter_list(EX_EDGE_MAP));
ex__rm_file_item(exoid, ex__get_counter_list(EX_FACE_MAP));
ex__rm_file_item(exoid, ex__get_counter_list(EX_ELEM_MAP));
ex__rm_file_item(exoid, ex__get_counter_list(EX_ASSEMBLY));
ex__rm_file_item(exoid, ex__get_counter_list(EX_BLOB));
ex__rm_stat_ptr(exoid, &exoII_ed);
ex__rm_stat_ptr(exoid, &exoII_fa);
......
/*
* Copyright (c) 2005-2017 National Technology & Engineering Solutions
* Copyright (c) 2005-2017, 2020 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.
*
......@@ -206,7 +206,7 @@ int ex__conv_init(int exoid, int *comp_wordsize, int *io_wordsize, int file_word
"Warning: invalid int64_status flag (%d) specified for "
"existing file id: %d. Ignoring invalids",
int64_status, exoid);
ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM);
ex_err_fn(exoid, __func__, errmsg, -EX_BADPARAM);
}
int64_status &= valid_int64;
}
......@@ -234,6 +234,9 @@ int ex__conv_init(int exoid, int *comp_wordsize, int *io_wordsize, int file_word
new_file->int64_status = int64_status;
new_file->maximum_name_length = ex__default_max_name_length;
new_file->time_varid = -1;
new_file->compression_algorithm = EX_COMPRESS_GZIP;
new_file->assembly_count = 0;
new_file->blob_count = 0;
new_file->compression_level = 0;
new_file->shuffle = 0;
new_file->file_type = filetype - 1;
......@@ -290,7 +293,7 @@ void ex__conv_exit(int exoid)
if (!file) {
snprintf(errmsg, MAX_ERR_LENGTH, "Warning: failure to clear file id %d - not in list.", exoid);
ex_err(__func__, errmsg, EX_BADFILEID);
ex_err(__func__, errmsg, -EX_BADFILEID);
EX_FUNC_VOID();
}
......@@ -422,7 +425,7 @@ int ex_set_option(int exoid, ex_option_type option, int option_value)
switch (option) {
case EX_OPT_MAX_NAME_LENGTH: file->maximum_name_length = option_value; break;
case EX_OPT_COMPRESSION_TYPE: /* Currently not used. GZip by default */ break;
case EX_OPT_COMPRESSION_TYPE: file->compression_algorithm = option_value; break;
case EX_OPT_COMPRESSION_LEVEL: /* 0 (disabled/fastest) ... 9 (best/slowest) */
/* Check whether file type supports compression... */
if (file->is_hdf5) {
......
/*
* Copyright (c) 2005-2017 National Technology & Engineering Solutions
* Copyright (c) 2005-2017, 2020 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.
*
......@@ -101,10 +101,7 @@ static int is_truth_table_variable(const char *var_name)
/* If copying just the "mesh" or "non-transient" portion of the
* input DB, these are the variables that won't be copied:
*/
return (strcmp(var_name, VAR_EBLK_TAB) == 0) || (strcmp(var_name, VAR_FBLK_TAB) == 0) ||
(strcmp(var_name, VAR_ELEM_TAB) == 0) || (strcmp(var_name, VAR_ELSET_TAB) == 0) ||
(strcmp(var_name, VAR_SSET_TAB) == 0) || (strcmp(var_name, VAR_FSET_TAB) == 0) ||
(strcmp(var_name, VAR_ESET_TAB) == 0) || (strcmp(var_name, VAR_NSET_TAB) == 0);
return (strstr(var_name, "_var_tab") != NULL);
}
static int is_non_mesh_variable(const char *var_name)
......@@ -112,22 +109,7 @@ static int is_non_mesh_variable(const char *var_name)
/* If copying just the "mesh" or "non-transient" portion of the
* input DB, these are the variables that won't be copied:
*/
return (strcmp(var_name, VAR_NAME_GLO_VAR) == 0) || (strcmp(var_name, VAR_GLO_VAR) == 0) ||
(strcmp(var_name, VAR_NAME_NOD_VAR) == 0) || (strcmp(var_name, VAR_NOD_VAR) == 0) ||
(strcmp(var_name, VAR_NAME_EDG_VAR) == 0) || (strcmp(var_name, VAR_NAME_FAC_VAR) == 0) ||
(strcmp(var_name, VAR_NAME_ELE_VAR) == 0) || (strcmp(var_name, VAR_NAME_NSET_VAR) == 0) ||
(strcmp(var_name, VAR_NAME_ESET_VAR) == 0) || (strcmp(var_name, VAR_NAME_FSET_VAR) == 0) ||
(strcmp(var_name, VAR_NAME_SSET_VAR) == 0) ||
(strcmp(var_name, VAR_NAME_ELSET_VAR) == 0) ||
(strncmp(var_name, "vals_elset_var", 14) == 0) ||
(strncmp(var_name, "vals_sset_var", 13) == 0) ||
(strncmp(var_name, "vals_fset_var", 13) == 0) ||
(strncmp(var_name, "vals_eset_var", 13) == 0) ||
(strncmp(var_name, "vals_nset_var", 13) == 0) ||
(strncmp(var_name, "vals_nod_var", 12) == 0) ||
(strncmp(var_name, "vals_edge_var", 13) == 0) ||
(strncmp(var_name, "vals_face_var", 13) == 0) ||
(strncmp(var_name, "vals_elem_var", 13) == 0);
return (strncmp(var_name, "vals_", 5) == 0) || (strncmp(var_name, "name_", 5) == 0);
}
/*! \endcond */
......@@ -338,7 +320,9 @@ int cpy_dimension(int in_exoid, int out_exoid, int mesh_only)
(strcmp(dim_nm, DIM_NUM_FAC_VAR) == 0) || (strcmp(dim_nm, DIM_NUM_ELE_VAR) == 0) ||
(strcmp(dim_nm, DIM_NUM_NSET_VAR) == 0) || (strcmp(dim_nm, DIM_NUM_ESET_VAR) == 0) ||
(strcmp(dim_nm, DIM_NUM_FSET_VAR) == 0) || (strcmp(dim_nm, DIM_NUM_SSET_VAR) == 0) ||
(strcmp(dim_nm, DIM_NUM_ELSET_VAR) == 0) || (strcmp(dim_nm, DIM_NUM_GLO_VAR) == 0))) {
(strcmp(dim_nm, DIM_NUM_ELSET_VAR) == 0) || (strcmp(dim_nm, DIM_NUM_GLO_VAR) == 0) ||
(strcmp(dim_nm, DIM_NUM_ASSEMBLY_VAR) == 0) ||
(strcmp(dim_nm, DIM_NUM_BLOB_VAR) == 0) || (strstr(dim_nm, "_red_var") != NULL))) {
is_filtered = 1;
}
else {
......@@ -620,6 +604,7 @@ int cpy_var_val(int in_id, int out_id, char *var_nm)
int nbr_dim;
int var_in_id;
int var_out_id;
size_t dim_max;
size_t dim_str[NC_MAX_VAR_DIMS];
size_t dim_cnt[NC_MAX_VAR_DIMS];
size_t var_sz = 1L;
......@@ -657,11 +642,15 @@ int cpy_var_val(int in_id, int out_id, char *var_nm)
the void_ptr is large enough to hold new dimension */
EXCHECKF(nc_inq_dimlen(in_id, dim_id_in[idx], &dim_in));
EXCHECKF(nc_inq_dimlen(out_id, dim_id_out[idx], &dim_out));
dim_cnt[idx] = dim_in > dim_out ? dim_in : dim_out;
dim_str[idx] = 0;
/* Initialize the indicial offset and stride arrays */
var_sz *= dim_cnt[idx];
dim_max = dim_in > dim_out ? dim_in : dim_out;
var_sz *= dim_max;
/* Handle case where output variable is smaller than input (rare, but happens) */
dim_cnt[idx] = dim_out > 0 ? dim_out : dim_in;
dim_str[idx] = 0;
} /* end loop over dim */
/* Allocate enough space to hold the variable */
......@@ -780,10 +769,12 @@ int cpy_coord_val(int in_id, int out_id, char *var_nm, int in_large)
EXCHECKI(nc_inq_varid(in_id, VAR_COORD, &var_in_id));
EXCHECKI(nc_inq_varid(out_id, VAR_COORD_X, &var_out_id[0]));
if (spatial_dim > 1)
if (spatial_dim > 1) {
EXCHECKI(nc_inq_varid(out_id, VAR_COORD_Y, &var_out_id[1]));
if (spatial_dim > 2)
}
if (spatial_dim > 2) {
EXCHECKI(nc_inq_varid(out_id, VAR_COORD_Z, &var_out_id[2]));
}
EXCHECKI(nc_inq_vartype(in_id, var_in_id, &var_type_in));
EXCHECKI(nc_inq_vartype(out_id, var_out_id[0], &var_type_out));
......@@ -821,6 +812,8 @@ void update_structs(int out_exoid)
update_internal_structs(out_exoid, EX_INQ_EDGE_BLK, ex__get_counter_list(EX_EDGE_BLOCK));
update_internal_structs(out_exoid, EX_INQ_FACE_BLK, ex__get_counter_list(EX_FACE_BLOCK));
update_internal_structs(out_exoid, EX_INQ_ELEM_BLK, ex__get_counter_list(EX_ELEM_BLOCK));
update_internal_structs(out_exoid, EX_INQ_ASSEMBLY, ex__get_counter_list(EX_ASSEMBLY));
update_internal_structs(out_exoid, EX_INQ_BLOB, ex__get_counter_list(EX_BLOB));
update_internal_structs(out_exoid, EX_INQ_NODE_SETS, ex__get_counter_list(EX_NODE_SET));
update_internal_structs(out_exoid, EX_INQ_EDGE_SETS, ex__get_counter_list(EX_EDGE_SET));
......@@ -860,7 +853,7 @@ size_t type_size(nc_type type)
if (type == NC_FLOAT) {
return sizeof(float); /* OK */
}
else if (type == NC_DOUBLE) {
if (type == NC_DOUBLE) {
return sizeof(double); /* OK */
}
else {
......
/*
* Copyright (c) 2005-2017 National Technology & Engineering Solutions
* Copyright (c) 2005-2017, 2020 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.
*
......@@ -35,6 +35,7 @@
#include "exodusII.h" // for ex_err, ex_block, etc
#include "exodusII_int.h" // for elem_blk_parm, EX_FATAL, etc
#include <stdbool.h>
static int64_t get_node(void_int *connect, size_t index, size_t int_size)
{
......@@ -272,6 +273,9 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n
EX_FUNC_ENTER();
ex__check_valid_file_id(exoid, __func__);
EX_UNUSED(side_sets_elem_index);
EX_UNUSED(side_sets_node_index);
/* first check if any side sets are specified */
/* inquire how many side sets have been stored */
......@@ -285,7 +289,7 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n
if (num_side_sets == 0) {
snprintf(errmsg, MAX_ERR_LENGTH, "Warning: no side sets defined in file id %d", exoid);
ex_err_fn(exoid, __func__, errmsg, EX_WARN);
ex_err_fn(exoid, __func__, errmsg, EX_NOENTITY);
EX_FUNC_LEAVE(EX_WARN);
}
......@@ -431,7 +435,7 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n
*/
/* Allocate space for same element type flag array*/
if (!(same_elem_type = malloc(num_side_sets * sizeof(int)))) {
if (!(same_elem_type = calloc(num_side_sets, sizeof(int)))) {
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: failed to allocate space for element type flag "
"array for file id %d",
......@@ -441,7 +445,7 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n
goto cleanup;
}
same_elem_type[0] = EX_TRUE;
same_elem_type[0] = true;
if (ex_int64_status(exoid) & EX_BULK_INT64_API) {
elem_ctr = ((int64_t *)num_elem_per_set)[0];
for (i = 0, k = 0; i < tot_num_ss_elem; i++) {
......@@ -468,11 +472,11 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n
elem_ctr += ((int64_t *)num_elem_per_set)[++k];
el_type = elem_blk_parms[j].elem_type_val;
same_elem_type[k] = EX_TRUE;
same_elem_type[k] = true;
}
if (el_type != elem_blk_parms[j].elem_type_val) {
same_elem_type[k] = EX_FALSE;
same_elem_type[k] = false;
}
}
......@@ -510,7 +514,7 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n
/* determine number of nodes per side */
if (((((int64_t *)num_nodes_per_set)[k] % ((int64_t *)num_elem_per_set)[k]) == 0) &&
(same_elem_type[k] == EX_TRUE)) { /* all side set elements are same type */
(same_elem_type[k] == true)) { /* all side set elements are same type */
node_ctr += ((int64_t *)num_nodes_per_set)[k] / ((int64_t *)num_elem_per_set)[k];
}
else {
......@@ -546,11 +550,11 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n
elem_ctr += ((int *)num_elem_per_set)[++k];
el_type = elem_blk_parms[j].elem_type_val;
same_elem_type[k] = EX_TRUE;
same_elem_type[k] = true;
}
if (el_type != elem_blk_parms[j].elem_type_val) {
same_elem_type[k] = EX_FALSE;
same_elem_type[k] = false;
}
}
......
/*
* Copyright (c) 2005-2017, 2020 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" // for ex_assembly, ex_err, etc
#include "exodusII_int.h" // for EX_FATAL, etc
/*!
* writes the assembly parameters and optionally assembly data for all assemblies
* assumes that `assembly` is large enough to contain all assemblies.
* \param exoid exodus file id
* \param *assembly array of ex_assembly structures
*/
int ex_get_assemblies(int exoid, ex_assembly *assembly)
{
/* Determine number of assemblies on database */
int num_assembly = ex_inquire_int(exoid, EX_INQ_ASSEMBLY);
int max_use_name_length = ex_inquire_int(exoid, EX_INQ_DB_MAX_USED_NAME_LENGTH);
if (num_assembly < 0) {
char errmsg[MAX_ERR_LENGTH];
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to inquire ASSEMBLY count in file id %d",
exoid);
ex_err_fn(exoid, __func__, errmsg, num_assembly);
return (EX_FATAL);
}
if (ex_int64_status(exoid) & EX_IDS_INT64_API) {
int64_t *ids = calloc(num_assembly, sizeof(int64_t));
ex_get_ids(exoid, EX_ASSEMBLY, ids);
for (int i = 0; i < num_assembly; i++) {
assembly[i].id = ids[i];
}
free(ids);
}
else {
int *ids = calloc(num_assembly, sizeof(int));
ex_get_ids(exoid, EX_ASSEMBLY, ids);
for (int i = 0; i < num_assembly; i++) {
assembly[i].id = ids[i];
}